adjusting keyboardstate to new ctrl / raw_ctrl handling on osx
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68864 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2584,7 +2584,7 @@ enum wxKeyModifier
|
|||||||
wxMOD_META = 0x0008,
|
wxMOD_META = 0x0008,
|
||||||
wxMOD_WIN = wxMOD_META,
|
wxMOD_WIN = wxMOD_META,
|
||||||
#if defined(__WXMAC__) || defined(__WXCOCOA__)
|
#if defined(__WXMAC__) || defined(__WXCOCOA__)
|
||||||
wxMOD_RAW_CONTROL = wxMOD_META,
|
wxMOD_RAW_CONTROL = 0x0010,
|
||||||
#else
|
#else
|
||||||
wxMOD_RAW_CONTROL = wxMOD_CONTROL,
|
wxMOD_RAW_CONTROL = wxMOD_CONTROL,
|
||||||
#endif
|
#endif
|
||||||
|
@@ -45,6 +45,7 @@ public:
|
|||||||
return (m_controlDown ? wxMOD_CONTROL : 0) |
|
return (m_controlDown ? wxMOD_CONTROL : 0) |
|
||||||
(m_shiftDown ? wxMOD_SHIFT : 0) |
|
(m_shiftDown ? wxMOD_SHIFT : 0) |
|
||||||
(m_metaDown ? wxMOD_META : 0) |
|
(m_metaDown ? wxMOD_META : 0) |
|
||||||
|
(m_rawControlDown ? wxMOD_RAW_CONTROL : 0) |
|
||||||
(m_altDown ? wxMOD_ALT : 0);
|
(m_altDown ? wxMOD_ALT : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,6 +54,14 @@ public:
|
|||||||
|
|
||||||
// accessors for individual modifier keys
|
// accessors for individual modifier keys
|
||||||
bool ControlDown() const { return m_controlDown; }
|
bool ControlDown() const { return m_controlDown; }
|
||||||
|
bool RawControlDown() const
|
||||||
|
{
|
||||||
|
#ifdef __WXOSX__
|
||||||
|
return m_rawControlDown;
|
||||||
|
#else
|
||||||
|
return m_controlDown;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
bool ShiftDown() const { return m_shiftDown; }
|
bool ShiftDown() const { return m_shiftDown; }
|
||||||
bool MetaDown() const { return m_metaDown; }
|
bool MetaDown() const { return m_metaDown; }
|
||||||
bool AltDown() const { return m_altDown; }
|
bool AltDown() const { return m_altDown; }
|
||||||
@@ -64,17 +73,21 @@ public:
|
|||||||
// purpose under Mac)
|
// purpose under Mac)
|
||||||
bool CmdDown() const
|
bool CmdDown() const
|
||||||
{
|
{
|
||||||
#if defined(__WXMAC__) || defined(__WXCOCOA__)
|
|
||||||
return MetaDown();
|
|
||||||
#else
|
|
||||||
return ControlDown();
|
return ControlDown();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// these functions are mostly used by wxWidgets itself
|
// these functions are mostly used by wxWidgets itself
|
||||||
// ---------------------------------------------------
|
// ---------------------------------------------------
|
||||||
|
|
||||||
void SetControlDown(bool down) { m_controlDown = down; }
|
void SetControlDown(bool down) { m_controlDown = down; }
|
||||||
|
void SetRawControlDown(bool down)
|
||||||
|
{
|
||||||
|
#ifdef __WXOSX__
|
||||||
|
m_rawControlDown = down;
|
||||||
|
#else
|
||||||
|
m_controlDown = down;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
void SetShiftDown(bool down) { m_shiftDown = down; }
|
void SetShiftDown(bool down) { m_shiftDown = down; }
|
||||||
void SetAltDown(bool down) { m_altDown = down; }
|
void SetAltDown(bool down) { m_altDown = down; }
|
||||||
void SetMetaDown(bool down) { m_metaDown = down; }
|
void SetMetaDown(bool down) { m_metaDown = down; }
|
||||||
@@ -84,10 +97,13 @@ public:
|
|||||||
// members of wxKeyEvent directly, these variables are public, however you
|
// members of wxKeyEvent directly, these variables are public, however you
|
||||||
// should not use them in any new code, please use the accessors instead
|
// should not use them in any new code, please use the accessors instead
|
||||||
public:
|
public:
|
||||||
bool m_controlDown : 1;
|
bool m_controlDown : 1;
|
||||||
bool m_shiftDown : 1;
|
bool m_shiftDown : 1;
|
||||||
bool m_altDown : 1;
|
bool m_altDown : 1;
|
||||||
bool m_metaDown : 1;
|
bool m_metaDown : 1;
|
||||||
|
#ifdef __WXOSX__
|
||||||
|
bool m_rawControlDown : 1;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _WX_KBDSTATE_H_
|
#endif // _WX_KBDSTATE_H_
|
||||||
|
@@ -77,18 +77,23 @@ public:
|
|||||||
bool HasModifiers() const;
|
bool HasModifiers() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns true if the Control key is pressed.
|
Returns true if the Control key or Apple/Command key under OS X is pressed.
|
||||||
|
|
||||||
This function doesn't distinguish between right and left control keys.
|
This function doesn't distinguish between right and left control keys.
|
||||||
|
|
||||||
In portable code you usually want to use CmdDown() to automatically
|
|
||||||
test for the more frequently used Command key (and not the rarely used
|
|
||||||
Control one) under Mac.
|
|
||||||
|
|
||||||
Notice that GetModifiers() should usually be used instead of this one.
|
Notice that GetModifiers() should usually be used instead of this one.
|
||||||
*/
|
*/
|
||||||
bool ControlDown() const;
|
bool ControlDown() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns true if the Control key (also under OS X).
|
||||||
|
|
||||||
|
This function doesn't distinguish between right and left control keys.
|
||||||
|
|
||||||
|
Notice that GetModifiers() should usually be used instead of this one.
|
||||||
|
*/
|
||||||
|
bool RawControlDown() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns true if the Shift key is pressed.
|
Returns true if the Shift key is pressed.
|
||||||
|
|
||||||
@@ -102,9 +107,7 @@ public:
|
|||||||
Returns true if the Meta/Windows/Apple key is pressed.
|
Returns true if the Meta/Windows/Apple key is pressed.
|
||||||
|
|
||||||
This function tests the state of the key traditionally called Meta
|
This function tests the state of the key traditionally called Meta
|
||||||
under Unix systems, Windows keys under MSW and Apple, or Command, key
|
under Unix systems, Windows keys under MSW
|
||||||
under Mac.
|
|
||||||
|
|
||||||
Notice that GetModifiers() should usually be used instead of this one.
|
Notice that GetModifiers() should usually be used instead of this one.
|
||||||
|
|
||||||
@see CmdDown()
|
@see CmdDown()
|
||||||
@@ -119,13 +122,8 @@ public:
|
|||||||
bool AltDown() const;
|
bool AltDown() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns true if the key used for command accelerators is pressed.
|
Returns true if the key used for command accelerators is pressed. Same as
|
||||||
|
ControlDown(). Deprecated.
|
||||||
@c Cmd is a pseudo key which is Control for PC and Unix platforms but
|
|
||||||
Apple (or Command) key under Macs: it makes often sense to use it
|
|
||||||
instead of ControlDown() because @c Command key is used for the same
|
|
||||||
thing under Mac as @c Control elsewhere (even though @c Control still
|
|
||||||
exists, it is usually not used for the same purpose under Mac).
|
|
||||||
|
|
||||||
Notice that GetModifiers() should usually be used instead of this one.
|
Notice that GetModifiers() should usually be used instead of this one.
|
||||||
*/
|
*/
|
||||||
@@ -133,6 +131,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
void SetControlDown(bool down);
|
void SetControlDown(bool down);
|
||||||
|
void SetRawControlDown(bool down);
|
||||||
void SetShiftDown(bool down);
|
void SetShiftDown(bool down);
|
||||||
void SetAltDown(bool down);
|
void SetAltDown(bool down);
|
||||||
void SetMetaDown(bool down);
|
void SetMetaDown(bool down);
|
||||||
|
Reference in New Issue
Block a user