added wxKeyEvent::GetModifiers()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36148 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-11-10 11:59:47 +00:00
parent b2f8e75a0a
commit e710277282
6 changed files with 134 additions and 16 deletions

View File

@@ -935,11 +935,22 @@ public:
wxKeyEvent(wxEventType keyType = wxEVT_NULL);
wxKeyEvent(const wxKeyEvent& evt);
// can be used check if the key event has exactly the given modifiers:
// "GetModifiers() = wxMOD_CONTROL" is easier to write than "ControlDown()
// && !MetaDown() && !AltDown() && !ShiftDown()"
int GetModifiers() const
{
return (m_controlDown ? wxMOD_CONTROL : 0) |
(m_shiftDown ? wxMOD_SHIFT : 0) |
(m_metaDown ? wxMOD_META : 0) |
(m_altDown ? wxMOD_ALT : 0);
}
// Find state of shift/control keys
bool ControlDown() const { return m_controlDown; }
bool ShiftDown() const { return m_shiftDown; }
bool MetaDown() const { return m_metaDown; }
bool AltDown() const { return m_altDown; }
bool ShiftDown() const { return m_shiftDown; }
// "Cmd" is a pseudo key which is Control for PC and Unix platforms but
// Apple ("Command") key under Macs: it makes often sense to use it instead
@@ -1029,10 +1040,13 @@ public:
long m_keyCode;
// TODO: replace those with a single m_modifiers bitmask of wxMOD_XXX?
bool m_controlDown;
bool m_shiftDown;
bool m_altDown;
bool m_metaDown;
// FIXME: what is this for? relation to m_rawXXX?
bool m_scanCode;
#if wxUSE_UNICODE