correct fix for Maximize() for hidden frames

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10042 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2001-05-08 01:09:21 +00:00
parent 794c5cb151
commit bf505d2855
2 changed files with 43 additions and 6 deletions

View File

@ -145,10 +145,16 @@ protected:
// window proc for the frames
long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
virtual bool IsMDIChild() const { return FALSE; }
bool m_iconized;
// is the frame currently iconized?
bool m_iconized;
// should the frame be maximized when it will be shown? set by Maximize()
// when it is called while the frame is hidden
bool m_maximizeOnShow;
WXHICON m_defaultIcon;
#if wxUSE_STATUSBAR

View File

@ -95,7 +95,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
void wxFrame::Init()
{
m_iconized = FALSE;
m_iconized =
m_maximizeOnShow = FALSE;
#if wxUSE_TOOLTIPS
m_hwndToolTip = 0;
@ -293,7 +294,27 @@ bool wxFrame::Show(bool show)
if ( !wxWindowBase::Show(show) )
return FALSE;
DoShowWindow(show ? SW_SHOW : SW_HIDE);
int nShowCmd;
if ( show )
{
if ( m_maximizeOnShow )
{
// show and maximize
nShowCmd = SW_MAXIMIZE;
m_maximizeOnShow = FALSE;
}
else // just show
{
nShowCmd = SW_SHOW;
}
}
else // hide
{
nShowCmd = SW_HIDE;
}
DoShowWindow(nShowCmd);
if ( show )
{
@ -303,7 +324,7 @@ bool wxFrame::Show(bool show)
event.SetEventObject( this );
GetEventHandler()->ProcessEvent(event);
}
else
else // hide
{
// Try to highlight the correct window (the parent)
if ( GetParent() )
@ -324,7 +345,17 @@ void wxFrame::Iconize(bool iconize)
void wxFrame::Maximize(bool maximize)
{
DoShowWindow(maximize ? SW_MAXIMIZE : SW_RESTORE);
if ( IsShown() )
{
// just maximize it directly
DoShowWindow(maximize ? SW_MAXIMIZE : SW_RESTORE);
}
else // hidden
{
// we can't maximize the hidden frame because it shows it as well, so
// just remember that we should do it later in this case
m_maximizeOnShow = TRUE;
}
}
void wxFrame::Restore()