GTK_TOOLBAR_BOTH_HORIZ is GTK 2 only (it would have been nice if the patch mentioned...
[wxWidgets.git] / src / common / framecmn.cpp
index 42669bd92eb7beefff506a2888f02d90dcbaee98..3641dec49e823f42ec1a6364cdb8afcb75e68279 100644 (file)
@@ -386,6 +386,18 @@ wxToolBar* wxFrameBase::CreateToolBar(long style,
     wxCHECK_MSG( !m_frameToolBar, (wxToolBar *)NULL,
                  wxT("recreating toolbar in wxFrame") );
 
+    if ( style == -1 )
+    {
+        // use default style
+        //
+        // NB: we don't specify the default value in the method declaration
+        //     because
+        //      a) this allows us to have different defaults for different
+        //         platforms (even if we don't have them right now)
+        //      b) we don't need to include wx/toolbar.h in the header then
+        style = wxBORDER_NONE | wxTB_HORIZONTAL | wxTB_FLAT;
+    }
+
     m_frameToolBar = OnCreateToolBar(style, id, name);
 
     return m_frameToolBar;
@@ -413,47 +425,12 @@ void wxFrameBase::DoMenuUpdates()
 {
     wxMenuBar* bar = GetMenuBar();
 
-#ifdef __WXMSW__
-    wxWindow* focusWin = wxFindFocusDescendant((wxWindow*) this);
-#else
-    wxWindow* focusWin = (wxWindow*) NULL;
-#endif
     if ( bar != NULL )
     {
+        wxEvtHandler* source = GetEventHandler();
         int nCount = bar->GetMenuCount();
         for (int n = 0; n < nCount; n++)
-            DoMenuUpdates(bar->GetMenu(n), focusWin);
-    }
-}
-
-// update a menu and all submenus recursively
-void wxFrameBase::DoMenuUpdates(wxMenu* menu, wxWindow* focusWin)
-{
-    wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler();
-    wxMenuItemList::Node* node = menu->GetMenuItems().GetFirst();
-    while (node)
-    {
-        wxMenuItem* item = node->GetData();
-        if ( !item->IsSeparator() )
-        {
-            wxWindowID id = item->GetId();
-            wxUpdateUIEvent event(id);
-            event.SetEventObject( this );
-
-            if (evtHandler->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(), focusWin);
-        }
-        node = node->GetNext();
+            bar->GetMenu(n)->UpdateUI(source);
     }
 }