source: trunk/src/user32/new/window.cpp@ 398

Last change on this file since 398 was 398, checked in by sandervl, 26 years ago

Lots of changes: Solitaire now displays cards correctly

File size: 32.9 KB
Line 
1/* $Id: window.cpp,v 1.14 1999-07-26 20:03:49 sandervl Exp $ */
2/*
3 * Win32 window apis for OS/2
4 *
5 * Copyright 1999 Sander van Leeuwen
6 *
7 * Parts based on Wine Windows code (windows\win.c)
8 *
9 * Copyright 1993, 1994 Alexandre Julliard
10 *
11 * Project Odin Software License can be found in LICENSE.TXT
12 *
13 *
14 * TODO: Decide what to do about commands for OS/2 windows (non-Win32 apps)
15 *
16 */
17
18#include <os2win.h>
19#include <misc.h>
20#include <win32wnd.h>
21#include <oslibwin.h>
22#include <oslibgdi.h>
23#include "user32.h"
24#include "icon.h"
25#include "usrcall.h"
26
27//******************************************************************************
28//******************************************************************************
29HWND WIN32API CreateWindowExA(DWORD exStyle, LPCSTR className,
30 LPCSTR windowName, DWORD style, INT x,
31 INT y, INT width, INT height,
32 HWND parent, HMENU menu,
33 HINSTANCE instance, LPVOID data )
34{
35 Win32Window *window;
36 ATOM classAtom;
37 CREATESTRUCTA cs;
38
39 if(exStyle & WS_EX_MDICHILD)
40 return CreateMDIWindowA(className, windowName, style, x, y, width, height, parent, instance, (LPARAM)data);
41
42 /* Find the class atom */
43 if (!(classAtom = GlobalFindAtomA(className)))
44 {
45 dprintf(("CreateWindowEx32A: bad class name "));
46 if (!HIWORD(className)) {
47 dprintf(("CreateWindowEx32A: bad class name %04x\n", LOWORD(className)));
48 }
49 else dprintf(("CreateWindowEx32A: bad class name '%s'\n", className ));
50 SetLastError(ERROR_INVALID_PARAMETER);
51 return 0;
52 }
53
54 /* Create the window */
55 cs.lpCreateParams = data;
56 cs.hInstance = instance;
57 cs.hMenu = menu;
58 cs.hwndParent = parent;
59 cs.x = x;
60 cs.y = y;
61 cs.cx = width;
62 cs.cy = height;
63 cs.style = style;
64 cs.lpszName = windowName;
65 cs.lpszClass = className;
66 cs.dwExStyle = exStyle;
67 dprintf(("CreateWindowExA: (%d,%d) (%d,%d), %x %x", x, y, width, height, style, exStyle));
68 window = new Win32Window( &cs, classAtom, FALSE );
69 if(window == NULL)
70 {
71 dprintf(("Win32Window creation failed!!"));
72 return 0;
73 }
74 if(GetLastError() != 0)
75 {
76 dprintf(("Win32Window error found!!"));
77 delete window;
78 return 0;
79 }
80 return window->getWindowHandle();
81}
82//******************************************************************************
83//******************************************************************************
84HWND WIN32API CreateMDIWindowA(LPCSTR arg1, LPCSTR arg2, DWORD arg3,
85 int arg4, int arg5, int arg6, int arg7,
86 HWND arg8, HINSTANCE arg9, LPARAM arg10)
87{
88 HWND hwnd;
89
90 dprintf(("USER32: CreateMDIWindowA\n"));
91
92 hwnd = O32_CreateMDIWindow((LPSTR)arg1, (LPSTR)arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
93
94 dprintf(("USER32: CreateMDIWindowA returned %X\n", hwnd));
95 return hwnd;
96}
97//******************************************************************************
98//******************************************************************************
99HWND WIN32API CreateMDIWindowW(LPCWSTR arg1, LPCWSTR arg2, DWORD arg3, int arg4,
100 int arg5, int arg6, int arg7, HWND arg8, HINSTANCE arg9,
101 LPARAM arg10)
102{
103 HWND hwnd;
104 char *astring1 = NULL, *astring2 = NULL;
105
106 if((int)arg1 >> 16 != 0) {
107 astring1 = UnicodeToAsciiString((LPWSTR)arg1);
108 }
109 else astring1 = (char *)arg2;
110
111 astring2 = UnicodeToAsciiString((LPWSTR)arg2);
112
113 hwnd = O32_CreateMDIWindow(astring1, astring2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
114
115 if(astring1) FreeAsciiString(astring1);
116 FreeAsciiString(astring2);
117 dprintf(("USER32: CreateMDIWindowW hwnd = %X\n", hwnd));
118 return(hwnd);
119}
120//******************************************************************************
121//******************************************************************************
122HWND WIN32API CreateWindowExW(DWORD exStyle, LPCWSTR className,
123 LPCWSTR windowName, DWORD style, INT x,
124 INT y, INT width, INT height,
125 HWND parent, HMENU menu,
126 HINSTANCE instance, LPVOID data )
127{
128 Win32Window *window;
129 ATOM classAtom;
130 CREATESTRUCTA cs;
131
132 if(exStyle & WS_EX_MDICHILD)
133 return CreateMDIWindowW(className, windowName, style, x, y, width, height, parent, instance, (LPARAM)data);
134
135 /* Find the class atom */
136 if (!(classAtom = GlobalFindAtomW(className)))
137 {
138 dprintf(("CreateWindowEx32A: bad class name "));
139 if (!HIWORD(className)) {
140 dprintf(("CreateWindowEx32A: bad class name %04x\n", LOWORD(className)));
141 }
142// else dprintf(("CreateWindowEx32A: bad class name '%s'\n", className ));
143 SetLastError(ERROR_INVALID_PARAMETER);
144 return 0;
145 }
146
147 /* Create the window */
148 cs.lpCreateParams = data;
149 cs.hInstance = instance;
150 cs.hMenu = menu;
151 cs.hwndParent = parent;
152 cs.x = x;
153 cs.y = y;
154 cs.cx = width;
155 cs.cy = height;
156 cs.style = style;
157 cs.lpszName = (LPSTR)windowName;
158 cs.lpszClass = (LPSTR)className;
159 cs.dwExStyle = exStyle;
160 window = new Win32Window( &cs, classAtom, TRUE );
161 if(window == NULL)
162 {
163 dprintf(("Win32Window creation failed!!"));
164 return 0;
165 }
166 if(GetLastError() != 0)
167 {
168 dprintf(("Win32Window error found!!"));
169 delete window;
170 return 0;
171 }
172 return window->getWindowHandle();
173}
174//******************************************************************************
175//******************************************************************************
176BOOL WIN32API DestroyWindow(HWND hwnd)
177{
178 Win32Window *window;
179
180 window = Win32Window::GetWindowFromHandle(hwnd);
181 if(!window) {
182 dprintf(("DestroyWindow, window %x not found", hwnd));
183 return 0;
184 }
185 dprintf(("DestroyWindow %x", hwnd));
186 return window->DestroyWindow();
187}
188//******************************************************************************
189//******************************************************************************
190HWND WIN32API SetActiveWindow( HWND hwnd)
191{
192 Win32Window *window;
193
194 window = Win32Window::GetWindowFromHandle(hwnd);
195 if(!window) {
196 dprintf(("SetActiveWindow, window %x not found", hwnd));
197 return 0;
198 }
199 dprintf(("SetActiveWindow %x", hwnd));
200 return window->SetActiveWindow();
201}
202//******************************************************************************
203//******************************************************************************
204HWND WIN32API GetParent( HWND hwnd)
205{
206 Win32Window *window;
207
208 window = Win32Window::GetWindowFromHandle(hwnd);
209 if(!window) {
210 dprintf(("GetParent, window %x not found", hwnd));
211 return 0;
212 }
213 dprintf(("GetParent %x", hwnd));
214 return window->GetParent();
215}
216//******************************************************************************
217//******************************************************************************
218HWND WIN32API SetParent( HWND hwndChild, HWND hwndNewParent)
219{
220 Win32Window *window;
221
222 window = Win32Window::GetWindowFromHandle(hwndChild);
223 if(!window) {
224 dprintf(("SetParent, window %x not found", hwndChild));
225 return 0;
226 }
227 dprintf(("SetParent %x %x", hwndChild, hwndNewParent));
228 return window->SetParent(hwndNewParent);
229}
230//******************************************************************************
231//******************************************************************************
232BOOL WIN32API IsChild( HWND hwndParent, HWND hwnd)
233{
234 Win32Window *window;
235
236 window = Win32Window::GetWindowFromHandle(hwnd);
237 if(!window) {
238 dprintf(("IsChild, window %x not found", hwnd));
239 return 0;
240 }
241 dprintf(("IsChild %x %x", hwndParent, hwnd));
242 return window->IsChild(hwndParent);
243}
244//******************************************************************************
245//******************************************************************************
246HWND WIN32API GetTopWindow( HWND hwnd)
247{
248 Win32Window *window;
249
250 window = Win32Window::GetWindowFromHandle(hwnd);
251 if(!window) {
252 dprintf(("GetTopWindow, window %x not found", hwnd));
253 return 0;
254 }
255 dprintf(("GetTopWindow %x", hwnd));
256 return window->GetTopWindow();
257}
258//******************************************************************************
259//******************************************************************************
260BOOL WIN32API UpdateWindow(HWND hwnd)
261{
262 Win32Window *window;
263
264 window = Win32Window::GetWindowFromHandle(hwnd);
265 if(!window) {
266 dprintf(("UpdateWindow, window %x not found", hwnd));
267 return 0;
268 }
269 dprintf(("UpdateWindow %x", hwnd));
270 return window->UpdateWindow();
271}
272//******************************************************************************
273//******************************************************************************
274BOOL WIN32API IsIconic( HWND hwnd)
275{
276 Win32Window *window;
277
278 window = Win32Window::GetWindowFromHandle(hwnd);
279 if(!window) {
280 dprintf(("IsIconic, window %x not found", hwnd));
281 return 0;
282 }
283 dprintf(("IsIconic %x", hwnd));
284 return window->IsIconic();
285}
286//******************************************************************************
287//******************************************************************************
288HWND WIN32API GetWindow(HWND hwnd, UINT uCmd)
289{
290 Win32Window *window;
291
292 window = Win32Window::GetWindowFromHandle(hwnd);
293 if(!window) {
294 dprintf(("GetWindow, window %x not found", hwnd));
295 return 0;
296 }
297 dprintf(("GetWindow %x %d", hwnd, uCmd));
298 return window->GetWindow(uCmd);
299}
300//******************************************************************************
301//******************************************************************************
302BOOL WIN32API EnableWindow( HWND hwnd, BOOL fEnable)
303{
304 Win32Window *window;
305
306 window = Win32Window::GetWindowFromHandle(hwnd);
307 if(!window) {
308 dprintf(("EnableWindow, window %x not found", hwnd));
309 return 0;
310 }
311 dprintf(("EnableWindow %x %d", hwnd, fEnable));
312 return window->EnableWindow(fEnable);
313}
314//******************************************************************************
315//******************************************************************************
316BOOL WIN32API BringWindowToTop(HWND hwnd)
317{
318 return SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE );
319}
320//******************************************************************************
321//******************************************************************************
322HWND WIN32API GetActiveWindow()
323{
324 return Win32Window::GetActiveWindow();
325}
326//******************************************************************************
327//******************************************************************************
328BOOL WIN32API ShowWindow(HWND hwnd, int nCmdShow)
329{
330 Win32Window *window;
331
332 window = Win32Window::GetWindowFromHandle(hwnd);
333 if(!window) {
334 dprintf(("ShowWindow, window %x not found", hwnd));
335 return 0;
336 }
337 dprintf(("ShowWindow %x", hwnd));
338 return window->ShowWindow(nCmdShow);
339}
340//******************************************************************************
341//******************************************************************************
342BOOL WIN32API SetWindowPos(HWND hwnd, HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags)
343{
344 Win32Window *window;
345
346 window = Win32Window::GetWindowFromHandle(hwnd);
347 if(!window) {
348 dprintf(("SetWindowPos, window %x not found", hwnd));
349 return 0;
350 }
351 dprintf(("SetWindowPos %x %x x=%d y=%d cx=%d cy=%d %x", hwnd, hwndInsertAfter, x, y, cx, cy, fuFlags));
352 return window->SetWindowPos(hwndInsertAfter, x, y, cx, cy, fuFlags);
353}
354//******************************************************************************
355//******************************************************************************
356BOOL WIN32API SetWindowPlacement( HWND arg1, const WINDOWPLACEMENT * arg2)
357{
358 dprintf(("USER32: SetWindowPlacement\n"));
359 return O32_SetWindowPlacement(arg1, arg2);
360}
361//******************************************************************************
362//******************************************************************************
363BOOL WIN32API GetWindowPlacement( HWND arg1, LPWINDOWPLACEMENT arg2)
364{
365#ifdef DEBUG
366 WriteLog("USER32: GetWindowPlacement\n");
367#endif
368 return O32_GetWindowPlacement(arg1, arg2);
369}
370//******************************************************************************
371//******************************************************************************
372BOOL WIN32API IsWindow( HWND hwnd)
373{
374 Win32Window *window;
375
376 window = Win32Window::GetWindowFromHandle(hwnd);
377 if(!window) {
378 dprintf(("IsWindow, window %x not found", hwnd));
379 return FALSE;
380 }
381 dprintf(("IsWindow %x", hwnd));
382 return window->IsWindow();
383}
384//******************************************************************************
385//******************************************************************************
386BOOL WIN32API IsWindowEnabled( HWND hwnd)
387{
388 Win32Window *window;
389
390 window = Win32Window::GetWindowFromHandle(hwnd);
391 if(!window) {
392 dprintf(("IsWindowEnabled, window %x not found", hwnd));
393 return 0;
394 }
395 dprintf(("IsWindowEnabled %x", hwnd));
396 return window->IsWindowEnabled();
397}
398//******************************************************************************
399//******************************************************************************
400BOOL WIN32API IsWindowVisible( HWND hwnd)
401{
402 Win32Window *window;
403
404 window = Win32Window::GetWindowFromHandle(hwnd);
405 if(!window) {
406 dprintf(("IsWindowVisible, window %x not found", hwnd));
407 return 0;
408 }
409 dprintf(("IsWindowVisible %x", hwnd));
410 return window->IsWindowVisible();
411}
412//******************************************************************************
413//******************************************************************************
414HWND WIN32API SetFocus( HWND hwnd)
415{
416 HWND lastFocus;
417
418 dprintf(("USER32: SetFocus\n"));
419
420 lastFocus = GetFocus();
421 hwnd = Win32Window::Win32ToOS2Handle(hwnd);
422 return (OSLibWinSetFocus(OSLIB_HWND_DESKTOP,hwnd)) ? lastFocus:0;
423}
424//******************************************************************************
425//******************************************************************************
426HWND WIN32API GetFocus(void)
427{
428 HWND hwnd;
429// dprintf(("USER32: GetFocus\n"));
430
431 hwnd = OSLibWinQueryFocus(OSLIB_HWND_DESKTOP);
432 return Win32Window::OS2ToWin32Handle(hwnd);
433}
434//******************************************************************************
435//******************************************************************************
436/***********************************************************************
437 * GetInternalWindowPos (USER32.245)
438 */
439UINT WIN32API GetInternalWindowPos(HWND hwnd,
440 LPRECT rectWnd,
441 LPPOINT ptIcon )
442{
443 WINDOWPLACEMENT wndpl;
444
445 dprintf(("USER32: GetInternalWindowPos(%08xh,%08xh,%08xh)\n",
446 hwnd,
447 rectWnd,
448 ptIcon));
449
450 if (GetWindowPlacement( hwnd, &wndpl ))
451 {
452 if (rectWnd) *rectWnd = wndpl.rcNormalPosition;
453 if (ptIcon) *ptIcon = wndpl.ptMinPosition;
454 return wndpl.showCmd;
455 }
456 return 0;
457}
458//******************************************************************************
459//******************************************************************************
460BOOL WIN32API IsZoomed( HWND arg1)
461{
462#ifdef DEBUG
463 WriteLog("USER32: IsZoomed\n");
464#endif
465 return O32_IsZoomed(arg1);
466}
467//******************************************************************************
468//******************************************************************************
469BOOL WIN32API LockWindowUpdate( HWND arg1)
470{
471#ifdef DEBUG
472 WriteLog("USER32: LockWindowUpdate\n");
473#endif
474 return O32_LockWindowUpdate(arg1);
475}
476//******************************************************************************
477//******************************************************************************
478BOOL WIN32API RedrawWindow( HWND arg1, const RECT * arg2, HRGN arg3, UINT arg4)
479{
480 BOOL rc;
481
482 rc = O32_RedrawWindow(arg1, arg2, arg3, arg4);
483#ifdef DEBUG
484 WriteLog("USER32: RedrawWindow %X , %X, %X, %X returned %d\n", arg1, arg2, arg3, arg4, rc);
485#endif
486 InvalidateRect(arg1, arg2, TRUE);
487 UpdateWindow(arg1);
488 SendMessageA(arg1, WM_PAINT, 0, 0);
489 return(rc);
490}
491//******************************************************************************
492//******************************************************************************
493BOOL WIN32API GetWindowRect( HWND hwnd, PRECT pRect)
494{
495 Win32Window *window;
496
497 window = Win32Window::GetWindowFromHandle(hwnd);
498 if(!window) {
499 dprintf(("GetWindowRect, window %x not found", hwnd));
500 return 0;
501 }
502 dprintf(("GetWindowRect %x", hwnd));
503 return window->GetWindowRect(pRect);
504}
505//******************************************************************************
506//******************************************************************************
507int WIN32API GetWindowTextLengthA( HWND hwnd)
508{
509 Win32Window *window;
510
511 window = Win32Window::GetWindowFromHandle(hwnd);
512 if(!window) {
513 dprintf(("GetWindowTextLength, window %x not found", hwnd));
514 return 0;
515 }
516 dprintf(("GetWindowTextLength %x", hwnd));
517 return window->GetWindowTextLengthA();
518}
519//******************************************************************************
520//******************************************************************************
521int WIN32API GetWindowTextA( HWND hwnd, LPSTR lpsz, int cch)
522{
523 Win32Window *window;
524
525 window = Win32Window::GetWindowFromHandle(hwnd);
526 if(!window) {
527 dprintf(("GetWindowTextA, window %x not found", hwnd));
528 return 0;
529 }
530 dprintf(("GetWindowTextA %x", hwnd));
531 return window->GetWindowTextA(lpsz, cch);
532}
533//******************************************************************************
534//******************************************************************************
535int WIN32API GetWindowTextLengthW( HWND hwnd)
536{
537 dprintf(("USER32: GetWindowTextLengthW\n"));
538 return GetWindowTextLengthA(hwnd);
539}
540//******************************************************************************
541//******************************************************************************
542int WIN32API GetWindowTextW(HWND hwnd, LPWSTR lpsz, int cch)
543{
544 char title[128];
545 int rc;
546
547 rc = O32_GetWindowText(hwnd, title, sizeof(title));
548#ifdef DEBUG
549 WriteLog("USER32: GetWindowTextW returned %s\n", title);
550#endif
551 if(rc > cch) {
552 title[cch-1] = 0;
553 rc = cch;
554 }
555 AsciiToUnicode(title, lpsz);
556 return(rc);
557}
558//******************************************************************************
559//******************************************************************************
560BOOL WIN32API SetWindowTextA(HWND hwnd, LPCSTR lpsz)
561{
562 Win32Window *window;
563
564 window = Win32Window::GetWindowFromHandle(hwnd);
565 if(!window) {
566 dprintf(("SetWindowTextA, window %x not found", hwnd));
567 return 0;
568 }
569 dprintf(("SetWindowTextA %x %s", hwnd, lpsz));
570 return window->SetWindowTextA(lpsz);
571}
572//******************************************************************************
573//******************************************************************************
574BOOL WIN32API SetWindowTextW( HWND arg1, LPCWSTR arg2)
575{
576 char *astring = UnicodeToAsciiString((LPWSTR)arg2);
577 BOOL rc;
578
579 rc = SetWindowTextA(arg1, (LPCSTR)astring);
580 dprintf(("USER32: SetWindowTextW %X %s returned %d\n", arg1, astring, rc));
581 FreeAsciiString(astring);
582 return(rc);
583}
584/*******************************************************************
585 * InternalGetWindowText (USER32.326)
586 */
587int WIN32API InternalGetWindowText(HWND hwnd,
588 LPWSTR lpString,
589 INT nMaxCount )
590{
591 dprintf(("USER32: InternalGetWindowText(%08xh,%08xh,%08xh) not properly implemented.\n",
592 hwnd,
593 lpString,
594 nMaxCount));
595
596 return GetWindowTextW(hwnd,lpString,nMaxCount);
597}
598//******************************************************************************
599//TODO: Correct?
600//******************************************************************************
601BOOL WIN32API SetForegroundWindow(HWND hwnd)
602{
603 dprintf((" SetForegroundWindow %x", hwnd));
604
605 return SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER );
606}
607//******************************************************************************
608//******************************************************************************
609BOOL WIN32API GetClientRect( HWND hwnd, PRECT pRect)
610{
611 BOOL rc;
612
613 hwnd = Win32Window::Win32ToOS2Handle(hwnd);
614 rc = OSLibWinQueryWindowRect(hwnd, pRect);
615 dprintf(("USER32: GetClientRect of %X returned (%d,%d) (%d,%d)\n", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom));
616 return rc;
617}
618//******************************************************************************
619//******************************************************************************
620BOOL WIN32API AdjustWindowRect( PRECT arg1, DWORD arg2, BOOL arg3)
621{
622#ifdef DEBUG
623 WriteLog("USER32: AdjustWindowRect\n");
624#endif
625 return O32_AdjustWindowRect(arg1, arg2, arg3);
626}
627//******************************************************************************
628//******************************************************************************
629BOOL WIN32API AdjustWindowRectEx( PRECT arg1, DWORD arg2, BOOL arg3, DWORD arg4)
630{
631#ifdef DEBUG
632 WriteLog("USER32: AdjustWindowRectEx\n");
633#endif
634 return O32_AdjustWindowRectEx(arg1, arg2, arg3, arg4);
635}
636//******************************************************************************
637//******************************************************************************
638HWND WIN32API GetDesktopWindow(void)
639{
640 dprintf(("USER32: GetDesktopWindow\n"));
641 return OSLIB_HWND_DESKTOP;
642}
643//******************************************************************************
644//******************************************************************************
645HWND WIN32API FindWindowA(LPCSTR arg1, LPCSTR arg2)
646{
647#ifdef DEBUG
648 WriteLog("USER32: FindWindow\n");
649#endif
650 return O32_FindWindow(arg1, arg2);
651}
652//******************************************************************************
653//******************************************************************************
654HWND WIN32API FindWindowExA(HWND arg1, HWND arg2, LPCSTR arg3, LPCSTR arg4)
655{
656#ifdef DEBUG
657 WriteLog("USER32: FindWindowExA, not completely implemented\n");
658#endif
659 return O32_FindWindow(arg3, arg4);
660}
661/*****************************************************************************
662 * Name : HWND WIN32API FindWindowExW
663 * Purpose : The FindWindowEx function retrieves the handle of a window whose
664 * class name and window name match the specified strings. The
665 * function searches child windows, beginning with the one following
666 * the given child window.
667 * Parameters: HWND hwndParent handle of parent window
668 * HWND hwndChildAfter handle of a child window
669 * LPCTSTR lpszClass address of class name
670 * LPCTSTR lpszWindow address of window name
671 * Variables :
672 * Result : If the function succeeds, the return value is the handle of the
673 * window that has the specified class and window names.
674 * If the function fails, the return value is NULL. To get extended
675 * error information, call GetLastError.
676 * Remark :
677 * Status : UNTESTED STUB
678 *
679 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
680 *****************************************************************************/
681
682HWND WIN32API FindWindowExW(HWND hwndParent,
683 HWND hwndChildAfter,
684 LPCWSTR lpszClass,
685 LPCWSTR lpszWindow)
686{
687 dprintf(("USER32:FindWindowExW (%08xh,%08xh,%s,%s) not implemented.\n",
688 hwndParent,
689 hwndChildAfter,
690 lpszClass,
691 lpszWindow));
692
693 return (NULL);
694}
695//******************************************************************************
696//******************************************************************************
697BOOL WIN32API FlashWindow(HWND hwnd, BOOL fFlash)
698{
699 dprintf(("FlashWindow %x %d\n", hwnd, fFlash));
700 return OSLibWinFlashWindow(Win32Window::Win32ToOS2Handle(hwnd), fFlash);
701}
702//******************************************************************************
703//******************************************************************************
704BOOL WIN32API MoveWindow( HWND hwnd, INT x, INT y, INT cx, INT cy,
705 BOOL repaint )
706{
707 int flags = SWP_NOZORDER | SWP_NOACTIVATE;
708
709 if (!repaint) flags |= SWP_NOREDRAW;
710 dprintf(("MoveWindow: %04x %d,%d %dx%d %d\n", hwnd, x, y, cx, cy, repaint ));
711
712 return SetWindowPos( hwnd, 0, x, y, cx, cy, flags );
713}
714//******************************************************************************
715//******************************************************************************
716BOOL WIN32API ClientToScreen( HWND arg1, PPOINT arg2)
717{
718#ifdef DEBUG
719//// WriteLog("USER32: ClientToScreen\n");
720#endif
721 return O32_ClientToScreen(arg1, arg2);
722}
723//******************************************************************************
724//******************************************************************************
725HDWP WIN32API BeginDeferWindowPos( int arg1)
726{
727#ifdef DEBUG
728 WriteLog("USER32: BeginDeferWindowPos\n");
729#endif
730 return O32_BeginDeferWindowPos(arg1);
731}
732//******************************************************************************
733//******************************************************************************
734HDWP WIN32API DeferWindowPos( HDWP arg1, HWND arg2, HWND arg3, int arg4, int arg5, int arg6, int arg7, UINT arg8)
735{
736#ifdef DEBUG
737 WriteLog("USER32: DeferWindowPos\n");
738#endif
739 return O32_DeferWindowPos(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
740}
741//******************************************************************************
742//******************************************************************************
743HWND WIN32API ChildWindowFromPoint( HWND arg1, POINT arg2)
744{
745#ifdef DEBUG
746 WriteLog("USER32: ChildWindowFromPoint\n");
747#endif
748 return O32_ChildWindowFromPoint(arg1, arg2);
749}
750//******************************************************************************
751//******************************************************************************
752HWND WIN32API ChildWindowFromPointEx(HWND arg1, POINT arg2, UINT uFlags)
753{
754#ifdef DEBUG
755 WriteLog("USER32: ChildWindowFromPointEx, not completely supported!\n");
756#endif
757 return O32_ChildWindowFromPoint(arg1, arg2);
758}
759//******************************************************************************
760//******************************************************************************
761BOOL WIN32API CloseWindow(HWND hwnd)
762{
763 Win32Window *window;
764
765 window = Win32Window::GetWindowFromHandle(hwnd);
766 if(!window) {
767 dprintf(("CloseWindow, window %x not found", hwnd));
768 return 0;
769 }
770 dprintf(("CloseWindow %x\n", hwnd));
771 return window->CloseWindow();
772}
773//******************************************************************************
774//TODO: Does this return handles of hidden or disabled windows?
775//******************************************************************************
776HWND WIN32API WindowFromPoint( POINT point)
777{
778 HWND hwnd;
779
780 dprintf(("WindowFromPoint (%d,%d)\n", point.x, point.y));
781 hwnd = OSLibWinWindowFromPoint(OSLIB_HWND_DESKTOP, (PVOID)&point);
782 if(hwnd) {
783 return Win32Window::OS2ToWin32Handle(hwnd);
784 }
785 return 0;
786}
787//******************************************************************************
788//******************************************************************************
789BOOL WIN32API IsWindowUnicode(HWND hwnd)
790{
791 Win32Window *window;
792
793 window = Win32Window::GetWindowFromHandle(hwnd);
794 if(!window) {
795 dprintf(("IsWindowUnicode, window %x not found", hwnd));
796 return 0;
797 }
798 return window->IsUnicode();
799}
800/*****************************************************************************
801 * Name : WORD WIN32API CascadeWindows
802 * Purpose : The CascadeWindows function cascades the specified windows or
803 * the child windows of the specified parent window.
804 * Parameters: HWND hwndParent handle of parent window
805 * UINT wHow types of windows not to arrange
806 * CONST RECT * lpRect rectangle to arrange windows in
807 * UINT cKids number of windows to arrange
808 * const HWND FAR * lpKids array of window handles
809 * Variables :
810 * Result : If the function succeeds, the return value is the number of windows arranged.
811 * If the function fails, the return value is zero.
812 * Remark :
813 * Status : UNTESTED STUB
814 *
815 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
816 *****************************************************************************/
817
818WORD WIN32API CascadeWindows(HWND hwndParent,
819 UINT wHow,
820 CONST LPRECT lpRect,
821 UINT cKids,
822 const HWND *lpKids)
823{
824 dprintf(("USER32:CascadeWindows(%08xh,%u,%08xh,%u,%08x) not implemented.\n",
825 hwndParent,
826 wHow,
827 lpRect,
828 cKids,
829 lpKids));
830
831 return (0);
832}
833/*****************************************************************************
834 * Name : BOOL WIN32API SwitchToThisWindow
835 * Purpose : Unknown
836 * Parameters: Unknown
837 * Variables :
838 * Result :
839 * Remark :
840 * Status : UNTESTED UNKNOWN STUB
841 *
842 * Author : Patrick Haller [Wed, 1998/06/16 11:55]
843 *****************************************************************************/
844
845BOOL WIN32API SwitchToThisWindow(HWND hwnd,
846 BOOL x2)
847{
848 dprintf(("USER32: SwitchToThisWindow(%08xh,%08xh) not implemented.\n",
849 hwnd,
850 x2));
851
852 return (FALSE); /* default */
853}
854//******************************************************************************
855//******************************************************************************
856BOOL WIN32API EnumThreadWindows(DWORD dwThreadId, WNDENUMPROC lpfn, LPARAM lParam)
857{
858 BOOL rc;
859 EnumWindowCallback *callback = new EnumWindowCallback(lpfn, lParam);
860
861 dprintf(("USER32: EnumThreadWindows\n"));
862 //CB: replace
863 rc = O32_EnumThreadWindows(dwThreadId, callback->GetOS2Callback(), (LPARAM)callback);
864 if(callback)
865 delete callback;
866 return(rc);
867}
868//******************************************************************************
869//******************************************************************************
870BOOL WIN32API GetUpdateRect( HWND hwnd, PRECT lpRect, BOOL bErase)
871{
872 dprintf(("GetUpdateRect %x %d\n", hwnd, bErase));
873 if (!lpRect) return FALSE;
874
875 return OSLibWinQueryUpdateRect(Win32Window::Win32ToOS2Handle(hwnd), lpRect);
876}
877//******************************************************************************
878//******************************************************************************
879BOOL WIN32API InvalidateRect(HWND hWnd, const RECT *lpRect, BOOL bErase)
880{
881#ifdef DEBUG
882 if(lpRect)
883 WriteLog("USER32: InvalidateRect for window %X (%d,%d)(%d,%d) %d\n", hWnd, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, bErase);
884 else WriteLog("USER32: InvalidateRect for window %X NULL, %d\n", hWnd, bErase);
885#endif
886
887 //CB: bErase no quite the same
888 hWnd = Win32Window::Win32ToOS2Handle(hWnd);
889 if (lpRect)
890 {
891 return OSLibWinInvalidateRect(hWnd, (PRECT)lpRect, bErase);
892 }
893 else return OSLibWinInvalidateRect(hWnd,NULL,bErase);
894}
895//******************************************************************************
896//******************************************************************************
897UINT WIN32API ArrangeIconicWindows( HWND arg1)
898{
899#ifdef DEBUG
900 WriteLog("USER32: ArrangeIconicWindows\n");
901#endif
902 return O32_ArrangeIconicWindows(arg1);
903}
904//******************************************************************************
905//restores iconized window to previous size/position
906//******************************************************************************
907BOOL WIN32API OpenIcon(HWND hwnd)
908{
909#ifdef DEBUG
910 WriteLog("USER32: OpenIcon\n");
911#endif
912 if(!IsIconic(hwnd))
913 return FALSE;
914 ShowWindow(hwnd, SW_SHOWNORMAL);
915 return TRUE;
916}
917//******************************************************************************
918//******************************************************************************
919BOOL WIN32API ShowOwnedPopups( HWND arg1, BOOL arg2)
920{
921 dprintf(("USER32: ShowOwnedPopups\n"));
922 return O32_ShowOwnedPopups(arg1, arg2);
923}
924//******************************************************************************
925//******************************************************************************
Note: See TracBrowser for help on using the repository browser.