]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/frame.cpp
better centering of text/images
[wxWidgets.git] / src / gtk / frame.cpp
index 18335cfef9ebee019dcbbe3be47a88d58d2fd2a2..c018c5b1637979b8f07d53bef6296fe7cd5d804e 100644 (file)
@@ -36,7 +36,6 @@ const int wxSTATUS_HEIGHT  = 25;
 // data
 //-----------------------------------------------------------------------------
 
-extern wxList wxTopLevelWindows;
 extern wxList wxPendingDelete;
 
 //-----------------------------------------------------------------------------
@@ -514,7 +513,7 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
 static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
 {
     menu->SetInvokingWindow( win );
-    wxNode *node = menu->m_items.First();
+    wxNode *node = menu->GetItems().First();
     while (node)
     {
         wxMenuItem *menuitem = (wxMenuItem*)node->Data();
@@ -533,7 +532,7 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
 
     if (m_frameMenuBar)
     {
-        wxNode *node = m_frameMenuBar->m_menus.First();
+        wxNode *node = m_frameMenuBar->GetMenus().First();
         while (node)
         {
             wxMenu *menu = (wxMenu*)node->Data();
@@ -548,7 +547,8 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
                 m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y );
 
             /* an mdi child menu bar might be underneath */
-            if (m_mdiMenuBar) m_frameMenuBar->Show( FALSE );
+            if (m_mdiMenuBar)
+                m_frameMenuBar->Show( FALSE );
         }
     }
 
@@ -640,6 +640,26 @@ wxStatusBar *wxFrame::OnCreateStatusBar( int number, long style, wxWindowID id,
     return statusBar;
 }
 
+void wxFrame::Command( int id )
+{
+    wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, id);
+    commandEvent.SetInt( id );
+    commandEvent.SetEventObject( this );
+
+    wxMenuBar *bar = GetMenuBar();
+    if (!bar) return;
+
+    wxMenuItem *item = bar->FindItemForId(id) ;
+    if (item && item->IsCheckable())
+    {
+        bar->Check(id,!bar->Checked(id)) ;
+    }
+
+    wxEvtHandler* evtHandler = GetEventHandler();
+
+    evtHandler->ProcessEvent(commandEvent);
+}
+
 void wxFrame::SetStatusText(const wxString& text, int number)
 {
     wxASSERT_MSG( (m_widget != NULL), "invalid frame" );