Merge branch 'accel_key_compat' of https://github.com/imciner2/wxWidgets

Give warnings for accelerator keys not supported by GTK under all
platforms instead of using asserts fin wxGTK only.

See https://github.com/wxWidgets/wxWidgets/pull/1505
This commit is contained in:
Vadim Zeitlin
2019-08-27 13:11:07 +02:00
3 changed files with 108 additions and 11 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);