| 1 | /* $Id: dc.h,v 1.5 1999-10-22 18:11:44 sandervl Exp $ */ | 
|---|
| 2 | /* | 
|---|
| 3 | * public dc functions | 
|---|
| 4 | * | 
|---|
| 5 | * | 
|---|
| 6 | * Copyright 1999      Daniela Engert (dani@ngrt.de) | 
|---|
| 7 | * | 
|---|
| 8 | * | 
|---|
| 9 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 10 | * | 
|---|
| 11 | */ | 
|---|
| 12 | #ifndef __DC_H__ | 
|---|
| 13 | #define __DC_H__ | 
|---|
| 14 |  | 
|---|
| 15 | extern BOOL isYup (struct _DCData *pHps); | 
|---|
| 16 | extern HDC sendEraseBkgnd (Win32BaseWindow *wnd); | 
|---|
| 17 | extern void releaseOwnDC (HDC hps); | 
|---|
| 18 |  | 
|---|
| 19 |  | 
|---|
| 20 | #ifdef INCLUDED_BY_DC | 
|---|
| 21 | /*********************/ | 
|---|
| 22 | typedef struct | 
|---|
| 23 | { | 
|---|
| 24 | HDC   hdc; | 
|---|
| 25 | BOOL  fErase; | 
|---|
| 26 | RECT  rcPaint; | 
|---|
| 27 | BOOL  fRestore; | 
|---|
| 28 | BOOL  IncUpdate; | 
|---|
| 29 | BYTE  rgbReserved[32]; | 
|---|
| 30 | } PAINTSTRUCT_W, *PPAINTSTRUCT_W, *LPPAINTSTRUCT_W; | 
|---|
| 31 |  | 
|---|
| 32 | #define PS_SOLID_W         0x00000000 | 
|---|
| 33 | #define PS_DASH_W          0x00000001 | 
|---|
| 34 | #define PS_DOT_W           0x00000002 | 
|---|
| 35 | #define PS_DASHDOT_W       0x00000003 | 
|---|
| 36 | #define PS_DASHDOTDOT_W    0x00000004 | 
|---|
| 37 | #define PS_NULL_W          0x00000005 | 
|---|
| 38 | #define PS_INSIDEFRAME_W   0x00000006 | 
|---|
| 39 | #define PS_USERSTYLE_W     0x00000007 | 
|---|
| 40 | #define PS_ALTERNATE_W     0x00000008 | 
|---|
| 41 | #define PS_STYLE_MASK_W    0x0000000f | 
|---|
| 42 |  | 
|---|
| 43 | typedef struct | 
|---|
| 44 | { | 
|---|
| 45 | UINT   lopnStyle; | 
|---|
| 46 | POINT  lopnWidth; | 
|---|
| 47 | ULONG  lopnColor; | 
|---|
| 48 | } LOGPEN_W, *LPLOGPEN_W; | 
|---|
| 49 |  | 
|---|
| 50 | typedef struct tagEXTLOGPEN | 
|---|
| 51 | { | 
|---|
| 52 | DWORD elpPenStyle; | 
|---|
| 53 | DWORD elpWidth; | 
|---|
| 54 | DWORD elpBrushStyle; | 
|---|
| 55 | DWORD elpColor; | 
|---|
| 56 | DWORD elpNumEntries; | 
|---|
| 57 | DWORD elpStyleEntry[1]; | 
|---|
| 58 | } EXTLOGPEN_W, *PEXTLOGPEN_W, *NPEXTLOGPEN_W, *LPEXTLOGPEN_W; | 
|---|
| 59 |  | 
|---|
| 60 | typedef struct | 
|---|
| 61 | { | 
|---|
| 62 | UINT   lbStyle; | 
|---|
| 63 | ULONG  lbColor; | 
|---|
| 64 | INT    lbHatch; | 
|---|
| 65 | } LOGBRUSH_W, *LPLOGBRUSH_W; | 
|---|
| 66 |  | 
|---|
| 67 | typedef struct _penobject | 
|---|
| 68 | { | 
|---|
| 69 | ULONG filler[9]; | 
|---|
| 70 | union { | 
|---|
| 71 | struct { | 
|---|
| 72 | PEXTLOGPEN_W      pExtLogPen; | 
|---|
| 73 | LOGBRUSH_W        logbrush; | 
|---|
| 74 | LOGPEN_W          logpen; | 
|---|
| 75 | } ExtPen; | 
|---|
| 76 | struct { | 
|---|
| 77 | LOGPEN_W          logpen; | 
|---|
| 78 | } Pen; | 
|---|
| 79 | }; | 
|---|
| 80 | } tPenObject, *pPenObject; | 
|---|
| 81 |  | 
|---|
| 82 | /* DC Graphics Mode */ | 
|---|
| 83 | #define GM_COMPATIBLE_W     1 | 
|---|
| 84 | #define GM_ADVANCED_W       2 | 
|---|
| 85 |  | 
|---|
| 86 | #define DCX_WINDOW_W                    0x00000001L | 
|---|
| 87 | #define DCX_CACHE_W                     0x00000002L | 
|---|
| 88 | #define DCX_NORESETATTRS_W              0x00000004L | 
|---|
| 89 | #define DCX_CLIPCHILDREN_W              0x00000008L | 
|---|
| 90 | #define DCX_CLIPSIBLINGS_W              0x00000010L | 
|---|
| 91 | #define DCX_PARENTCLIP_W                0x00000020L | 
|---|
| 92 | #define DCX_EXCLUDERGN_W                0x00000040L | 
|---|
| 93 | #define DCX_INTERSECTRGN_W              0x00000080L | 
|---|
| 94 | #define DCX_EXCLUDEUPDATE_W             0x00000100L | 
|---|
| 95 | #define DCX_INTERSECTUPDATE_W           0x00000200L | 
|---|
| 96 | #define DCX_LOCKWINDOWUPDATE_W          0x00000400L | 
|---|
| 97 | #define DCX_VALIDATE_W                  0x00200000L | 
|---|
| 98 |  | 
|---|
| 99 | #define RDW_INVALIDATE_W       0x0001 | 
|---|
| 100 | #define RDW_INTERNALPAINT_W    0x0002 | 
|---|
| 101 | #define RDW_ERASE_W            0x0004 | 
|---|
| 102 | #define RDW_VALIDATE_W         0x0008 | 
|---|
| 103 | #define RDW_NOINTERNALPAINT_W  0x0010 | 
|---|
| 104 | #define RDW_NOERASE_W          0x0020 | 
|---|
| 105 | #define RDW_NOCHILDREN_W       0x0040 | 
|---|
| 106 | #define RDW_ALLCHILDREN_W      0x0080 | 
|---|
| 107 | #define RDW_UPDATENOW_W        0x0100 | 
|---|
| 108 | #define RDW_ERASENOW_W         0x0200 | 
|---|
| 109 | #define RDW_FRAME_W            0x0400 | 
|---|
| 110 | #define RDW_NOFRAME_W          0x0800 | 
|---|
| 111 |  | 
|---|
| 112 | typedef struct _RGNDATAHEADER_W { | 
|---|
| 113 | DWORD       dwSize; | 
|---|
| 114 | DWORD       iType; | 
|---|
| 115 | DWORD       nCount; | 
|---|
| 116 | DWORD       nRgnSize; | 
|---|
| 117 | RECT        rcBound; | 
|---|
| 118 | } RGNDATAHEADER_W, *LPRGNDATAHEADER_W; | 
|---|
| 119 |  | 
|---|
| 120 | typedef struct _RGNDATA_W { | 
|---|
| 121 | RGNDATAHEADER_W     rdh; | 
|---|
| 122 | char                Buffer[1]; | 
|---|
| 123 | } RGNDATA_W , *PRGNDATA_W , *LPRGNDATA_W ; | 
|---|
| 124 |  | 
|---|
| 125 |  | 
|---|
| 126 | /* Xform FLAGS */ | 
|---|
| 127 | #define MWT_IDENTITY_W        1 | 
|---|
| 128 | #define MWT_LEFTMULTIPLY_W    2 | 
|---|
| 129 | #define MWT_RIGHTMULTIPLY_W   3 | 
|---|
| 130 |  | 
|---|
| 131 | /* Mapping Modes */ | 
|---|
| 132 | #define MM_TEXT_W             1 | 
|---|
| 133 | #define MM_LOMETRIC_W         2 | 
|---|
| 134 | #define MM_HIMETRIC_W         3 | 
|---|
| 135 | #define MM_LOENGLISH_W        4 | 
|---|
| 136 | #define MM_HIENGLISH_W        5 | 
|---|
| 137 | #define MM_TWIPS_W            6 | 
|---|
| 138 | #define MM_ISOTROPIC_W        7 | 
|---|
| 139 | #define MM_ANISOTROPIC_W      8 | 
|---|
| 140 |  | 
|---|
| 141 | #define RGN_OR_W              2 | 
|---|
| 142 |  | 
|---|
| 143 | /* Window scrolling */ | 
|---|
| 144 | #define SW_SCROLLCHILDREN_W    0x0001 | 
|---|
| 145 | #define SW_INVALIDATE_W        0x0002 | 
|---|
| 146 | #define SW_ERASE_W             0x0004 | 
|---|
| 147 |  | 
|---|
| 148 | /*********************/ | 
|---|
| 149 |  | 
|---|
| 150 | #ifndef OPEN32API | 
|---|
| 151 | #define OPEN32API _System | 
|---|
| 152 | #endif | 
|---|
| 153 |  | 
|---|
| 154 |  | 
|---|
| 155 | BOOL    APIENTRY _GpiEnableYInversion (HPS hps, LONG lHeight); | 
|---|
| 156 |  | 
|---|
| 157 | inline BOOL APIENTRY GpiEnableYInversion (HPS hps, LONG lHeight) | 
|---|
| 158 | { | 
|---|
| 159 | BOOL yyrc; | 
|---|
| 160 | USHORT sel = RestoreOS2FS(); | 
|---|
| 161 |  | 
|---|
| 162 | yyrc = _GpiEnableYInversion(hps, lHeight); | 
|---|
| 163 | SetFS(sel); | 
|---|
| 164 |  | 
|---|
| 165 | return yyrc; | 
|---|
| 166 | } | 
|---|
| 167 |  | 
|---|
| 168 | //LONG    APIENTRY GpiQueryYInversion (HPS hps); | 
|---|
| 169 |  | 
|---|
| 170 | PVOID   APIENTRY _GpiAllocateDCData (HPS GpiH, ULONG size); | 
|---|
| 171 |  | 
|---|
| 172 | inline PVOID APIENTRY GpiAllocateDCData (HPS GpiH, ULONG size) | 
|---|
| 173 | { | 
|---|
| 174 | PVOID yyrc; | 
|---|
| 175 | USHORT sel = RestoreOS2FS(); | 
|---|
| 176 |  | 
|---|
| 177 | yyrc = _GpiAllocateDCData(GpiH, size); | 
|---|
| 178 | SetFS(sel); | 
|---|
| 179 |  | 
|---|
| 180 | return yyrc; | 
|---|
| 181 | } | 
|---|
| 182 |  | 
|---|
| 183 | PVOID   APIENTRY _GpiQueryDCData (HPS hps); | 
|---|
| 184 |  | 
|---|
| 185 | inline PVOID APIENTRY GpiQueryDCData (HPS hps) | 
|---|
| 186 | { | 
|---|
| 187 | PVOID yyrc; | 
|---|
| 188 | USHORT sel = RestoreOS2FS(); | 
|---|
| 189 |  | 
|---|
| 190 | yyrc = _GpiQueryDCData(hps); | 
|---|
| 191 | SetFS(sel); | 
|---|
| 192 |  | 
|---|
| 193 | return yyrc; | 
|---|
| 194 | } | 
|---|
| 195 |  | 
|---|
| 196 | HDC     OPEN32API _HPSToHDC (HWND hwnd, HPS hps, HDC hdc, PVOID a); | 
|---|
| 197 |  | 
|---|
| 198 | inline HDC OPEN32API HPSToHDC (HWND hwnd, HPS hps, HDC hdc, PVOID a) | 
|---|
| 199 | { | 
|---|
| 200 | HDC yyrc; | 
|---|
| 201 | USHORT sel = RestoreOS2FS(); | 
|---|
| 202 |  | 
|---|
| 203 | yyrc = _HPSToHDC(hwnd, hps, hdc, a); | 
|---|
| 204 | SetFS(sel); | 
|---|
| 205 |  | 
|---|
| 206 | return yyrc; | 
|---|
| 207 | } | 
|---|
| 208 |  | 
|---|
| 209 | void    OPEN32API _DeleteHDC (HDC hdc); | 
|---|
| 210 |  | 
|---|
| 211 | inline void OPEN32API DeleteHDC (HDC hdc) | 
|---|
| 212 | { | 
|---|
| 213 | USHORT sel = RestoreOS2FS(); | 
|---|
| 214 |  | 
|---|
| 215 | _DeleteHDC(hdc); | 
|---|
| 216 | SetFS(sel); | 
|---|
| 217 | } | 
|---|
| 218 |  | 
|---|
| 219 | BOOL    OPEN32API _O32_EndPaint (HWND hwnd, const PAINTSTRUCT_W *lpps); | 
|---|
| 220 |  | 
|---|
| 221 | inline BOOL O32_EndPaint(HWND a, CONST PAINTSTRUCT_W *b) | 
|---|
| 222 | { | 
|---|
| 223 | BOOL yyrc; | 
|---|
| 224 | USHORT sel = RestoreOS2FS(); | 
|---|
| 225 |  | 
|---|
| 226 | yyrc = _O32_EndPaint(a, b); | 
|---|
| 227 | SetFS(sel); | 
|---|
| 228 |  | 
|---|
| 229 | return yyrc; | 
|---|
| 230 | } | 
|---|
| 231 |  | 
|---|
| 232 | int     OPEN32API _O32_GetUpdateRgn (HWND hwnd, HRGN hrgn, BOOL erase); | 
|---|
| 233 |  | 
|---|
| 234 | inline int O32_GetUpdateRgn(HWND a, HRGN b, BOOL c) | 
|---|
| 235 | { | 
|---|
| 236 | int yyrc; | 
|---|
| 237 | USHORT sel = RestoreOS2FS(); | 
|---|
| 238 |  | 
|---|
| 239 | yyrc = _O32_GetUpdateRgn(a, b, c); | 
|---|
| 240 | SetFS(sel); | 
|---|
| 241 |  | 
|---|
| 242 | return yyrc; | 
|---|
| 243 | } | 
|---|
| 244 |  | 
|---|
| 245 | ULONG   OPEN32API _O32_GetRegionData (HRGN hrgn, ULONG count, PRGNDATA_W pData); | 
|---|
| 246 |  | 
|---|
| 247 | inline DWORD O32_GetRegionData(HRGN a, DWORD b, PRGNDATA_W c) | 
|---|
| 248 | { | 
|---|
| 249 | DWORD yyrc; | 
|---|
| 250 | USHORT sel = RestoreOS2FS(); | 
|---|
| 251 |  | 
|---|
| 252 | yyrc = _O32_GetRegionData(a, b, c); | 
|---|
| 253 | SetFS(sel); | 
|---|
| 254 |  | 
|---|
| 255 | return yyrc; | 
|---|
| 256 | } | 
|---|
| 257 |  | 
|---|
| 258 | BOOL    OPEN32API _O32_DeleteObject (LHANDLE hgdiobj); | 
|---|
| 259 |  | 
|---|
| 260 | inline BOOL O32_DeleteObject(HANDLE a) | 
|---|
| 261 | { | 
|---|
| 262 | BOOL yyrc; | 
|---|
| 263 | USHORT sel = RestoreOS2FS(); | 
|---|
| 264 |  | 
|---|
| 265 | yyrc = _O32_DeleteObject(a); | 
|---|
| 266 | SetFS(sel); | 
|---|
| 267 |  | 
|---|
| 268 | return yyrc; | 
|---|
| 269 | } | 
|---|
| 270 |  | 
|---|
| 271 | int     OPEN32API _O32_ReleaseDC (HWND hwnd, HDC hdc); | 
|---|
| 272 |  | 
|---|
| 273 | inline int O32_ReleaseDC(HWND a, HDC b) | 
|---|
| 274 | { | 
|---|
| 275 | int yyrc; | 
|---|
| 276 | USHORT sel = RestoreOS2FS(); | 
|---|
| 277 |  | 
|---|
| 278 | yyrc = _O32_ReleaseDC(a, b); | 
|---|
| 279 | SetFS(sel); | 
|---|
| 280 |  | 
|---|
| 281 | return yyrc; | 
|---|
| 282 | } | 
|---|
| 283 |  | 
|---|
| 284 | VOID    OPEN32API _O32_SetLastError( DWORD ); | 
|---|
| 285 |  | 
|---|
| 286 | inline VOID O32_SetLastError(DWORD a) | 
|---|
| 287 | { | 
|---|
| 288 | USHORT sel = RestoreOS2FS(); | 
|---|
| 289 |  | 
|---|
| 290 | _O32_SetLastError(a); | 
|---|
| 291 | SetFS(sel); | 
|---|
| 292 | } | 
|---|
| 293 |  | 
|---|
| 294 | BOOL    OPEN32API _O32_SetRectRgn (HRGN dest, int left, int top, int right, int bottom); | 
|---|
| 295 |  | 
|---|
| 296 | inline BOOL O32_SetRectRgn(HRGN a, int b, int c, int d, int e) | 
|---|
| 297 | { | 
|---|
| 298 | BOOL yyrc; | 
|---|
| 299 | USHORT sel = RestoreOS2FS(); | 
|---|
| 300 |  | 
|---|
| 301 | yyrc = _O32_SetRectRgn(a, b, c, d, e); | 
|---|
| 302 | SetFS(sel); | 
|---|
| 303 |  | 
|---|
| 304 | return yyrc; | 
|---|
| 305 | } | 
|---|
| 306 |  | 
|---|
| 307 | int     OPEN32API _O32_CombineRgn (HRGN dest, HRGN src1, HRGN src2, int mode); | 
|---|
| 308 |  | 
|---|
| 309 | inline int O32_CombineRgn(HRGN a, HRGN b, HRGN c, int d) | 
|---|
| 310 | { | 
|---|
| 311 | int yyrc; | 
|---|
| 312 | USHORT sel = RestoreOS2FS(); | 
|---|
| 313 |  | 
|---|
| 314 | yyrc = _O32_CombineRgn(a, b, c, d); | 
|---|
| 315 | SetFS(sel); | 
|---|
| 316 |  | 
|---|
| 317 | return yyrc; | 
|---|
| 318 | } | 
|---|
| 319 |  | 
|---|
| 320 | HRGN    OPEN32API _O32_CreateRectRgn (int left, int top, int right, int bottom); | 
|---|
| 321 |  | 
|---|
| 322 | inline HRGN O32_CreateRectRgn(int a, int b, int c, int d) | 
|---|
| 323 | { | 
|---|
| 324 | HRGN yyrc; | 
|---|
| 325 | USHORT sel = RestoreOS2FS(); | 
|---|
| 326 |  | 
|---|
| 327 | yyrc = _O32_CreateRectRgn(a, b, c, d); | 
|---|
| 328 | SetFS(sel); | 
|---|
| 329 |  | 
|---|
| 330 | return yyrc; | 
|---|
| 331 | } | 
|---|
| 332 |  | 
|---|
| 333 | BOOL OPEN32API _O32_CreateCaret (HWND hwnd, HBITMAP hbm, int width, int height); | 
|---|
| 334 |  | 
|---|
| 335 | inline BOOL O32_CreateCaret(HWND a, HBITMAP b, int c, int d) | 
|---|
| 336 | { | 
|---|
| 337 | BOOL yyrc; | 
|---|
| 338 | USHORT sel = RestoreOS2FS(); | 
|---|
| 339 |  | 
|---|
| 340 | yyrc = _O32_CreateCaret(a, b, c, d); | 
|---|
| 341 | SetFS(sel); | 
|---|
| 342 |  | 
|---|
| 343 | return yyrc; | 
|---|
| 344 | } | 
|---|
| 345 |  | 
|---|
| 346 | BOOL    APIENTRY  __DestroyCaret (void); | 
|---|
| 347 |  | 
|---|
| 348 | inline BOOL APIENTRY _DestroyCaret (void) | 
|---|
| 349 | { | 
|---|
| 350 | BOOL yyrc; | 
|---|
| 351 | USHORT sel = RestoreOS2FS(); | 
|---|
| 352 |  | 
|---|
| 353 | yyrc = __DestroyCaret(); | 
|---|
| 354 | SetFS(sel); | 
|---|
| 355 |  | 
|---|
| 356 | return yyrc; | 
|---|
| 357 | } | 
|---|
| 358 |  | 
|---|
| 359 | UINT    APIENTRY  __GetCaretBlinkTime (void); | 
|---|
| 360 |  | 
|---|
| 361 | inline UINT APIENTRY _GetCaretBlinkTime (void) | 
|---|
| 362 | { | 
|---|
| 363 | UINT yyrc; | 
|---|
| 364 | USHORT sel = RestoreOS2FS(); | 
|---|
| 365 |  | 
|---|
| 366 | yyrc = __GetCaretBlinkTime(); | 
|---|
| 367 | SetFS(sel); | 
|---|
| 368 |  | 
|---|
| 369 | return yyrc; | 
|---|
| 370 | } | 
|---|
| 371 |  | 
|---|
| 372 | BOOL    APIENTRY  __HideCaret (HWND hwnd); | 
|---|
| 373 |  | 
|---|
| 374 | inline BOOL APIENTRY _HideCaret (HWND hwnd) | 
|---|
| 375 | { | 
|---|
| 376 | BOOL yyrc; | 
|---|
| 377 | USHORT sel = RestoreOS2FS(); | 
|---|
| 378 |  | 
|---|
| 379 | yyrc = __HideCaret(hwnd); | 
|---|
| 380 | SetFS(sel); | 
|---|
| 381 |  | 
|---|
| 382 | return yyrc; | 
|---|
| 383 | } | 
|---|
| 384 |  | 
|---|
| 385 | BOOL    APIENTRY  __SetCaretBlinkTime (UINT mSecs); | 
|---|
| 386 |  | 
|---|
| 387 | inline BOOL APIENTRY _SetCaretBlinkTime (UINT mSecs) | 
|---|
| 388 | { | 
|---|
| 389 | BOOL yyrc; | 
|---|
| 390 | USHORT sel = RestoreOS2FS(); | 
|---|
| 391 |  | 
|---|
| 392 | yyrc = __SetCaretBlinkTime(mSecs); | 
|---|
| 393 | SetFS(sel); | 
|---|
| 394 |  | 
|---|
| 395 | return yyrc; | 
|---|
| 396 | } | 
|---|
| 397 |  | 
|---|
| 398 | BOOL    APIENTRY  __ShowCaret (HWND hwnd); | 
|---|
| 399 |  | 
|---|
| 400 | inline BOOL APIENTRY _ShowCaret (HWND hwnd) | 
|---|
| 401 | { | 
|---|
| 402 | BOOL yyrc; | 
|---|
| 403 | USHORT sel = RestoreOS2FS(); | 
|---|
| 404 |  | 
|---|
| 405 | yyrc = __ShowCaret(hwnd); | 
|---|
| 406 | SetFS(sel); | 
|---|
| 407 |  | 
|---|
| 408 | return yyrc; | 
|---|
| 409 | } | 
|---|
| 410 |  | 
|---|
| 411 | #endif //INCLUDED_BY_DC | 
|---|
| 412 |  | 
|---|
| 413 | #endif //__DC_H__ | 
|---|
| 414 |  | 
|---|