]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/framecmn.cpp
Add missing WXK constants for the control keys
[wxWidgets.git] / src / common / framecmn.cpp
index 8f3d81c6e4f2710ab7058f1722745d723cad00a4..b303b53a366942bb8715c1acf13fddfec971bfb6 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
 // ----------------------------------------------------------------------------
@@ -116,8 +119,10 @@ wxPROPERTY( Title,wxString, SetTitle, GetTitle, wxString(), 0 /*flags*/, \
 wxPROPERTY_FLAGS( WindowStyle, wxFrameStyle, long, SetWindowStyleFlag, \
                  GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \
                  wxT("Helpstring"), wxT("group")) // style
+#if wxUSE_MENUS
 wxPROPERTY( MenuBar, wxMenuBar *, SetMenuBar, GetMenuBar, wxEMPTY_PARAMETER_VALUE, \
            0 /*flags*/, wxT("Helpstring"), wxT("group"))
+#endif
 wxEND_PROPERTIES_TABLE()
 
 wxEMPTY_HANDLERS_TABLE(wxFrame)
@@ -239,11 +244,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 +253,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 +261,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;
     }
 
-    return HandleWindowEvent(commandEvent);
+    wxMenu* const menu = item->GetMenu();
+    wxCHECK_MSG( menu, false, wxS("Menu item should be attached to a menu") );
+
+    return menu->SendEvent(item->GetId(), checked);
 }
 
 #endif // wxUSE_MENUS