]> git.saurik.com Git - wxWidgets.git/commitdiff
improved handling of frames with parent: now they have a NULL parent HWND (to
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 7 Aug 1998 22:21:08 +0000 (22:21 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 7 Aug 1998 22:21:08 +0000 (22:21 +0000)
avoid Win32 bugs in handling this situation) but still are iconized/restored
with their parent frame

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@462 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

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

index 642962a4880e55597ef6e6763c08698f5b94db83..12fe97a0d1e77ef08866564b7681c9a374c049dc 100644 (file)
@@ -156,6 +156,9 @@ public:
                    int x, int y, int width, int height, long style);
 
 protected:
+  // propagate our state change to all child frames
+  void IconizeChildFrames(bool bIconize);
+
   wxMenuBar *           m_frameMenuBar;
   wxStatusBar *         m_frameStatusBar;
   wxIcon                m_icon;
index 71309be7240bf5886e7c92d2b8f75edbb5b617ae..1a7f2bb7a600992e21f6c77dac20fe1c2d6c17c7 100644 (file)
@@ -112,8 +112,11 @@ bool wxFrame::Create(wxWindow *parent,
   int height = size.y;
 
   m_iconized = FALSE;
-  MSWCreate(m_windowId, (wxWindow *)parent, wxFrameClassName, this, (char *)(const char *)title,
-                   x, y, width, height, style);
+
+  // we pass NULL as parent to MSWCreate because frames with parents behave
+  // very strangely under Win95 shell
+  MSWCreate(m_windowId, NULL, wxFrameClassName, this, title,
+            x, y, width, height, style);
 
   wxModelessWindows.Append(this);
   return TRUE;
@@ -684,11 +687,20 @@ void wxFrame::MSWOnSize(int x, int y, WXUINT id)
 #endif
   switch (id)
   {
-    case SIZEFULLSCREEN:
     case SIZENORMAL:
+      // restore all child frames too
+      IconizeChildFrames(FALSE);
+
+      // fall through
+
+    case SIZEFULLSCREEN:
       m_iconized = FALSE;
     break;
+
     case SIZEICONIC:
+      // iconize all child frames too
+      IconizeChildFrames(TRUE);
+
       m_iconized = TRUE;
     break;
   }
@@ -982,8 +994,6 @@ wxToolBar* wxFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& n
 
 void wxFrame::PositionToolBar(void)
 {
-    int cw, ch;
-
     RECT rect;
     ::GetClientRect((HWND) GetHWND(), &rect);
 
@@ -1011,3 +1021,16 @@ void wxFrame::PositionToolBar(void)
         }
     }
 }
+
+// propagate our state change to all child frames
+void wxFrame::IconizeChildFrames(bool bIconize)
+{
+  wxWindow *child = NULL;
+  for ( wxNode *node = GetChildren()->First(); node; node = node->Next() ) {
+    wxWindow *win = (wxWindow *)node->Data();
+    if ( win->IsKindOf(CLASSINFO(wxFrame)) ) {
+      ((wxFrame *)win)->Iconize(bIconize);
+    }
+  }
+}
+