From 4bc0f25ed7eefb4a6fbeb61189a4c12023b9730f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 15 Sep 2004 22:14:05 +0000 Subject: [PATCH 1/1] fixed wxMaximizeEvent generation git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29145 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/msw/frame.cpp | 30 +++++++-------------- src/msw/window.cpp | 66 +++++++++++++++++++++++----------------------- 3 files changed, 44 insertions(+), 53 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index ab450d5a7d..0f9d119721 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -272,6 +272,7 @@ wxMSW: - fixed flat style for toolbars under XP, Windows Classic style - fixed truncation of transferred data in wxConnection under unicode build - wxChoice and wxComboBox dropdown background can be set now too (Adrian Lupei) +- fixed wxMaximizeEvent generation in wxFrame wxUniv/X11: diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index 0fd73e50bc..042978c4e8 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -658,6 +658,8 @@ void wxFrame::PositionToolBar() // on the desktop, but are iconized/restored with it void wxFrame::IconizeChildFrames(bool bIconize) { + m_iconized = bIconize; + for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); node; node = node->GetNext() ) @@ -788,14 +790,13 @@ bool wxFrame::HandlePaint() } } -bool wxFrame::HandleSize(int x, int y, WXUINT id) +bool wxFrame::HandleSize(int WXUNUSED(x), int WXUNUSED(y), WXUINT id) { - bool processed = false; #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) - switch ( id ) { - case SIZENORMAL: + case SIZE_RESTORED: + case SIZE_MAXIMIZED: // only do it it if we were iconized before, otherwise resizing the // parent frame has a curious side effect of bringing it under it's // children @@ -806,23 +807,14 @@ bool wxFrame::HandleSize(int x, int y, WXUINT id) IconizeChildFrames(false); (void)SendIconizeEvent(false); - - // fall through - - case SIZEFULLSCREEN: - m_iconized = FALSE; break; - case SIZEICONIC: + case SIZE_MINIMIZED: // iconize all child frames too IconizeChildFrames(true); - - (void)SendIconizeEvent(); - - m_iconized = true; break; } -#endif +#endif // !__WXWINCE__ if ( !m_iconized ) { @@ -848,13 +840,11 @@ bool wxFrame::HandleSize(int x, int y, WXUINT id) } } -#endif - - - processed = wxWindow::HandleSize(x, y, id); +#endif // WINCE_WITH_COMMANDBAR } - return processed; + // call the base class version to generate the appropriate events + return false; } bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control) diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 2bc19adc48..ede0741c54 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -2285,31 +2285,7 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l #endif case WM_SIZE: - switch ( wParam ) - { - case SIZE_MAXHIDE: - case SIZE_MAXSHOW: - // we're not interested in these messages at all - break; - - case SIZE_MINIMIZED: - // we shouldn't send sizev events for these messages as the - // client size may be negative which breaks existing code - // - // OTOH we might send another (wxMinimizedEvent?) one or - // add an additional parameter to wxSizeEvent if this is - // useful to anybody - break; - - default: - wxFAIL_MSG( _T("unexpected WM_SIZE parameter") ); - // fall through nevertheless - - case SIZE_MAXIMIZED: - case SIZE_RESTORED: - processed = HandleSize(LOWORD(lParam), HIWORD(lParam), - wParam); - } + processed = HandleSize(LOWORD(lParam), HIWORD(lParam), wParam); break; #if !defined(__WXWINCE__) @@ -4187,16 +4163,40 @@ bool wxWindowMSW::HandleMoving(wxRect& rect) return rc; } -bool wxWindowMSW::HandleSize(int WXUNUSED(w), int WXUNUSED(h), - WXUINT WXUNUSED(flag)) +bool wxWindowMSW::HandleSize(int WXUNUSED(w), int WXUNUSED(h), WXUINT wParam) { - // don't use w and h parameters as they specify the client size while - // according to the docs EVT_SIZE handler is supposed to receive the total - // size - wxSizeEvent event(GetSize(), m_windowId); - event.SetEventObject(this); + bool processed = false; - return GetEventHandler()->ProcessEvent(event); + switch ( wParam ) + { + default: + wxFAIL_MSG( _T("unexpected WM_SIZE parameter") ); + // fall through nevertheless + + case SIZE_MAXHIDE: + case SIZE_MAXSHOW: + // we're not interested in these messages at all + break; + + case SIZE_MINIMIZED: + processed = HandleMinimize(); + break; + + case SIZE_MAXIMIZED: + processed = HandleMaximize(); + // fall through to send a normal size event as well + + case SIZE_RESTORED: + // don't use w and h parameters as they specify the client size + // while according to the docs EVT_SIZE handler is supposed to + // receive the total size + wxSizeEvent event(GetSize(), m_windowId); + event.SetEventObject(this); + + processed = GetEventHandler()->ProcessEvent(event); + } + + return processed; } bool wxWindowMSW::HandleSizing(wxRect& rect) -- 2.45.2