Hooking up the scrollbar so that I can listen to events.

This commit is contained in:
hyatt%netscape.com 1999-06-23 23:05:36 +00:00
Родитель 04a20290f9
Коммит bbac4a1a39
4 изменённых файлов: 57 добавлений и 10 удалений

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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<nsIAtom> scrollbarAtom = dont_AddRef(NS_NewAtom("slider"));
nsIFrame* sliderFrame;
nsScrollbarButtonFrame::GetChildWithTag(scrollbarAtom, aFrame, sliderFrame);
((nsSliderFrame*)sliderFrame)->SetScrollbarListener(this);
}
PRBool nsTreeRowGroupFrame::RowGroupDesiresExcessSpace()
{
nsIFrame* parentFrame;

Просмотреть файл

@ -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();