]> git.saurik.com Git - wxWidgets.git/commitdiff
document (and check for it with assert) that wxGetKeyState(WXK_[LMR]BUTTON) doesn...
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 21 Mar 2005 23:05:16 +0000 (23:05 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 21 Mar 2005 23:05:16 +0000 (23:05 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32970 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/function.tex
src/mac/carbon/app.cpp
src/mac/classic/app.cpp
src/mac/corefoundation/hid.cpp
src/msw/window.cpp
src/unix/utilsx11.cpp

index da69c22a611a2eaa25b2166d2ed90ed284b2a40c..42069bf337a92e477d03b83dc1c102e4b16ba5a1 100644 (file)
@@ -2660,9 +2660,14 @@ this language feature but still take advantage of it when it is available.
 
 \func{bool}{wxGetKeyState}{\param{wxKeyCode }{key}}
 
-Returns \true if the key parameter is currently pressed on the keyboard, or
-with modifier keys, (caps lock, etc) if the key is active (the led light is
-on).
+For normal keys, returns \true if the specified key is currently down.
+
+For togglable keys (Caps Lock, Num Lock and Scroll Lock), returns
+\true if the key is toggled such that its LED indicator is lit. There is
+currently no way to test whether togglable keys are up or down.
+
+Even though there are virtual key codes defined for mouse buttons, they
+cannot be used with this function currently.
 
 \wxheading{Include files}
 
index bcff118fb622f12cda064e8a3d71ef2949fc2f30..43c7cf1b29d145c01911d2dd75894b4c7fe8eac2 100644 (file)
@@ -1184,6 +1184,9 @@ int wxMacKeyCodeToModifier(wxKeyCode key)
 #ifndef __DARWIN__
 bool wxGetKeyState(wxKeyCode key) //virtual key code if < 10.2.x, else see below
 {
+    wxASSERT_MSG(key != WXK_LBUTTON && key != WXK_RBUTTON && key !=
+        WXK_MBUTTON, wxT("can't use wxGetKeyState() for mouse buttons"));
+
 //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
index d1267be385bedfc3fddc38ba44d713cea1d7a63c..c2aaf86cd00aa46a4322579e189a7cb88e2e1ded 100644 (file)
@@ -1853,6 +1853,9 @@ int wxKeyCodeToMacModifier(wxKeyCode key)
 
 bool wxGetKeyState(wxKeyCode key) //virtual key code if < 10.2.x, else see below
 {
+    wxASSERT_MSG(key != WXK_LBUTTON && key != WXK_RBUTTON && key !=
+        WXK_MBUTTON, wxT("can't use wxGetKeyState() for mouse buttons"));
+
 #if __WXMAC_CARBON__
 //TODO: Low get map...
    return !!(GetCurrentKeyModifiers() & wxKeyCodeToMacModifier(key)); 
index 16c956b2077fb47163a885a74a7967541db7264d..f3e2f937f996e0be3821872ff0a25e096efafcf5 100644 (file)
@@ -488,6 +488,9 @@ wxHIDKeyboard* wxHIDModule::sm_keyboard;
 
 bool wxGetKeyState (wxKeyCode key)
 {
+    wxASSERT_MSG(key != WXK_LBUTTON && key != WXK_RBUTTON && key !=
+        WXK_MBUTTON, wxT("can't use wxGetKeyState() for mouse buttons"));
+
     if (!wxHIDModule::sm_keyboard)
     {
         wxHIDModule::sm_keyboard = new wxHIDKeyboard();
index d196f61203cb546c27cb20af3d87f821fe87b2a5..c332ba35effc6223edba8c3e93eb411442723db3 100644 (file)
@@ -5144,6 +5144,9 @@ bool wxGetKeyState(wxKeyCode key)
 {
     bool bVirtual;
 
+    wxASSERT_MSG(key != WXK_LBUTTON && key != WXK_RBUTTON && key !=
+        WXK_MBUTTON, wxT("can't use wxGetKeyState() for mouse buttons"));
+
 //High order with GetAsyncKeyState only available on WIN32
 #ifdef __WIN32__
     //If the requested key is a LED key, return
index 8d400126c660603c0a30818813df572f6cd44387..012b53114e9e2603e910fb964667fe92ced3f914 100644 (file)
@@ -764,6 +764,9 @@ KeySym wxCharCodeWXToX(int id)
 
 bool wxGetKeyState(wxKeyCode key)
 {
+    wxASSERT_MSG(key != WXK_LBUTTON && key != WXK_RBUTTON && key !=
+        WXK_MBUTTON, wxT("can't use wxGetKeyState() for mouse buttons"));
+
 #if defined(__WXX11__)
     Display *pDisplay = (Display*) wxApp::GetDisplay();
 #elif defined(__WXGTK__)