Added wxKeyEvent::IsKeyInCategory() method.

This allows to test whether a given key belongs to the category of e.g. arrow
keys or navigation keys in a more concise and more readable manner.

Closes #10268.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61736 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-08-23 00:32:17 +00:00
parent 2e4d0e91bf
commit 7a34307e24
6 changed files with 114 additions and 20 deletions

View File

@@ -1083,6 +1083,36 @@ protected:
};
/**
Flags for categories of keys.
These values are used by wxKeyEvent::IsKeyInCategory(). They may be
combined via the bitwise operators |, &, and ~.
@since 2.9.1
*/
enum wxKeyCategoryFlags
{
/// arrow keys, on and off numeric keypads
WXK_CATEGORY_ARROW,
/// page up and page down keys, on and off numeric keypads
WXK_CATEGORY_PAGING,
/// home and end keys, on and off numeric keypads
WXK_CATEGORY_JUMP,
/// tab key
WXK_CATEGORY_TAB,
/// backspace and delete keys, on and off numeric keypads
WXK_CATEGORY_CUT,
/// union of WXK_CATEGORY_ARROW, WXK_CATEGORY_PAGING, and WXK_CATEGORY_JUMP categories
WXK_CATEGORY_NAVIGATION
};
/**
@class wxKeyEvent
@@ -1177,6 +1207,16 @@ public:
*/
int GetKeyCode() const;
/**
Returns true if the key is in the given key category.
@param category
A bitwise combination of named ::wxKeyCategoryFlags constants.
@since 2.9.1
*/
bool IsKeyInCategory(int category) const;
//@{
/**
Obtains the position (in client coordinates) at which the key was pressed.