]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/framecmn.cpp
fixing build with wxUSE_PROTOCOL = 1 and wxUSE_SOCKETS = 0
[wxWidgets.git] / src / common / framecmn.cpp
index 8f3d81c6e4f2710ab7058f1722745d723cad00a4..3e40e5db200f905ad6710f679bf2f0821f860c56 100644 (file)
@@ -33,6 +33,9 @@
     #include "wx/statusbr.h"
 #endif // WX_PRECOMP
 
+extern WXDLLEXPORT_DATA(const char) wxFrameNameStr[] = "frame";
+extern WXDLLEXPORT_DATA(const char) wxStatusLineNameStr[] = "status_line";
+
 // ----------------------------------------------------------------------------
 // event table
 // ----------------------------------------------------------------------------
@@ -239,11 +242,7 @@ wxPoint wxFrameBase::GetClientAreaOrigin() const
 
 bool wxFrameBase::ProcessCommand(int id)
 {
-    wxMenuBar *bar = GetMenuBar();
-    if ( !bar )
-        return false;
-
-    wxMenuItem *item = bar->FindItem(id);
+    wxMenuItem* const item = FindItemInMenuBar(id);
     if ( !item )
         return false;
 
@@ -252,8 +251,7 @@ bool wxFrameBase::ProcessCommand(int id)
 
 bool wxFrameBase::ProcessCommand(wxMenuItem *item)
 {
-    wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, item->GetId());
-    commandEvent.SetEventObject(this);
+    wxCHECK_MSG( item, false, wxS("Menu item can't be NULL") );
 
     if (!item->IsEnabled())
         return true;
@@ -261,15 +259,23 @@ bool wxFrameBase::ProcessCommand(wxMenuItem *item)
     if ((item->GetKind() == wxITEM_RADIO) && item->IsChecked() )
         return true;
 
+    int checked;
     if (item->IsCheckable())
     {
         item->Toggle();
 
         // use the new value
-        commandEvent.SetInt(item->IsChecked());
+        checked = item->IsChecked();
     }
+    else // Uncheckable item.
+    {
+        checked = -1;
+    }
+
+    wxMenu* const menu = item->GetMenu();
+    wxCHECK_MSG( menu, false, wxS("Menu item should be attached to a menu") );
 
-    return HandleWindowEvent(commandEvent);
+    return menu->SendEvent(item->GetId(), checked);
 }
 
 #endif // wxUSE_MENUS