]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/accelcmn.cpp
Make wxRefCounter non copyable.
[wxWidgets.git] / src / common / accelcmn.cpp
index 611fdfd97fa83411d30f62ed06ac8ad37bf6ab45..718275e160520564ffbdb7ca9330b28f5c4ead28 100644 (file)
@@ -160,17 +160,19 @@ wxAcceleratorEntry::ParseAccel(const wxString& text, int *flagsOut, int *keyOut)
     wxString label = text;
     label.Trim(true);  // the initial \t must be preserved so don't strip leading whitespaces
 
+    // If we're passed the entire menu item label instead of just the
+    // accelerator, skip the label part and only look after the TAB.
     // check for accelerators: they are given after '\t'
     int posTab = label.Find(wxT('\t'));
     if ( posTab == wxNOT_FOUND )
-    {
-        return false;
-    }
+        posTab = 0;
+    else
+        posTab++;
 
     // parse the accelerator string
     int accelFlags = wxACCEL_NORMAL;
     wxString current;
-    for ( size_t n = (size_t)posTab + 1; n < label.length(); n++ )
+    for ( size_t n = (size_t)posTab; n < label.length(); n++ )
     {
         if ( (label[n] == '+') || (label[n] == '-') )
         {
@@ -291,11 +293,11 @@ wxString wxAcceleratorEntry::ToString() const
 
     int flags = GetFlags();
     if ( flags & wxACCEL_ALT )
-        text += _("Alt-");
+        text += _("Alt+");
     if ( flags & wxACCEL_CTRL )
-        text += _("Ctrl-");
+        text += _("Ctrl+");
     if ( flags & wxACCEL_SHIFT )
-        text += _("Shift-");
+        text += _("Shift+");
 
     const int code = GetKeyCode();
 
@@ -323,7 +325,9 @@ wxString wxAcceleratorEntry::ToString() const
             // must be a simple key
             if (
 #if !wxUSE_UNICODE
-                 isascii(code) &&
+                 // we can't call wxIsalnum() for non-ASCII characters in ASCII
+                 // build as they're only defined for the ASCII range (or EOF)
+                 wxIsascii(code) &&
 #endif // ANSI
                     wxIsalnum(code) )
             {