diff --git a/layout/xul/base/src/nsSliderFrame.cpp b/layout/xul/base/src/nsSliderFrame.cpp index 99db3902cd48..91b272d78610 100644 --- a/layout/xul/base/src/nsSliderFrame.cpp +++ b/layout/xul/base/src/nsSliderFrame.cpp @@ -553,8 +553,6 @@ nsSliderFrame::SetCurrentPosition(nsIPresContext& aPresContext, nsIContent* scro // set the new position scrollbar->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, nsString(ch), PR_TRUE); - CurrentPositionChanged(&aPresContext); - printf("Current Pos=%d\n",newpos); } diff --git a/layout/xul/base/src/nsTitledButtonFrame.h b/layout/xul/base/src/nsTitledButtonFrame.h index 12c5ae8312c5..336ad341214f 100644 --- a/layout/xul/base/src/nsTitledButtonFrame.h +++ b/layout/xul/base/src/nsTitledButtonFrame.h @@ -38,12 +38,7 @@ public: NS_IMETHOD GetBoxInfo(nsIPresContext& aPresContext, const nsHTMLReflowState& aReflowState, nsBoxInfo& aSize); NS_IMETHOD Dirty(const nsHTMLReflowState& aReflowState, nsIFrame*& incrementalChild); - NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr); - - NS_IMETHOD_(nsrefcnt) AddRef(void); - NS_IMETHOD_(nsrefcnt) Release(void); - - + NS_DECL_ISUPPORTS NS_IMETHOD Init(nsIPresContext& aPresContext, nsIContent* aContent, diff --git a/layout/xul/base/src/nsTreeRowGroupFrame.cpp b/layout/xul/base/src/nsTreeRowGroupFrame.cpp index ac6ba37adc6a..af1738820e87 100644 --- a/layout/xul/base/src/nsTreeRowGroupFrame.cpp +++ b/layout/xul/base/src/nsTreeRowGroupFrame.cpp @@ -31,6 +31,8 @@ #include "nsCellMap.h" #include "nsIReflowCommand.h" #include "nsHTMLParts.h" +#include "nsScrollbarButtonFrame.h" +#include "nsSliderFrame.h" // // NS_NewTreeFrame @@ -65,6 +67,52 @@ nsTreeRowGroupFrame::~nsTreeRowGroupFrame() { } +NS_IMPL_ADDREF(nsTreeRowGroupFrame) +NS_IMPL_RELEASE(nsTreeRowGroupFrame) + +NS_IMETHODIMP +nsTreeRowGroupFrame::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + if (NULL == aInstancePtr) { + return NS_ERROR_NULL_POINTER; + } + + *aInstancePtr = NULL; + + if (aIID.Equals(nsIScrollbarListener::GetIID())) { + *aInstancePtr = (void*)(nsIScrollbarListener*) this; + NS_ADDREF_THIS(); + return NS_OK; + } + + return nsTableRowGroupFrame::QueryInterface(aIID, aInstancePtr); +} + +NS_IMETHODIMP +nsTreeRowGroupFrame::PositionChanged(PRInt32 aOldIndex, PRInt32 aNewIndex) +{ + printf("The position changed!\n"); + return NS_OK; +} + +NS_IMETHODIMP +nsTreeRowGroupFrame::PagedUpDown() +{ + printf("Hey! You paged up and down!\n"); + return NS_OK; +} + +void +nsTreeRowGroupFrame::SetScrollbarFrame(nsIFrame* aFrame) +{ + mIsLazy = PR_TRUE; + mScrollbar = aFrame; + nsCOMPtr scrollbarAtom = dont_AddRef(NS_NewAtom("slider")); + nsIFrame* sliderFrame; + nsScrollbarButtonFrame::GetChildWithTag(scrollbarAtom, aFrame, sliderFrame); + ((nsSliderFrame*)sliderFrame)->SetScrollbarListener(this); +} + PRBool nsTreeRowGroupFrame::RowGroupDesiresExcessSpace() { nsIFrame* parentFrame; diff --git a/layout/xul/base/src/nsTreeRowGroupFrame.h b/layout/xul/base/src/nsTreeRowGroupFrame.h index 66ceb99c3c5d..c0436ee91fd4 100644 --- a/layout/xul/base/src/nsTreeRowGroupFrame.h +++ b/layout/xul/base/src/nsTreeRowGroupFrame.h @@ -19,18 +19,19 @@ #include "nsTableRowGroupFrame.h" #include "nsVoidArray.h" +#include "nsIScrollbarListener.h" class nsTreeFrame; class nsCSSFrameConstructor; -class nsTreeRowGroupFrame : public nsTableRowGroupFrame +class nsTreeRowGroupFrame : public nsTableRowGroupFrame, public nsIScrollbarListener { public: friend nsresult NS_NewTreeRowGroupFrame(nsIFrame** aNewFrame); virtual PRBool ExcludeFrameFromReflow(nsIFrame* aFrame); - void SetScrollbarFrame(nsIFrame* aFrame) { mIsLazy = PR_TRUE; mScrollbar = aFrame; }; + void SetScrollbarFrame(nsIFrame* aFrame); void SetFrameConstructor(nsCSSFrameConstructor* aFrameConstructor) { mFrameConstructor = aFrameConstructor; }; void MakeLazy() { mIsLazy = PR_TRUE; }; @@ -60,6 +61,11 @@ public: virtual PRBool RowsDesireExcessSpace() { return PR_FALSE; }; virtual PRBool RowGroupDesiresExcessSpace(); + NS_DECL_ISUPPORTS + + NS_IMETHOD PositionChanged(PRInt32 aOldIndex, PRInt32 aNewIndex); + NS_IMETHOD PagedUpDown(); + protected: nsTreeRowGroupFrame(); virtual ~nsTreeRowGroupFrame();