This commit is contained in:
blizzard%redhat.com 1999-08-10 19:19:33 +00:00
Родитель a56c79fa7d
Коммит ee51d555d9
3 изменённых файлов: 28 добавлений и 14 удалений

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

@ -291,6 +291,9 @@ NS_IMETHODIMP nsScrollbar::Resize(PRInt32 aX,
PRInt32 aHeight, PRInt32 aHeight,
PRBool aRepaint) PRBool aRepaint)
{ {
// for scrollbars we need this info
mBounds.x = aX;
mBounds.y = aY;
nsWidget::Resize(aX, aY, aWidth, aHeight, aRepaint); nsWidget::Resize(aX, aY, aWidth, aHeight, aRepaint);
CalcBarBounds(); CalcBarBounds();
LayoutBar(); LayoutBar();
@ -414,5 +417,7 @@ void nsScrollbar::LayoutBar(void)
NS_IMETHODIMP nsScrollbar::Move(PRInt32 aX, PRInt32 aY) NS_IMETHODIMP nsScrollbar::Move(PRInt32 aX, PRInt32 aY)
{ {
mBounds.x = aX;
mBounds.y = aY;
return nsWidget::Move(aX, aY); return nsWidget::Move(aX, aY);
} }

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

@ -101,6 +101,8 @@ nsWidget::nsWidget() : nsBaseWidget()
mIsToplevel = PR_FALSE; mIsToplevel = PR_FALSE;
mIsMapped = PR_FALSE; mIsMapped = PR_FALSE;
mVisibility = VisibilityFullyObscured; // this is an X constant. mVisibility = VisibilityFullyObscured; // this is an X constant.
mWindowType = eWindowType_child;
mBorderStyle = eBorderStyle_default;
} }
nsWidget::~nsWidget() nsWidget::~nsWidget()
@ -172,6 +174,7 @@ nsWidget::StandardWidgetCreate(nsIWidget *aParent,
// set up the BaseWidget parts. // set up the BaseWidget parts.
BaseCreate(aParent, aRect, aHandleEventFunction, aContext, BaseCreate(aParent, aRect, aHandleEventFunction, aContext,
aAppShell, aToolkit, aInitData); aAppShell, aToolkit, aInitData);
// check to see if the parent is there... // check to see if the parent is there...
if (nsnull != aParent) { if (nsnull != aParent) {
parent = ((aParent) ? (Window)aParent->GetNativeData(NS_NATIVE_WINDOW) : nsnull); parent = ((aParent) ? (Window)aParent->GetNativeData(NS_NATIVE_WINDOW) : nsnull);
@ -230,10 +233,8 @@ NS_IMETHODIMP nsWidget::Move(PRInt32 aX, PRInt32 aY)
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("nsWidget::Move(x, y)\n")); PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("nsWidget::Move(x, y)\n"));
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("Moving window 0x%lx to %d, %d\n", mBaseWindow, aX, aY)); PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("Moving window 0x%lx to %d, %d\n", mBaseWindow, aX, aY));
mBounds.x = aX;
mBounds.y = aY;
if (mParentWidget) { if (mParentWidget) {
((nsWidget*)mParentWidget)->WidgetMove(this); ((nsWidget*)mParentWidget)->WidgetMove(this, aX, aY);
} else { } else {
XMoveWindow(mDisplay, mBaseWindow, aX, aY); XMoveWindow(mDisplay, mBaseWindow, aX, aY);
} }
@ -293,12 +294,10 @@ NS_IMETHODIMP nsWidget::Resize(PRInt32 aX,
("Resizing window 0x%lx to %d, %d\n", mBaseWindow, aWidth, aHeight)); ("Resizing window 0x%lx to %d, %d\n", mBaseWindow, aWidth, aHeight));
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG,
("Moving window 0x%lx to %d, %d\n", mBaseWindow, aX, aY)); ("Moving window 0x%lx to %d, %d\n", mBaseWindow, aX, aY));
mBounds.x = aX;
mBounds.y = aY;
mBounds.width = aWidth; mBounds.width = aWidth;
mBounds.height = aHeight; mBounds.height = aHeight;
if (mParentWidget) { if (mParentWidget) {
((nsWidget *)mParentWidget)->WidgetMoveResize(this); ((nsWidget *)mParentWidget)->WidgetMoveResize(this, aX, aY);
} else { } else {
XMoveResizeWindow(mDisplay, mBaseWindow, aX, aY, aWidth, aHeight); XMoveResizeWindow(mDisplay, mBaseWindow, aX, aY, aWidth, aHeight);
} }
@ -578,6 +577,17 @@ NS_IMETHODIMP nsWidget::SetCursor(nsCursor aCursor)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsWidget::PreCreateWidget(nsWidgetInitData *aInitData)
{
if (nsnull != aInitData) {
SetWindowType(aInitData->mWindowType);
SetBorderStyle(aInitData->mBorderStyle);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
nsIWidget *nsWidget::GetParent(void) nsIWidget *nsWidget::GetParent(void)
{ {
if (nsnull != mParentWidget) { if (nsnull != mParentWidget) {
@ -952,14 +962,13 @@ void nsWidget::WidgetPut(nsWidget *aWidget)
} }
void nsWidget::WidgetMove(nsWidget *aWidget) void nsWidget::WidgetMove(nsWidget *aWidget, PRInt32 aX, PRInt32 aY)
{ {
PR_LOG(XlibScrollingLM, PR_LOG_DEBUG, ("nsWidget::WidgetMove()\n")); PR_LOG(XlibScrollingLM, PR_LOG_DEBUG, ("nsWidget::WidgetMove()\n"));
if (PR_TRUE == WidgetVisible(aWidget->mBounds)) { if (PR_TRUE == WidgetVisible(aWidget->mBounds)) {
PR_LOG(XlibScrollingLM, PR_LOG_DEBUG, ("Widget is visible...\n")); PR_LOG(XlibScrollingLM, PR_LOG_DEBUG, ("Widget is visible...\n"));
XMoveWindow(aWidget->mDisplay, aWidget->mBaseWindow, XMoveWindow(aWidget->mDisplay, aWidget->mBaseWindow,
aWidget->mBounds.x, aX, aY);
aWidget->mBounds.y);
if (aWidget->mIsShown == PR_TRUE) { if (aWidget->mIsShown == PR_TRUE) {
PR_LOG(XlibScrollingLM, PR_LOG_DEBUG, ("Mapping window 0x%lx...\n", aWidget->mBaseWindow)); PR_LOG(XlibScrollingLM, PR_LOG_DEBUG, ("Mapping window 0x%lx...\n", aWidget->mBaseWindow));
aWidget->Map(); aWidget->Map();
@ -993,7 +1002,7 @@ void nsWidget::WidgetResize(nsWidget *aWidget)
} }
} }
void nsWidget::WidgetMoveResize(nsWidget *aWidget) void nsWidget::WidgetMoveResize(nsWidget *aWidget, PRInt32 aX, PRInt32 aY)
{ {
PR_LOG(XlibScrollingLM, PR_LOG_DEBUG, ("nsWidget::WidgetMoveResize()\n")); PR_LOG(XlibScrollingLM, PR_LOG_DEBUG, ("nsWidget::WidgetMoveResize()\n"));
if (PR_TRUE == WidgetVisible(aWidget->mBounds)) { if (PR_TRUE == WidgetVisible(aWidget->mBounds)) {
@ -1002,8 +1011,7 @@ void nsWidget::WidgetMoveResize(nsWidget *aWidget)
aWidget->mBaseWindow, aWidget->mBaseWindow,
aWidget->mBounds.width, aWidget->mBounds.height); aWidget->mBounds.width, aWidget->mBounds.height);
XMoveWindow(aWidget->mDisplay, aWidget->mBaseWindow, XMoveWindow(aWidget->mDisplay, aWidget->mBaseWindow,
aWidget->mBounds.x, aX, aY);
aWidget->mBounds.y);
if (aWidget->mIsShown == PR_TRUE) { if (aWidget->mIsShown == PR_TRUE) {
PR_LOG(XlibScrollingLM, PR_LOG_DEBUG, ("Mapping window 0x%lx...\n", aWidget->mBaseWindow)); PR_LOG(XlibScrollingLM, PR_LOG_DEBUG, ("Mapping window 0x%lx...\n", aWidget->mBaseWindow));
aWidget->Map(); aWidget->Map();

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

@ -102,6 +102,7 @@ public:
NS_IMETHOD GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight); NS_IMETHOD GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight);
NS_IMETHOD SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight); NS_IMETHOD SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight);
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus); NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
NS_IMETHOD PreCreateWidget(nsWidgetInitData *aInitData);
#ifdef DEBUG #ifdef DEBUG
void DebugPrintEvent(nsGUIEvent & aEvent,Window aWindow); void DebugPrintEvent(nsGUIEvent & aEvent,Window aWindow);
@ -158,8 +159,8 @@ protected:
// there's no geometry information here because that should be in the mBounds // there's no geometry information here because that should be in the mBounds
// in the widget // in the widget
void WidgetPut (nsWidget *aWidget); void WidgetPut (nsWidget *aWidget);
void WidgetMove (nsWidget *aWidget); void WidgetMove (nsWidget *aWidget, PRInt32 aX, PRInt32 aY);
void WidgetMoveResize (nsWidget *aWidget); void WidgetMoveResize (nsWidget *aWidget, PRInt32 aX, PRInt32 aY);
void WidgetResize (nsWidget *aWidget); void WidgetResize (nsWidget *aWidget);
void WidgetShow (nsWidget *aWidget); void WidgetShow (nsWidget *aWidget);
// check to see whether or not a rect will intersect with the current scrolled area // check to see whether or not a rect will intersect with the current scrolled area