X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cd70477bbdadcf28967ac62d3b7c6fb845f0a243..e6688c3fd28581a9f438cb2c56030e107593bb5e:/src/msw/frame.cpp diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index 8adcf37a44..090d681cac 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -68,6 +68,7 @@ bool wxFrame::m_useNativeStatusBar = FALSE; wxFrame::wxFrame(void) { + m_frameToolBar = NULL ; m_frameMenuBar = NULL; m_frameStatusBar = NULL; @@ -90,6 +91,7 @@ bool wxFrame::Create(wxWindow *parent, // m_modalShowing = FALSE; m_windowStyle = style; m_frameMenuBar = NULL; + m_frameToolBar = NULL ; m_frameStatusBar = NULL; SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE)); @@ -739,7 +741,7 @@ void wxFrame::MSWOnMenuHighlight(WXWORD nItem, WXWORD nFlags, WXHMENU hSysMenu) bool wxFrame::MSWProcessMessage(WXMSG* pMsg) { if (m_acceleratorTable != 0 && - ::TranslateAccelerator((HWND) GetHWND(), (HANDLE) m_acceleratorTable, (MSG *)pMsg)) + ::TranslateAccelerator((HWND) GetHWND(), (HACCEL) m_acceleratorTable, (MSG *)pMsg)) return TRUE; return FALSE; @@ -764,7 +766,8 @@ void wxFrame::OnSize(wxSizeEvent& event) wxWindow *win = (wxWindow *)node->Data(); if ( !win->IsKindOf(CLASSINFO(wxFrame)) && !win->IsKindOf(CLASSINFO(wxDialog)) && - (win != GetStatusBar()) ) + (win != GetStatusBar()) && + (win != GetToolBar()) ) { if ( child ) return; // it's our second subwindow - nothing to do @@ -774,10 +777,23 @@ void wxFrame::OnSize(wxSizeEvent& event) if ( child ) { // we have exactly one child - set it's size to fill the whole frame - int client_x, client_y; + int clientW, clientH; + GetClientSize(&clientW, &clientH); - GetClientSize(&client_x, &client_y); - child->SetSize(0, 0, client_x, client_y); + int x = 0; + int y = 0; + + // Manage the toolbar if there is one + if ( GetToolBar() ) + { + int wt, ht; + GetToolBar()->GetSize(&wt, &ht); + clientH -= ht; + y += ht; + GetToolBar()->SetSize(0, 0, clientW, ht); + } + + child->SetSize(x, y, clientW, clientH); } } @@ -813,6 +829,11 @@ void wxFrame::OnCloseWindow(wxCloseEvent& event) } } +bool wxFrame::OnClose(void) +{ + return TRUE; +} + // Destroy the window (delayed, if a managed window) bool wxFrame::Destroy(void) { @@ -886,52 +907,3 @@ void wxFrame::ProcessCommand(int id) GetEventHandler()->ProcessEvent(commandEvent); } -void wxFrame::OnIdle(wxIdleEvent& event) -{ - DoMenuUpdates(); -} - -// Query app for menu item updates (called from OnIdle) -void wxFrame::DoMenuUpdates(void) -{ - wxMenuBar* bar = GetMenuBar(); - if (!bar) - return; - - int i; - for (i = 0; i < bar->m_menuCount; i++) - { - wxMenu* menu = bar->m_menus[i]; - - DoMenuUpdates(menu); - } -} - -void wxFrame::DoMenuUpdates(wxMenu* menu) -{ - wxNode* node = menu->m_menuItems.First(); - while (node) - { - wxMenuItem* item = (wxMenuItem*) node->Data(); - if ( !item->IsSeparator() ) - { - wxWindowID id = item->GetId(); - wxUpdateUIEvent event(id); - event.SetEventObject( this ); - - if (GetEventHandler()->ProcessEvent(event)) - { - if (event.GetSetText()) - menu->SetLabel(id, event.GetText()); - if (event.GetSetChecked()) - menu->Check(id, event.GetChecked()); - if (event.GetSetEnabled()) - menu->Enable(id, event.GetEnabled()); - } - - if (item->GetSubMenu()) - DoMenuUpdates(item->GetSubMenu()); - } - node = node->Next(); - } -}