- Timestamp:
- Jul 18, 1999, 3:57:48 PM (26 years ago)
- Location:
- trunk/src/user32/new
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/new/oslibwin.cpp
r325 r327 1 /* $Id: oslibwin.cpp,v 1.1 0 1999-07-18 10:39:51 sandervlExp $ */1 /* $Id: oslibwin.cpp,v 1.11 1999-07-18 13:57:47 cbratschi Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 46 46 47 47 if(pszName && *pszName == 0) { 48 48 pszName = NULL; 49 49 } 50 50 if(hwndParent == 0) { … … 53 53 if(dwFrameStyle) { 54 54 dwWinStyle &= ~WS_CLIPCHILDREN; //invalid style according to docs 55 56 55 if(pszName) 56 dwFrameStyle |= FCF_TITLEBAR; 57 57 58 58 *hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle, … … 60 60 "", 0, 0, 0, &hwndClient); 61 61 if(*hwndFrame) { 62 63 64 62 if(pszName) { 63 WinSetWindowText(*hwndFrame, pszName); 64 } 65 65 return hwndClient; 66 66 } … … 161 161 //****************************************************************************** 162 162 //****************************************************************************** 163 HWND OSLibWinQueryFocus(HWND hwndDeskTop) 164 { 165 return WinQueryFocus(hwndDeskTop); 166 } 167 //****************************************************************************** 168 //****************************************************************************** 169 HWND OSLibWinWindowFromID(HWND hwndParent,ULONG id) 170 { 171 return WinWindowFromID(hwndParent,id); 172 } 173 //****************************************************************************** 174 //****************************************************************************** 175 BOOL OSLibWinSetFocus(HWND hwndDeskTop,HWND hwndNewFocus) 176 { 177 return WinSetFocus(hwndDeskTop,hwndNewFocus); 178 } 179 //****************************************************************************** 180 //****************************************************************************** 181 ULONG OSLibGetWindowHeight(HWND hwnd) 182 { 183 RECTL rect; 184 185 return (WinQueryWindowRect(hwnd,&rect)) ? rect.yTop-rect.yBottom:0; 186 } 187 //****************************************************************************** 188 //****************************************************************************** 189 BOOL OSLibWinInvalidateRect(HWND hwnd,POSRECTL pwrc,BOOL fIncludeChildren) 190 { 191 return WinInvalidateRect(hwnd,(PRECTL)pwrc,fIncludeChildren); 192 } 193 //****************************************************************************** 194 //****************************************************************************** 195 LONG OSLibWinQuerySysValue(HWND hwndDeskTop,LONG iSysValue) 196 { 197 return WinQuerySysValue(hwndDeskTop,iSysValue); 198 } 199 //****************************************************************************** 200 //****************************************************************************** 201 ULONG OSLibWinQueryDlgItemText(HWND hwndDlg,ULONG idItem,LONG cchBufferMax,char* pchBuffer) 202 { 203 return WinQueryDlgItemText(hwndDlg,idItem,cchBufferMax,pchBuffer); 204 } 205 //****************************************************************************** 206 //****************************************************************************** 207 BOOL OSLibWinSetDlgItemText(HWND hwndDlg,ULONG idItem,char* pszText) 208 { 209 return WinSetDlgItemText(hwndDlg,idItem,pszText); 210 } 211 //****************************************************************************** 212 //****************************************************************************** 213 BOOL OSLibWinQueryPointerPos(HWND hwndDeskTop,PPOINT pptlPoint) 214 { 215 return WinQueryPointerPos(hwndDeskTop,(PPOINTL)pptlPoint); 216 } 163 217 //****************************************************************************** 164 218 //****************************************************************************** … … 173 227 { 174 228 if(fl & SWP_MOVE) { 175 229 y = MapOS2ToWin32Y(hwnd, cy, y); 176 230 } 177 231 dprintf(("WinSetWindowPos %x %x %d %d %d %d %x", hwnd, hwndInsertBehind, x, y, cx, cy, fl)); … … 185 239 186 240 if(fl & SWP_SHOW) { 187 241 rc = WinShowWindow(hwnd, TRUE); 188 242 } 189 243 if(rc == 0) 190 244 dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB()))); 191 245 rc = WinSetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, fl); 192 246 if(rc == 0) 193 247 dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB()))); 194 248 return rc; 195 249 } … … 202 256 //****************************************************************************** 203 257 //****************************************************************************** 204 BOOL OSLibWinQueryUpdateRect(HWND hwnd, PRECT pRect) 205 { 206 BOOL rc; 207 RECTLOS2 rectl; 208 209 rc = WinQueryUpdateRect(hwnd, (PRECTL)&rectl); 210 if(rc) { 211 MapOS2ToWin32Rectl(hwnd, &rectl, pRect); 212 } 213 return rc; 258 BOOL OSLibWinQueryUpdateRect(HWND hwnd, POSRECTL pRect) 259 { 260 return WinQueryUpdateRect(hwnd, (PRECTL)pRect); 261 //CB: caller must convert rect 214 262 } 215 263 //****************************************************************************** -
trunk/src/user32/new/oslibwin.h
r325 r327 1 /* $Id: oslibwin.h,v 1. 9 1999-07-18 10:39:51 sandervlExp $ */1 /* $Id: oslibwin.h,v 1.10 1999-07-18 13:57:47 cbratschi Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 29 29 HWND OSLibWinCreateMenu(HWND hwndParent, PVOID menutemplate); 30 30 31 #define WA _WARNING 032 #define WA _NOTE 133 #define WA _ERROR 234 #define WA _CWINALARMS 13 /* count of valid alarms 53304*/31 #define WAOS_WARNING 0 32 #define WAOS_NOTE 1 33 #define WAOS_ERROR 2 34 #define WAOS_CWINALARMS 13 /* count of valid alarms 53304*/ 35 35 36 36 BOOL OSLibWinAlarm(HWND hwndDeskTop,ULONG flStyle); 37 37 ULONG OSLibDosBeep(ULONG freg,ULONG dur); 38 HWND OSLibWinQueryFocus(HWND hwndDeskTop); 39 HWND OSLibWinWindowFromID(HWND hwndParent,ULONG id); 40 BOOL OSLibWinSetFocus(HWND hwndDeskTop,HWND hwndNewFocus); 41 ULONG OSLibGetWindowHeight(HWND hwnd); //for point transformation 42 43 typedef struct _OSRECTL 44 { 45 LONG xLeft; 46 LONG yBottom; 47 LONG xRight; 48 LONG yTop; 49 } OSRECTL; 50 51 typedef OSRECTL *POSRECTL; 52 53 BOOL OSLibWinInvalidateRect(HWND hwnd,POSRECTL pwrc,BOOL fIncludeChildren); //must be RECTL pointer! 54 55 //reserved deleted 56 57 #define SVOS_SWAPBUTTON 0 58 #define SVOS_DBLCLKTIME 1 59 #define SVOS_CXDBLCLK 2 60 #define SVOS_CYDBLCLK 3 61 #define SVOS_CXSIZEBORDER 4 62 #define SVOS_CYSIZEBORDER 5 63 #define SVOS_ALARM 6 64 #define SVOS_CURSORRATE 9 65 #define SVOS_FIRSTSCROLLRATE 10 66 #define SVOS_SCROLLRATE 11 67 #define SVOS_NUMBEREDLISTS 12 68 #define SVOS_WARNINGFREQ 13 69 #define SVOS_NOTEFREQ 14 70 #define SVOS_ERRORFREQ 15 71 #define SVOS_WARNINGDURATION 16 72 #define SVOS_NOTEDURATION 17 73 #define SVOS_ERRORDURATION 18 74 #define SVOS_CXSCREEN 20 75 #define SVOS_CYSCREEN 21 76 #define SVOS_CXVSCROLL 22 77 #define SVOS_CYHSCROLL 23 78 #define SVOS_CYVSCROLLARROW 24 79 #define SVOS_CXHSCROLLARROW 25 80 #define SVOS_CXBORDER 26 81 #define SVOS_CYBORDER 27 82 #define SVOS_CXDLGFRAME 28 83 #define SVOS_CYDLGFRAME 29 84 #define SVOS_CYTITLEBAR 30 85 #define SVOS_CYVSLIDER 31 86 #define SVOS_CXHSLIDER 32 87 #define SVOS_CXMINMAXBUTTON 33 88 #define SVOS_CYMINMAXBUTTON 34 89 #define SVOS_CYMENU 35 90 #define SVOS_CXFULLSCREEN 36 91 #define SVOS_CYFULLSCREEN 37 92 #define SVOS_CXICON 38 93 #define SVOS_CYICON 39 94 #define SVOS_CXPOINTER 40 95 #define SVOS_CYPOINTER 41 96 #define SVOS_DEBUG 42 97 #define SVOS_CMOUSEBUTTONS 43 98 #define SVOS_CPOINTERBUTTONS 43 99 #define SVOS_POINTERLEVEL 44 100 #define SVOS_CURSORLEVEL 45 101 #define SVOS_TRACKRECTLEVEL 46 102 #define SVOS_CTIMERS 47 103 #define SVOS_MOUSEPRESENT 48 104 #define SVOS_CXBYTEALIGN 49 105 #define SVOS_CXALIGN 49 106 #define SVOS_CYBYTEALIGN 50 107 #define SVOS_CYALIGN 50 108 109 /* The following value enables any greater value to be set by WinSetSysValue. */ 110 /* This is to enable the setting of SV_EXTRAKEYBEEP by applications. */ 111 112 #define SVOS_NOTRESERVED 56 113 #define SVOS_EXTRAKEYBEEP 57 114 115 /* The following system value controls whether PM controls the keyboard */ 116 /* lights for light key keystrokes (else applications will) */ 117 #define SVOS_SETLIGHTS 58 118 #define SVOS_INSERTMODE 59 119 120 #define SVOS_MENUROLLDOWNDELAY 64 121 #define SVOS_MENUROLLUPDELAY 65 122 #define SVOS_ALTMNEMONIC 66 123 #define SVOS_TASKLISTMOUSEACCESS 67 124 #define SVOS_CXICONTEXTWIDTH 68 125 #define SVOS_CICONTEXTLINES 69 126 #define SVOS_CHORDTIME 70 127 #define SVOS_CXCHORD 71 128 #define SVOS_CYCHORD 72 129 #define SVOS_CXMOTIONSTART 73 130 #define SVOS_CYMOTIONSTART 74 131 #define SVOS_BEGINDRAG 75 132 #define SVOS_ENDDRAG 76 133 #define SVOS_SINGLESELECT 77 134 #define SVOS_OPEN 78 135 #define SVOS_CONTEXTMENU 79 136 #define SVOS_CONTEXTHELP 80 137 #define SVOS_TEXTEDIT 81 138 #define SVOS_BEGINSELECT 82 139 #define SVOS_ENDSELECT 83 140 #define SVOS_BEGINDRAGKB 84 141 #define SVOS_ENDDRAGKB 85 142 #define SVOS_SELECTKB 86 143 #define SVOS_OPENKB 87 144 #define SVOS_CONTEXTMENUKB 88 145 #define SVOS_CONTEXTHELPKB 89 146 #define SVOS_TEXTEDITKB 90 147 #define SVOS_BEGINSELECTKB 91 148 #define SVOS_ENDSELECTKB 92 149 #define SVOS_ANIMATION 93 150 #define SVOS_ANIMATIONSPEED 94 151 #define SVOS_MONOICONS 95 152 #define SVOS_KBDALTERED 96 153 #define SVOS_PRINTSCREEN 97 154 #define SVOS_LOCKSTARTINPUT 98 155 #define SVOS_CSYSVALUES 108 156 157 LONG OSLibWinQuerySysValue(HWND hwndDeskTop,LONG iSysValue); 158 ULONG OSLibWinQueryDlgItemText(HWND hwndDlg,ULONG idItem,LONG cchBufferMax,char* pchBuffer); 159 BOOL OSLibWinSetDlgItemText(HWND hwndDlg,ULONG idItem,char* pszText); 160 BOOL OSLibWinQueryPointerPos(HWND hwndDeskTop,PPOINT pptlPoint); //pptlPoint == POINTL pointer! 38 161 39 162 #define SWPOS_SIZE 0x0001 … … 61 184 62 185 BOOL OSLibWinDestroyWindow(HWND hwnd); 63 BOOL OSLibWinQueryUpdateRect(HWND hwnd, P RECT pRect);186 BOOL OSLibWinQueryUpdateRect(HWND hwnd, POSRECTL pRect); //must be RECTL pointer! 64 187 BOOL OSLibWinIsIconic(HWND hwnd); 65 188 BOOL OSLibWinSetActiveWindow(HWND hwnd); -
trunk/src/user32/new/user32.cpp
r325 r327 1 /* $Id: user32.cpp,v 1. 5 1999-07-18 10:39:51 sandervlExp $ */1 /* $Id: user32.cpp,v 1.6 1999-07-18 13:57:47 cbratschi Exp $ */ 2 2 3 3 /* … … 19 19 *****************************************************************************/ 20 20 21 /* 22 CB: 23 - don't replace GDI functions (hdc), only convert window handle 24 - always use OSRECTL for PM functions 25 - POINT == POINTL 26 */ 27 21 28 #include <os2win.h> 22 29 #include "misc.h" … … 31 38 #include <string.h> 32 39 #include <oslibwin.h> 40 #include <win32wnd.h> 33 41 34 42 //undocumented stuff … … 69 77 // WIN32API YieldTask 70 78 71 72 79 //Window handle transformation 80 81 inline HWND Win32ToOS2Handle(HWND hwnd) 82 { 83 Win32Window *window; 84 85 window = Win32Window::GetWindowFromHandle(hwnd); 86 if (window) return window->getOS2WindowHandle(); 87 else return hwnd; //already OS/2 handle? 88 } 89 90 inline HWND OS2ToWin32Handle(HWND hwnd) 91 { 92 Win32Window *window; 93 94 window = Win32Window::GetWindowFromOS2Handle(hwnd); 95 if (window) return window->getWindowHandle(); 96 else return hwnd; //OS/2 window 97 } 98 99 //Coordinate transformation 100 101 inline void Win32ToOS2Rect(POSRECTL dest,PRECT source,ULONG windowH) 102 { 103 dest->xLeft = source->left; 104 dest->xRight = source->right; 105 dest->yTop = windowH-source->top; 106 dest->yBottom = windowH-source->bottom; 107 } 108 109 inline void OS2ToWin32Rect(PRECT dest,POSRECTL source,ULONG windowH) 110 { 111 dest->left = source->xLeft; 112 dest->right = source->xRight; 113 dest->top = windowH-source->yTop; 114 dest->bottom = windowH-source->yBottom; 115 } 116 117 inline void OS2ToWin32ScreenPos(POINT *dest,POINT *source) 118 { 119 dest->x = source->x; 120 dest->y = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CYSCREEN)-source->y; 121 } 122 123 inline void Win32ToOS2ScreenPos(POINT *dest,POINT *source) 124 { 125 OS2ToWin32ScreenPos(dest,source); //transform back 126 } 73 127 74 128 //****************************************************************************** … … 185 239 //****************************************************************************** 186 240 //****************************************************************************** 187 BOOL WIN32API MessageBeep( UINT arg1)241 BOOL WIN32API MessageBeep( UINT uType) 188 242 { 189 243 INT flStyle; … … 193 247 #endif 194 248 195 switch ( arg1)249 switch (uType) 196 250 { 197 251 case 0xFFFFFFFF: … … 199 253 return TRUE; 200 254 case MB_ICONASTERISK: 201 flStyle = WA _NOTE;255 flStyle = WAOS_NOTE; 202 256 break; 203 257 case MB_ICONEXCLAMATION: 204 flStyle = WA _WARNING;258 flStyle = WAOS_WARNING; 205 259 break; 206 260 case MB_ICONHAND: 207 261 case MB_ICONQUESTION: 208 262 case MB_OK: 209 flStyle = WA _NOTE;263 flStyle = WAOS_NOTE; 210 264 break; 211 265 default: 212 flStyle = WA _ERROR; //CB: should be right266 flStyle = WAOS_ERROR; //CB: should be right 213 267 break; 214 268 } 215 return OSLibWinAlarm(HWND_DESKTOP,flStyle); 216 } 269 return OSLibWinAlarm(OSLIB_HWND_DESKTOP,flStyle); 270 } 271 //****************************************************************************** 217 272 //****************************************************************************** 218 273 … … 231 286 return GetWindowTextW(hwnd,lpString,nMaxCount); 232 287 } 233 234 235 //******************************************************************************236 288 //****************************************************************************** 237 289 //****************************************************************************** 238 290 HWND WIN32API GetFocus(void) 239 291 { 292 HWND hwnd; 240 293 // dprintf(("USER32: GetFocus\n")); 241 //return OS2LibWinQueryFocus(HWND_DESKTOP); 242 return O32_GetFocus(); 294 295 hwnd = OSLibWinQueryFocus(OSLIB_HWND_DESKTOP); 296 return OS2ToWin32Handle(hwnd); 243 297 } 244 298 //****************************************************************************** … … 247 301 { 248 302 dprintf(("USER32: GetDesktopWindow\n")); 249 //return HWND_DESKTOP //CB: WinQueryDesktopWindow();, hab and hdc not available! 250 return O32_GetDesktopWindow(); 303 return OSLIB_HWND_DESKTOP; 251 304 } 252 305 //****************************************************************************** … … 258 311 259 312 dprintf(("USER32: EnumThreadWindows\n")); 260 // replace313 //CB: replace 261 314 rc = O32_EnumThreadWindows(dwThreadId, callback->GetOS2Callback(), (LPARAM)callback); 262 315 if(callback) … … 271 324 //// WriteLog("USER32: OffsetRect\n"); 272 325 #endif 273 //CB: inc values274 326 if (lprc) 275 327 { … … 295 347 //****************************************************************************** 296 348 //****************************************************************************** 297 HWND WIN32API SetFocus( HWND arg1) 298 { 349 HWND WIN32API SetFocus( HWND hwnd) 350 { 351 HWND lastFocus; 352 299 353 dprintf(("USER32: SetFocus\n")); 300 //return OSLibWinSetFocus(HWND_DESKTOP,arg1); 301 return O32_SetFocus(arg1); 302 } 303 //****************************************************************************** 304 //****************************************************************************** 305 BOOL WIN32API InvalidateRect(HWND arg1, const RECT *arg2, BOOL arg3) 306 { 307 #ifdef DEBUG 308 if(arg2) 309 WriteLog("USER32: InvalidateRect for window %X (%d,%d)(%d,%d) %d\n", arg1, arg2->left, arg2->top, arg2->right, arg2->bottom, arg3); 310 else WriteLog("USER32: InvalidateRect for window %X NULL, %d\n", arg1, arg3); 311 #endif 312 //return OSLibWinInvalidateRect(arg1,arg2,arg3); 313 return O32_InvalidateRect(arg1, arg2, arg3); 314 } 315 //****************************************************************************** 316 //****************************************************************************** 317 BOOL WIN32API GetUpdateRect( HWND arg1, PRECT arg2, BOOL arg3) 318 { 354 355 lastFocus = GetFocus(); 356 hwnd = Win32ToOS2Handle(hwnd); 357 return (OSLibWinSetFocus(OSLIB_HWND_DESKTOP,hwnd)) ? lastFocus:0; 358 } 359 //****************************************************************************** 360 //****************************************************************************** 361 BOOL WIN32API InvalidateRect(HWND hWnd, const RECT *lpRect, BOOL bErase) 362 { 363 #ifdef DEBUG 364 if(lpRect) 365 WriteLog("USER32: InvalidateRect for window %X (%d,%d)(%d,%d) %d\n", hWnd, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, bErase); 366 else WriteLog("USER32: InvalidateRect for window %X NULL, %d\n", hWnd, bErase); 367 #endif 368 369 //CB: bErase no quite the same 370 hWnd = Win32ToOS2Handle(hWnd); 371 if (lpRect) 372 { 373 OSRECTL rect; 374 ULONG windowH; 375 376 windowH = OSLibGetWindowHeight(hWnd); 377 Win32ToOS2Rect(&rect,(PRECT)lpRect,windowH); 378 return OSLibWinInvalidateRect(hWnd,&rect,bErase); //rect == RECTL 379 } else return OSLibWinInvalidateRect(hWnd,NULL,bErase); 380 } 381 //****************************************************************************** 382 //****************************************************************************** 383 BOOL WIN32API GetUpdateRect( HWND hWnd, PRECT lpRect, BOOL bErase) 384 { 385 OSRECTL rect; 386 ULONG windowH; 387 BOOL rc; 388 319 389 #ifdef DEBUG 320 390 WriteLog("USER32: GetUpdateRect\n"); 321 391 #endif 322 // OSLibWinQueryUpdateRect(arg1,arg2); 323 // translate top,bottom 324 return O32_GetUpdateRect(arg1, arg2, arg3); 325 } 326 //****************************************************************************** 327 //****************************************************************************** 328 //****************************************************************************** 329 //****************************************************************************** 330 int WIN32API GetSystemMetrics(int arg1) 331 { 332 int rc; 333 334 switch(arg1) { 392 if (!lpRect) return FALSE; 393 hWnd = Win32ToOS2Handle(hWnd); 394 rc = OSLibWinQueryUpdateRect(hWnd,&rect); 395 windowH = OSLibGetWindowHeight(hWnd); 396 OS2ToWin32Rect(lpRect,&rect,windowH); 397 return rc; 398 } 399 //****************************************************************************** 400 //****************************************************************************** 401 int WIN32API GetSystemMetrics(int nIndex) 402 { 403 int rc = 0; 404 405 switch(nIndex) { 335 406 case SM_CXICONSPACING: //TODO: size of grid cell for large icons 336 //rc = OSLibWinQuerySysValue(HWND_DESKTOP,SV_CXICON);337 //CB: better: return standard windows icon size338 rc = 32;407 rc = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CXICON); 408 //CB: return standard windows icon size? 409 //rc = 32; 339 410 break; 340 411 case SM_CYICONSPACING: 412 rc = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CYICON); 341 413 //read SM_CXICONSPACING comment 342 rc = 32;414 //rc = 32; 343 415 break; 344 416 case SM_PENWINDOWS: … … 355 427 break; 356 428 case SM_CXMINSPACING: //can be SM_CXMINIMIZED or larger 429 //CB: replace with const 357 430 rc = O32_GetSystemMetrics(SM_CXMINIMIZED); 358 431 break; 359 432 case SM_CYMINSPACING: 433 //CB: replace with const 360 434 rc = GetSystemMetrics(SM_CYMINIMIZED); 361 435 break; … … 390 464 case SM_CXMAXTRACK: //max window size 391 465 case SM_CXMAXIMIZED: //max toplevel window size 392 rc = O 32_GetSystemMetrics(SM_CXSCREEN);466 rc = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CXSCREEN); 393 467 break; 394 468 case SM_CYMAXTRACK: 395 469 case SM_CYMAXIMIZED: 396 rc = O 32_GetSystemMetrics(SM_CYSCREEN);470 rc = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CYSCREEN); 397 471 break; 398 472 case SM_NETWORK: … … 415 489 break; 416 490 case SM_CYMENUCHECK: 417 rc = O 32_GetSystemMetrics(SM_CYMENU);491 rc = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CYMENU); 418 492 break; 419 493 case SM_SLOWMACHINE: … … 424 498 break; 425 499 case SM_CMETRICS: 500 //CB: replace with const 426 501 rc = O32_GetSystemMetrics(44); //Open32 changed this one 427 502 break; 428 503 default: 429 rc = O32_GetSystemMetrics(arg1); 504 //better than nothing 505 rc = O32_GetSystemMetrics(nIndex); 430 506 break; 431 507 } 432 508 #ifdef DEBUG 433 WriteLog("USER32: GetSystemMetrics %d returned %d\n", arg1, rc);509 WriteLog("USER32: GetSystemMetrics %d returned %d\n", nIndex, rc); 434 510 #endif 435 511 return(rc); … … 437 513 //****************************************************************************** 438 514 //****************************************************************************** 439 UINT WIN32API SetTimer( HWND arg1, UINT arg2, UINT arg3, TIMERPROC arg4)515 UINT WIN32API SetTimer( HWND hwnd, UINT idTimer, UINT uTimeout, TIMERPROC tmprc) 440 516 { 441 517 #ifdef DEBUG 442 518 WriteLog("USER32: SetTimer INCORRECT CALLING CONVENTION FOR HANDLER!!!!!\n"); 443 519 #endif 520 hwnd = Win32ToOS2Handle(hwnd); 444 521 //SvL: Write callback handler class for this one 445 return O32_SetTimer(arg1, arg2, arg3, (TIMERPROC_O32)arg4); 446 } 447 //****************************************************************************** 448 //****************************************************************************** 449 BOOL WIN32API KillTimer(HWND arg1, UINT arg2) 522 //CB: replace 523 return O32_SetTimer(hwnd,idTimer,uTimeout,(TIMERPROC_O32)tmprc); 524 } 525 //****************************************************************************** 526 //****************************************************************************** 527 BOOL WIN32API KillTimer(HWND hWnd, UINT uIDEvent) 450 528 { 451 529 #ifdef DEBUG 452 530 WriteLog("USER32: KillTimer\n"); 453 531 #endif 532 hWnd = Win32ToOS2Handle(hWnd); 454 533 //WinStopTimer 455 return O32_KillTimer(arg1, arg2); 456 } 457 //****************************************************************************** 458 //****************************************************************************** 459 BOOL WIN32API InflateRect( PRECT arg1, int arg2, int arg3) 534 //CB: replace 535 return O32_KillTimer(hWnd,uIDEvent); 536 } 537 //****************************************************************************** 538 //****************************************************************************** 539 BOOL WIN32API InflateRect( PRECT lprc, int dx, int dy) 460 540 { 461 541 #ifdef DEBUG 462 542 WriteLog("USER32: InflateRect\n"); 463 543 #endif 464 //don't know how Win32 handles this 465 return O32_InflateRect(arg1, arg2, arg3); 544 if (!lprc) return FALSE; 545 //right? 546 lprc->left -= dx; 547 lprc->right += dx; 548 lprc->top -= dy; 549 lprc->bottom += dy; 550 551 return TRUE; 466 552 } 467 553 //****************************************************************************** … … 486 572 WriteLog("USER32: ShowCursor\n"); 487 573 #endif 488 //WinShowCursor( HWND_DESKTOP,arg1); //not the same574 //WinShowCursor(OSLIB_HWND_DESKTOP,arg1); //CB: not the same 489 575 return O32_ShowCursor(arg1); 490 576 } … … 497 583 #endif 498 584 585 if (!lprc) return FALSE; 499 586 lprc->left = nLeft; 500 587 lprc->top = nTop; … … 506 593 //****************************************************************************** 507 594 //****************************************************************************** 508 BOOL WIN32API WinHelpA( HWND arg1, LPCSTR arg2, UINT arg3, DWORD arg4) 509 { 510 #ifdef DEBUG 511 WriteLog("USER32: WinHelp not implemented %s\n", arg2); 512 #endif 595 BOOL WIN32API WinHelpA( HWND hwnd, LPCSTR lpszHelp, UINT uCommand, DWORD dwData) 596 { 597 #ifdef DEBUG 598 WriteLog("USER32: WinHelp not implemented %s\n", lpszHelp); 599 #endif 600 // hwnd = Win32ToOS2Handle(hwnd); 513 601 // return O32_WinHelp(arg1, arg2, arg3, arg4); 602 514 603 return(TRUE); 515 604 } 516 605 //****************************************************************************** 517 606 //****************************************************************************** 518 int WIN32API TranslateAcceleratorA(HWND arg1, HACCEL arg2, LPMSG arg3)607 int WIN32API TranslateAcceleratorA(HWND hwnd, HACCEL haccel, LPMSG lpmsg) 519 608 { 520 609 #ifdef DEBUG 521 610 //// WriteLog("USER32: TranslateAccelerator\n"); 522 611 #endif 612 //CB: needs more work 523 613 //WinTranslateAccel(); 524 614 //get hab, translate 525 return O32_TranslateAccelerator(arg1, arg2, arg3); 526 } 527 //****************************************************************************** 528 //****************************************************************************** 529 BOOL WIN32API SubtractRect( PRECT arg1, const RECT * arg2, const RECT * arg3) 615 hwnd = Win32ToOS2Handle(hwnd); 616 return O32_TranslateAccelerator(hwnd,haccel,lpmsg); 617 } 618 //****************************************************************************** 619 //****************************************************************************** 620 BOOL WIN32API SubtractRect( PRECT lprcDest, const RECT * lprcSrc1, const RECT * lprcSrc2) 530 621 { 531 622 #ifdef DEBUG 532 623 WriteLog("USER32: SubtractRect"); 533 624 #endif 534 // how?535 return O32_SubtractRect( arg1, arg2, arg3);625 //CB: how? 626 return O32_SubtractRect(lprcDest,lprcSrc1,lprcSrc2); 536 627 } 537 628 //****************************************************************************** 538 629 //SvL: 24-6-'97 - Added 539 630 //****************************************************************************** 540 BOOL WIN32API ClipCursor(const RECT * arg1)631 BOOL WIN32API ClipCursor(const RECT * lpRect) 541 632 { 542 633 #ifdef DEBUG 543 634 WriteLog("USER32: ClipCursor\n"); 544 635 #endif 545 return O32_ClipCursor(arg1); 636 //CB: how to replace? 637 return O32_ClipCursor(lpRect); 546 638 } 547 639 //****************************************************************************** … … 569 661 //SvL: 24-6-'97 - Added 570 662 //****************************************************************************** 571 BOOL WIN32API GetCursorPos( PPOINT arg1) 572 { 663 BOOL WIN32API GetCursorPos( PPOINT lpPoint) 664 { 665 BOOL rc; 666 POINT point; 573 667 #ifdef DEBUG 574 668 //// WriteLog("USER32: GetCursorPos\n"); 575 669 #endif 576 return O32_GetCursorPos(arg1); 670 if (!lpPoint) return FALSE; 671 if (OSLibWinQueryPointerPos(OSLIB_HWND_DESKTOP,&point)) //POINT == POINTL 672 { 673 OS2ToWin32ScreenPos(lpPoint,&point); 674 return TRUE; 675 } else return FALSE; 577 676 } 578 677 //****************************************************************************** 579 678 //SvL: 24-6-'97 - Added 580 679 //****************************************************************************** 581 WORD WIN32API VkKeyScanA( char arg1)680 WORD WIN32API VkKeyScanA( char ch) 582 681 { 583 682 #ifdef DEBUG 584 683 WriteLog("USER32: VkKeyScanA\n"); 585 684 #endif 586 return O32_VkKeyScan( arg1);685 return O32_VkKeyScan(ch); 587 686 } 588 687 //****************************************************************************** 589 688 //SvL: 24-6-'97 - Added 590 689 //****************************************************************************** 591 SHORT WIN32API GetKeyState( int arg1)592 { 593 #ifdef DEBUG 594 WriteLog("USER32: GetKeyState %d\n", arg1);595 #endif 596 return O32_GetKeyState( arg1);597 } 598 //****************************************************************************** 599 //****************************************************************************** 600 HCURSOR WIN32API SetCursor( HCURSOR arg1)690 SHORT WIN32API GetKeyState( int nVirtKey) 691 { 692 #ifdef DEBUG 693 WriteLog("USER32: GetKeyState %d\n", nVirtKey); 694 #endif 695 return O32_GetKeyState(nVirtKey); 696 } 697 //****************************************************************************** 698 //****************************************************************************** 699 HCURSOR WIN32API SetCursor( HCURSOR hcur) 601 700 { 602 701 #ifdef DEBUG 603 702 WriteLog("USER32: SetCursor\n"); 604 703 #endif 605 return O32_SetCursor( arg1);704 return O32_SetCursor(hcur); 606 705 } 607 706 //****************************************************************************** … … 612 711 WriteLog("USER32: SetCursorPos\n"); 613 712 #endif 713 //CB:{a} stopped here 614 714 return O32_SetCursorPos(arg1, arg2); 615 715 } … … 621 721 WriteLog("USER32: EnableScrollBar\n"); 622 722 #endif 723 //CB: implement in window class 623 724 return O32_EnableScrollBar(arg1, arg2, arg3); 624 725 } -
trunk/src/user32/new/win32wnd.cpp
r325 r327 1 /* $Id: win32wnd.cpp,v 1. 9 1999-07-18 10:39:51 sandervlExp $ */1 /* $Id: win32wnd.cpp,v 1.10 1999-07-18 13:57:48 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Window Code for OS/2 … … 124 124 if (cs->hwndParent) 125 125 { 126 127 126 Win32Window *window = GetWindowFromHandle(cs->hwndParent); 127 if(!window) { 128 128 dprintf(("Bad parent %04x\n", cs->hwndParent )); 129 129 SetLastError(ERROR_INVALID_PARAMETER); 130 131 130 return FALSE; 131 } 132 132 /* Make sure parent is valid */ 133 133 if (!window->IsWindow() ) … … 231 231 if ((cs->style & WS_CHILD) && cs->hwndParent) 232 232 { 233 233 SetParent(cs->hwndParent); 234 234 } 235 235 else … … 240 240 else 241 241 { 242 242 owner = GetWindowFromHandle(cs->hwndParent); 243 243 if(owner == NULL) 244 244 { … … 263 263 if (HOOK_IsHooked( WH_CBT )) 264 264 { 265 265 CBT_CREATEWNDA cbtc; 266 266 LRESULT ret; 267 267 268 269 268 cbtc.lpcs = cs; 269 cbtc.hwndInsertAfter = hwndLinkAfter; 270 270 ret = unicode ? HOOK_CallHooksW(WH_CBT, HCBT_CREATEWND, Win32Hwnd, (LPARAM)&cbtc) 271 271 : HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND, Win32Hwnd, (LPARAM)&cbtc); 272 272 if (ret) 273 274 275 273 { 274 TRACE_(win)("CBT-hook returned 0\n"); 275 wndPtr->pDriver->pFinalize(wndPtr); 276 276 retvalue = 0; 277 277 goto end; 278 278 } 279 279 } 280 280 #endif … … 337 337 dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName, 338 338 (owner) ? owner->getOS2WindowHandle() : 0, 339 339 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE, 340 340 &OS2HwndFrame); 341 341 … … 354 354 #if 0 355 355 if(OS2Hwnd != OS2HwndFrame) { 356 357 358 359 360 361 362 363 356 if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) { 357 dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2HwndFrame)); 358 return FALSE; 359 } 360 if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) { 361 dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2HwndFrame)); 362 return FALSE; 363 } 364 364 } 365 365 #endif … … 378 378 else windowId = (UINT)cs->hMenu; 379 379 380 /* Send the WM_CREATE message 381 * Perhaps we shouldn't allow width/height changes as well. 382 * See p327 in "Internals". 380 /* Send the WM_CREATE message 381 * Perhaps we shouldn't allow width/height changes as well. 382 * See p327 in "Internals". 383 383 */ 384 384 maxPos.x = rectWindow.left; maxPos.y = rectWindow.top; … … 389 389 OffsetRect(&rectWindow, maxPos.x - rectWindow.left, 390 390 maxPos.y - rectWindow.top); 391 391 dprintf(("Sending WM_CREATE")); 392 392 if( (SendInternalMessage(WM_CREATE, 0, (LPARAM)cs )) != -1 ) 393 393 { 394 394 SetWindowPos(HWND_TOP, rectClient.left, rectClient.top, 395 rectClient.right-rectClient.left, 396 397 395 rectClient.right-rectClient.left, 396 rectClient.bottom-rectClient.top, 397 SWP_NOACTIVATE); 398 398 399 399 if (cs->style & WS_VISIBLE) ShowWindow( sw ); … … 405 405 HOOK_CallHooks16( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 ); 406 406 #endif 407 407 return TRUE; 408 408 } 409 409 } … … 429 429 if (lpPos && !HOOK_CallHooks16(WH_CBT, HCBT_MINMAX, hwndSelf, cmd)) 430 430 { 431 432 433 434 435 436 437 438 439 440 441 442 443 431 if( dwStyle & WS_MINIMIZE ) 432 { 433 if( !SendInternalMessageA(WM_QUERYOPEN, 0, 0L ) ) 434 return (SWP_NOSIZE | SWP_NOMOVE); 435 swpFlags |= SWP_NOCOPYBITS; 436 } 437 switch( cmd ) 438 { 439 case SW_MINIMIZE: 440 if( dwStyle & WS_MAXIMIZE) 441 { 442 flags |= WIN_RESTORE_MAX; 443 dwStyle &= ~WS_MAXIMIZE; 444 444 } 445 445 else 446 447 446 flags &= ~WIN_RESTORE_MAX; 447 dwStyle |= WS_MINIMIZE; 448 448 449 449 #if 0 450 451 452 450 if( flags & WIN_NATIVE ) 451 if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, TRUE ) ) 452 swpFlags |= MINMAX_NOSWP; 453 453 #endif 454 454 455 456 457 458 459 460 461 462 455 lpPos->ptIconPos = WINPOS_FindIconPos( wndPtr, lpPos->ptIconPos ); 456 457 SetRect(lpRect, lpPos->ptIconPos.x, lpPos->ptIconPos.y, 458 GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) ); 459 swpFlags |= SWP_NOCOPYBITS; 460 break; 461 462 case SW_MAXIMIZE: 463 463 CONV_POINT16TO32( &lpPos->ptMaxPos, &pt ); 464 464 WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL ); 465 465 CONV_POINT32TO16( &pt, &lpPos->ptMaxPos ); 466 466 467 468 469 470 471 472 473 474 475 467 if( dwStyle & WS_MINIMIZE ) 468 { 469 if( flags & WIN_NATIVE ) 470 if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) ) 471 swpFlags |= MINMAX_NOSWP; 472 473 WINPOS_ShowIconTitle( wndPtr, FALSE ); 474 dwStyle &= ~WS_MINIMIZE; 475 } 476 476 dwStyle |= WS_MAXIMIZE; 477 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 478 SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y, 479 size.x, size.y ); 480 break; 481 482 case SW_RESTORE: 483 if( dwStyle & WS_MINIMIZE ) 484 { 485 if( flags & WIN_NATIVE ) 486 if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) ) 487 swpFlags |= MINMAX_NOSWP; 488 489 dwStyle &= ~WS_MINIMIZE; 490 WINPOS_ShowIconTitle( wndPtr, FALSE ); 491 492 if( flags & WIN_RESTORE_MAX) 493 { 494 /* Restore to maximized position */ 495 495 CONV_POINT16TO32( &lpPos->ptMaxPos, &pt ); 496 496 WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL); 497 497 CONV_POINT32TO16( &pt, &lpPos->ptMaxPos ); 498 499 500 501 502 } 503 else 504 505 506 507 508 509 *lpRect = lpPos->rectNormal; 510 lpRect->right -= lpRect->left; 511 512 513 514 498 dwStyle |= WS_MAXIMIZE; 499 SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y, size.x, size.y ); 500 break; 501 } 502 } 503 else 504 if( !(dwStyle & WS_MAXIMIZE) ) return (UINT16)(-1); 505 else dwStyle &= ~WS_MAXIMIZE; 506 507 /* Restore to normal position */ 508 509 *lpRect = lpPos->rectNormal; 510 lpRect->right -= lpRect->left; 511 lpRect->bottom -= lpRect->top; 512 513 break; 514 } 515 515 } else swpFlags |= SWP_NOSIZE | SWP_NOMOVE; 516 516 return swpFlags; … … 611 611 { 612 612 winposCopy = *winpos; 613 614 615 613 params.rgrc[1] = *oldWindowRect; 614 params.rgrc[2] = *oldClientRect; 615 params.lppos = &winposCopy; 616 616 } 617 617 result = SendInternalMessageA(WM_NCCALCSIZE, calcValidRect, … … 752 752 { 753 753 if(isUnicode) { 754 755 } 756 else 754 return SendInternalMessageW(WM_SETTEXT, 0, (LPARAM)lpsz); 755 } 756 else return SendInternalMessageA(WM_SETTEXT, 0, (LPARAM)lpsz); 757 757 } 758 758 //****************************************************************************** … … 843 843 { 844 844 if(PostSpyMessage(getWindowHandle(), Msg, wParam, lParam) == FALSE) 845 845 846 dprintf(("SendInternalMessageA %s for %x %x %x", GetMsgText(Msg), getWindowHandle(), wParam, lParam)); 846 847 … … 928 929 postmsg = (POSTMSG_PACKET *)malloc(sizeof(POSTMSG_PACKET)); 929 930 if(postmsg == NULL) { 930 931 931 dprintf(("Win32Window::PostMessageA: malloc returned NULL!!")); 932 return 0; 932 933 } 933 934 postmsg->Msg = msg; … … 944 945 postmsg = (POSTMSG_PACKET *)malloc(sizeof(POSTMSG_PACKET)); 945 946 if(postmsg == NULL) { 946 947 947 dprintf(("Win32Window::PostMessageW: malloc returned NULL!!")); 948 return 0; 948 949 } 949 950 postmsg->Msg = msg; … … 984 985 PVOID menutemplate; 985 986 986 if(HMHandleTranslateToOS2(hMenu, (PULONG)&menutemplate) == NO_ERROR) 987 if(HMHandleTranslateToOS2(hMenu, (PULONG)&menutemplate) == NO_ERROR) 987 988 { 988 989 990 991 992 989 OS2HwndMenu = OSLibWinCreateMenu(OS2HwndFrame, menutemplate); 990 if(OS2HwndMenu == 0) { 991 dprintf(("Win32Window::SetMenu OS2HwndMenu == 0")); 992 return FALSE; 993 } 993 994 } 994 995 dprintf(("Win32Window::SetMenu unknown hMenu (%x)", hMenu)); … … 1004 1005 switch(nCmdShow) 1005 1006 { 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1007 case SW_SHOW: 1008 case SW_SHOWDEFAULT: //todo 1009 showstate = SWPOS_SHOW | SWPOS_ACTIVATE; 1010 break; 1011 case SW_HIDE: 1012 showstate = SWPOS_HIDE; 1013 break; 1014 case SW_RESTORE: 1015 showstate = SWPOS_RESTORE | SWPOS_SHOW | SWPOS_ACTIVATE; 1016 break; 1017 case SW_MINIMIZE: 1018 showstate = SWPOS_MINIMIZE; 1019 break; 1020 case SW_SHOWMAXIMIZED: 1021 showstate = SWPOS_MAXIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE; 1022 break; 1023 case SW_SHOWMINIMIZED: 1024 showstate = SWPOS_MINIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE; 1025 break; 1026 case SW_SHOWMINNOACTIVE: 1027 showstate = SWPOS_MINIMIZE | SWPOS_SHOW; 1028 break; 1029 case SW_SHOWNA: 1030 showstate = SWPOS_SHOW; 1031 break; 1032 case SW_SHOWNOACTIVATE: 1033 showstate = SWPOS_SHOW; 1034 break; 1035 case SW_SHOWNORMAL: 1036 showstate = SWPOS_RESTORE | SWPOS_ACTIVATE | SWPOS_SHOW; 1037 break; 1037 1038 } 1038 1039 return OSLibWinShowWindow(OS2HwndFrame, showstate); … … 1046 1047 1047 1048 switch(hwndInsertAfter) { 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1049 case HWND_BOTTOM: 1050 hwndInsertAfter = HWNDOS_BOTTOM; 1051 break; 1052 case HWND_TOPMOST: //TODO: 1053 case HWND_NOTOPMOST: //TODO: 1054 case HWND_TOP: 1055 hwndInsertAfter = HWNDOS_TOP; 1056 break; 1057 default: 1058 window = GetWindowFromHandle(hwndInsertAfter); 1059 if(window) { 1060 hwndInsertAfter = window->getOS2WindowHandle(); 1061 } 1062 else { 1063 dprintf(("Win32Window::SetWindowPos, unknown hwndInsertAfter %x", hwndInsertAfter)); 1064 hwndInsertAfter = 0; 1065 } 1066 break; 1067 1067 1068 } 1068 1069 setstate = SWPOS_MOVE | SWPOS_SIZE | SWPOS_ACTIVATE | SWPOS_ZORDER; 1069 1070 if(fuFlags & SWP_DRAWFRAME) 1070 1071 setstate |= 0; //TODO 1071 1072 if(fuFlags & SWP_FRAMECHANGED) 1072 1073 setstate |= 0; //TODO 1073 1074 if(fuFlags & SWP_HIDEWINDOW) 1074 1075 setstate &= ~SWPOS_ZORDER; 1075 1076 if(fuFlags & SWP_NOACTIVATE) 1076 1077 setstate &= ~SWPOS_ACTIVATE; 1077 1078 if(fuFlags & SWP_NOCOPYBITS) 1078 setstate |= 0;//TODO1079 setstate |= 0; //TODO 1079 1080 if(fuFlags & SWP_NOMOVE) 1080 1081 setstate &= ~SWPOS_MOVE; 1081 1082 if(fuFlags & SWP_NOSIZE) 1082 1083 setstate &= ~SWPOS_SIZE; 1083 1084 if(fuFlags & SWP_NOREDRAW) 1084 1085 setstate |= SWPOS_NOREDRAW; 1085 1086 if(fuFlags & SWP_NOZORDER) 1086 1087 setstate &= ~SWPOS_ZORDER; 1087 1088 if(fuFlags & SWP_SHOWWINDOW) 1088 1089 setstate |= SWPOS_SHOW; 1089 1090 1090 1091 return OSLibWinSetWindowPos(OS2HwndFrame, hwndInsertAfter, x, y, cx, cy, setstate); … … 1102 1103 { 1103 1104 if(getParent()) { 1104 1105 } 1106 else 1105 return getParent()->getWindowHandle(); 1106 } 1107 else return 0; 1107 1108 } 1108 1109 //****************************************************************************** … … 1114 1115 1115 1116 if(getParent()) { 1116 1117 oldhwnd = getParent()->getWindowHandle(); 1117 1118 } 1118 1119 else oldhwnd = 0; 1119 1120 1120 1121 if(hwndNewParent == 0) {//desktop window = parent 1121 1122 setParent(NULL); 1122 1123 OSLibWinSetParent(getOS2WindowHandle(), OSLIB_HWND_DESKTOP); 1123 1124 return oldhwnd; … … 1138 1139 { 1139 1140 if(getParent()) { 1140 1141 } 1142 else 1141 return getParent()->getWindowHandle() == hwndParent; 1142 } 1143 else return 0; 1143 1144 } 1144 1145 //****************************************************************************** … … 1154 1155 //****************************************************************************** 1155 1156 BOOL Win32Window::UpdateWindow() 1156 { 1157 RECTrect;1157 { 1158 OSRECTL rect; 1158 1159 1159 1160 if(OSLibWinQueryUpdateRect(OS2Hwnd, &rect)) 1160 1161 {//update region not empty 1161 1162 SendInternalMessageA((isIcon) ? WM_PAINTICON : WM_PAINT, 0, 0); 1162 1163 } 1163 1164 return TRUE; … … 1182 1183 switch(uCmd) 1183 1184 { 1184 1185 1186 1187 1188 1189 1190 1191 elsegetcmd = QWOS_TOP; //TODO1192 1193 1194 1195 1196 1197 elsegetcmd = QWOS_BOTTOM; //TODO1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 elsereturn 0;1185 case GW_CHILD: 1186 getcmd = QWOS_TOP; 1187 break; 1188 case GW_HWNDFIRST: 1189 if(getParent()) { 1190 getcmd = QWOS_TOP; //top of child windows 1191 } 1192 else getcmd = QWOS_TOP; //TODO 1193 break; 1194 case GW_HWNDLAST: 1195 if(getParent()) { 1196 getcmd = QWOS_BOTTOM; //bottom of child windows 1197 } 1198 else getcmd = QWOS_BOTTOM; //TODO 1199 break; 1200 case GW_HWNDNEXT: 1201 getcmd = QWOS_NEXT; 1202 break; 1203 case GW_HWNDPREV: 1204 getcmd = QWOS_PREV; 1205 break; 1206 case GW_OWNER: 1207 if(owner) { 1208 return owner->getWindowHandle(); 1209 } 1210 else return 0; 1210 1211 } 1211 1212 hwndRelated = OSLibWinQueryWindow(OS2Hwnd, getcmd); 1212 if(hwndRelated) 1213 { 1214 1215 1216 1217 1218 1219 1213 if(hwndRelated) 1214 { 1215 win32wnd = (Win32Window *)OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32WNDPTR); 1216 magic = OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32PM_MAGIC); 1217 if(CheckMagicDword(magic) && win32wnd) 1218 { 1219 return win32wnd->getWindowHandle(); 1220 } 1220 1221 } 1221 1222 return 0; … … 1254 1255 if(CheckMagicDword(magic) && win32wnd) 1255 1256 { 1256 1257 return win32wnd->getWindowHandle(); 1257 1258 } 1258 1259 return hwndActive; … … 1324 1325 return oldval; 1325 1326 case GWL_HWNDPARENT: 1326 1327 return SetParent((HWND)value); 1327 1328 1328 1329 case GWL_ID: … … 1409 1410 1410 1411 if(HIWORD(hwnd) != 0x6800) { 1411 1412 return NULL; 1412 1413 } 1413 1414 1414 1415 if(HMHandleTranslateToOS2(LOWORD(hwnd), (PULONG)&window) == NO_ERROR) { 1415 1416 return window; 1416 1417 } 1417 1418 else return NULL; … … 1419 1420 //****************************************************************************** 1420 1421 //****************************************************************************** 1422 Win32Window *Win32Window::GetWindowFromOS2Handle(HWND hwnd) 1423 { 1424 ULONG winHandle; 1425 Win32Window *window; 1426 1427 //CB: returns index, not handle! 1428 if(HMHandleTranslateToWin(hwnd,(PULONG)&winHandle) == NO_ERROR) 1429 { 1430 if (HMHandleTranslateToOS2(LOWORD(winHandle),(PULONG)&window) == NO_ERROR) 1431 { 1432 return window; 1433 } else return NULL; 1434 } else return NULL; 1435 } 1436 //****************************************************************************** 1437 //****************************************************************************** 1421 1438 GenericObject *Win32Window::windows = NULL; -
trunk/src/user32/new/win32wnd.h
r325 r327 1 /* $Id: win32wnd.h,v 1. 8 1999-07-18 10:39:52 sandervlExp $ */1 /* $Id: win32wnd.h,v 1.9 1999-07-18 13:57:48 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Window Code for OS/2 … … 21 21 class Win32Window; 22 22 23 #define OFFSET_WIN32WNDPTR 24 #define OFFSET_WIN32PM_MAGIC 25 26 #define WIN32PM_MAGIC 27 #define CheckMagicDword(a) 23 #define OFFSET_WIN32WNDPTR 0 24 #define OFFSET_WIN32PM_MAGIC 4 25 26 #define WIN32PM_MAGIC 0x12345678 27 #define CheckMagicDword(a) (a==WIN32PM_MAGIC) 28 28 29 29 typedef struct { 30 USHORTcb;31 32 ULONG win32CreateStruct;//or dialog create dword30 USHORT cb; 31 Win32Window *win32wnd; 32 ULONG win32CreateStruct; //or dialog create dword 33 33 } CUSTOMWNDDATA; 34 34 35 35 typedef struct 36 36 { 37 ULONGMsg;38 ULONGwParam;39 ULONGlParam;37 ULONG Msg; 38 ULONG wParam; 39 ULONG lParam; 40 40 } POSTMSG_PACKET; 41 41 42 #define WM_WIN32_POSTMESSAGEA 43 #define WM_WIN32_POSTMESSAGEW 42 #define WM_WIN32_POSTMESSAGEA 0x4000 43 #define WM_WIN32_POSTMESSAGEW 0x4001 44 44 45 45 class Win32Window : private GenericObject, private ChildWindow 46 46 { 47 47 public: 48 DWORDmagic;49 50 51 48 DWORD magic; 49 50 Win32Window(DWORD objType); 51 Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode); 52 52 virtual ~Win32Window(); 53 53 54 54 virtual ULONG MsgCreate(HWND hwndOS2, ULONG initParam); 55 56 55 ULONG MsgQuit(); 56 ULONG MsgClose(); 57 57 ULONG MsgDestroy(); 58 59 60 61 58 ULONG MsgEnable(BOOL fEnable); 59 ULONG MsgShow(BOOL fShow); 60 ULONG MsgMove(ULONG xParent, ULONG yParent); 61 ULONG MsgSize(ULONG width, ULONG height, BOOL fMinimize, BOOL fMaximize); 62 62 ULONG MsgActivate(BOOL fActivate, HWND hwnd); 63 ULONG MsgSetFocus(HWND hwnd); 64 ULONG MsgKillFocus(HWND hwnd); 65 ULONG MsgButton(ULONG msg, ULONG x, ULONG y); 66 ULONG MsgPaint(ULONG tmp1, ULONG tmp2); 67 ULONG MsgEraseBackGround(ULONG hps); 68 ULONG MsgSetText(LPSTR lpsz, LONG cch); 69 70 virtual LONG SetWindowLongA(int index, ULONG value); 71 virtual ULONG GetWindowLongA(int index); 72 virtual WORD SetWindowWord(int index, WORD value); 73 virtual WORD GetWindowWord(int index); 74 75 DWORD getStyle() { return dwStyle; }; 76 DWORD getExStyle() { return dwExStyle; }; 77 HWND getWindowHandle() { return Win32Hwnd; }; 78 HWND getOS2WindowHandle() { return OS2Hwnd; }; 79 Win32Window *getParent() { return (Win32Window *)ChildWindow::GetParent(); }; 80 void setParent(Win32Window *pwindow) { ChildWindow::SetParent((ChildWindow *)pwindow); }; 63 ULONG MsgSetFocus(HWND hwnd); 64 ULONG MsgKillFocus(HWND hwnd); 65 ULONG MsgButton(ULONG msg, ULONG x, ULONG y); 66 ULONG MsgPaint(ULONG tmp1, ULONG tmp2); 67 ULONG MsgEraseBackGround(ULONG hps); 68 ULONG MsgSetText(LPSTR lpsz, LONG cch); 69 70 virtual LONG SetWindowLongA(int index, ULONG value); 71 virtual ULONG GetWindowLongA(int index); 72 virtual WORD SetWindowWord(int index, WORD value); 73 virtual WORD GetWindowWord(int index); 74 75 DWORD getStyle() { return dwStyle; }; 76 DWORD getExStyle() { return dwExStyle; }; 77 HWND getWindowHandle() { return Win32Hwnd; }; 78 HWND getOS2WindowHandle() { return OS2Hwnd; }; 79 Win32Window *getParent() { return (Win32Window *)ChildWindow::GetParent(); }; 80 void setParent(Win32Window *pwindow) { ChildWindow::SetParent((ChildWindow *)pwindow); }; 81 81 82 WNDPROC getWindowProc() { return win32wndproc; }; 82 83 void setWindowProc(WNDPROC newproc) { win32wndproc = newproc; }; … … 84 85 void setWindowId(DWORD id) { windowId = id; }; 85 86 86 DWORD getFlags(){ return flags; };87 void setFlags(DWORD newflags){ flags = newflags; };88 89 90 91 92 93 94 95 96 97 98 99 87 DWORD getFlags() { return flags; }; 88 void setFlags(DWORD newflags) { flags = newflags; }; 89 90 BOOL SetMenu(ULONG hMenu); 91 BOOL ShowWindow(ULONG nCmdShow); 92 BOOL SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags); 93 BOOL DestroyWindow(); 94 HWND SetActiveWindow(); 95 HWND GetParent(); 96 HWND SetParent(HWND hwndNewParent); 97 BOOL IsChild(HWND hwndParent); 98 HWND GetTopWindow(); 99 BOOL UpdateWindow(); 100 BOOL IsIconic(); 100 101 HWND GetWindow(UINT uCmd); 101 102 102 BOOL EnableWindow(BOOL fEnable); 103 BOOL BringWindowToTop(); 103 104 static HWND GetActiveWindow(); 104 BOOL IsWindow(); 105 BOOL IsWindowEnabled(); 106 BOOL IsWindowVisible(); 107 108 BOOL GetWindowRect(PRECT pRect); 109 int GetWindowTextLengthA(); 110 int GetWindowTextA(LPSTR lpsz, int cch); 111 BOOL SetWindowTextA(LPCSTR lpsz); 105 106 BOOL IsWindow(); 107 BOOL IsWindowEnabled(); 108 BOOL IsWindowVisible(); 109 110 BOOL GetWindowRect(PRECT pRect); 111 int GetWindowTextLengthA(); 112 int GetWindowTextA(LPSTR lpsz, int cch); 113 BOOL SetWindowTextA(LPCSTR lpsz); 112 114 113 115 LRESULT SendMessageA(ULONG msg, WPARAM wParam, LPARAM lParam); … … 123 125 124 126 static Win32Window *GetWindowFromHandle(HWND hwnd); 127 static Win32Window *GetWindowFromOS2Handle(HWND hwnd); 125 128 126 129 protected: 127 130 LRESULT SendInternalMessageA(ULONG msg, WPARAM wParam, LPARAM lParam); 128 131 LRESULT SendInternalMessageW(ULONG msg, WPARAM wParam, LPARAM lParam); 129 130 131 HWNDOS2Hwnd;132 HWNDOS2HwndFrame;133 134 HWNDWin32Hwnd;135 136 137 intposx, posy, width, height;138 139 140 ULONG dwExStyle;//GWL_EXSTYLE141 ULONG dwStyle;//GWL_STYLE142 WNDPROC win32wndproc; 143 ULONG hInstance;//GWL_HINSTANCE132 void Init(); 133 134 HWND OS2Hwnd; 135 HWND OS2HwndFrame; 136 HWND OS2HwndMenu; 137 HWND Win32Hwnd; 138 BOOL isUnicode; 139 140 int posx, posy, width, height; 141 142 // values normally contained in the standard window words 143 ULONG dwExStyle; //GWL_EXSTYLE 144 ULONG dwStyle; //GWL_STYLE 145 WNDPROC win32wndproc; //GWL_WNDPROC 146 ULONG hInstance; //GWL_HINSTANCE 144 147 //Moved in ChildWindow class 145 ///// Win32Window *parent; 146 ULONG windowId;//GWL_ID147 ULONG userData;//GWL_USERDATA148 ///// Win32Window *parent; //GWL_HWNDPARENT 149 ULONG windowId; //GWL_ID 150 ULONG userData; //GWL_USERDATA 148 151 149 152 HWND hwndLinkAfter; 150 153 DWORD flags; 151 154 152 153 154 Win32Window *owner; 155 156 157 158 159 160 161 162 163 ULONGnrUserWindowLong;164 165 166 155 BOOL isIcon; 156 157 Win32Window *owner; 158 159 char *windowName; 160 ULONG wndNameLength; 161 162 char *windowText; 163 ULONG wndTextLength; 164 165 ULONG *userWindowLong; 166 ULONG nrUserWindowLong; 167 168 RECT rectWindow; 169 RECT rectClient; 167 170 168 171 Win32WndClass *windowClass; … … 172 175 private: 173 176 #ifndef OS2_INCLUDED 174 175 176 177 178 177 BOOL CreateWindowExA(CREATESTRUCTA *lpCreateStruct, ATOM classAtom); 178 179 void GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack ); 180 181 LONG SendNCCalcSize(BOOL calcValidRect, 179 182 RECT *newWindowRect, RECT *oldWindowRect, 180 183 RECT *oldClientRect, WINDOWPOS *winpos, … … 183 186 LRESULT SendInternalMessage(ULONG msg, WPARAM wParam, LPARAM lParam) 184 187 { 185 186 187 elsereturn SendInternalMessageA(msg, wParam, lParam);188 if(isUnicode) 189 return SendInternalMessageW(msg, wParam, lParam); 190 else return SendInternalMessageA(msg, wParam, lParam); 188 191 } 189 192 #endif … … 191 194 192 195 193 #define BUTTON_LEFTDOWN 194 #define BUTTON_LEFTUP 195 #define BUTTON_LEFTDBLCLICK 196 #define BUTTON_RIGHTUP 197 #define BUTTON_RIGHTDOWN 198 #define BUTTON_RIGHTDBLCLICK 196 #define BUTTON_LEFTDOWN 0 197 #define BUTTON_LEFTUP 1 198 #define BUTTON_LEFTDBLCLICK 2 199 #define BUTTON_RIGHTUP 3 200 #define BUTTON_RIGHTDOWN 4 201 #define BUTTON_RIGHTDBLCLICK 5 199 202 200 203 #endif //__cplusplus -
trunk/src/user32/new/windlg.cpp
r325 r327 1 /* $Id: windlg.cpp,v 1. 1 1999-07-18 10:39:52 sandervlExp $ */1 /* $Id: windlg.cpp,v 1.2 1999-07-18 13:57:48 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 dialog apis for OS/2 … … 9 9 * 10 10 */ 11 #include <wchar.h> 11 12 #include <os2win.h> 12 13 #include <misc.h> … … 89 90 //****************************************************************************** 90 91 //****************************************************************************** 91 BOOL WIN32API SetDlgItemInt( HWND arg1, int arg2, UINT arg3, BOOL arg4) 92 { 92 BOOL WIN32API SetDlgItemInt( HWND hwndDlg, int idControl, UINT uValue, BOOL fSigned) 93 { 94 char buf[30]; 95 93 96 #ifdef DEBUG 94 97 WriteLog("USER32: SetDlgItemInt\n"); 95 98 #endif 96 //get item text and translate to int 97 return O32_SetDlgItemInt(arg1, arg2, arg3, arg4); 99 if (fSigned) sprintf(buf,"%u",uValue); 100 else sprintf(buf,"%d",uValue); 101 102 return SetDlgItemTextA(hwndDlg,idControl,buf); 98 103 } 99 104 //****************************************************************************** -
trunk/src/user32/new/wingdi.cpp
r326 r327 1 /* $Id: wingdi.cpp,v 1. 1 1999-07-18 10:40:16 sandervlExp $ */1 /* $Id: wingdi.cpp,v 1.2 1999-07-18 13:57:48 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Window graphics apis for OS/2 … … 23 23 { 24 24 Win32Window *window; 25 OSRECTL rect; 25 26 26 27 window = Win32Window::GetWindowFromHandle(hwnd); 27 28 if(!window) { 28 29 29 dprintf(("GetDC, window %x not found", hwnd)); 30 return 0; 30 31 } 31 32 dprintf(("BeginPaint %X\n", hwnd)); 32 if(OSLibWinQueryUpdateRect(window->getOS2WindowHandle(), & lps->rcPaint) == FALSE)33 if(OSLibWinQueryUpdateRect(window->getOS2WindowHandle(), &rect) == FALSE) 33 34 { 34 35 35 dprintf(("BeginPaint, NO update rectl")); 36 return 0; 36 37 } 38 MapOS2ToWin32Rectl(window->getOS2WindowHandle(),(PRECTLOS2)&rect,&lps->rcPaint); 37 39 lps->hdc = OSLibWinBeginPaint(window->getOS2WindowHandle(), (PVOID)&lps->rcPaint); 38 40 … … 55 57 window = Win32Window::GetWindowFromHandle(hwnd); 56 58 if(!window) { 57 58 59 dprintf(("GetDC, window %x not found", hwnd)); 60 return 0; 59 61 } 60 62 dprintf(("GetDC %x", hwnd));
Note:
See TracChangeset
for help on using the changeset viewer.