From d2aef3124b711987f45c0f789994a05877fac7ba Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 7 Aug 1998 22:21:08 +0000 Subject: [PATCH] improved handling of frames with parent: now they have a NULL parent HWND (to 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 | 3 +++ src/msw/frame.cpp | 33 ++++++++++++++++++++++++++++----- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/include/wx/msw/frame.h b/include/wx/msw/frame.h index 642962a488..12fe97a0d1 100644 --- a/include/wx/msw/frame.h +++ b/include/wx/msw/frame.h @@ -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; diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index 71309be724..1a7f2bb7a6 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -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); + } + } +} + -- 2.45.2