+
+
+// ----------------------------------------------------------------------------
+// toolbar stuff
+// ----------------------------------------------------------------------------
+
+#if wxUSE_TOOLBAR
+
+wxToolBar* wxFrameBase::CreateToolBar(long style,
+ wxWindowID id,
+ const wxString& name)
+{
+ // the main toolbar can't be recreated (unless it was explicitly deeleted
+ // before)
+ 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;
+ }
+
+ SetToolBar(OnCreateToolBar(style, id, name));
+
+ return m_frameToolBar;
+}
+
+wxToolBar* wxFrameBase::OnCreateToolBar(long style,
+ wxWindowID id,
+ const wxString& name)
+{
+#if defined(__WXWINCE__) && defined(__POCKETPC__)
+ return new wxToolMenuBar(this, id,
+ wxDefaultPosition, wxDefaultSize,
+ style, name);
+#else
+ return new wxToolBar(this, id,
+ wxDefaultPosition, wxDefaultSize,
+ style, name);
+#endif
+}
+
+void wxFrameBase::SetToolBar(wxToolBar *toolbar)
+{
+ bool hadBar = m_frameToolBar != NULL;
+ m_frameToolBar = toolbar;
+
+ if ( (m_frameToolBar != NULL) != hadBar )
+ {
+ PositionToolBar();
+
+ DoLayout();
+ }
+}
+
+#endif // wxUSE_TOOLBAR
+
+// ----------------------------------------------------------------------------
+// menus
+// ----------------------------------------------------------------------------
+
+#if wxUSE_MENUS
+
+// update all menus
+void wxFrameBase::DoMenuUpdates(wxMenu* menu)
+{
+ wxEvtHandler* source = GetEventHandler();
+ wxMenuBar* bar = GetMenuBar();
+
+ if (menu)
+ menu->UpdateUI(source);
+ else if ( bar != NULL )
+ {
+ int nCount = bar->GetMenuCount();
+ for (int n = 0; n < nCount; n++)
+ bar->GetMenu(n)->UpdateUI(source);
+ }
+}
+
+void wxFrameBase::DetachMenuBar()
+{
+ if ( m_frameMenuBar )
+ {
+ m_frameMenuBar->Detach();
+ m_frameMenuBar = NULL;
+ }
+}
+
+void wxFrameBase::AttachMenuBar(wxMenuBar *menubar)
+{
+ if ( menubar )
+ {
+ menubar->Attach((wxFrame *)this);
+ m_frameMenuBar = menubar;
+ }
+}
+
+void wxFrameBase::SetMenuBar(wxMenuBar *menubar)
+{
+ if ( menubar == GetMenuBar() )
+ {
+ // nothing to do
+ return;
+ }
+
+ DetachMenuBar();
+
+ this->AttachMenuBar(menubar);
+}
+
+#endif // wxUSE_MENUS
+
+#if WXWIN_COMPATIBILITY_2_2
+
+bool wxFrameBase::Command(int winid)
+{
+ return ProcessCommand(winid);
+}
+
+#endif // WXWIN_COMPATIBILITY_2_2