diff --git a/widget/public/nsIWidget.h b/widget/public/nsIWidget.h index a75d783b70a8..777a1ea26c03 100644 --- a/widget/public/nsIWidget.h +++ b/widget/public/nsIWidget.h @@ -214,6 +214,12 @@ enum nsContentType { eContentTypeContent = 1 // eContentTypeUI must equal 1 }; +enum nsTopLevelWidgetZPlacement { // for PlaceBehind() + eZPlacementBottom = 0, // bottom of the window stack + eZPlacementBelow, // just below another widget + eZPlacementTop // top of the window stack +}; + /** * Basic struct for widget initialization data. * @see Create member function of nsIWidget @@ -450,9 +456,15 @@ class nsIWidget : public nsISupports { * Position this widget just behind the given widget. (Used to * control z-order for top-level widgets. Get/SetZIndex by contrast * control z-order for child widgets of other widgets.) - * null aWidget means put on top. + * @param aPlacement top, bottom, or below a widget + * (if top or bottom, param aWidget is ignored) + * @param aWidget widget to place this widget behind + * (only if aPlacement is eZPlacementBelow). + * null is equivalent to aPlacement of eZPlacementTop + * @param aActivate true to activate the widget after placing it */ - NS_IMETHOD PlaceBehind(nsIWidget *aWidget, PRBool aActivate) = 0; + NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, + nsIWidget *aWidget, PRBool aActivate) = 0; /** * Minimize, maximize or normalize the window size. diff --git a/widget/src/cocoa/nsCocoaWindow.h b/widget/src/cocoa/nsCocoaWindow.h index abc3935ece74..7b3f28ba8920 100644 --- a/widget/src/cocoa/nsCocoaWindow.h +++ b/widget/src/cocoa/nsCocoaWindow.h @@ -129,7 +129,8 @@ public: NS_IMETHOD ConstrainPosition(PRBool aAllowSlop, PRInt32 *aX, PRInt32 *aY); NS_IMETHOD Move(PRInt32 aX, PRInt32 aY); - NS_IMETHOD PlaceBehind(nsIWidget *aWidget, PRBool aActivate); + NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, + nsIWidget *aWidget, PRBool aActivate); NS_IMETHOD SetSizeMode(PRInt32 aMode); void CalculateAndSetZoomedSize(); diff --git a/widget/src/cocoa/nsCocoaWindow.mm b/widget/src/cocoa/nsCocoaWindow.mm index 17a16a059589..53630e782196 100644 --- a/widget/src/cocoa/nsCocoaWindow.mm +++ b/widget/src/cocoa/nsCocoaWindow.mm @@ -1149,7 +1149,8 @@ NS_IMETHODIMP nsCocoaWindow::Move(PRInt32 aX, PRInt32 aY) // Position the window behind the given window // //------------------------------------------------------------------------- -NS_METHOD nsCocoaWindow::PlaceBehind(nsIWidget *aWidget, PRBool aActivate) +NS_METHOD nsCocoaWindow::PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, + nsIWidget *aWidget, PRBool aActivate) { #if 0 if (aWidget) { diff --git a/widget/src/gtk2/nsWindow.cpp b/widget/src/gtk2/nsWindow.cpp index ed5aa87a58ea..5e63dde66195 100644 --- a/widget/src/gtk2/nsWindow.cpp +++ b/widget/src/gtk2/nsWindow.cpp @@ -503,8 +503,9 @@ nsWindow::Move(PRInt32 aX, PRInt32 aY) } NS_IMETHODIMP -nsWindow::PlaceBehind(nsIWidget *aWidget, - PRBool aActivate) +nsWindow::PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, + nsIWidget *aWidget, + PRBool aActivate) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/widget/src/gtk2/nsWindow.h b/widget/src/gtk2/nsWindow.h index 3bab4ddbfa06..6c79794b8977 100644 --- a/widget/src/gtk2/nsWindow.h +++ b/widget/src/gtk2/nsWindow.h @@ -94,8 +94,9 @@ public: PRInt32 *aY); NS_IMETHOD Move(PRInt32 aX, PRInt32 aY); - NS_IMETHOD PlaceBehind(nsIWidget *aWidget, - PRBool aActivate); + NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, + nsIWidget *aWidget, + PRBool aActivate); NS_IMETHOD SetSizeMode(PRInt32 aMode); NS_IMETHOD Enable(PRBool aState); NS_IMETHOD SetFocus(PRBool aRaise = PR_FALSE); diff --git a/widget/src/mac/nsMacWindow.cpp b/widget/src/mac/nsMacWindow.cpp index 0875ece00980..d07596d815f0 100644 --- a/widget/src/mac/nsMacWindow.cpp +++ b/widget/src/mac/nsMacWindow.cpp @@ -1210,7 +1210,8 @@ NS_IMETHODIMP nsMacWindow::Move(PRInt32 aX, PRInt32 aY) // Position the window behind the given window // //------------------------------------------------------------------------- -NS_METHOD nsMacWindow::PlaceBehind(nsIWidget *aWidget, PRBool aActivate) +NS_METHOD nsMacWindow::PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, + nsIWidget *aWidget, PRBool aActivate) { if (aWidget) { WindowPtr behind = (WindowPtr)aWidget->GetNativeData(NS_NATIVE_DISPLAY); diff --git a/widget/src/mac/nsMacWindow.h b/widget/src/mac/nsMacWindow.h index b79490fd8c66..49176d019549 100644 --- a/widget/src/mac/nsMacWindow.h +++ b/widget/src/mac/nsMacWindow.h @@ -113,7 +113,8 @@ public: NS_IMETHOD ConstrainPosition(PRBool aAllowSlop, PRInt32 *aX, PRInt32 *aY); NS_IMETHOD Move(PRInt32 aX, PRInt32 aY); - NS_IMETHOD PlaceBehind(nsIWidget *aWidget, PRBool aActivate); + NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, + nsIWidget *aWidget, PRBool aActivate); NS_IMETHOD SetSizeMode(PRInt32 aMode); NS_IMETHOD Resize(PRInt32 aWidth,PRInt32 aHeight, PRBool aRepaint); diff --git a/widget/src/os2/nsWindow.cpp b/widget/src/os2/nsWindow.cpp index cbf58cfbd53a..9c40d1e59dc3 100644 --- a/widget/src/os2/nsWindow.cpp +++ b/widget/src/os2/nsWindow.cpp @@ -1217,7 +1217,8 @@ NS_METHOD nsWindow::IsVisible(PRBool & bState) // Position the window behind the given window // //------------------------------------------------------------------------- -NS_METHOD nsWindow::PlaceBehind(nsIWidget *aWidget, PRBool aActivate) +NS_METHOD nsWindow::PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, + nsIWidget *aWidget, PRBool aActivate) { HWND behind = aWidget ? (HWND)aWidget->GetNativeData(NS_NATIVE_WINDOW) : HWND_TOP; UINT flags = SWP_ZORDER; diff --git a/widget/src/os2/nsWindow.h b/widget/src/os2/nsWindow.h index f60774f5438d..b7ef88c8de0e 100644 --- a/widget/src/os2/nsWindow.h +++ b/widget/src/os2/nsWindow.h @@ -121,7 +121,8 @@ class nsWindow : public nsBaseWidget, NS_IMETHOD SetFocus(PRBool aRaise); NS_IMETHOD GetBounds(nsRect &aRect); NS_IMETHOD IsVisible( PRBool &aState); - NS_IMETHOD PlaceBehind(nsIWidget *aWidget, PRBool aActivate); + NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, + nsIWidget *aWidget, PRBool aActivate); NS_IMETHOD CaptureMouse(PRBool aCapture); diff --git a/widget/src/windows/nsWindow.h b/widget/src/windows/nsWindow.h index 080ac128a9ca..3f7bd347d7ee 100644 --- a/widget/src/windows/nsWindow.h +++ b/widget/src/windows/nsWindow.h @@ -312,7 +312,8 @@ public: virtual nsIWidget* GetParent(void); NS_IMETHOD Show(PRBool bState); NS_IMETHOD IsVisible(PRBool & aState); - NS_IMETHOD PlaceBehind(nsIWidget *aWidget, PRBool aActivate); + NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, + nsIWidget *aWidget, PRBool aActivate); NS_IMETHOD SetSizeMode(PRInt32 aMode); NS_IMETHOD ModalEventFilter(PRBool aRealEvent, void *aEvent, diff --git a/widget/src/xpwidgets/nsBaseWidget.cpp b/widget/src/xpwidgets/nsBaseWidget.cpp index 3fed87021f63..0a2ab7cb4505 100644 --- a/widget/src/xpwidgets/nsBaseWidget.cpp +++ b/widget/src/xpwidgets/nsBaseWidget.cpp @@ -342,7 +342,7 @@ NS_IMETHODIMP nsBaseWidget::SetZIndex(PRInt32 aZIndex) if (NS_SUCCEEDED(childWidget->GetZIndex(&childZIndex))) { if (aZIndex < childZIndex) { parent->mChildren->InsertElementAt(this, index); - PlaceBehind(childWidget, PR_FALSE); + PlaceBehind(eZPlacementBelow, childWidget, PR_FALSE); break; } } @@ -374,7 +374,8 @@ NS_IMETHODIMP nsBaseWidget::GetZIndex(PRInt32* aZIndex) // Places widget behind the given widget (platforms must override) // //------------------------------------------------------------------------- -NS_IMETHODIMP nsBaseWidget::PlaceBehind(nsIWidget *aWidget, PRBool aActivate) +NS_IMETHODIMP nsBaseWidget::PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, + nsIWidget *aWidget, PRBool aActivate) { return NS_OK; } diff --git a/widget/src/xpwidgets/nsBaseWidget.h b/widget/src/xpwidgets/nsBaseWidget.h index 1b2da268b1a9..054e6912f7bd 100644 --- a/widget/src/xpwidgets/nsBaseWidget.h +++ b/widget/src/xpwidgets/nsBaseWidget.h @@ -86,7 +86,8 @@ public: NS_IMETHOD SetZIndex(PRInt32 aZIndex); NS_IMETHOD GetZIndex(PRInt32* aZIndex); - NS_IMETHOD PlaceBehind(nsIWidget *aWidget, PRBool aActivate); + NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, + nsIWidget *aWidget, PRBool aActivate); NS_IMETHOD SetSizeMode(PRInt32 aMode); NS_IMETHOD GetSizeMode(PRInt32* aMode);