]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/menucmn.cpp
disable select root menu command when the root is hidden
[wxWidgets.git] / src / common / menucmn.cpp
index 7d5185c1b51d0b043bacddbef01e13d14292bc55..87969e0411da4450b8d2623b22dabae99dfa0de7 100644 (file)
@@ -319,9 +319,7 @@ wxString wxAcceleratorEntry::ToString() const
 
     const int code = GetKeyCode();
 
-    if ( wxIsalnum(code) )
-        text << (wxChar)code;
-    else if ( code >= WXK_F1 && code <= WXK_F12 )
+    if ( code >= WXK_F1 && code <= WXK_F12 )
         text << _("F") << code - WXK_F1 + 1;
     else if ( code >= WXK_NUMPAD0 && code <= WXK_NUMPAD9 )
         text << _("KP_") << code - WXK_NUMPAD0;
@@ -340,8 +338,22 @@ wxString wxAcceleratorEntry::ToString() const
             }
         }
 
-        wxASSERT_MSG( n != WXSIZEOF(wxKeyNames),
-                      wxT("unknown keyboard accelerator code") );
+        if ( n == WXSIZEOF(wxKeyNames) )
+        {
+            // must be a simple key
+            if (
+#if !wxUSE_UNICODE
+                 isascii(code) &&
+#endif // ANSI
+                    wxIsalnum(code) )
+            {
+                text << (wxChar)code;
+            }
+            else
+            {
+                wxFAIL_MSG( wxT("unknown keyboard accelerator code") );
+            }
+        }
     }
 
     return text;
@@ -375,7 +387,7 @@ wxMenuItemBase::wxMenuItemBase(wxMenu *parentMenu,
     m_id          = id;
     m_kind        = kind;
     if (m_id == wxID_ANY)
-        m_id = wxWindow::NewControlId();
+        m_id = wxNewId();
     if (m_id == wxID_SEPARATOR)
         m_kind = wxITEM_SEPARATOR;