]> git.saurik.com Git - wxWidgets.git/commitdiff
correct fix for Maximize() for hidden frames
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 8 May 2001 01:09:21 +0000 (01:09 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 8 May 2001 01:09:21 +0000 (01:09 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10042 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/frame.h
src/msw/frame.cpp

index d9c67c2bd2565e9ea308d2b54f456aaebe586e55..5e161cd3ab1d06267e2af3971870471278a482be 100644 (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
index 6723824373f2678d3f4deef7d399245ddf04e63e..9a699cfebc7b61649e10447055705ef20e0700cb 100644 (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()