| 1 | /* |
| 2 | ///////////////////////////////////////////////////////////////////////////// |
| 3 | // Name: microwin.h |
| 4 | // Purpose: Extra implementation for MicroWindows |
| 5 | // Author: Julian Smart |
| 6 | // Created: 2001-05-31 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) Julian Smart |
| 9 | // Licence: wxWindows licence |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | */ |
| 12 | |
| 13 | #ifndef _WX_MICROWIN_H_ |
| 14 | #define _WX_MICROWIN_H_ |
| 15 | |
| 16 | #ifdef __GNUG__ |
| 17 | #pragma interface "microwin.h" |
| 18 | #endif |
| 19 | |
| 20 | |
| 21 | /* Implemented by microwin.cpp */ |
| 22 | |
| 23 | #ifdef __cplusplus |
| 24 | extern "C" { |
| 25 | #endif |
| 26 | |
| 27 | BOOL SetCursorPos(int x, int y); |
| 28 | |
| 29 | HCURSOR SetCursor(HCURSOR hCursor); |
| 30 | |
| 31 | /* Implemented with wrong number of args by MicroWindows */ |
| 32 | /* so we need to use a different name */ |
| 33 | int GetScrollPosWX (HWND hWnd, int iSBar); |
| 34 | |
| 35 | BOOL ScrollWindow(HWND, int xAmount, int yAmount, |
| 36 | CONST RECT* lpRect, CONST RECT* lpClipRect); |
| 37 | |
| 38 | HWND WindowFromPoint(POINT pt); |
| 39 | SHORT GetKeyState(int nVirtKey); |
| 40 | HWND SetParent(HWND hWndChild, HWND hWndNewParent); |
| 41 | VOID DragAcceptFiles(HWND, BOOL); |
| 42 | BOOL IsDialogMessage(HWND hWnd, MSG* msg); |
| 43 | DWORD GetMessagePos(VOID); |
| 44 | BOOL IsIconic(HWND hWnd); |
| 45 | int SetMapMode(HDC hDC, int mode); |
| 46 | int GetMapMode(HDC hDC); |
| 47 | HCURSOR LoadCursor(HINSTANCE hInst, int cursor); |
| 48 | DWORD GetModuleFileName(HINSTANCE hInst, LPSTR name, DWORD sz); |
| 49 | VOID DestroyIcon(HICON hIcon); |
| 50 | COLORREF GetTextColor(HDC hdc); |
| 51 | COLORREF GetBkColor(HDC hdc); |
| 52 | HPALETTE SelectPalette(HDC hdc, HPALETTE hPalette, BOOL b); |
| 53 | BOOL IntersectClipRect(HDC hdc, int x, int y, |
| 54 | int w, int h); |
| 55 | BOOL GetClipBox(HDC hdc, RECT* rect); |
| 56 | BOOL DrawIconEx(HDC hdc, int x, int y, HICON hIcon, int w, int h, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags); |
| 57 | BOOL SetViewportExtEx(HDC hdc, int x, int y, LPSIZE lpSize); |
| 58 | BOOL SetViewportOrgEx(HDC hdc, int x, int y, LPPOINT lpPoint); |
| 59 | BOOL SetWindowExtEx(HDC hdc, int x, int y, LPSIZE lpSize); |
| 60 | BOOL SetWindowOrgEx(HDC hdc, int x, int y, LPPOINT lpSize); |
| 61 | BOOL ExtFloodFill(HDC hdc, int x, int y, COLORREF col, UINT flags); |
| 62 | int SetPolyFillMode(HDC hdc, int mode); |
| 63 | BOOL RoundRect(HDC hdc, int left, int top, int right, int bottom, int r1, int r2); |
| 64 | BOOL MaskBlt(HDC hdc, int x, int y, int w, int h, |
| 65 | HDC hDCSource, int xSrc, int ySrc, HBITMAP hBitmapMask, int xMask, int yMask, DWORD rop); |
| 66 | UINT RealizePalette(HDC hDC); |
| 67 | BOOL SetBrushOrgEx(HDC hdc, int xOrigin, int yOrigin, LPPOINT lpPoint); |
| 68 | int GetObject(HGDIOBJ hObj, int sz, LPVOID logObj); |
| 69 | |
| 70 | /* For some reason these aren't defined in the headers */ |
| 71 | BOOL EnableScrollBar (HWND hWnd, int iSBar, BOOL bEnable) ; |
| 72 | BOOL GetScrollPos (HWND hWnd, int iSBar, int* pPos); |
| 73 | BOOL GetScrollRange (HWND hWnd, int iSBar, int* pMinPos, int* pMaxPos); |
| 74 | BOOL SetScrollPos (HWND hWnd, int iSBar, int iNewPos); |
| 75 | BOOL SetScrollRange (HWND hWnd, int iSBar, int iMinPos, int iMaxPos); |
| 76 | BOOL SetScrollInfo (HWND hWnd, int iSBar, |
| 77 | LPCSCROLLINFO lpsi, BOOL fRedraw); |
| 78 | BOOL GetScrollInfo(HWND hWnd, int iSBar, LPSCROLLINFO lpsi); |
| 79 | BOOL ShowScrollBar (HWND hWnd, int iSBar, BOOL bShow); |
| 80 | HBITMAP WINAPI |
| 81 | CreateBitmap( int width, int height, int nPlanes, int bPP, LPCVOID lpData); |
| 82 | |
| 83 | #ifdef __cplusplus |
| 84 | } |
| 85 | #endif |
| 86 | |
| 87 | /* |
| 88 | * Key State Masks for Mouse Messages |
| 89 | */ |
| 90 | #ifndef MK_LBUTTON |
| 91 | #define MK_LBUTTON 0x0001 |
| 92 | #define MK_RBUTTON 0x0002 |
| 93 | #define MK_SHIFT 0x0004 |
| 94 | #define MK_CONTROL 0x0008 |
| 95 | #define MK_MBUTTON 0x0010 |
| 96 | #endif |
| 97 | |
| 98 | /* |
| 99 | * DrawIcon flags |
| 100 | */ |
| 101 | |
| 102 | #ifndef DI_MASK |
| 103 | #define DI_MASK 0x0001 |
| 104 | #define DI_IMAGE 0x0002 |
| 105 | #define DI_NORMAL 0x0003 |
| 106 | #define DI_COMPAT 0x0004 |
| 107 | #define DI_DEFAULTSIZE 0x0008 |
| 108 | #endif |
| 109 | |
| 110 | /* TODO: May have to fake these message */ |
| 111 | #ifndef WM_INITDIALOG |
| 112 | #define WM_INITDIALOG 0x0110 |
| 113 | #endif |
| 114 | #ifndef WM_QUERYENDSESSION |
| 115 | #define WM_QUERYENDSESSION 0x0011 |
| 116 | #endif |
| 117 | #ifndef WM_ENDSESSION |
| 118 | #define WM_ENDSESSION 0x0016 |
| 119 | #endif |
| 120 | #ifndef WM_SETCURSOR |
| 121 | #define WM_SETCURSOR 0x0020 |
| 122 | #endif |
| 123 | #ifndef WM_GETMINMAXINFO |
| 124 | #define WM_GETMINMAXINFO 0x0024 |
| 125 | typedef struct tagMINMAXINFO { |
| 126 | POINT ptReserved; |
| 127 | POINT ptMaxSize; |
| 128 | POINT ptMaxPosition; |
| 129 | POINT ptMinTrackSize; |
| 130 | POINT ptMaxTrackSize; |
| 131 | } MINMAXINFO, *PMINMAXINFO, *LPMINMAXINFO; |
| 132 | |
| 133 | #endif |
| 134 | #ifndef WM_SYSCOMMAND |
| 135 | #define WM_SYSCOMMAND 0x0112 |
| 136 | #endif |
| 137 | #ifndef WM_SYSCOLORCHANGE |
| 138 | #define WM_SYSCOLORCHANGE 0x0015 |
| 139 | #endif |
| 140 | #ifndef WM_QUERYNEWPALETTE |
| 141 | #define WM_QUERYNEWPALETTE 0x030F |
| 142 | #endif |
| 143 | #ifndef WM_PALETTEISCHANGING |
| 144 | #define WM_PALETTEISCHANGING 0x0310 |
| 145 | #endif |
| 146 | #ifndef WM_PALETTECHANGED |
| 147 | #define WM_PALETTECHANGED 0x0311 |
| 148 | #endif |
| 149 | #ifndef WM_NOTIFY |
| 150 | #define WM_NOTIFY 0x004E |
| 151 | #endif |
| 152 | #ifndef WM_DROPFILES |
| 153 | #define WM_DROPFILES 0x0233 |
| 154 | #endif |
| 155 | |
| 156 | #ifndef PALETTERGB |
| 157 | #define PALETTERGB RGB |
| 158 | #endif |
| 159 | |
| 160 | #ifndef MM_TEXT |
| 161 | #define MM_TEXT 1 |
| 162 | #define MM_LOMETRIC 2 |
| 163 | #define MM_HIMETRIC 3 |
| 164 | #define MM_LOENGLISH 4 |
| 165 | #define MM_HIENGLISH 5 |
| 166 | #define MM_TWIPS 6 |
| 167 | #define MM_ISOTROPIC 7 |
| 168 | #define MM_ANISOTROPIC 8 |
| 169 | #endif |
| 170 | |
| 171 | #ifndef SC_MAXIMIZE |
| 172 | #define SC_MINIMIZE 0xF020 |
| 173 | #define SC_MAXIMIZE 0xF030 |
| 174 | #endif |
| 175 | |
| 176 | // TODO: all of them |
| 177 | #ifndef IDC_ARROW |
| 178 | #define IDC_ARROW 1 |
| 179 | #endif |
| 180 | |
| 181 | /* |
| 182 | * Standard Cursor IDs |
| 183 | */ |
| 184 | #ifndef MAKEINTRESOURCE |
| 185 | #define MAKEINTRESOURCE(r) r |
| 186 | #endif |
| 187 | |
| 188 | #ifndef IDC_ARROW |
| 189 | #define IDC_ARROW MAKEINTRESOURCE(32512) |
| 190 | #define IDC_IBEAM MAKEINTRESOURCE(32513) |
| 191 | #define IDC_WAIT MAKEINTRESOURCE(32514) |
| 192 | #define IDC_CROSS MAKEINTRESOURCE(32515) |
| 193 | #define IDC_UPARROW MAKEINTRESOURCE(32516) |
| 194 | #define IDC_SIZE MAKEINTRESOURCE(32640) /* OBSOLETE: use IDC_SIZEALL */ |
| 195 | #define IDC_ICON MAKEINTRESOURCE(32641) /* OBSOLETE: use IDC_ARROW */ |
| 196 | #define IDC_SIZENWSE MAKEINTRESOURCE(32642) |
| 197 | #define IDC_SIZENESW MAKEINTRESOURCE(32643) |
| 198 | #define IDC_SIZEWE MAKEINTRESOURCE(32644) |
| 199 | #define IDC_SIZENS MAKEINTRESOURCE(32645) |
| 200 | #define IDC_SIZEALL MAKEINTRESOURCE(32646) |
| 201 | #define IDC_NO MAKEINTRESOURCE(32648) /* not in win3.1 */ |
| 202 | #if(WINVER >= 0x0500) |
| 203 | #define IDC_HAND MAKEINTRESOURCE(32649) |
| 204 | #endif /* WINVER >= 0x0500 */ |
| 205 | #define IDC_APPSTARTING MAKEINTRESOURCE(32650) /* not in win3.1 */ |
| 206 | #if(WINVER >= 0x0400) |
| 207 | #define IDC_HELP MAKEINTRESOURCE(32651) |
| 208 | #endif /* WINVER >= 0x0400 */ |
| 209 | #endif |
| 210 | |
| 211 | /* ExtFloodFill style flags */ |
| 212 | #define FLOODFILLBORDER 0 |
| 213 | #define FLOODFILLSURFACE 1 |
| 214 | |
| 215 | /* PolyFill() Modes */ |
| 216 | #define ALTERNATE 1 |
| 217 | #define WINDING 2 |
| 218 | #define POLYFILL_LAST 2 |
| 219 | |
| 220 | /* Quaternary raster codes */ |
| 221 | #define MAKEROP4(fore,back) (DWORD)((((back) << 8) & 0xFF000000) | (fore)) |
| 222 | |
| 223 | /* Device Parameters for GetDeviceCaps() */ |
| 224 | #define DRIVERVERSION 0 /* Device driver version */ |
| 225 | #define TECHNOLOGY 2 /* Device classification */ |
| 226 | #define HORZSIZE 4 /* Horizontal size in millimeters */ |
| 227 | #define VERTSIZE 6 /* Vertical size in millimeters */ |
| 228 | |
| 229 | /* Ternary raster operations */ |
| 230 | /* Now defined by MicroWindows */ |
| 231 | #if 0 |
| 232 | #define DSTINVERT (DWORD)0x00550009 /* dest = (NOT dest) */ |
| 233 | #define WHITENESS (DWORD)0x00FF0062 /* dest = WHITE */ |
| 234 | #define SRCERASE (DWORD)0x00440328 /* dest = source AND (NOT dest ) */ |
| 235 | #define MERGEPAINT (DWORD)0x00BB0226 /* dest = (NOT source) OR dest */ |
| 236 | #define SRCPAINT (DWORD)0x00EE0086 /* dest = source OR dest */ |
| 237 | #define NOTSRCCOPY (DWORD)0x00330008 /* dest = (NOT source) */ |
| 238 | #endif |
| 239 | |
| 240 | #endif /* _WX_MICROWIN_H_ */ |