X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d4597e138eff53fccbcb41259e8cb7ab2db3bab9..ee3510132b8b4160f848bd4f502a6f5315f90dbc:/src/msw/frame.cpp diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index 814f3bd254..c4ab391cd8 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -78,7 +78,7 @@ BEGIN_EVENT_TABLE(wxFrame, wxFrameBase) EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged) END_EVENT_TABLE() -IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow) +IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxTopLevelWindow) // ============================================================================ // implementation @@ -128,7 +128,7 @@ bool wxFrame::Create(wxWindow *parent, if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) ) return FALSE; - SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE)); + SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); wxModelessWindows.Append(this); @@ -157,6 +157,11 @@ void wxFrame::DoSetClientSize(int width, int height) } #endif // wxUSE_STATUSBAR + // call GetClientAreaOrigin() to take the toolbar into account + wxPoint pt = GetClientAreaOrigin(); + width += pt.x; + height += pt.y; + wxTopLevelWindow::DoSetClientSize(width, height); } @@ -165,6 +170,14 @@ void wxFrame::DoGetClientSize(int *x, int *y) const { wxTopLevelWindow::DoGetClientSize(x, y); + // account for the possible toolbar + wxPoint pt = GetClientAreaOrigin(); + if ( x ) + *x -= pt.x; + + if ( y ) + *y -= pt.y; + #if wxUSE_STATUSBAR // adjust client area height to take the status bar into account if ( y ) @@ -294,7 +307,7 @@ void wxFrame::InternalSetMenuBar() // Responds to colour changes, and passes event on to children. void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event) { - SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE)); + SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); Refresh(); #if wxUSE_STATUSBAR @@ -750,7 +763,17 @@ bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu) } wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, item); - event.SetEventObject( this ); + event.SetEventObject(this); + + return GetEventHandler()->ProcessEvent(event); +} + +bool wxFrame::HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup) +{ + // we don't have the menu id here, so we use the id to specify if the event + // was from a popup menu or a normal one + wxMenuEvent event(evtType, isPopup ? -1 : 0); + event.SetEventObject(this); return GetEventHandler()->ProcessEvent(event); } @@ -772,6 +795,10 @@ long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) processed = !Close(); break; + case WM_SIZE: + processed = HandleSize(LOWORD(lParam), HIWORD(lParam), wParam); + break; + case WM_COMMAND: { WORD id, cmd; @@ -783,6 +810,10 @@ long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) } break; + case WM_PAINT: + processed = HandlePaint(); + break; + #ifndef __WXMICROWIN__ case WM_MENUSELECT: { @@ -793,13 +824,17 @@ long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) processed = HandleMenuSelect(item, flags, hmenu); } break; -#endif - case WM_PAINT: - processed = HandlePaint(); +#ifndef __WIN16__ + case WM_ENTERMENULOOP: + processed = HandleMenuLoop(wxEVT_MENU_OPEN, wParam); break; -#ifndef __WXMICROWIN__ + case WM_EXITMENULOOP: + processed = HandleMenuLoop(wxEVT_MENU_CLOSE, wParam); + break; +#endif // __WIN16__ + case WM_QUERYDRAGICON: { HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon) @@ -808,11 +843,7 @@ long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) processed = rc != 0; } break; -#endif - - case WM_SIZE: - processed = HandleSize(LOWORD(lParam), HIWORD(lParam), wParam); - break; +#endif // !__WXMICROWIN__ } if ( !processed )