X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3882e74621cd5833fddb432fe014bea66c16ee28..19253261f5c6127f5448078295d4cbe1521d469f:/src/msw/frame.cpp diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index c93bb168a1..b976a678c5 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -357,9 +357,32 @@ void wxFrame::PositionStatusBar() int sw, sh; m_frameStatusBar->GetSize(&sw, &sh); + int x = 0; +#if wxUSE_TOOLBAR + wxToolBar * const toolbar = GetToolBar(); + if ( toolbar && !toolbar->HasFlag(wxTB_TOP) ) + { + const wxSize sizeTB = toolbar->GetSize(); + + if ( toolbar->HasFlag(wxTB_LEFT | wxTB_RIGHT) ) + { + if ( toolbar->HasFlag(wxTB_LEFT) ) + x -= sizeTB.x; + + w += sizeTB.x; + } + else // wxTB_BOTTOM + { + // we need to position the status bar below the toolbar + h += sizeTB.y; + } + } + //else: no adjustments necessary for the toolbar on top +#endif // wxUSE_TOOLBAR + // Since we wish the status bar to be directly under the client area, // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS. - m_frameStatusBar->SetSize(0, h, w, sh); + m_frameStatusBar->SetSize(x, h, w, sh); } #endif // wxUSE_STATUSBAR @@ -375,7 +398,7 @@ void wxFrame::AttachMenuBar(wxMenuBar *menubar) if( menubar->GetMenuCount() == 1 ) { autoMenu = wxTopLevelWindowMSW::ButtonMenu::DuplicateMenu(menubar->GetMenu(0)); - SetRightMenu(wxID_ANY, menubar->GetLabelTop(0), autoMenu); + SetRightMenu(wxID_ANY, menubar->GetMenuLabel(0), autoMenu); } else { @@ -384,7 +407,7 @@ void wxFrame::AttachMenuBar(wxMenuBar *menubar) for( size_t n = 0; n < menubar->GetMenuCount(); n++ ) { wxMenu *item = menubar->GetMenu(n); - wxString label = menubar->GetLabelTop(n); + wxString label = menubar->GetMenuLabel(n); wxMenu *new_item = wxTopLevelWindowMSW::ButtonMenu::DuplicateMenu(item); autoMenu->Append(wxID_ANY, label, new_item); } @@ -474,7 +497,7 @@ void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event) { wxSysColourChangedEvent event2; event2.SetEventObject( m_frameStatusBar ); - m_frameStatusBar->GetEventHandler()->ProcessEvent(event2); + m_frameStatusBar->HandleWindowEvent(event2); } #endif // wxUSE_STATUSBAR @@ -540,6 +563,7 @@ bool wxFrame::ShowFullScreen(bool show, long style) } #endif // wxUSE_TOOLBAR +#if wxUSE_MENUS if (m_fsStyle & wxFULLSCREEN_NOMENUBAR) { WXHMENU menu = m_hMenu; @@ -561,6 +585,7 @@ bool wxFrame::ShowFullScreen(bool show, long style) ::SetMenu(GetHwnd(), (HMENU)menu); } } +#endif // wxUSE_MENUS #if wxUSE_STATUSBAR wxStatusBar *theStatusBar = GetStatusBar(); @@ -600,16 +625,13 @@ wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& nam void wxFrame::PositionToolBar() { - int x = 0, y = 0; + // TODO: we want to do something different in WinCE, because the toolbar + // should be associated with the commandbar, instead of being + // independent window. +#if !defined(WINCE_WITHOUT_COMMANDBAR) wxToolBar *toolbar = GetToolBar(); if ( toolbar && toolbar->IsShown() ) { -#if defined(WINCE_WITHOUT_COMMANDBAR) - // We want to do something different in WinCE, because - // the toolbar should be associated with the commandbar, - // and not an independent window. - // TODO -#else // don't call our (or even wxTopLevelWindow) version because we want // the real (full) client area size, not excluding the tool/status bar int width, height; @@ -627,6 +649,7 @@ void wxFrame::PositionToolBar() toolbar->GetPosition( &tx, &ty ); toolbar->GetSize( &tw, &th ); + int x = 0, y = 0; if ( toolbar->HasFlag(wxTB_BOTTOM) ) { x = 0; @@ -719,8 +742,8 @@ void wxFrame::PositionToolBar() if (tx != 0 || ty != 0 || widthChanging || heightChanging) toolbar->SetSize(x, y, desiredW, desiredH, wxSIZE_NO_ADJUSTMENTS); -#endif // __WXWINCE__ } +#endif // !WINCE_WITH_COMMANDBAR } #endif // wxUSE_TOOLBAR @@ -923,8 +946,11 @@ bool wxFrame::HandleSize(int WXUNUSED(x), int WXUNUSED(y), WXUINT id) return false; } -bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control) +bool wxFrame::HandleCommand(WXWORD id_, WXWORD cmd, WXHWND control) { + // sign extend to int from short before comparing with the other int ids + int id = (signed short)id_; + if ( control ) { // In case it's e.g. a toolbar. @@ -963,6 +989,8 @@ bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control) return false; } +#if wxUSE_MENUS + bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu) { int item; @@ -983,7 +1011,7 @@ bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu) // items opening popup menus (they don't have them anyhow) but do clear // the status line - otherwise, we would be left with the help message // for the previous item which doesn't apply any more - DoGiveHelp(wxEmptyString, false); + DoGiveHelp(wxEmptyString, true); return false; } @@ -991,7 +1019,7 @@ bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu) wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, item); event.SetEventObject(this); - return GetEventHandler()->ProcessEvent(event); + return HandleWindowEvent(event); } bool wxFrame::HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup) @@ -1001,9 +1029,33 @@ bool wxFrame::HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup) wxMenuEvent event(evtType, isPopup ? -1 : 0); event.SetEventObject(this); - return GetEventHandler()->ProcessEvent(event); + return HandleWindowEvent(event); +} + +bool wxFrame::HandleInitMenuPopup(WXHMENU hMenu) +{ + wxMenu* menu = NULL; + if (GetMenuBar()) + { + int nCount = GetMenuBar()->GetMenuCount(); + for (int n = 0; n < nCount; n++) + { + if (GetMenuBar()->GetMenu(n)->GetHMenu() == hMenu) + { + menu = GetMenuBar()->GetMenu(n); + break; + } + } + } + + wxMenuEvent event(wxEVT_MENU_OPEN, 0, menu); + event.SetEventObject(this); + + return HandleWindowEvent(event); } +#endif // wxUSE_MENUS + // --------------------------------------------------------------------------- // the window proc for wxFrame // --------------------------------------------------------------------------- @@ -1040,11 +1092,12 @@ WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPara processed = HandlePaint(); break; +#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) +#if wxUSE_MENUS case WM_INITMENUPOPUP: processed = HandleInitMenuPopup((WXHMENU) wParam); break; -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) case WM_MENUSELECT: { WXWORD item, flags; @@ -1058,6 +1111,7 @@ WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPara case WM_EXITMENULOOP: processed = HandleMenuLoop(wxEVT_MENU_CLOSE, (WXWORD)wParam); break; +#endif // wxUSE_MENUS case WM_QUERYDRAGICON: { @@ -1077,29 +1131,6 @@ WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPara return rc; } -// handle WM_INITMENUPOPUP message -bool wxFrame::HandleInitMenuPopup(WXHMENU hMenu) -{ - wxMenu* menu = NULL; - if (GetMenuBar()) - { - int nCount = GetMenuBar()->GetMenuCount(); - for (int n = 0; n < nCount; n++) - { - if (GetMenuBar()->GetMenu(n)->GetHMenu() == hMenu) - { - menu = GetMenuBar()->GetMenu(n); - break; - } - } - } - - wxMenuEvent event(wxEVT_MENU_OPEN, 0, menu); - event.SetEventObject(this); - - return GetEventHandler()->ProcessEvent(event); -} - // ---------------------------------------------------------------------------- // wxFrame size management: we exclude the areas taken by menu/status/toolbars // from the client area, so the client area is what's really available for the