+#include <wx/gdicmn.h>
+#include <wx/colour.h>
+
+// make conversion from wxColour and COLORREF a bit less painful
+inline COLORREF wxColourToRGB(const wxColour& c)
+{
+ return RGB(c.Red(), c.Green(), c.Blue());
+}
+
+inline COLORREF wxColourToPalRGB(const wxColour& c)
+{
+ return PALETTERGB(c.Red(), c.Green(), c.Blue());
+}
+
+inline wxColour wxRGBToColour(COLORREF rgb)
+{
+ return wxColour(GetRValue(rgb), GetGValue(rgb), GetBValue(rgb));
+}
+
+inline void wxRGBToColour(wxColour& c, COLORREF rgb)
+{
+ c.Set(GetRValue(rgb), GetGValue(rgb), GetBValue(rgb));
+}
+
+// get the standard colour map for some standard colours - see comment in this
+// function to understand why is it needed and when should it be used
+//
+// it returns a wxCOLORMAP (can't use COLORMAP itself here as comctl32.dll
+// might be not included/available) array of size wxSTD_COLOUR_MAX
+//
+// NB: if you change these colours, update wxBITMAP_STD_COLOURS in the
+// resources as well: it must have the same number of pixels!
+enum wxSTD_COLOUR
+{
+ wxSTD_COL_BTNTEXT,
+ wxSTD_COL_BTNSHADOW,
+ wxSTD_COL_BTNFACE,
+ wxSTD_COL_BTNHIGHLIGHT,
+ wxSTD_COL_MAX,
+};
+
+struct WXDLLEXPORT wxCOLORMAP
+{
+ COLORREF from, to;
+};
+
+// this function is implemented in src/msw/window.cpp
+extern wxCOLORMAP *wxGetStdColourMap();
+
+// copy Windows RECT to our wxRect
+inline void wxCopyRECTToRect(const RECT& r, wxRect& rect)
+{
+ rect.y = r.top;
+ rect.x = r.left;
+ rect.width = r.right - r.left;
+ rect.height = r.bottom - r.top;
+}
+
+// translations between HIMETRIC units (which OLE likes) and pixels (which are
+// liked by all the others) - implemented in msw/utilsexc.cpp
+extern void HIMETRICToPixel(LONG *x, LONG *y);
+extern void PixelToHIMETRIC(LONG *x, LONG *y);
+
+// Windows convention of the mask is opposed to the wxWindows one, so we need
+// to invert the mask each time we pass one/get one to/from Windows
+extern HBITMAP wxInvertMask(HBITMAP hbmpMask, int w = 0, int h = 0);
+
+// Creates an icon or cursor depending from a bitmap
+//
+// The bitmap must be valid and it should have a mask. If it doesn't, a default
+// mask is created using light grey as the transparent colour.
+extern HICON wxBitmapToHICON(const wxBitmap& bmp);
+
+// Same requirments as above apply and the bitmap must also have the correct
+// size.
+extern
+HCURSOR wxBitmapToHCURSOR(const wxBitmap& bmp, int hotSpotX, int hotSpotY);
+
+// get (x, y) from DWORD - notice that HI/LOWORD can *not* be used because they
+// will fail on system with multiple monitors where the coords may be negative
+//
+// these macros are standard now (Win98) but some older headers don't have them
+#ifndef GET_X_LPARAM
+ #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
+ #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
+#endif // GET_X_LPARAM
+
+// get the current state of SHIFT/CTRL keys
+inline bool wxIsShiftDown()
+{
+// return (::GetKeyState(VK_SHIFT) & 0x100) != 0;
+ // Returns different negative values on WinME and WinNT,
+ // so simply test for negative value.
+ return ::GetKeyState(VK_SHIFT) < 0;
+}
+
+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;
+}
+
+// wrapper around GetWindowRect() and GetClientRect() APIs doing error checking
+// for Win32
+inline RECT wxGetWindowRect(HWND hwnd)
+{
+ RECT rect;
+
+ if ( !::GetWindowRect(hwnd, &rect) )
+ {
+ wxLogLastError(_T("GetWindowRect"));
+ }
+
+ return rect;
+}
+
+inline RECT wxGetClientRect(HWND hwnd)
+{
+ RECT rect;
+
+ if ( !::GetClientRect(hwnd, &rect) )
+ {
+ wxLogLastError(_T("GetClientRect"));
+ }
+
+ return rect;
+}