mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
r=mkaply,danm, a=blizzard Code from jblanco - Implement SetSizeMode on OS/2
This commit is contained in:
parent
c28ffed191
commit
d4a3aa7de7
@ -280,6 +280,17 @@ nsresult nsFrameWindow::Show( PRBool bState)
|
||||
if( bState) {
|
||||
ULONG ulStyle = WinQueryWindowULong( GetMainWindow(), QWL_STYLE);
|
||||
ulFlags = SWP_SHOW | SWP_ACTIVATE;
|
||||
if (!( ulStyle & WS_VISIBLE)) {
|
||||
PRInt32 sizeMode;
|
||||
GetSizeMode( &sizeMode);
|
||||
if ( sizeMode == nsSizeMode_Maximized) {
|
||||
ulFlags |= SWP_MAXIMIZE;
|
||||
} else if ( sizeMode == nsSizeMode_Minimized) {
|
||||
ulFlags |= SWP_MINIMIZE;
|
||||
} else {
|
||||
ulFlags |= SWP_RESTORE;
|
||||
}
|
||||
}
|
||||
if( ulStyle & WS_MINIMIZED)
|
||||
ulFlags |= (SWP_RESTORE | SWP_MAXIMIZE);
|
||||
}
|
||||
@ -351,6 +362,21 @@ MRESULT nsFrameWindow::FrameMessage( ULONG msg, MPARAM mp1, MPARAM mp2)
|
||||
UpdateClientSize();
|
||||
DispatchResizeEvent( mSizeClient.width, mSizeClient.height);
|
||||
}
|
||||
|
||||
if ( pSwp->fl & (SWP_MAXIMIZE | SWP_MINIMIZE | SWP_RESTORE)) {
|
||||
nsSizeModeEvent event;
|
||||
event.eventStructType = NS_SIZEMODE_EVENT;
|
||||
if ( pSwp->fl & SWP_MAXIMIZE)
|
||||
event.mSizeMode = nsSizeMode_Maximized;
|
||||
else if ( pSwp->fl & SWP_MINIMIZE)
|
||||
event.mSizeMode = nsSizeMode_Minimized;
|
||||
else
|
||||
event.mSizeMode = nsSizeMode_Normal;
|
||||
InitEvent(event, NS_SIZEMODE);
|
||||
DispatchWindowEvent(&event);
|
||||
NS_RELEASE(event.widget);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1098,6 +1098,38 @@ NS_METHOD nsWindow::PlaceBehind(nsIWidget *aWidget, PRBool aActivate)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Maximize, minimize or restore the window.
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_IMETHODIMP nsWindow::SetSizeMode(PRInt32 aMode) {
|
||||
|
||||
nsresult rv;
|
||||
PRBool visible;
|
||||
|
||||
// save the requested state
|
||||
rv = nsBaseWidget::SetSizeMode(aMode);
|
||||
|
||||
IsVisible( visible);
|
||||
if (NS_SUCCEEDED(rv) && visible) {
|
||||
ULONG mode;
|
||||
switch (aMode) {
|
||||
case nsSizeMode_Maximized :
|
||||
mode = SWP_MAXIMIZE;
|
||||
break;
|
||||
case nsSizeMode_Minimized :
|
||||
mode = SWP_MINIMIZE;
|
||||
break;
|
||||
default :
|
||||
mode = SWP_RESTORE;
|
||||
}
|
||||
::WinSetWindowPos(mWnd, NULLHANDLE, 0L, 0L, 0L, 0L, mode);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Return PR_TRUE in aForWindow if the given event should be processed
|
||||
// assuming this is a modal window.
|
||||
|
@ -84,6 +84,7 @@ class nsWindow : public nsBaseWidget,
|
||||
// Hierarchy: only interested in widget children (it seems)
|
||||
virtual nsIWidget *GetParent();
|
||||
|
||||
NS_IMETHOD SetSizeMode(PRInt32 aMode);
|
||||
NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar) { return NS_ERROR_FAILURE; }
|
||||
NS_IMETHOD ShowMenuBar(PRBool aShow) { return NS_ERROR_FAILURE; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user