// Create functors for the templatized events, either allocated on the heap for
// wxNewXXX() variants (this is needed in wxEvtHandler::Bind<>() to store them
-// in dynamic event table) or just by returning them as a temporary objects (this
+// in dynamic event table) or just by returning them as temporary objects (this
// is enough for Unbind<>() and we avoid unnecessary heap allocation like this).
wxPropagateOnce(wxEvent& event) : m_event(event)
{
wxASSERT_MSG( m_event.m_propagationLevel > 0,
- _T("shouldn't be used unless ShouldPropagate()!") );
+ wxT("shouldn't be used unless ShouldPropagate()!") );
m_event.m_propagationLevel--;
}
wxEVT_HOTKEY
*/
+// key categories: the bit flags for IsKeyInCategory() function
+//
+// the enum values used may change in future version of wx
+// use the named constants only, or bitwise combinations thereof
+enum wxKeyCategoryFlags
+{
+ // arrow keys, on and off numeric keypads
+ WXK_CATEGORY_ARROW = 1,
+
+ // page up and page down keys, on and off numeric keypads
+ WXK_CATEGORY_PAGING = 2,
+
+ // home and end keys, on and off numeric keypads
+ WXK_CATEGORY_JUMP = 4,
+
+ // tab key, on and off numeric keypads
+ WXK_CATEGORY_TAB = 8,
+
+ // backspace and delete keys, on and off numeric keypads
+ WXK_CATEGORY_CUT = 16,
+
+ // all keys usually used for navigation
+ WXK_CATEGORY_NAVIGATION = WXK_CATEGORY_ARROW |
+ WXK_CATEGORY_PAGING |
+ WXK_CATEGORY_JUMP
+};
+
class WXDLLIMPEXP_CORE wxKeyEvent : public wxEvent,
public wxKeyboardState
{
// get the key code: an ASCII7 char or an element of wxKeyCode enum
int GetKeyCode() const { return (int)m_keyCode; }
+ // returns true iff this event's key code is of a certain type
+ bool IsKeyInCategory(int category) const;
+
#if wxUSE_UNICODE
// get the Unicode character corresponding to this key
wxChar GetUnicodeKey() const { return m_uniChar; }
// m_loggingOff flag is only used by wxEVT_[QUERY_]END_SESSION, it
// doesn't make sense for wxEVT_CLOSE_WINDOW
wxASSERT_MSG( m_eventType != wxEVT_CLOSE_WINDOW,
- _T("this flag is for end session events only") );
+ wxT("this flag is for end session events only") );
return m_loggingOff;
}