Add compatibility warning for invalid GTK accelerator keys

This commit is contained in:
Ian McInerney
2019-08-25 15:24:44 +02:00
parent 2a08afb369
commit e961307043
2 changed files with 97 additions and 1 deletions

View File

@@ -53,7 +53,9 @@ public:
, m_keyCode(keyCode)
, m_command(cmd)
, m_item(item)
{ }
{
ValidateKey(flags, keyCode);
}
// create accelerator corresponding to the specified string, return NULL if
// string couldn't be parsed or a pointer to be deleted by the caller
@@ -61,6 +63,8 @@ public:
void Set(int flags, int keyCode, int cmd, wxMenuItem *item = NULL)
{
ValidateKey(flags, keyCode);
m_flags = flags;
m_keyCode = keyCode;
m_command = cmd;
@@ -118,6 +122,8 @@ public:
private:
wxString AsPossiblyLocalizedString(bool localized) const;
static bool ValidateKey(int flags, int keycode);
// common part of Create() and FromString()
static bool ParseAccel(const wxString& str, int *flags, int *keycode);