[5685] | 1 | /* $Id: oslibgdi.h,v 1.9 2001-05-11 08:39:43 sandervl Exp $ */
|
---|
[2469] | 2 | /*
|
---|
| 3 | * Window GDI wrapper functions for OS/2
|
---|
| 4 | *
|
---|
| 5 | *
|
---|
| 6 | * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
| 7 | *
|
---|
| 8 | *
|
---|
| 9 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
| 10 | *
|
---|
| 11 | */
|
---|
| 12 | #ifndef __OSLIBGDI_H__
|
---|
| 13 | #define __OSLIBGDI_H__
|
---|
| 14 |
|
---|
| 15 | #ifdef OS2_INCLUDED
|
---|
[21916] | 16 | #include <win32type.h>
|
---|
[2469] | 17 | #endif
|
---|
[21916] | 18 | #include "win32wbase.h"
|
---|
[2469] | 19 |
|
---|
| 20 | typedef struct
|
---|
| 21 | {
|
---|
| 22 | LONG xLeft;
|
---|
| 23 | LONG yBottom;
|
---|
| 24 | LONG xRight;
|
---|
| 25 | LONG yTop;
|
---|
| 26 | } RECTLOS2, *PRECTLOS2;
|
---|
| 27 |
|
---|
| 28 | typedef struct
|
---|
| 29 | {
|
---|
| 30 | LONG x;
|
---|
| 31 | LONG y;
|
---|
| 32 | } OSLIBPOINT;
|
---|
| 33 |
|
---|
[3662] | 34 | //Mapping functions
|
---|
[2469] | 35 |
|
---|
[3662] | 36 | INT mapScreenY(INT screenPosY);
|
---|
| 37 | INT mapScreenY(INT screenH,INT screenPosY);
|
---|
| 38 | INT inline mapY(INT height, int y)
|
---|
| 39 | {
|
---|
| 40 | return height - 1 - y;
|
---|
| 41 | }
|
---|
[2469] | 42 |
|
---|
[3662] | 43 | INT inline mapY(Win32BaseWindow *win32wnd,INT y)
|
---|
| 44 | {
|
---|
| 45 | return win32wnd->getWindowHeight() - 1 - y;
|
---|
| 46 | }
|
---|
[2469] | 47 |
|
---|
[3662] | 48 | INT inline mapOS2ToWin32Y(Win32BaseWindow *win32wnd,INT y)
|
---|
| 49 | {
|
---|
| 50 | return win32wnd->getWindowHeight() - 1 - (y + win32wnd->getClientRectPtr()->top);
|
---|
| 51 | }
|
---|
[2469] | 52 |
|
---|
[3662] | 53 | INT inline mapOS2ToWin32X(Win32BaseWindow *win32wnd,INT x)
|
---|
| 54 | {
|
---|
| 55 | return x - win32wnd->getClientRectPtr()->left;
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | INT inline mapWin32ToOS2Y(Win32BaseWindow *win32wnd,INT y)
|
---|
| 59 | {
|
---|
| 60 | if(win32wnd->getParent()) {
|
---|
| 61 | return win32wnd->getWindowHeight() - 1 - (y - win32wnd->getParent()->getClientRectPtr()->top);
|
---|
| 62 | }
|
---|
| 63 | else return y;
|
---|
| 64 | }
|
---|
| 65 |
|
---|
| 66 | INT inline mapWin32ToOS2X(Win32BaseWindow *win32wnd,INT x)
|
---|
| 67 | {
|
---|
| 68 | if(win32wnd->getParent()) {
|
---|
| 69 | return x + win32wnd->getParent()->getClientRectPtr()->left;
|
---|
| 70 | }
|
---|
| 71 | else return x;
|
---|
| 72 | }
|
---|
| 73 |
|
---|
[2469] | 74 | INT mapOS2ToWin32Y(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,INT fromPosY);
|
---|
| 75 | INT mapWin32Y(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,INT fromPosY);
|
---|
| 76 | BOOL mapScreenPoint(OSLIBPOINT *screenPt);
|
---|
| 77 | BOOL mapScreenPoint(INT screenH,OSLIBPOINT *screenPt);
|
---|
[3662] | 78 |
|
---|
| 79 | BOOL mapOS2ToWin32Rect(int height, PRECTLOS2 rectOS2, PRECT rectWin32);
|
---|
| 80 | BOOL mapWin32ToOS2Rect(int height, PRECT rectWin32,PRECTLOS2 rectOS2);
|
---|
| 81 |
|
---|
[5685] | 82 | #ifndef CLIENTFRAME
|
---|
[3662] | 83 | BOOL mapWin32ToOS2RectClientToFrame(Win32BaseWindow *window, PRECT rectWin32,PRECTLOS2 rectOS2);
|
---|
[3679] | 84 | BOOL mapOS2ToWin32RectFrameToClient(Win32BaseWindow *window, PRECTLOS2 rectOS2, PRECT rectWin32);
|
---|
[5685] | 85 | #endif
|
---|
[3662] | 86 |
|
---|
| 87 | #define mapWin32ToOS2RectFrame(window, rectWin32, rectOS2) \
|
---|
| 88 | if(window->getParent()) { \
|
---|
| 89 | mapWin32ToOS2Rect(window->getParent()->getWindowHeight(), rectWin32, rectOS2); \
|
---|
| 90 | } \
|
---|
| 91 | else mapWin32ToOS2Rect(OSLibQueryScreenHeight(), rectWin32, rectOS2);
|
---|
| 92 |
|
---|
| 93 | #define mapWin32ToOS2RectClient(window, rectWin32, rectOS2) \
|
---|
| 94 | mapWin32ToOS2Rect(window->getClientHeight(), rectWin32, rectOS2)
|
---|
| 95 |
|
---|
| 96 | #define mapWin32ToOS2ScreenRect(rectOS2, rectWin32) \
|
---|
| 97 | mapWin32ToOS2Rect(OSLibQueryScreenHeight(), rectOS2, rectWin32)
|
---|
| 98 |
|
---|
| 99 | #define mapOS2ToWin32RectFrame(window, rectOS2, rectWin32) \
|
---|
| 100 | if(window->getParent()) { \
|
---|
| 101 | mapOS2ToWin32Rect(window->getParent()->getWindowHeight(), rectOS2, rectWin32); \
|
---|
| 102 | } \
|
---|
| 103 | else mapOS2ToWin32Rect(OSLibQueryScreenHeight(), rectOS2, rectWin32);
|
---|
| 104 |
|
---|
| 105 |
|
---|
| 106 | #define mapOS2ToWin32RectClient(window, rectOS2, rectWin32) \
|
---|
| 107 | mapOS2ToWin32Rect(window->getClientHeight(), rectOS2, rectWin32)
|
---|
| 108 |
|
---|
| 109 | #define mapOS2ToWin32ScreenRect(rectOS2, rectWin32) \
|
---|
| 110 | mapOS2ToWin32Rect(OSLibQueryScreenHeight(), rectOS2, rectWin32)
|
---|
| 111 |
|
---|
[2469] | 112 | BOOL copyOS2ToWin32Rect(PRECTLOS2 rectOS2,PRECT rectWin32);
|
---|
| 113 | BOOL copyWin32ToOS2WindowRect(PRECT rectWin32,PRECTLOS2 rectOS2);
|
---|
| 114 | INT mapOS2ToWin32ChildOrigin(INT parentH,INT parentPosY,INT childH);
|
---|
| 115 |
|
---|
[4628] | 116 | #define RECT_WIDTH(a) ((a).right - (a).left)
|
---|
| 117 | #define RECT_HEIGHT(a) ((a).bottom - (a).top)
|
---|
| 118 |
|
---|
[2469] | 119 | #endif //__OSLIBGDI_H__
|
---|