Changeset 11276
- Timestamp:
- Aug 24, 1999, 5:57:27 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified tags/trunk/src/user32/new/user32.cpp ¶
r11193 r11276 1 /* $Id: user32.cpp,v 1.1 4 1999-08-19 12:53:56 sandervlExp $ */1 /* $Id: user32.cpp,v 1.15 1999-08-24 15:57:27 cbratschi Exp $ */ 2 2 3 3 /* … … 77 77 // WIN32API YieldTask 78 78 79 / /Coordinate transformation79 /* Coordinate Transformation */ 80 80 81 81 inline void OS2ToWin32ScreenPos(POINT *dest,POINT *source) … … 90 90 } 91 91 92 //****************************************************************************** 93 //****************************************************************************** 92 /* Rectangle Functions - parts from wine/windows/rect.c */ 93 94 BOOL WIN32API CopyRect( PRECT lprcDst, const RECT * lprcSrc) 95 { 96 // ddprintf(("USER32: CopyRect\n")); 97 if (!lprcDst || !lprcSrc) { 98 SetLastError(ERROR_INVALID_PARAMETER); 99 return FALSE; 100 } 101 102 memcpy(lprcDst,lprcSrc,sizeof(RECT)); 103 104 return TRUE; 105 } 106 //****************************************************************************** 107 //****************************************************************************** 108 BOOL WIN32API EqualRect( const RECT *lprc1, const RECT *lprc2) 109 { 110 #ifdef DEBUG 111 WriteLog("USER32: EqualRect\n"); 112 #endif 113 if (!lprc1 || !lprc2) 114 { 115 SetLastError(ERROR_INVALID_PARAMETER); 116 return FALSE; 117 } 118 119 return (lprc1->left == lprc2->left && 120 lprc1->right == lprc2->right && 121 lprc1->top == lprc2->top && 122 lprc1->bottom == lprc2->bottom); 123 } 124 //****************************************************************************** 125 //****************************************************************************** 126 BOOL WIN32API InflateRect( PRECT lprc, int dx, int dy) 127 { 128 #ifdef DEBUG 129 WriteLog("USER32: InflateRect\n"); 130 #endif 131 if (!lprc) 132 { 133 SetLastError(ERROR_INVALID_PARAMETER); 134 return FALSE; 135 } 136 137 lprc->left -= dx; 138 lprc->right += dx; 139 lprc->top -= dy; 140 lprc->bottom += dy; 141 142 return TRUE; 143 } 144 //****************************************************************************** 145 //****************************************************************************** 146 BOOL WIN32API IntersectRect( PRECT lprcDst, const RECT * lprcSrc1, const RECT * lprcSrc2) 147 { 148 #ifdef DEBUG 149 //// WriteLog("USER32: IntersectRect\n"); 150 #endif 151 if (!lprcDst || !lprcSrc1 || !lprcSrc2) 152 { 153 SetLastError(ERROR_INVALID_PARAMETER); 154 return FALSE; 155 } 156 157 if (IsRectEmpty(lprcSrc1) || IsRectEmpty(lprcSrc2) || 158 (lprcSrc1->left >= lprcSrc2->right) || (lprcSrc2->left >= lprcSrc1->right) || 159 (lprcSrc1->top >= lprcSrc2->bottom) || (lprcSrc2->top >= lprcSrc1->bottom)) 160 { 161 SetLastError(ERROR_INVALID_PARAMETER); 162 SetRectEmpty(lprcDst); 163 return FALSE; 164 } 165 lprcDst->left = MAX(lprcSrc1->left,lprcSrc2->left); 166 lprcDst->right = MIN(lprcSrc1->right,lprcSrc2->right); 167 lprcDst->top = MAX(lprcSrc1->top,lprcSrc2->top); 168 lprcDst->bottom = MIN(lprcSrc1->bottom,lprcSrc2->bottom); 169 170 return TRUE; 171 } 172 //****************************************************************************** 173 //****************************************************************************** 174 BOOL WIN32API IsRectEmpty( const RECT * lprc) 175 { 176 #ifdef DEBUG 177 WriteLog("USER32: IsRectEmpty\n"); 178 #endif 179 if (!lprc) 180 { 181 SetLastError(ERROR_INVALID_PARAMETER); 182 return FALSE; 183 } 184 185 return (lprc->left == lprc->right || lprc->top == lprc->bottom); 186 } 187 //****************************************************************************** 188 //****************************************************************************** 189 BOOL WIN32API OffsetRect( PRECT lprc, int x, int y) 190 { 191 #ifdef DEBUG 192 //// WriteLog("USER32: OffsetRect\n"); 193 #endif 194 if (!lprc) 195 { 196 SetLastError(ERROR_INVALID_PARAMETER); 197 return FALSE; 198 } 199 200 lprc->left += x; 201 lprc->right += x; 202 lprc->top += y; 203 lprc->bottom += y; 204 205 return TRUE; 206 } 207 //****************************************************************************** 208 //****************************************************************************** 209 BOOL WIN32API PtInRect( const RECT *lprc, POINT pt) 210 { 211 #ifdef DEBUG1 212 WriteLog("USER32: PtInRect\n"); 213 #endif 214 if (!lprc) 215 { 216 SetLastError(ERROR_INVALID_PARAMETER); 217 return FALSE; 218 } 219 220 return (pt.x >= lprc->left && 221 pt.x < lprc->right && 222 pt.y >= lprc->top && 223 pt.y < lprc->bottom); 224 } 225 //****************************************************************************** 226 //****************************************************************************** 227 BOOL WIN32API SetRect( PRECT lprc, int nLeft, int nTop, int nRight, int nBottom) 228 { 229 if (!lprc) 230 { 231 SetLastError(ERROR_INVALID_PARAMETER); 232 return FALSE; 233 } 234 235 lprc->left = nLeft; 236 lprc->top = nTop; 237 lprc->right = nRight; 238 lprc->bottom = nBottom; 239 240 return TRUE; 241 } 242 //****************************************************************************** 243 //****************************************************************************** 244 BOOL WIN32API SetRectEmpty( PRECT lprc) 245 { 246 #ifdef DEBUG 247 WriteLog("USER32: SetRectEmpty\n"); 248 #endif 249 if (!lprc) 250 { 251 SetLastError(ERROR_INVALID_PARAMETER); 252 return FALSE; 253 } 254 255 lprc->left = lprc->right = lprc->top = lprc->bottom = 0; 256 257 return TRUE; 258 } 259 //****************************************************************************** 260 //****************************************************************************** 261 BOOL WIN32API SubtractRect( PRECT lprcDest, const RECT * lprcSrc1, const RECT * lprcSrc2) 262 { 263 #ifdef DEBUG 264 WriteLog("USER32: SubtractRect"); 265 #endif 266 RECT tmp; 267 268 if (!lprcDest || !lprcSrc1 || !lprcSrc2) 269 { 270 SetLastError(ERROR_INVALID_PARAMETER); 271 return FALSE; 272 } 273 274 if (IsRectEmpty(lprcSrc1)) 275 { 276 SetLastError(ERROR_INVALID_PARAMETER); 277 SetRectEmpty(lprcDest); 278 return FALSE; 279 } 280 *lprcDest = *lprcSrc1; 281 if (IntersectRect(&tmp,lprcSrc1,lprcSrc2)) 282 { 283 if (EqualRect(&tmp,lprcDest)) 284 { 285 SetRectEmpty(lprcDest); 286 return FALSE; 287 } 288 if ((tmp.top == lprcDest->top) && (tmp.bottom == lprcDest->bottom)) 289 { 290 if (tmp.left == lprcDest->left) lprcDest->left = tmp.right; 291 else if (tmp.right == lprcDest->right) lprcDest->right = tmp.left; 292 } 293 else if ((tmp.left == lprcDest->left) && (tmp.right == lprcDest->right)) 294 { 295 if (tmp.top == lprcDest->top) lprcDest->top = tmp.bottom; 296 else if (tmp.bottom == lprcDest->bottom) lprcDest->bottom = tmp.top; 297 } 298 } 299 300 return TRUE; 301 } 302 //****************************************************************************** 303 //****************************************************************************** 304 BOOL WIN32API UnionRect( PRECT lprcDst, const RECT *lprcSrc1, const RECT *lprcSrc2) 305 { 306 #ifdef DEBUG 307 WriteLog("USER32: UnionRect\n"); 308 #endif 309 if (!lprcDst || !lprcSrc1 || !lprcSrc2) 310 { 311 SetLastError(ERROR_INVALID_PARAMETER); 312 return FALSE; 313 } 314 315 if (IsRectEmpty(lprcSrc1)) 316 { 317 if (IsRectEmpty(lprcSrc2)) 318 { 319 SetLastError(ERROR_INVALID_PARAMETER); 320 SetRectEmpty(lprcDst); 321 return FALSE; 322 } 323 else *lprcDst = *lprcSrc2; 324 } 325 else 326 { 327 if (IsRectEmpty(lprcSrc2)) *lprcDst = *lprcSrc1; 328 else 329 { 330 lprcDst->left = MIN(lprcSrc1->left,lprcSrc2->left); 331 lprcDst->right = MAX(lprcSrc1->right,lprcSrc2->right); 332 lprcDst->top = MIN(lprcSrc1->top,lprcSrc2->top); 333 lprcDst->bottom = MAX(lprcSrc1->bottom,lprcSrc2->bottom); 334 } 335 } 336 337 return TRUE; 338 } 339 340 /* String Manipulating Functions */ 341 94 342 int __cdecl wsprintfA(char *lpOut, LPCSTR lpFmt, ...) 95 343 { … … 235 483 //****************************************************************************** 236 484 //****************************************************************************** 237 238 //******************************************************************************239 //******************************************************************************240 BOOL WIN32API OffsetRect( PRECT lprc, int x, int y)241 {242 #ifdef DEBUG243 //// WriteLog("USER32: OffsetRect\n");244 #endif245 if (lprc)246 {247 lprc->left += x;248 lprc->right += x;249 lprc->top += y;250 lprc->bottom += y;251 252 return TRUE;253 } else return FALSE;254 }255 //******************************************************************************256 //******************************************************************************257 BOOL WIN32API CopyRect( PRECT lprcDst, const RECT * lprcSrc)258 {259 // ddprintf(("USER32: CopyRect\n"));260 if (!lprcDst || !lprcSrc) {261 SetLastError(ERROR_INVALID_PARAMETER);262 return FALSE;263 }264 265 memcpy(lprcDst,lprcSrc,sizeof(RECT));266 267 return TRUE;268 }269 //******************************************************************************270 //******************************************************************************271 485 int WIN32API GetSystemMetrics(int nIndex) 272 486 { … … 407 621 //****************************************************************************** 408 622 //****************************************************************************** 409 BOOL WIN32API InflateRect( PRECT lprc, int dx, int dy)410 {411 #ifdef DEBUG412 WriteLog("USER32: InflateRect\n");413 #endif414 if (!lprc) return FALSE;415 //right?416 lprc->left -= dx;417 lprc->right += dx;418 lprc->top -= dy;419 lprc->bottom += dy;420 421 return TRUE;422 }423 623 //****************************************************************************** 424 624 //TODO:How can we emulate this one in OS/2??? … … 447 647 //****************************************************************************** 448 648 //****************************************************************************** 449 BOOL WIN32API SetRect( PRECT lprc, int nLeft, int nTop, int nRight, int nBottom)450 {451 if (!lprc) return FALSE;452 lprc->left = nLeft;453 lprc->top = nTop;454 lprc->right = nRight;455 lprc->bottom = nBottom;456 457 return TRUE;458 }459 //******************************************************************************460 //******************************************************************************461 649 BOOL WIN32API WinHelpA( HWND hwnd, LPCSTR lpszHelp, UINT uCommand, DWORD dwData) 462 650 { … … 468 656 469 657 return(TRUE); 470 }471 //******************************************************************************472 //******************************************************************************473 BOOL WIN32API SubtractRect( PRECT lprcDest, const RECT * lprcSrc1, const RECT * lprcSrc2)474 {475 #ifdef DEBUG476 WriteLog("USER32: SubtractRect");477 #endif478 //CB: how?479 return O32_SubtractRect(lprcDest,lprcSrc1,lprcSrc2);480 658 } 481 659 //****************************************************************************** … … 688 866 //****************************************************************************** 689 867 //****************************************************************************** 690 BOOL WIN32API EqualRect( const RECT * arg1, const RECT * arg2)691 {692 #ifdef DEBUG693 WriteLog("USER32: EqualRect\n");694 #endif695 return O32_EqualRect(arg1, arg2);696 }697 //******************************************************************************698 //******************************************************************************699 868 BOOL WIN32API ExcludeUpdateRgn( HDC arg1, HWND arg2) 700 869 { … … 906 1075 //****************************************************************************** 907 1076 //****************************************************************************** 908 BOOL WIN32API IntersectRect( PRECT arg1, const RECT * arg2, const RECT * arg3)909 {910 #ifdef DEBUG911 //// WriteLog("USER32: IntersectRect\n");912 #endif913 return O32_IntersectRect(arg1, arg2, arg3);914 }915 //******************************************************************************916 //******************************************************************************917 1077 BOOL WIN32API InvalidateRgn( HWND arg1, HRGN arg2, BOOL arg3) 918 1078 { … … 930 1090 #endif 931 1091 return O32_InvertRect(arg1, arg2); 932 }933 //******************************************************************************934 //******************************************************************************935 BOOL WIN32API IsRectEmpty( const RECT * arg1)936 {937 #ifdef DEBUG938 WriteLog("USER32: IsRectEmpty\n");939 #endif940 return O32_IsRectEmpty(arg1);941 1092 } 942 1093 //****************************************************************************** … … 979 1130 //****************************************************************************** 980 1131 //****************************************************************************** 981 BOOL WIN32API PtInRect( const RECT * arg1, POINT arg2)982 {983 #ifdef DEBUG1984 WriteLog("USER32: PtInRect\n");985 #endif986 return O32_PtInRect(arg1, arg2);987 }988 //******************************************************************************989 //******************************************************************************990 1132 BOOL WIN32API ScreenToClient( HWND arg1, LPPOINT arg2) 991 1133 { … … 1028 1170 #endif 1029 1171 return O32_SetDoubleClickTime(arg1); 1030 }1031 //******************************************************************************1032 //******************************************************************************1033 BOOL WIN32API SetRectEmpty( PRECT arg1)1034 {1035 #ifdef DEBUG1036 WriteLog("USER32: SetRectEmpty\n");1037 #endif1038 return O32_SetRectEmpty(arg1);1039 1172 } 1040 1173 //****************************************************************************** … … 1197 1330 //****************************************************************************** 1198 1331 //****************************************************************************** 1199 BOOL WIN32API UnionRect( PRECT arg1, const RECT * arg2, const RECT * arg3)1200 {1201 #ifdef DEBUG1202 WriteLog("USER32: UnionRect\n");1203 #endif1204 return O32_UnionRect(arg1, arg2, arg3);1205 }1206 //******************************************************************************1207 //******************************************************************************1208 1332 BOOL WIN32API ValidateRect( HWND arg1, const RECT * arg2) 1209 1333 {
Note:
See TracChangeset
for help on using the changeset viewer.