Changeset 340 for trunk/src/user32/new/oslibgdi.cpp
- Timestamp:
- Jul 19, 1999, 8:40:44 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/new/oslibgdi.cpp
r328 r340 1 /* $Id: oslibgdi.cpp,v 1. 2 1999-07-18 14:39:35sandervl Exp $ */1 /* $Id: oslibgdi.cpp,v 1.3 1999-07-19 18:40:43 sandervl Exp $ */ 2 2 /* 3 3 * Window GDI wrapper functions for OS/2 … … 19 19 #include <misc.h> 20 20 #include <oslibgdi.h> 21 #include <oslibwin.h> 21 22 22 //******************************************************************************23 //******************************************************************************24 inline PRECTL Win32ToOS2Rect(PVOID pRectl)25 {26 PRECTL pWinRect = (PRECTL)pRectl;27 ULONG tmp;28 29 tmp = pWinRect->yBottom;30 pWinRect->yBottom = pWinRect->yTop;31 pWinRect->yTop = tmp;32 return pWinRect;33 }34 //******************************************************************************35 //******************************************************************************36 inline ULONG MAPWIN32POINT(RECTLOS2 *parent, RECTLOS2 *child, ULONG y)37 {38 return (parent->yTop - parent->yBottom - (child->yTop - child->yBottom) - y - 1);39 }40 23 //****************************************************************************** 41 24 //****************************************************************************** 42 25 inline ULONG MAPWIN32POINT(RECTLOS2 *parent, ULONG cy, ULONG y) 43 26 { 44 return (parent->yTop - parent->yBottom - cy - y - 1); 27 return (parent->yTop - parent->yBottom - cy - y); 28 } 29 //****************************************************************************** 30 //Map win32 y coordinate (in parent window coordinates) to OS/2 y coord. (in parent window coordinates) 31 //****************************************************************************** 32 ULONG MapOS2ToWin32Y(HWND hwndParent, ULONG cy, ULONG y) 33 { 34 RECTLOS2 rectParent = {0}; 35 36 if(hwndParent == OSLIB_HWND_DESKTOP) { 37 hwndParent = HWND_DESKTOP; 38 } 39 WinQueryWindowRect(hwndParent, (PRECTL)&rectParent); 40 return MAPWIN32POINT(&rectParent, cy, y); 45 41 } 46 42 //****************************************************************************** 47 43 //****************************************************************************** 48 ULONG MapOS2ToWin32Y(HWND hwndChild)44 BOOL MapOS2ToWin32Point(HWND hwndParent, HWND hwndChild, OSLIBPOINT *point) 49 45 { 50 HWND hwndParent;51 RECTLOS2 rectParent = {0}, rectChild = {0};52 53 WinQueryWindowRect(hwndChild, (PRECTL)&rectChild);54 hwndParent = WinQueryWindow(hwndChild, QW_PARENT);55 WinQueryWindowRect(hwndParent, (PRECTL)&rectParent);56 return MAPWIN32POINT(&rectParent, &rectChild, rectChild.yBottom);57 }58 //******************************************************************************59 //******************************************************************************60 ULONG MapOS2ToWin32Y(HWND hwndChild, ULONG y)61 {62 HWND hwndParent;63 RECTLOS2 rectParent = {0}, rectChild = {0};64 65 WinQueryWindowRect(hwndChild, (PRECTL)&rectChild);66 hwndParent = WinQueryWindow(hwndChild, QW_PARENT);67 WinQueryWindowRect(hwndParent, (PRECTL)&rectParent);68 return MAPWIN32POINT(&rectParent, &rectChild, y);69 }70 //******************************************************************************71 //******************************************************************************72 ULONG MapOS2ToWin32Y(HWND hwndChild, ULONG cy, ULONG y)73 {74 HWND hwndParent;75 46 RECTLOS2 rectParent = {0}; 76 47 77 hwndParent = WinQueryWindow(hwndChild, QW_PARENT); 78 WinQueryWindowRect(hwndParent, (PRECTL)&rectParent); 79 return MAPWIN32POINT(&rectParent, cy, y); 80 } 81 //****************************************************************************** 82 //****************************************************************************** 83 ULONG MapOS2ToWin32Y(PRECTLOS2 rectParent, PRECTLOS2 rectChild, ULONG y) 84 { 85 return MAPWIN32POINT(rectParent, rectChild, y); 86 } 87 //****************************************************************************** 88 //****************************************************************************** 89 ULONG MapOS2ToWin32Y(PRECTLOS2 rectParent, HWND hwndChild, ULONG y) 90 { 91 RECTLOS2 rectChild = {0}; 92 93 WinQueryWindowRect(hwndChild, (PRECTL)&rectChild); 94 return MAPWIN32POINT(rectParent, &rectChild, y); 95 } 96 //****************************************************************************** 97 //****************************************************************************** 98 ULONG MapOS2ToWin32Y(HWND hwndChild, PRECTLOS2 rectChild, ULONG y) 99 { 100 HWND hwndParent; 101 RECTLOS2 rectParent = {0}; 102 103 hwndParent = WinQueryWindow(hwndChild, QW_PARENT); 104 WinQueryWindowRect(hwndParent, (PRECTL)&rectParent); 105 return MAPWIN32POINT(&rectParent, rectChild, y); 48 if(hwndParent == OSLIB_HWND_DESKTOP) { 49 hwndParent = HWND_DESKTOP; 50 } 51 if(WinMapWindowPoints(hwndChild, hwndParent, (POINTL *)point, 1) != 0) { 52 dprintf(("MapOS2ToWin32Point:WinMapWindowPoint %x %x returned false", hwndParent, hwndChild)); 53 return FALSE; 54 } 55 WinQueryWindowRect(hwndParent, (PRECTL)&rectParent); 56 point->y = rectParent.yTop - point->y; 57 return TRUE; 106 58 } 107 59 //****************************************************************************** … … 110 62 // 111 63 // Parameters: 112 // hwndChild: Child window handle113 // rect Child: OS/2 child window RECTL64 // rectOS2: OS/2 child window RECTL 65 // rectWin32: Win32 Child window RECT (IN) 114 66 // 115 67 // Returns: 116 // rectChild: Converted OS/2 rectange stored in Win32 RECTL (yTop & yBottom reversed)117 68 // TRUE: Success 118 69 // FALSE: Failures 119 70 //****************************************************************************** 120 BOOL MapOS2ToWin32Rectl( HWND hwndChild, PRECTLOS2 rectChild, PRECT rectWin32)71 BOOL MapOS2ToWin32Rectl(PRECTLOS2 rectOS2, PRECT rectWin32) 121 72 { 122 HWND hwndParent; 123 RECTLOS2 rectParent = {0}; 73 ULONG length = rectOS2->yTop - rectOS2->yBottom; 124 74 125 hwndParent = WinQueryWindow(hwndChild, QW_PARENT); 126 WinQueryWindowRect(hwndParent, (PRECTL)&rectParent); 127 128 rectWin32->yTop = MAPWIN32POINT(&rectParent, rectChild->yTop - rectChild->yBottom, rectChild->yBottom); 129 rectWin32->yBottom = MAPWIN32POINT(&rectParent, rectChild->yTop - rectChild->yBottom, rectChild->yTop); 130 rectWin32->xLeft = rectChild->xLeft; 131 rectWin32->xRight = rectChild->xRight; 132 return TRUE; 133 } 134 //****************************************************************************** 135 // MapOS2ToWin32Rectl 136 // Convert OS/2 to Win32 RECTL structure 137 // 138 // Parameters: 139 // rectParent: OS/2 Parent window RECTL 140 // rectChild: OS/2 Child window RECTL 141 // 142 // Returns: 143 // rectChild: Converted OS/2 rectange stored in Win32 RECTL (yTop & yBottom reversed) 144 // TRUE: Success 145 // FALSE: Failures 146 //****************************************************************************** 147 BOOL MapOS2ToWin32Rectl(PRECTLOS2 rectParent, PRECTLOS2 rectChild, PRECT rectWin32) 148 { 149 rectWin32->yTop = MAPWIN32POINT(rectParent, rectChild->yTop - rectChild->yBottom, rectChild->yBottom); 150 rectWin32->yBottom = MAPWIN32POINT(rectParent, rectChild->yTop - rectChild->yBottom, rectChild->yTop); 151 rectWin32->xLeft = rectChild->xLeft; 152 rectWin32->xRight = rectChild->xRight; 75 rectWin32->bottom = length - rectOS2->yBottom; 76 rectWin32->top = length - rectOS2->yTop; 77 rectWin32->left = rectOS2->xLeft; 78 rectWin32->right = rectOS2->xRight; 153 79 return TRUE; 154 80 } … … 158 84 // 159 85 // Parameters: 160 // hwndChild: OS/2 Child window handle (IN)161 86 // rectWin32: Win32 Child window RECT (IN) 162 // rect Child:OS/2 Child window RECTL (OUT)87 // rectOS2: OS/2 Child window RECTL (OUT) 163 88 // Returns: 164 89 // TRUE: Success 165 90 // FALSE: Failures 166 91 //****************************************************************************** 167 BOOL MapWin32ToOS2Rectl( HWND hwndChild, PRECT rectWin32, PRECTLOS2 rectChild)92 BOOL MapWin32ToOS2Rectl(PRECT rectWin32, PRECTLOS2 rectOS2) 168 93 { 169 HWND hwndParent; 170 RECTLOS2 rectParent = {0}; 94 ULONG length = rectWin32->top - rectWin32->bottom; 171 95 172 hwndParent = WinQueryWindow(hwndChild, QW_PARENT); 173 WinQueryWindowRect(hwndParent, (PRECTL)&rectParent); 174 175 rectChild->yTop = MAPWIN32POINT(&rectParent, rectWin32->yBottom - rectWin32->yTop, rectWin32->yBottom); 176 rectChild->yBottom = MAPWIN32POINT(&rectParent, rectWin32->yBottom - rectWin32->yTop, rectWin32->yTop); 177 rectChild->xLeft = rectWin32->xLeft; 178 rectChild->xRight = rectWin32->xRight; 179 return TRUE; 180 } 181 //****************************************************************************** 182 // MapWin32ToOS2Rectl 183 // Convert Win32 to OS/2 RECTL structure 184 // 185 // Parameters: 186 // rectParent: OS/2 Parent window RECTL (IN) 187 // rectWin32: Win32 Child window RECT (IN) 188 // rectChild: OS/2 Child window RECTL (OUT) 189 // Returns: 190 // TRUE: Success 191 // FALSE: Failures 192 //****************************************************************************** 193 BOOL MapWin32ToOS2Rectl(PRECTLOS2 rectParent, PRECT rectWin32, PRECTLOS2 rectChild) 194 { 195 rectChild->yTop = MAPWIN32POINT(rectParent, rectWin32->yBottom - rectWin32->yTop, rectWin32->yBottom); 196 rectChild->yBottom = MAPWIN32POINT(rectParent, rectWin32->yBottom - rectWin32->yTop, rectWin32->yTop); 197 rectChild->xLeft = rectWin32->xLeft; 198 rectChild->xRight = rectWin32->xRight; 199 return TRUE; 96 rectOS2->yBottom = length - rectWin32->bottom; 97 rectOS2->yTop = length - rectWin32->top; 98 rectOS2->xLeft = rectWin32->left; 99 rectOS2->xRight = rectWin32->right; 100 return TRUE; 200 101 } 201 102 //****************************************************************************** 202 103 //****************************************************************************** 203 HDC OSLibWinBeginPaint(HWND hwnd, PVOID pRectl)104 HDC OSLibWinBeginPaint(HWND hwnd, RECT *rectWin32) 204 105 { 205 RECTL OS2 rectlOS2;106 RECTL rectl; 206 107 207 MapWin32ToOS2Rectl(hwnd, (PRECT)pRectl, &rectlOS2); 208 return WinBeginPaint(hwnd, NULLHANDLE, (PRECTL)&rectlOS2); 108 if(WinQueryUpdateRect(hwnd, &rectl) == FALSE) 109 { 110 dprintf(("BeginPaint, NO update rectl")); 111 return 0; 112 } 113 MapOS2ToWin32Rectl((RECTLOS2 *)&rectl, rectWin32); 114 return WinBeginPaint(hwnd, NULLHANDLE, &rectl); 209 115 } 210 116 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.