X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b5dbe15d0bacde245539f54c4d97af6b4696f01f..b23bc769d3d1943ca2b02ca90701d86b00880af9:/include/wx/msw/private.h?ds=sidebyside diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index 262fc9ff80..7944e1b976 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -213,6 +213,11 @@ struct WinStruct : public T #include "wx/gdicmn.h" #include "wx/colour.h" +#include "wx/msw/dc.h" +#include "wx/msw/dcclient.h" +#include "wx/msw/dcmemory.h" + + // make conversion from wxColour and COLORREF a bit less painful inline COLORREF wxColourToRGB(const wxColour& c) { @@ -311,21 +316,32 @@ HCURSOR wxBitmapToHCURSOR(const wxBitmap& bmp, int hotSpotX, int hotSpotY); #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp)) #endif // GET_X_LPARAM -// get the current state of SHIFT/CTRL keys -inline bool wxIsShiftDown() +// get the current state of SHIFT/CTRL/ALT keys +inline bool wxIsModifierDown(int vk) { -// return (::GetKeyState(VK_SHIFT) & 0x100) != 0; - // Returns different negative values on WinME and WinNT, + // GetKeyState() returns different negative values on WinME and WinNT, // so simply test for negative value. - return ::GetKeyState(VK_SHIFT) < 0; + return ::GetKeyState(vk) < 0; +} + +inline bool wxIsShiftDown() +{ + return wxIsModifierDown(VK_SHIFT); } inline bool wxIsCtrlDown() { -// return (::GetKeyState(VK_CONTROL) & 0x100) != 0; - // Returns different negative values on WinME and WinNT, - // so simply test for negative value. - return ::GetKeyState(VK_CONTROL) < 0; + return wxIsModifierDown(VK_CONTROL); +} + +inline bool wxIsAltDown() +{ + return wxIsModifierDown(VK_MENU); +} + +inline bool wxIsAnyModifierDown() +{ + return wxIsShiftDown() || wxIsCtrlDown() || wxIsAltDown(); } // wrapper around GetWindowRect() and GetClientRect() APIs doing error checking @@ -855,7 +871,7 @@ extern WXDLLEXPORT wxString wxGetWindowClass(WXHWND hWnd); // get the window id (should be unsigned, hence this is not wxWindowID which // is, for mainly historical reasons, signed) -extern WXDLLEXPORT WXWORD wxGetWindowId(WXHWND hWnd); +extern WXDLLEXPORT int wxGetWindowId(WXHWND hWnd); // check if hWnd's WNDPROC is wndProc. Return true if yes, false if they are // different