| 1 | /* $Id: oslibgdi.h,v 1.6 2000-06-07 14:51:26 sandervl Exp $ */
|
|---|
| 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
|
|---|
| 16 | #include "win32type.h"
|
|---|
| 17 | #endif
|
|---|
| 18 | #include <win32wbase.h>
|
|---|
| 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 |
|
|---|
| 34 | //Mapping functions
|
|---|
| 35 |
|
|---|
| 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 | }
|
|---|
| 42 |
|
|---|
| 43 | INT inline mapY(Win32BaseWindow *win32wnd,INT y)
|
|---|
| 44 | {
|
|---|
| 45 | return win32wnd->getWindowHeight() - 1 - y;
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | INT inline mapOS2ToWin32Y(Win32BaseWindow *win32wnd,INT y)
|
|---|
| 49 | {
|
|---|
| 50 | return win32wnd->getWindowHeight() - 1 - (y + win32wnd->getClientRectPtr()->top);
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
| 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 |
|
|---|
| 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);
|
|---|
| 78 |
|
|---|
| 79 | BOOL mapOS2ToWin32Rect(int height, PRECTLOS2 rectOS2, PRECT rectWin32);
|
|---|
| 80 | BOOL mapWin32ToOS2Rect(int height, PRECT rectWin32,PRECTLOS2 rectOS2);
|
|---|
| 81 |
|
|---|
| 82 | BOOL mapWin32ToOS2RectClientToFrame(Win32BaseWindow *window, PRECT rectWin32,PRECTLOS2 rectOS2);
|
|---|
| 83 |
|
|---|
| 84 | #define mapWin32ToOS2RectFrame(window, rectWin32, rectOS2) \
|
|---|
| 85 | if(window->getParent()) { \
|
|---|
| 86 | mapWin32ToOS2Rect(window->getParent()->getWindowHeight(), rectWin32, rectOS2); \
|
|---|
| 87 | } \
|
|---|
| 88 | else mapWin32ToOS2Rect(OSLibQueryScreenHeight(), rectWin32, rectOS2);
|
|---|
| 89 |
|
|---|
| 90 | #define mapWin32ToOS2RectClient(window, rectWin32, rectOS2) \
|
|---|
| 91 | mapWin32ToOS2Rect(window->getClientHeight(), rectWin32, rectOS2)
|
|---|
| 92 |
|
|---|
| 93 | #define mapWin32ToOS2ScreenRect(rectOS2, rectWin32) \
|
|---|
| 94 | mapWin32ToOS2Rect(OSLibQueryScreenHeight(), rectOS2, rectWin32)
|
|---|
| 95 |
|
|---|
| 96 | #define mapOS2ToWin32RectFrame(window, rectOS2, rectWin32) \
|
|---|
| 97 | if(window->getParent()) { \
|
|---|
| 98 | mapOS2ToWin32Rect(window->getParent()->getWindowHeight(), rectOS2, rectWin32); \
|
|---|
| 99 | } \
|
|---|
| 100 | else mapOS2ToWin32Rect(OSLibQueryScreenHeight(), rectOS2, rectWin32);
|
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 | #define mapOS2ToWin32RectClient(window, rectOS2, rectWin32) \
|
|---|
| 104 | mapOS2ToWin32Rect(window->getClientHeight(), rectOS2, rectWin32)
|
|---|
| 105 |
|
|---|
| 106 | #define mapOS2ToWin32ScreenRect(rectOS2, rectWin32) \
|
|---|
| 107 | mapOS2ToWin32Rect(OSLibQueryScreenHeight(), rectOS2, rectWin32)
|
|---|
| 108 |
|
|---|
| 109 | BOOL copyOS2ToWin32Rect(PRECTLOS2 rectOS2,PRECT rectWin32);
|
|---|
| 110 | BOOL copyWin32ToOS2WindowRect(PRECT rectWin32,PRECTLOS2 rectOS2);
|
|---|
| 111 | INT mapOS2ToWin32ChildOrigin(INT parentH,INT parentPosY,INT childH);
|
|---|
| 112 |
|
|---|
| 113 | #endif //__OSLIBGDI_H__
|
|---|