added raw key code and flags support (based on patch from Bryce Denney)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15003 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-04-07 21:06:59 +00:00
parent 62fa9712a0
commit 9c7df356f9
9 changed files with 123 additions and 44 deletions

View File

@@ -1475,8 +1475,8 @@ enum wxKeyCode
WXK_MENU,
WXK_PAUSE,
WXK_CAPITAL,
WXK_PRIOR, /* Page up */
WXK_NEXT, /* Page down */
WXK_PRIOR, // Page up
WXK_NEXT, // Page down
WXK_END,
WXK_HOME,
WXK_LEFT,

View File

@@ -783,6 +783,12 @@ public:
// get the key code: an ASCII7 char or an element of wxKeyCode enum
int GetKeyCode() const { return (int)m_keyCode; }
// get the raw key code (platform-dependent)
wxUint32 GetRawKeyCode() const { return m_rawCode; }
// get the raw key flags (platform-dependent)
wxUint32 GetRawKeyFlags() const { return m_rawFlags; }
// Find the position of the event
void GetPosition(wxCoord *xpos, wxCoord *ypos) const
{
@@ -826,6 +832,8 @@ public:
m_altDown = evt.m_altDown;
m_metaDown = evt.m_metaDown;
m_scanCode = evt.m_scanCode;
m_rawCode = evt.m_rawCode;
m_rawFlags = evt.m_rawFlags;
return *this;
}
@@ -841,6 +849,11 @@ public:
bool m_metaDown;
bool m_scanCode;
// these fields contain the platform-specific information about the pressed
// key
wxUint32 m_rawCode;
wxUint32 m_rawFlags;
private:
DECLARE_DYNAMIC_CLASS(wxKeyEvent)
};

View File

@@ -20,5 +20,12 @@
#undef wxHAS_RADIO_MENU_ITEMS
#endif
// the raw keyboard codes are generated under wxGTK and wxMSW only
#if defined(__WXGTK__) || defined(__WXMSW__)
#define wxHAS_RAW_KEY_CODES
#else
#undef wxHAS_RAW_KEY_CODES
#endif
#endif // _WX_FEATURES_H_

View File

@@ -459,7 +459,8 @@ protected:
#endif // wxUSE_TOOLTIPS
// the helper functions used by HandleChar/KeyXXX methods
wxKeyEvent CreateKeyEvent(wxEventType evType, int id, WXLPARAM lp) const;
wxKeyEvent CreateKeyEvent(wxEventType evType, int id,
WXLPARAM lParam = 0, WXWPARAM wParam = 0) const;
private:
// common part of all ctors