wxGetKeyState as per feature request :).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24854 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Ryan Norton
2003-12-14 23:35:21 +00:00
parent c10eeb63ba
commit 6ed892f3f2
5 changed files with 112 additions and 0 deletions

View File

@@ -1757,6 +1757,42 @@ long wxMacTranslateKey(unsigned char key, unsigned char code)
return retval;
}
int wxKeyCodeToMacModifier(wxKeyCode key)
{
switch (key)
{
case WXK_START:
return cmdKey;
case WXK_SHIFT:
return shiftKey;
case WXK_CAPITAL:
return alphaLock;
case WXK_OPTION:
return optionKey;
case WXK_CONTROL:
return controlKey;
default:
return 0;
}
}
bool wxGetKeyState(wxKeyCode key) //virtual key code if < 10.2.x, else see below
{
//if OS X > 10.2 (i.e. 10.2.x)
//a known apple bug prevents the system from determining led
//states with GetKeys... can only determine caps lock led
return !!(GetCurrentKeyModifiers() & wxKeyCodeToMacModifier(key));
//else
// KeyMapByteArray keymap;
// GetKeys((BigEndianLong*)keymap);
// return !!(BitTst(keymap, (sizeof(KeyMapByteArray)*8) - iKey));
}
#if !TARGET_CARBON
void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
{