minimize/maximize/restore code

This commit is contained in:
pavlov%netscape.com 1999-07-30 23:53:17 +00:00
parent c887b3033c
commit f60786e94f
12 changed files with 145 additions and 0 deletions

View File

@ -292,6 +292,24 @@ class nsIWidget : public nsISupports {
*/
NS_IMETHOD Show(PRBool aState) = 0;
/**
* Minimize or iconify the window. Not for child windows.
*
*/
NS_IMETHOD Minimize(void) = 0;
/**
* Maximize the window. Not for child windows.
*
*/
NS_IMETHOD Maximize(void) = 0;
/**
* Undo maximize or minimize. Not for child windows.
*
*/
NS_IMETHOD Restore(void) = 0;
/**
* Make the window modal
*

View File

@ -731,6 +731,28 @@ NS_METHOD nsWindow::IsVisible(PRBool & bState)
return NS_OK;
}
NS_METHOD nsWindow::Minimize(void)
{
mView->Window()->Minimize(true);
return NS_OK;
}
NS_METHOD nsWindow::Maximize(void)
{
// IMPLIMENT ME! :)
return NS_OK;
}
NS_METHOD nsWindow::Restore(void)
{
mView->Window()->Minimize(false);
return NS_OK;
}
//-------------------------------------------------------------------------
//
// Move this component

View File

@ -93,6 +93,10 @@ public:
NS_IMETHOD Show(PRBool bState);
NS_IMETHOD IsVisible(PRBool & aState);
NS_IMETHOD Minimize(void);
NS_IMETHOD Maximize(void);
NS_IMETHOD Restore(void);
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
NS_IMETHOD Resize(PRInt32 aWidth,
PRInt32 aHeight,

View File

@ -87,6 +87,10 @@ class nsWidget : public nsBaseWidget
NS_IMETHOD Show(PRBool state);
NS_IMETHOD IsVisible(PRBool &aState);
NS_IMETHOD Minimize(void) {return NS_OK; }
NS_IMETHOD Maximize(void) {return NS_OK; }
NS_IMETHOD Restore(void) {return NS_OK; }
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
NS_IMETHOD Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint);
NS_IMETHOD Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth,

View File

@ -694,6 +694,28 @@ NS_METHOD nsWindow::ShowMenuBar(PRBool aShow)
return NS_OK;
}
NS_METHOD nsWindow::Minimize(void)
{
int status;
if (mIsToplevel && mShell)
{
// ret val 0 == successful
status = XIconifyWindow(GDK_DISPLAY(), GDK_WINDOW_XWINDOW(mShell), 0);
return status ? NS_ERROR_FAILURE : NS_OK;
}
return NS_ERROR_FAILURE;
}
NS_METHOD nsWindow::Maximize(void)
{
return NS_OK;
}
NS_METHOD nsWindow::Restore(void)
{
return NS_OK;
}
NS_METHOD nsWindow::Move(PRInt32 aX, PRInt32 aY)
{
// not implimented for toplevel windows

View File

@ -62,6 +62,11 @@ public:
NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar);
NS_IMETHOD Show(PRBool aShow);
NS_IMETHOD ShowMenuBar(PRBool aShow);
NS_IMETHOD Minimize(void);
NS_IMETHOD Maximize(void);
NS_IMETHOD Restore(void);
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
NS_IMETHOD Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint);

View File

@ -512,6 +512,24 @@ NS_IMETHODIMP nsMacWindow::Show(PRBool bState)
return NS_OK;
}
NS_METHOD nsWindow::Minimize(void)
{
return NS_OK;
}
NS_METHOD nsWindow::Maximize(void)
{
return NS_OK;
}
NS_METHOD nsWindow::Restore(void)
{
return NS_OK;
}
//-------------------------------------------------------------------------
//
// Move this window

View File

@ -72,6 +72,12 @@ public:
nsNativeWidget aNativeParent = nsnull);
NS_IMETHOD Show(PRBool aState);
NS_IMETHOD Minimize(void);
NS_IMETHOD Maximize(void);
NS_IMETHOD Restore(void);
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
NS_IMETHOD Resize(PRInt32 aWidth,PRInt32 aHeight, PRBool aRepaint);
virtual PRBool OnPaint(nsPaintEvent &event);

View File

@ -885,6 +885,25 @@ NS_METHOD nsWindow::IsVisible(PRBool & bState)
return NS_OK;
}
NS_METHOD nsWindow::Minimize(void)
{
::ShowWindow(mWnd, SW_MINIMIZE);
return NS_OK;
}
NS_METHOD nsWindow::Maximize(void)
{
::ShowWindow(mWnd, SW_MAXIMIZE);
return NS_OK;
}
NS_METHOD nsWindow::Restore(void)
{
::ShowWindow(mWnd, SW_RESTORE);
return NS_OK;
}
//-------------------------------------------------------------------------
//
// Move this component

View File

@ -84,6 +84,12 @@ public:
virtual nsIWidget* GetParent(void);
NS_IMETHOD Show(PRBool bState);
NS_IMETHOD IsVisible(PRBool & aState);
NS_IMETHOD Minimize(void);
NS_IMETHOD Maximize(void);
NS_IMETHOD Restore(void);
HWND mBorderlessParent;
NS_IMETHOD CaptureMouse(PRBool aCapture);

View File

@ -417,6 +417,23 @@ NS_IMETHODIMP nsWidget::IsVisible(PRBool &aState)
return NS_OK;
}
NS_METHOD nsWindow::Minimize(void)
{
status = XIconifyWindow(mDisplay, mBaseWindow, 0);
return status ? NS_ERROR_FAULRE : NS_OK;
}
NS_METHOD nsWindow::Maximize(void)
{
return NS_OK;
}
NS_METHOD nsWindow::Restore(void)
{
return NS_OK;
}
NS_IMETHODIMP nsWidget::SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight)
{
return NS_OK;

View File

@ -66,6 +66,10 @@ public:
NS_IMETHOD Show(PRBool bState);
NS_IMETHOD IsVisible(PRBool &aState);
NS_IMETHOD Minimize(void);
NS_IMETHOD Maximize(void);
NS_IMETHOD Restore(void);
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
NS_IMETHOD Resize(PRInt32 aWidth,
PRInt32 aHeight,