+ if ( flagsOut )
+ *flagsOut = accelFlags;
+ if ( keyOut )
+ *keyOut = keyCode;
+
+ return true;
+}
+
+/* static */
+wxAcceleratorEntry *wxAcceleratorEntry::Create(const wxString& str)
+{
+ int flags,
+ keyCode;
+ if ( !ParseAccel(str, &flags, &keyCode) )
+ return NULL;
+
+ return new wxAcceleratorEntry(flags, keyCode);
+}
+
+bool wxAcceleratorEntry::FromString(const wxString& str)
+{
+ return ParseAccel(str, &m_flags, &m_keyCode);
+}
+
+wxString wxAcceleratorEntry::ToString() const
+{
+ wxString text;
+
+ int flags = GetFlags();
+ if ( flags & wxACCEL_ALT )
+ text += _("Alt-");
+ if ( flags & wxACCEL_CTRL )
+ text += _("Ctrl-");
+ if ( flags & wxACCEL_SHIFT )
+ text += _("Shift-");
+
+ const int code = GetKeyCode();
+
+ if ( wxIsalnum(code) )
+ text << (wxChar)code;
+ else 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;
+ else if ( code >= WXK_SPECIAL1 && code <= WXK_SPECIAL20 )
+ text << _("SPECIAL") << code - WXK_SPECIAL1 + 1;
+ else // check the named keys
+ {
+ size_t n;
+ for ( n = 0; n < WXSIZEOF(wxKeyNames); n++ )
+ {
+ const wxKeyName& kn = wxKeyNames[n];
+ if ( code == kn.code )
+ {
+ text << wxGetTranslation(kn.name);
+ break;
+ }
+ }
+
+ wxASSERT_MSG( n != WXSIZEOF(wxKeyNames),
+ wxT("unknown keyboard accelerator code") );
+ }
+
+ return text;
+}
+
+wxAcceleratorEntry *wxGetAccelFromString(const wxString& label)
+{
+ return wxAcceleratorEntry::Create(label);