00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #define INCL_WIN
00013 #define INCL_PM
00014 #include <os2wrap.h>
00015 #include <stdlib.h>
00016 #include <string.h>
00017 #include <misc.h>
00018 #include <winconst.h>
00019 #include <oslibgdi.h>
00020 #include <oslibwin.h>
00021 #include "win32wbase.h"
00022
00023 #define DBG_LOCALLOG DBG_oslibgdi
00024 #include "dbglocal.h"
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 INT mapScreenY(INT screenPosY)
00061 {
00062 return ScreenHeight-1-screenPosY;
00063 }
00064
00065
00066
00067 INT mapScreenY(INT screenH,INT screenPosY)
00068 {
00069 return screenH-1-screenPosY;
00070 }
00071
00072
00073
00074 BOOL mapScreenPoint(OSLIBPOINT *screenPt)
00075 {
00076 if(!screenPt) return FALSE;
00077 screenPt->y = ScreenHeight-1-screenPt->y;
00078
00079 return TRUE;
00080 }
00081
00082
00083
00084 BOOL mapScreenPoint(INT screenH,OSLIBPOINT *screenPt)
00085 {
00086 if (!screenPt) return FALSE;
00087 screenPt->y = screenH-1-screenPt->y;
00088
00089 return TRUE;
00090 }
00091
00092
00093
00094 BOOL mapOS2ToWin32Rect(int height, PRECTLOS2 rectOS2, PRECT rectWin32)
00095 {
00096 if(!rectOS2 || !rectWin32) {
00097 DebugInt3();
00098 return FALSE;
00099 }
00100 rectWin32->bottom = height-rectOS2->yBottom;
00101 rectWin32->top = height-rectOS2->yTop;
00102 rectWin32->left = rectOS2->xLeft;
00103 rectWin32->right = rectOS2->xRight;
00104
00105 return TRUE;
00106 }
00107
00108
00109 BOOL mapWin32ToOS2Rect(int height, PRECT rectWin32, PRECTLOS2 rectOS2)
00110 {
00111 if(!rectOS2 || !rectWin32) {
00112 DebugInt3();
00113 return FALSE;
00114 }
00115 rectOS2->yBottom = height-rectWin32->bottom;
00116 rectOS2->yTop = height-rectWin32->top;
00117 rectOS2->xLeft = rectWin32->left;
00118 rectOS2->xRight = rectWin32->right;
00119
00120 return TRUE;
00121 }
00122 #ifndef CLIENTFRAME
00123
00124
00125
00126
00127 BOOL mapWin32ToOS2RectClientToFrame(Win32BaseWindow *window, PRECT rectWin32,PRECTLOS2 rectOS2)
00128 {
00129 int height;
00130 int xclientorg;
00131 int yclientorg;
00132
00133 if(!window || !rectOS2 || !rectWin32) {
00134 DebugInt3();
00135 return FALSE;
00136 }
00137 height = window->getWindowHeight();
00138 xclientorg = window->getClientRectPtr()->left;
00139 yclientorg = window->getClientRectPtr()->top;
00140
00141 rectOS2->yBottom = height - (rectWin32->bottom + yclientorg);
00142 rectOS2->yTop = height - (rectWin32->top + yclientorg);
00143 rectOS2->xLeft = rectWin32->left + xclientorg;
00144 rectOS2->xRight = rectWin32->right + xclientorg;
00145
00146 return TRUE;
00147 }
00148
00149
00150
00151
00152
00153 BOOL mapOS2ToWin32RectFrameToClient(Win32BaseWindow *window, PRECTLOS2 rectOS2,
00154 PRECT rectWin32)
00155 {
00156 int height;
00157 int xclientorg;
00158 int yclientorg;
00159
00160 if(!window || !rectOS2 || !rectWin32) {
00161 DebugInt3();
00162 return FALSE;
00163 }
00164 height = window->getWindowHeight();
00165 xclientorg = window->getClientRectPtr()->left;
00166 yclientorg = window->getClientRectPtr()->top;
00167
00168 rectWin32->bottom = height - (rectOS2->yBottom + yclientorg);
00169 rectWin32->top = height - (rectOS2->yTop + yclientorg);
00170 rectWin32->left = rectOS2->xLeft - xclientorg;
00171 rectWin32->right = rectOS2->xRight - xclientorg;
00172
00173 return TRUE;
00174 }
00175 #endif //CLIENTFRAME
00176
00177
00178 BOOL copyOS2ToWin32Rect(PRECTLOS2 rectOS2,PRECT rectWin32)
00179 {
00180 rectWin32->bottom = rectOS2->yBottom;
00181 rectWin32->top = rectOS2->yTop;
00182 rectWin32->left = rectOS2->xLeft;
00183 rectWin32->right = rectOS2->xRight;
00184
00185 return TRUE;
00186 }
00187
00188
00189 BOOL copyWin32ToOS2WindowRect(PRECT rectWin32,PRECTLOS2 rectOS2)
00190 {
00191 rectOS2->yBottom = rectWin32->bottom;
00192 rectOS2->yTop = rectWin32->top;
00193 rectOS2->xLeft = rectWin32->left;
00194 rectOS2->xRight = rectWin32->right;
00195
00196 return TRUE;
00197 }
00198
00199