00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __OSLIBGDI_H__
00013 #define __OSLIBGDI_H__
00014
00015 #ifdef OS2_INCLUDED
00016 #include "win32type.h"
00017 #endif
00018 #include <win32wbase.h>
00019
00020 typedef struct
00021 {
00022 LONG xLeft;
00023 LONG yBottom;
00024 LONG xRight;
00025 LONG yTop;
00026 } RECTLOS2, *PRECTLOS2;
00027
00028 typedef struct
00029 {
00030 LONG x;
00031 LONG y;
00032 } OSLIBPOINT;
00033
00034
00035
00036 INT mapScreenY(INT screenPosY);
00037 INT mapScreenY(INT screenH,INT screenPosY);
00038 INT inline mapY(INT height, int y)
00039 {
00040 return height - 1 - y;
00041 }
00042
00043 INT inline mapY(Win32BaseWindow *win32wnd,INT y)
00044 {
00045 return win32wnd->getWindowHeight() - 1 - y;
00046 }
00047
00048 INT inline mapOS2ToWin32Y(Win32BaseWindow *win32wnd,INT y)
00049 {
00050 return win32wnd->getWindowHeight() - 1 - (y + win32wnd->getClientRectPtr()->top);
00051 }
00052
00053 INT inline mapOS2ToWin32X(Win32BaseWindow *win32wnd,INT x)
00054 {
00055 return x - win32wnd->getClientRectPtr()->left;
00056 }
00057
00058 INT inline mapWin32ToOS2Y(Win32BaseWindow *win32wnd,INT y)
00059 {
00060 if(win32wnd->getParent()) {
00061 return win32wnd->getWindowHeight() - 1 - (y - win32wnd->getParent()->getClientRectPtr()->top);
00062 }
00063 else return y;
00064 }
00065
00066 INT inline mapWin32ToOS2X(Win32BaseWindow *win32wnd,INT x)
00067 {
00068 if(win32wnd->getParent()) {
00069 return x + win32wnd->getParent()->getClientRectPtr()->left;
00070 }
00071 else return x;
00072 }
00073
00074 INT mapOS2ToWin32Y(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,INT fromPosY);
00075 INT mapWin32Y(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,INT fromPosY);
00076 BOOL mapScreenPoint(OSLIBPOINT *screenPt);
00077 BOOL mapScreenPoint(INT screenH,OSLIBPOINT *screenPt);
00078
00079 BOOL mapOS2ToWin32Rect(int height, PRECTLOS2 rectOS2, PRECT rectWin32);
00080 BOOL mapWin32ToOS2Rect(int height, PRECT rectWin32,PRECTLOS2 rectOS2);
00081
00082 #ifndef CLIENTFRAME
00083 BOOL mapWin32ToOS2RectClientToFrame(Win32BaseWindow *window, PRECT rectWin32,PRECTLOS2 rectOS2);
00084 BOOL mapOS2ToWin32RectFrameToClient(Win32BaseWindow *window, PRECTLOS2 rectOS2, PRECT rectWin32);
00085 #endif
00086
00087 #define mapWin32ToOS2RectFrame(window, rectWin32, rectOS2) \
00088 if(window->getParent()) { \
00089 mapWin32ToOS2Rect(window->getParent()->getWindowHeight(), rectWin32, rectOS2); \
00090 } \
00091 else mapWin32ToOS2Rect(OSLibQueryScreenHeight(), rectWin32, rectOS2);
00092
00093 #define mapWin32ToOS2RectClient(window, rectWin32, rectOS2) \
00094 mapWin32ToOS2Rect(window->getClientHeight(), rectWin32, rectOS2)
00095
00096 #define mapWin32ToOS2ScreenRect(rectOS2, rectWin32) \
00097 mapWin32ToOS2Rect(OSLibQueryScreenHeight(), rectOS2, rectWin32)
00098
00099 #define mapOS2ToWin32RectFrame(window, rectOS2, rectWin32) \
00100 if(window->getParent()) { \
00101 mapOS2ToWin32Rect(window->getParent()->getWindowHeight(), rectOS2, rectWin32); \
00102 } \
00103 else mapOS2ToWin32Rect(OSLibQueryScreenHeight(), rectOS2, rectWin32);
00104
00105
00106 #define mapOS2ToWin32RectClient(window, rectOS2, rectWin32) \
00107 mapOS2ToWin32Rect(window->getClientHeight(), rectOS2, rectWin32)
00108
00109 #define mapOS2ToWin32ScreenRect(rectOS2, rectWin32) \
00110 mapOS2ToWin32Rect(OSLibQueryScreenHeight(), rectOS2, rectWin32)
00111
00112 BOOL copyOS2ToWin32Rect(PRECTLOS2 rectOS2,PRECT rectWin32);
00113 BOOL copyWin32ToOS2WindowRect(PRECT rectWin32,PRECTLOS2 rectOS2);
00114 INT mapOS2ToWin32ChildOrigin(INT parentH,INT parentPosY,INT childH);
00115
00116 #define RECT_WIDTH(a) ((a).right - (a).left)
00117 #define RECT_HEIGHT(a) ((a).bottom - (a).top)
00118
00119 #endif //__OSLIBGDI_H__