1 | /* $Id: window.cpp,v 1.8 1999-09-25 09:27:08 dengert Exp $ */
|
---|
2 | /*
|
---|
3 | * Win32 window apis for OS/2
|
---|
4 | *
|
---|
5 | * Copyright 1999 Sander van Leeuwen
|
---|
6 | * Copyright 1999 Daniela Engert (dani@ngrt.de)
|
---|
7 | *
|
---|
8 | * Parts based on Wine Windows code (windows\win.c)
|
---|
9 | *
|
---|
10 | * Copyright 1993, 1994 Alexandre Julliard
|
---|
11 | *
|
---|
12 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
13 | *
|
---|
14 | *
|
---|
15 | * TODO: Decide what to do about commands for OS/2 windows (non-Win32 apps)
|
---|
16 | *
|
---|
17 | */
|
---|
18 |
|
---|
19 | #include <os2win.h>
|
---|
20 | #include <misc.h>
|
---|
21 | #include <win32wbase.h>
|
---|
22 | #include <win32wmdiclient.h>
|
---|
23 | #include <win32wdesktop.h>
|
---|
24 | #include <oslibwin.h>
|
---|
25 | #include <oslibgdi.h>
|
---|
26 | #include "user32.h"
|
---|
27 | #include "winicon.h"
|
---|
28 |
|
---|
29 | //******************************************************************************
|
---|
30 | //******************************************************************************
|
---|
31 | HWND WIN32API CreateWindowExA(DWORD exStyle, LPCSTR className,
|
---|
32 | LPCSTR windowName, DWORD style, INT x,
|
---|
33 | INT y, INT width, INT height,
|
---|
34 | HWND parent, HMENU menu,
|
---|
35 | HINSTANCE instance, LPVOID data )
|
---|
36 | {
|
---|
37 | Win32BaseWindow *window;
|
---|
38 | ATOM classAtom;
|
---|
39 | CREATESTRUCTA cs;
|
---|
40 |
|
---|
41 | if(exStyle & WS_EX_MDICHILD)
|
---|
42 | return CreateMDIWindowA(className, windowName, style, x, y, width, height, parent, instance, (LPARAM)data);
|
---|
43 |
|
---|
44 | //TODO: According to the docs className can be a 16 bits atom
|
---|
45 | // Wine seems to assume it's a string though...
|
---|
46 | /* Find the class atom */
|
---|
47 | if (!(classAtom = GlobalFindAtomA(className)))
|
---|
48 | {
|
---|
49 | dprintf(("CreateWindowEx32A: bad class name "));
|
---|
50 | if (!HIWORD(className)) {
|
---|
51 | dprintf(("CreateWindowEx32A: bad class name %04x\n", LOWORD(className)));
|
---|
52 | }
|
---|
53 | else dprintf(("CreateWindowEx32A: bad class name '%s'\n", className ));
|
---|
54 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
55 | return 0;
|
---|
56 | }
|
---|
57 |
|
---|
58 | /* Create the window */
|
---|
59 | cs.lpCreateParams = data;
|
---|
60 | cs.hInstance = instance;
|
---|
61 | cs.hMenu = menu;
|
---|
62 | cs.hwndParent = parent;
|
---|
63 | cs.x = x;
|
---|
64 | cs.y = y;
|
---|
65 | cs.cx = width;
|
---|
66 | cs.cy = height;
|
---|
67 | cs.style = style;
|
---|
68 | cs.lpszName = windowName;
|
---|
69 | cs.lpszClass = className;
|
---|
70 | cs.dwExStyle = exStyle;
|
---|
71 | dprintf(("CreateWindowExA: parent %x (%d,%d) (%d,%d), %x %x", parent, x, y, width, height, style, exStyle));
|
---|
72 |
|
---|
73 | //TODO: According to the docs className can be a 16 bits atom
|
---|
74 | // Wine seems to assume it's a string though...
|
---|
75 | if(!stricmp(className, MDICLIENTCLASSNAMEA)) {
|
---|
76 | window = (Win32BaseWindow *) new Win32MDIClientWindow(&cs, classAtom, FALSE);
|
---|
77 | }
|
---|
78 | else {
|
---|
79 | window = new Win32BaseWindow( &cs, classAtom, FALSE );
|
---|
80 | }
|
---|
81 | if(window == NULL)
|
---|
82 | {
|
---|
83 | dprintf(("Win32BaseWindow creation failed!!"));
|
---|
84 | return 0;
|
---|
85 | }
|
---|
86 | if(GetLastError() != 0)
|
---|
87 | {
|
---|
88 | dprintf(("Win32BaseWindow error found!!"));
|
---|
89 | delete window;
|
---|
90 | return 0;
|
---|
91 | }
|
---|
92 | return window->getWindowHandle();
|
---|
93 | }
|
---|
94 | //******************************************************************************
|
---|
95 | //******************************************************************************
|
---|
96 | HWND WIN32API CreateWindowExW(DWORD exStyle, LPCWSTR className,
|
---|
97 | LPCWSTR windowName, DWORD style, INT x,
|
---|
98 | INT y, INT width, INT height,
|
---|
99 | HWND parent, HMENU menu,
|
---|
100 | HINSTANCE instance, LPVOID data )
|
---|
101 | {
|
---|
102 | Win32BaseWindow *window;
|
---|
103 | ATOM classAtom;
|
---|
104 | CREATESTRUCTA cs;
|
---|
105 |
|
---|
106 | if(exStyle & WS_EX_MDICHILD)
|
---|
107 | return CreateMDIWindowW(className, windowName, style, x, y, width, height, parent, instance, (LPARAM)data);
|
---|
108 |
|
---|
109 | //TODO: According to the docs className can be a 16 bits atom
|
---|
110 | // Wine seems to assume it's a string though...
|
---|
111 | /* Find the class atom */
|
---|
112 | if (!(classAtom = GlobalFindAtomW(className)))
|
---|
113 | {
|
---|
114 | dprintf(("CreateWindowEx32A: bad class name "));
|
---|
115 | if (!HIWORD(className)) {
|
---|
116 | dprintf(("CreateWindowEx32A: bad class name %04x\n", LOWORD(className)));
|
---|
117 | }
|
---|
118 | // else dprintf(("CreateWindowEx32A: bad class name '%s'\n", className ));
|
---|
119 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
120 | return 0;
|
---|
121 | }
|
---|
122 |
|
---|
123 | /* Create the window */
|
---|
124 | cs.lpCreateParams = data;
|
---|
125 | cs.hInstance = instance;
|
---|
126 | cs.hMenu = menu;
|
---|
127 | cs.hwndParent = parent;
|
---|
128 | cs.x = x;
|
---|
129 | cs.y = y;
|
---|
130 | cs.cx = width;
|
---|
131 | cs.cy = height;
|
---|
132 | cs.style = style;
|
---|
133 | cs.lpszName = (LPSTR)windowName;
|
---|
134 | cs.lpszClass = (LPSTR)className;
|
---|
135 | cs.dwExStyle = exStyle;
|
---|
136 |
|
---|
137 | //TODO: According to the docs className can be a 16 bits atom
|
---|
138 | // Wine seems to assume it's a string though...
|
---|
139 | if(!lstrcmpW(className, (LPWSTR)MDICLIENTCLASSNAMEW)) {
|
---|
140 | window = (Win32BaseWindow *) new Win32MDIClientWindow(&cs, classAtom, TRUE);
|
---|
141 | }
|
---|
142 | else {
|
---|
143 | window = new Win32BaseWindow( &cs, classAtom, TRUE );
|
---|
144 | }
|
---|
145 | if(window == NULL)
|
---|
146 | {
|
---|
147 | dprintf(("Win32BaseWindow creation failed!!"));
|
---|
148 | return 0;
|
---|
149 | }
|
---|
150 | if(GetLastError() != 0)
|
---|
151 | {
|
---|
152 | dprintf(("Win32BaseWindow error found!!"));
|
---|
153 | delete window;
|
---|
154 | return 0;
|
---|
155 | }
|
---|
156 | return window->getWindowHandle();
|
---|
157 | }
|
---|
158 | //******************************************************************************
|
---|
159 | //******************************************************************************
|
---|
160 | HWND WIN32API CreateMDIWindowA(LPCSTR lpszClassName, LPCSTR lpszWindowName,
|
---|
161 | DWORD dwStyle, int x, int y, int nWidth,
|
---|
162 | int nHeight, HWND hwndParent,
|
---|
163 | HINSTANCE hInstance, LPARAM lParam )
|
---|
164 | {
|
---|
165 | HWND hwnd;
|
---|
166 | MDICREATESTRUCTA cs;
|
---|
167 | Win32BaseWindow *window;
|
---|
168 |
|
---|
169 | window = Win32BaseWindow::GetWindowFromHandle(hwndParent);
|
---|
170 | if(!window) {
|
---|
171 | dprintf(("CreateMDIWindowA, window %x not found", hwndParent));
|
---|
172 | return 0;
|
---|
173 | }
|
---|
174 |
|
---|
175 | dprintf(("USER32: CreateMDIWindowA\n"));
|
---|
176 | cs.szClass = lpszClassName;
|
---|
177 | cs.szTitle = lpszWindowName;
|
---|
178 | cs.hOwner = hInstance;
|
---|
179 | cs.x = x;
|
---|
180 | cs.y = y;
|
---|
181 | cs.cx = nHeight;
|
---|
182 | cs.cy = nWidth;
|
---|
183 | cs.style = dwStyle;
|
---|
184 | cs.lParam = lParam;
|
---|
185 |
|
---|
186 | return window->SendMessageA(WM_MDICREATE, 0, (LPARAM)&cs);
|
---|
187 | }
|
---|
188 | //******************************************************************************
|
---|
189 | //******************************************************************************
|
---|
190 | HWND WIN32API CreateMDIWindowW(LPCWSTR lpszClassName, LPCWSTR lpszWindowName,
|
---|
191 | DWORD dwStyle, int x, int y, int nWidth,
|
---|
192 | int nHeight, HWND hwndParent,
|
---|
193 | HINSTANCE hInstance, LPARAM lParam )
|
---|
194 | {
|
---|
195 | HWND hwnd;
|
---|
196 | MDICREATESTRUCTW cs;
|
---|
197 | Win32BaseWindow *window;
|
---|
198 |
|
---|
199 | window = Win32BaseWindow::GetWindowFromHandle(hwndParent);
|
---|
200 | if(!window) {
|
---|
201 | dprintf(("CreateMDIWindowW, window %x not found", hwndParent));
|
---|
202 | return 0;
|
---|
203 | }
|
---|
204 |
|
---|
205 | dprintf(("USER32: CreateMDIWindowW\n"));
|
---|
206 | cs.szClass = lpszClassName;
|
---|
207 | cs.szTitle = lpszWindowName;
|
---|
208 | cs.hOwner = hInstance;
|
---|
209 | cs.x = x;
|
---|
210 | cs.y = y;
|
---|
211 | cs.cx = nHeight;
|
---|
212 | cs.cy = nWidth;
|
---|
213 | cs.style = dwStyle;
|
---|
214 | cs.lParam = lParam;
|
---|
215 |
|
---|
216 | return window->SendMessageW(WM_MDICREATE, 0, (LPARAM)&cs);
|
---|
217 | }
|
---|
218 | //******************************************************************************
|
---|
219 | //******************************************************************************
|
---|
220 | BOOL WIN32API DestroyWindow(HWND hwnd)
|
---|
221 | {
|
---|
222 | Win32BaseWindow *window;
|
---|
223 |
|
---|
224 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
225 | if(!window) {
|
---|
226 | dprintf(("DestroyWindow, window %x not found", hwnd));
|
---|
227 | return 0;
|
---|
228 | }
|
---|
229 | dprintf(("DestroyWindow %x", hwnd));
|
---|
230 | return window->DestroyWindow();
|
---|
231 | }
|
---|
232 | //******************************************************************************
|
---|
233 | //******************************************************************************
|
---|
234 | HWND WIN32API SetActiveWindow( HWND hwnd)
|
---|
235 | {
|
---|
236 | Win32BaseWindow *window;
|
---|
237 |
|
---|
238 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
239 | if(!window) {
|
---|
240 | dprintf(("SetActiveWindow, window %x not found", hwnd));
|
---|
241 | return 0;
|
---|
242 | }
|
---|
243 | dprintf(("SetActiveWindow %x", hwnd));
|
---|
244 | return window->SetActiveWindow();
|
---|
245 | }
|
---|
246 | //******************************************************************************
|
---|
247 | //******************************************************************************
|
---|
248 | HWND WIN32API GetParent( HWND hwnd)
|
---|
249 | {
|
---|
250 | Win32BaseWindow *window;
|
---|
251 |
|
---|
252 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
253 | if(!window) {
|
---|
254 | dprintf(("GetParent, window %x not found", hwnd));
|
---|
255 | return 0;
|
---|
256 | }
|
---|
257 | dprintf(("GetParent %x", hwnd));
|
---|
258 | return window->GetParent();
|
---|
259 | }
|
---|
260 | //******************************************************************************
|
---|
261 | //******************************************************************************
|
---|
262 | HWND WIN32API SetParent( HWND hwndChild, HWND hwndNewParent)
|
---|
263 | {
|
---|
264 | Win32BaseWindow *window;
|
---|
265 |
|
---|
266 | window = Win32BaseWindow::GetWindowFromHandle(hwndChild);
|
---|
267 | if(!window) {
|
---|
268 | dprintf(("SetParent, window %x not found", hwndChild));
|
---|
269 | return 0;
|
---|
270 | }
|
---|
271 | dprintf(("SetParent %x %x", hwndChild, hwndNewParent));
|
---|
272 | return window->SetParent(hwndNewParent);
|
---|
273 | }
|
---|
274 | //******************************************************************************
|
---|
275 | //******************************************************************************
|
---|
276 | BOOL WIN32API IsChild( HWND hwndParent, HWND hwnd)
|
---|
277 | {
|
---|
278 | Win32BaseWindow *window;
|
---|
279 |
|
---|
280 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
281 | if(!window) {
|
---|
282 | dprintf(("IsChild, window %x not found", hwnd));
|
---|
283 | return 0;
|
---|
284 | }
|
---|
285 | dprintf(("IsChild %x %x", hwndParent, hwnd));
|
---|
286 | return window->IsChild(hwndParent);
|
---|
287 | }
|
---|
288 | //******************************************************************************
|
---|
289 | //******************************************************************************
|
---|
290 | HWND WIN32API GetTopWindow( HWND hwnd)
|
---|
291 | {
|
---|
292 | Win32BaseWindow *window;
|
---|
293 |
|
---|
294 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
295 | if(!window) {
|
---|
296 | dprintf(("GetTopWindow, window %x not found", hwnd));
|
---|
297 | return 0;
|
---|
298 | }
|
---|
299 | dprintf(("GetTopWindow %x", hwnd));
|
---|
300 | return window->GetTopWindow();
|
---|
301 | }
|
---|
302 | //******************************************************************************
|
---|
303 | //******************************************************************************
|
---|
304 | #if 0
|
---|
305 | BOOL WIN32API UpdateWindow(HWND hwnd)
|
---|
306 | {
|
---|
307 | Win32BaseWindow *window;
|
---|
308 |
|
---|
309 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
310 | if(!window) {
|
---|
311 | dprintf(("UpdateWindow, window %x not found", hwnd));
|
---|
312 | return 0;
|
---|
313 | }
|
---|
314 | dprintf(("UpdateWindow %x", hwnd));
|
---|
315 | return window->UpdateWindow();
|
---|
316 | }
|
---|
317 | #endif
|
---|
318 | //******************************************************************************
|
---|
319 | //******************************************************************************
|
---|
320 | BOOL WIN32API IsIconic( HWND hwnd)
|
---|
321 | {
|
---|
322 | Win32BaseWindow *window;
|
---|
323 |
|
---|
324 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
325 | if(!window) {
|
---|
326 | dprintf(("IsIconic, window %x not found", hwnd));
|
---|
327 | return 0;
|
---|
328 | }
|
---|
329 | dprintf(("IsIconic %x", hwnd));
|
---|
330 | return window->IsIconic();
|
---|
331 | }
|
---|
332 | //******************************************************************************
|
---|
333 | //******************************************************************************
|
---|
334 | HWND WIN32API GetWindow(HWND hwnd, UINT uCmd)
|
---|
335 | {
|
---|
336 | Win32BaseWindow *window;
|
---|
337 |
|
---|
338 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
339 | if(!window) {
|
---|
340 | dprintf(("GetWindow, window %x not found", hwnd));
|
---|
341 | return 0;
|
---|
342 | }
|
---|
343 | dprintf(("GetWindow %x %d", hwnd, uCmd));
|
---|
344 | return window->GetWindow(uCmd);
|
---|
345 | }
|
---|
346 | //******************************************************************************
|
---|
347 | //******************************************************************************
|
---|
348 | BOOL WIN32API EnableWindow( HWND hwnd, BOOL fEnable)
|
---|
349 | {
|
---|
350 | Win32BaseWindow *window;
|
---|
351 |
|
---|
352 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
353 | if(!window) {
|
---|
354 | dprintf(("EnableWindow, window %x not found", hwnd));
|
---|
355 | return 0;
|
---|
356 | }
|
---|
357 | dprintf(("EnableWindow %x %d", hwnd, fEnable));
|
---|
358 | return window->EnableWindow(fEnable);
|
---|
359 | }
|
---|
360 | //******************************************************************************
|
---|
361 | //******************************************************************************
|
---|
362 | BOOL WIN32API BringWindowToTop(HWND hwnd)
|
---|
363 | {
|
---|
364 | return SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE );
|
---|
365 | }
|
---|
366 | //******************************************************************************
|
---|
367 | //******************************************************************************
|
---|
368 | HWND WIN32API GetActiveWindow()
|
---|
369 | {
|
---|
370 | return Win32BaseWindow::GetActiveWindow();
|
---|
371 | }
|
---|
372 | //******************************************************************************
|
---|
373 | //******************************************************************************
|
---|
374 | BOOL WIN32API ShowWindow(HWND hwnd, int nCmdShow)
|
---|
375 | {
|
---|
376 | Win32BaseWindow *window;
|
---|
377 |
|
---|
378 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
379 | if(!window) {
|
---|
380 | dprintf(("ShowWindow, window %x not found", hwnd));
|
---|
381 | return 0;
|
---|
382 | }
|
---|
383 | dprintf(("ShowWindow %x", hwnd));
|
---|
384 | return window->ShowWindow(nCmdShow);
|
---|
385 | }
|
---|
386 | //******************************************************************************
|
---|
387 | //******************************************************************************
|
---|
388 | BOOL WIN32API SetWindowPos(HWND hwnd, HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags)
|
---|
389 | {
|
---|
390 | Win32BaseWindow *window;
|
---|
391 |
|
---|
392 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
393 | if(!window) {
|
---|
394 | dprintf(("SetWindowPos, window %x not found", hwnd));
|
---|
395 | return 0;
|
---|
396 | }
|
---|
397 | dprintf(("SetWindowPos %x %x x=%d y=%d cx=%d cy=%d %x", hwnd, hwndInsertAfter, x, y, cx, cy, fuFlags));
|
---|
398 | return window->SetWindowPos(hwndInsertAfter, x, y, cx, cy, fuFlags);
|
---|
399 | }
|
---|
400 | //******************************************************************************
|
---|
401 | //******************************************************************************
|
---|
402 | BOOL WIN32API SetWindowPlacement( HWND arg1, const WINDOWPLACEMENT * arg2)
|
---|
403 | {
|
---|
404 | dprintf(("USER32: SetWindowPlacement\n"));
|
---|
405 | return O32_SetWindowPlacement(arg1, arg2);
|
---|
406 | }
|
---|
407 | //******************************************************************************
|
---|
408 | //******************************************************************************
|
---|
409 | BOOL WIN32API GetWindowPlacement( HWND arg1, LPWINDOWPLACEMENT arg2)
|
---|
410 | {
|
---|
411 | #ifdef DEBUG
|
---|
412 | WriteLog("USER32: GetWindowPlacement\n");
|
---|
413 | #endif
|
---|
414 | return O32_GetWindowPlacement(arg1, arg2);
|
---|
415 | }
|
---|
416 | //******************************************************************************
|
---|
417 | //******************************************************************************
|
---|
418 | BOOL WIN32API IsWindow( HWND hwnd)
|
---|
419 | {
|
---|
420 | Win32BaseWindow *window;
|
---|
421 |
|
---|
422 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
423 | if(!window) {
|
---|
424 | dprintf(("IsWindow, window %x not found", hwnd));
|
---|
425 | return FALSE;
|
---|
426 | }
|
---|
427 | dprintf(("IsWindow %x", hwnd));
|
---|
428 | return window->IsWindow();
|
---|
429 | }
|
---|
430 | //******************************************************************************
|
---|
431 | //******************************************************************************
|
---|
432 | BOOL WIN32API IsWindowEnabled( HWND hwnd)
|
---|
433 | {
|
---|
434 | Win32BaseWindow *window;
|
---|
435 |
|
---|
436 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
437 | if(!window) {
|
---|
438 | dprintf(("IsWindowEnabled, window %x not found", hwnd));
|
---|
439 | return 0;
|
---|
440 | }
|
---|
441 | dprintf(("IsWindowEnabled %x", hwnd));
|
---|
442 | return window->IsWindowEnabled();
|
---|
443 | }
|
---|
444 | //******************************************************************************
|
---|
445 | //******************************************************************************
|
---|
446 | BOOL WIN32API IsWindowVisible( HWND hwnd)
|
---|
447 | {
|
---|
448 | Win32BaseWindow *window;
|
---|
449 |
|
---|
450 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
451 | if(!window) {
|
---|
452 | dprintf(("IsWindowVisible, window %x not found", hwnd));
|
---|
453 | return 0;
|
---|
454 | }
|
---|
455 | dprintf(("IsWindowVisible %x", hwnd));
|
---|
456 | return window->IsWindowVisible();
|
---|
457 | }
|
---|
458 | //******************************************************************************
|
---|
459 | //******************************************************************************
|
---|
460 | HWND WIN32API SetFocus (HWND hwnd)
|
---|
461 | {
|
---|
462 | HWND lastFocus, lastFocus_W, hwnd_O;
|
---|
463 | BOOL activate;
|
---|
464 |
|
---|
465 | hwnd_O = Win32BaseWindow::Win32ToOS2Handle (hwnd);
|
---|
466 | lastFocus = OSLibWinQueryFocus (OSLIB_HWND_DESKTOP);
|
---|
467 | activate = ((hwnd_O == lastFocus) || OSLibWinIsChild (lastFocus, hwnd_O));
|
---|
468 | lastFocus_W = Win32BaseWindow::OS2ToWin32Handle (lastFocus);
|
---|
469 |
|
---|
470 | dprintf(("USER32: SetFocus %x (%x) -> %x (%x)\n", lastFocus_W, lastFocus, hwnd, hwnd_O));
|
---|
471 |
|
---|
472 | return (OSLibWinSetFocus (OSLIB_HWND_DESKTOP, hwnd_O, activate)) ? lastFocus_W : 0;
|
---|
473 | }
|
---|
474 | //******************************************************************************
|
---|
475 | //******************************************************************************
|
---|
476 | HWND WIN32API GetFocus(void)
|
---|
477 | {
|
---|
478 | HWND hwnd;
|
---|
479 | // dprintf(("USER32: GetFocus\n"));
|
---|
480 |
|
---|
481 | hwnd = OSLibWinQueryFocus(OSLIB_HWND_DESKTOP);
|
---|
482 | return Win32BaseWindow::OS2ToWin32Handle(hwnd);
|
---|
483 | }
|
---|
484 | //******************************************************************************
|
---|
485 | //******************************************************************************
|
---|
486 | /***********************************************************************
|
---|
487 | * GetInternalWindowPos (USER32.245)
|
---|
488 | */
|
---|
489 | UINT WIN32API GetInternalWindowPos(HWND hwnd,
|
---|
490 | LPRECT rectWnd,
|
---|
491 | LPPOINT ptIcon )
|
---|
492 | {
|
---|
493 | WINDOWPLACEMENT wndpl;
|
---|
494 |
|
---|
495 | dprintf(("USER32: GetInternalWindowPos(%08xh,%08xh,%08xh)\n",
|
---|
496 | hwnd,
|
---|
497 | rectWnd,
|
---|
498 | ptIcon));
|
---|
499 |
|
---|
500 | if (GetWindowPlacement( hwnd, &wndpl ))
|
---|
501 | {
|
---|
502 | if (rectWnd) *rectWnd = wndpl.rcNormalPosition;
|
---|
503 | if (ptIcon) *ptIcon = wndpl.ptMinPosition;
|
---|
504 | return wndpl.showCmd;
|
---|
505 | }
|
---|
506 | return 0;
|
---|
507 | }
|
---|
508 | //******************************************************************************
|
---|
509 | //******************************************************************************
|
---|
510 | BOOL WIN32API IsZoomed( HWND arg1)
|
---|
511 | {
|
---|
512 | #ifdef DEBUG
|
---|
513 | WriteLog("USER32: IsZoomed\n");
|
---|
514 | #endif
|
---|
515 | return O32_IsZoomed(arg1);
|
---|
516 | }
|
---|
517 | //******************************************************************************
|
---|
518 | //******************************************************************************
|
---|
519 | BOOL WIN32API LockWindowUpdate( HWND arg1)
|
---|
520 | {
|
---|
521 | #ifdef DEBUG
|
---|
522 | WriteLog("USER32: LockWindowUpdate\n");
|
---|
523 | #endif
|
---|
524 | return O32_LockWindowUpdate(arg1);
|
---|
525 | }
|
---|
526 | //******************************************************************************
|
---|
527 | //******************************************************************************
|
---|
528 |
|
---|
529 | #if 0
|
---|
530 | BOOL WIN32API RedrawWindow( HWND arg1, const RECT * arg2, HRGN arg3, UINT arg4)
|
---|
531 | {
|
---|
532 | BOOL rc;
|
---|
533 |
|
---|
534 | rc = O32_RedrawWindow(arg1, arg2, arg3, arg4);
|
---|
535 | #ifdef DEBUG
|
---|
536 | WriteLog("USER32: RedrawWindow %X , %X, %X, %X returned %d\n", arg1, arg2, arg3, arg4, rc);
|
---|
537 | #endif
|
---|
538 | InvalidateRect(arg1, arg2, TRUE);
|
---|
539 | UpdateWindow(arg1);
|
---|
540 | SendMessageA(arg1, WM_PAINT, 0, 0);
|
---|
541 | return(rc);
|
---|
542 | }
|
---|
543 | #endif
|
---|
544 | //******************************************************************************
|
---|
545 | //******************************************************************************
|
---|
546 | BOOL WIN32API GetWindowRect( HWND hwnd, PRECT pRect)
|
---|
547 | {
|
---|
548 | Win32BaseWindow *window;
|
---|
549 |
|
---|
550 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
551 | if(!window) {
|
---|
552 | dprintf(("GetWindowRect, window %x not found", hwnd));
|
---|
553 | return 0;
|
---|
554 | }
|
---|
555 | dprintf(("GetWindowRect %x", hwnd));
|
---|
556 | return window->GetWindowRect(pRect);
|
---|
557 | }
|
---|
558 | //******************************************************************************
|
---|
559 | //******************************************************************************
|
---|
560 | int WIN32API GetWindowTextLengthA( HWND hwnd)
|
---|
561 | {
|
---|
562 | Win32BaseWindow *window;
|
---|
563 |
|
---|
564 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
565 | if(!window) {
|
---|
566 | dprintf(("GetWindowTextLength, window %x not found", hwnd));
|
---|
567 | return 0;
|
---|
568 | }
|
---|
569 | dprintf(("GetWindowTextLength %x", hwnd));
|
---|
570 | return window->GetWindowTextLength();
|
---|
571 | }
|
---|
572 | //******************************************************************************
|
---|
573 | //******************************************************************************
|
---|
574 | int WIN32API GetWindowTextA( HWND hwnd, LPSTR lpsz, int cch)
|
---|
575 | {
|
---|
576 | Win32BaseWindow *window;
|
---|
577 | int rc;
|
---|
578 |
|
---|
579 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
580 | if(!window) {
|
---|
581 | dprintf(("GetWindowTextA, window %x not found", hwnd));
|
---|
582 | return 0;
|
---|
583 | }
|
---|
584 | rc = window->GetWindowTextA(lpsz, cch);
|
---|
585 | dprintf(("GetWindowTextA %x %s", hwnd, lpsz));
|
---|
586 | return rc;
|
---|
587 | }
|
---|
588 | //******************************************************************************
|
---|
589 | //******************************************************************************
|
---|
590 | int WIN32API GetWindowTextLengthW( HWND hwnd)
|
---|
591 | {
|
---|
592 | dprintf(("USER32: GetWindowTextLengthW\n"));
|
---|
593 | return GetWindowTextLengthA(hwnd);
|
---|
594 | }
|
---|
595 | //******************************************************************************
|
---|
596 | //******************************************************************************
|
---|
597 | int WIN32API GetWindowTextW(HWND hwnd, LPWSTR lpsz, int cch)
|
---|
598 | {
|
---|
599 | Win32BaseWindow *window;
|
---|
600 |
|
---|
601 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
602 | if(!window) {
|
---|
603 | dprintf(("GetWindowTextW, window %x not found", hwnd));
|
---|
604 | return 0;
|
---|
605 | }
|
---|
606 | dprintf(("GetWindowTextW %x", hwnd));
|
---|
607 | return window->GetWindowTextW(lpsz, cch);
|
---|
608 | }
|
---|
609 | //******************************************************************************
|
---|
610 | //******************************************************************************
|
---|
611 | BOOL WIN32API SetWindowTextA(HWND hwnd, LPCSTR lpsz)
|
---|
612 | {
|
---|
613 | Win32BaseWindow *window;
|
---|
614 |
|
---|
615 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
616 | if(!window) {
|
---|
617 | dprintf(("SetWindowTextA, window %x not found", hwnd));
|
---|
618 | return 0;
|
---|
619 | }
|
---|
620 | dprintf(("SetWindowTextA %x %s", hwnd, lpsz));
|
---|
621 | return window->SetWindowTextA((LPSTR)lpsz);
|
---|
622 | }
|
---|
623 | //******************************************************************************
|
---|
624 | //******************************************************************************
|
---|
625 | BOOL WIN32API SetWindowTextW( HWND hwnd, LPCWSTR lpsz)
|
---|
626 | {
|
---|
627 | Win32BaseWindow *window;
|
---|
628 |
|
---|
629 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
630 | if(!window) {
|
---|
631 | dprintf(("SetWindowTextA, window %x not found", hwnd));
|
---|
632 | return 0;
|
---|
633 | }
|
---|
634 | dprintf(("SetWindowTextW %x", hwnd));
|
---|
635 | return window->SetWindowTextW((LPWSTR)lpsz);
|
---|
636 | }
|
---|
637 | /*******************************************************************
|
---|
638 | * InternalGetWindowText (USER32.326)
|
---|
639 | */
|
---|
640 | int WIN32API InternalGetWindowText(HWND hwnd,
|
---|
641 | LPWSTR lpString,
|
---|
642 | INT nMaxCount )
|
---|
643 | {
|
---|
644 | dprintf(("USER32: InternalGetWindowText(%08xh,%08xh,%08xh) not properly implemented.\n",
|
---|
645 | hwnd,
|
---|
646 | lpString,
|
---|
647 | nMaxCount));
|
---|
648 |
|
---|
649 | return GetWindowTextW(hwnd,lpString,nMaxCount);
|
---|
650 | }
|
---|
651 | //******************************************************************************
|
---|
652 | //TODO: Correct?
|
---|
653 | //******************************************************************************
|
---|
654 | BOOL WIN32API SetForegroundWindow(HWND hwnd)
|
---|
655 | {
|
---|
656 | dprintf((" SetForegroundWindow %x", hwnd));
|
---|
657 |
|
---|
658 | return SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER );
|
---|
659 | }
|
---|
660 | //******************************************************************************
|
---|
661 | //******************************************************************************
|
---|
662 | BOOL WIN32API GetClientRect( HWND hwnd, PRECT pRect)
|
---|
663 | {
|
---|
664 | BOOL rc;
|
---|
665 |
|
---|
666 | hwnd = Win32BaseWindow::Win32ToOS2Handle(hwnd);
|
---|
667 | rc = OSLibWinQueryWindowRect(hwnd, pRect);
|
---|
668 | dprintf(("USER32: GetClientRect of %X returned (%d,%d) (%d,%d)\n", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom));
|
---|
669 | return rc;
|
---|
670 | }
|
---|
671 | //******************************************************************************
|
---|
672 | //******************************************************************************
|
---|
673 | BOOL WIN32API AdjustWindowRect( PRECT arg1, DWORD arg2, BOOL arg3)
|
---|
674 | {
|
---|
675 | #ifdef DEBUG
|
---|
676 | WriteLog("USER32: AdjustWindowRect\n");
|
---|
677 | #endif
|
---|
678 | return O32_AdjustWindowRect(arg1, arg2, arg3);
|
---|
679 | }
|
---|
680 | //******************************************************************************
|
---|
681 | //******************************************************************************
|
---|
682 | BOOL WIN32API AdjustWindowRectEx( PRECT arg1, DWORD arg2, BOOL arg3, DWORD arg4)
|
---|
683 | {
|
---|
684 | #ifdef DEBUG
|
---|
685 | WriteLog("USER32: AdjustWindowRectEx\n");
|
---|
686 | #endif
|
---|
687 | return O32_AdjustWindowRectEx(arg1, arg2, arg3, arg4);
|
---|
688 | }
|
---|
689 | //******************************************************************************
|
---|
690 | //******************************************************************************
|
---|
691 | HWND WIN32API GetDesktopWindow(void)
|
---|
692 | {
|
---|
693 | dprintf(("USER32: GetDesktopWindow\n"));
|
---|
694 | return windowDesktop->getWindowHandle();
|
---|
695 | }
|
---|
696 | //******************************************************************************
|
---|
697 | //******************************************************************************
|
---|
698 | HWND WIN32API FindWindowA(LPCSTR lpszClass, LPCSTR lpszWindow)
|
---|
699 | {
|
---|
700 | if(!lpszClass) {
|
---|
701 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
702 | return 0;
|
---|
703 | }
|
---|
704 | if(HIWORD(lpszClass)) {
|
---|
705 | dprintf(("USER32: FindWindow %s %s\n", lpszClass, lpszWindow));
|
---|
706 | }
|
---|
707 | else dprintf(("USER32: FindWindow %x %s\n", lpszClass, lpszWindow));
|
---|
708 |
|
---|
709 | return Win32BaseWindow::FindWindowEx(OSLIB_HWND_DESKTOP, 0, (LPSTR)lpszClass, (LPSTR)lpszWindow);
|
---|
710 | }
|
---|
711 | //******************************************************************************
|
---|
712 | //******************************************************************************
|
---|
713 | HWND WIN32API FindWindowExA(HWND hwndParent, HWND hwndChildAfter, LPCSTR lpszClass, LPCSTR lpszWindow)
|
---|
714 | {
|
---|
715 | if(!lpszClass) {
|
---|
716 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
717 | return 0;
|
---|
718 | }
|
---|
719 | if(HIWORD(lpszClass)) {
|
---|
720 | dprintf(("USER32: FindWindowExA (%x,%x) %s %s\n", hwndParent, hwndChildAfter, lpszClass, lpszWindow));
|
---|
721 | }
|
---|
722 | else dprintf(("USER32: FindWindowExA (%x,%x)%x %s\n", hwndParent, hwndChildAfter, lpszClass, lpszWindow));
|
---|
723 |
|
---|
724 | return Win32BaseWindow::FindWindowEx(hwndParent, hwndChildAfter, (LPSTR)lpszClass, (LPSTR)lpszWindow);
|
---|
725 | }
|
---|
726 | /*****************************************************************************
|
---|
727 | * Name : HWND WIN32API FindWindowExW
|
---|
728 | * Purpose : The FindWindowEx function retrieves the handle of a window whose
|
---|
729 | * class name and window name match the specified strings. The
|
---|
730 | * function searches child windows, beginning with the one following
|
---|
731 | * the given child window.
|
---|
732 | * Parameters: HWND hwndParent handle of parent window
|
---|
733 | * HWND hwndChildAfter handle of a child window
|
---|
734 | * LPCTSTR lpszClass address of class name
|
---|
735 | * LPCTSTR lpszWindow address of window name
|
---|
736 | * Variables :
|
---|
737 | * Result : If the function succeeds, the return value is the handle of the
|
---|
738 | * window that has the specified class and window names.
|
---|
739 | * If the function fails, the return value is NULL. To get extended
|
---|
740 | * error information, call GetLastError.
|
---|
741 | * Remark :
|
---|
742 | * Status : UNTESTED STUB
|
---|
743 | *
|
---|
744 | * Author : Patrick Haller [Thu, 1998/02/26 11:55]
|
---|
745 | *****************************************************************************/
|
---|
746 |
|
---|
747 | HWND WIN32API FindWindowExW(HWND hwndParent,
|
---|
748 | HWND hwndChildAfter,
|
---|
749 | LPCWSTR lpszClass,
|
---|
750 | LPCWSTR lpszWindow)
|
---|
751 | {
|
---|
752 | if(!lpszClass) {
|
---|
753 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
754 | return 0;
|
---|
755 | }
|
---|
756 | dprintf(("USER32: FindWindowExW (%x,%x) %x %s\n", hwndParent, hwndChildAfter, lpszClass, lpszWindow));
|
---|
757 |
|
---|
758 | return Win32BaseWindow::FindWindowEx(hwndParent, hwndChildAfter, (LPSTR)lpszClass, (LPSTR)lpszWindow);
|
---|
759 | }
|
---|
760 | //******************************************************************************
|
---|
761 | //******************************************************************************
|
---|
762 | BOOL WIN32API FlashWindow(HWND hwnd, BOOL fFlash)
|
---|
763 | {
|
---|
764 | dprintf(("FlashWindow %x %d\n", hwnd, fFlash));
|
---|
765 | return OSLibWinFlashWindow(Win32BaseWindow::Win32ToOS2Handle(hwnd), fFlash);
|
---|
766 | }
|
---|
767 | //******************************************************************************
|
---|
768 | //******************************************************************************
|
---|
769 | BOOL WIN32API MoveWindow( HWND hwnd, INT x, INT y, INT cx, INT cy,
|
---|
770 | BOOL repaint )
|
---|
771 | {
|
---|
772 | int flags = SWP_NOZORDER | SWP_NOACTIVATE;
|
---|
773 |
|
---|
774 | if (!repaint) flags |= SWP_NOREDRAW;
|
---|
775 | dprintf(("MoveWindow: %04x %d,%d %dx%d %d\n", hwnd, x, y, cx, cy, repaint ));
|
---|
776 |
|
---|
777 | return SetWindowPos( hwnd, 0, x, y, cx, cy, flags );
|
---|
778 | }
|
---|
779 | //******************************************************************************
|
---|
780 | //******************************************************************************
|
---|
781 | BOOL WIN32API ClientToScreen (HWND hwnd, PPOINT pt)
|
---|
782 | {
|
---|
783 | #ifdef DEBUG
|
---|
784 | WriteLog("USER32: ClientToScreen\n");
|
---|
785 | #endif
|
---|
786 | Win32BaseWindow *wnd;
|
---|
787 | PRECT rcl;
|
---|
788 |
|
---|
789 | if (!hwnd) return (TRUE);
|
---|
790 | wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
|
---|
791 | if (!wnd) return (TRUE);
|
---|
792 |
|
---|
793 | rcl = wnd->getClientRect();
|
---|
794 | pt->y = (rcl->bottom - rcl->top) - pt->y;
|
---|
795 | OSLibWinMapWindowPoints (wnd->getOS2WindowHandle(), OSLIB_HWND_DESKTOP, (OSLIBPOINT *)pt, 1);
|
---|
796 | pt->y = ScreenHeight - pt->y;
|
---|
797 | return (TRUE);
|
---|
798 | }
|
---|
799 | //******************************************************************************
|
---|
800 | //******************************************************************************
|
---|
801 | HDWP WIN32API BeginDeferWindowPos( int arg1)
|
---|
802 | {
|
---|
803 | #ifdef DEBUG
|
---|
804 | WriteLog("USER32: BeginDeferWindowPos\n");
|
---|
805 | #endif
|
---|
806 | return O32_BeginDeferWindowPos(arg1);
|
---|
807 | }
|
---|
808 | //******************************************************************************
|
---|
809 | //******************************************************************************
|
---|
810 | HDWP WIN32API DeferWindowPos( HDWP arg1, HWND arg2, HWND arg3, int arg4, int arg5, int arg6, int arg7, UINT arg8)
|
---|
811 | {
|
---|
812 | #ifdef DEBUG
|
---|
813 | WriteLog("USER32: DeferWindowPos\n");
|
---|
814 | #endif
|
---|
815 | return O32_DeferWindowPos(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
|
---|
816 | }
|
---|
817 | //******************************************************************************
|
---|
818 | //******************************************************************************
|
---|
819 | HWND WIN32API ChildWindowFromPoint( HWND arg1, POINT arg2)
|
---|
820 | {
|
---|
821 | #ifdef DEBUG
|
---|
822 | WriteLog("USER32: ChildWindowFromPoint\n");
|
---|
823 | #endif
|
---|
824 | return O32_ChildWindowFromPoint(arg1, arg2);
|
---|
825 | }
|
---|
826 | //******************************************************************************
|
---|
827 | //******************************************************************************
|
---|
828 | /*****************************************************************************
|
---|
829 | * Name : HWND WIN32API ChildWindowFromPointEx
|
---|
830 | * Purpose : The GetWindowRect function retrieves the dimensions of the
|
---|
831 | * bounding rectangle of the specified window. The dimensions are
|
---|
832 | * given in screen coordinates that are relative to the upper-left
|
---|
833 | * corner of the screen.
|
---|
834 | * Parameters:
|
---|
835 | * Variables :
|
---|
836 | * Result : If the function succeeds, the return value is the window handle.
|
---|
837 | * If the function fails, the return value is zero
|
---|
838 | * Remark :
|
---|
839 | * Status : FULLY IMPLEMENTED AND TESTED
|
---|
840 | *
|
---|
841 | * Author : Rene Pronk [Sun, 1999/08/08 23:30]
|
---|
842 | *****************************************************************************/
|
---|
843 |
|
---|
844 | HWND WIN32API ChildWindowFromPointEx (HWND hwndParent, POINT pt, UINT uFlags)
|
---|
845 | {
|
---|
846 | RECT rect;
|
---|
847 | HWND hWnd;
|
---|
848 | POINT absolutePt;
|
---|
849 |
|
---|
850 | dprintf(("USER32: ChildWindowFromPointEx(%08xh,%08xh,%08xh).\n",
|
---|
851 | hwndParent, pt, uFlags));
|
---|
852 |
|
---|
853 | if (GetWindowRect (hwndParent, &rect) == 0) {
|
---|
854 | // oops, invalid handle
|
---|
855 | return NULL;
|
---|
856 | }
|
---|
857 |
|
---|
858 | // absolutePt has its top in the upper-left corner of the screen
|
---|
859 | absolutePt = pt;
|
---|
860 | ClientToScreen (hwndParent, &absolutePt);
|
---|
861 |
|
---|
862 | // make rect the size of the parent window
|
---|
863 | GetWindowRect (hwndParent, &rect);
|
---|
864 | rect.right = rect.right - rect.left;
|
---|
865 | rect.bottom = rect.bottom - rect.top;
|
---|
866 | rect.left = 0;
|
---|
867 | rect.top = 0;
|
---|
868 |
|
---|
869 | if (PtInRect (&rect, pt) == 0) {
|
---|
870 | // point is outside window
|
---|
871 | return NULL;
|
---|
872 | }
|
---|
873 |
|
---|
874 | // get first child
|
---|
875 | hWnd = GetWindow (hwndParent, GW_CHILD);
|
---|
876 |
|
---|
877 | while (hWnd != NULL) {
|
---|
878 |
|
---|
879 | // do I need to skip this window?
|
---|
880 | if (((uFlags & CWP_SKIPINVISIBLE) &&
|
---|
881 | (IsWindowVisible (hWnd) == FALSE)) ||
|
---|
882 | ((uFlags & CWP_SKIPDISABLED) &&
|
---|
883 | (IsWindowEnabled (hWnd) == FALSE)) ||
|
---|
884 | ((uFlags & CWP_SKIPTRANSPARENT) &&
|
---|
885 | (GetWindowLongA (hWnd, GWL_EXSTYLE) & WS_EX_TRANSPARENT)))
|
---|
886 |
|
---|
887 | {
|
---|
888 | hWnd = GetWindow (hWnd, GW_HWNDNEXT);
|
---|
889 | continue;
|
---|
890 | }
|
---|
891 |
|
---|
892 | // is the point in this window's rect?
|
---|
893 | GetWindowRect (hWnd, &rect);
|
---|
894 | if (PtInRect (&rect, absolutePt) == FALSE) {
|
---|
895 | hWnd = GetWindow (hWnd, GW_HWNDNEXT);
|
---|
896 | continue;
|
---|
897 | }
|
---|
898 |
|
---|
899 | // found it!
|
---|
900 | return hWnd;
|
---|
901 | }
|
---|
902 |
|
---|
903 | // the point is in the parentwindow but the parentwindow has no child
|
---|
904 | // at this coordinate
|
---|
905 | return hwndParent;
|
---|
906 | }
|
---|
907 | //******************************************************************************
|
---|
908 | //******************************************************************************
|
---|
909 | BOOL WIN32API CloseWindow(HWND hwnd)
|
---|
910 | {
|
---|
911 | Win32BaseWindow *window;
|
---|
912 |
|
---|
913 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
914 | if(!window) {
|
---|
915 | dprintf(("CloseWindow, window %x not found", hwnd));
|
---|
916 | return 0;
|
---|
917 | }
|
---|
918 | dprintf(("CloseWindow %x\n", hwnd));
|
---|
919 | return window->CloseWindow();
|
---|
920 | }
|
---|
921 | //******************************************************************************
|
---|
922 | //TODO: Does this return handles of hidden or disabled windows?
|
---|
923 | //******************************************************************************
|
---|
924 | HWND WIN32API WindowFromPoint( POINT point)
|
---|
925 | {
|
---|
926 | HWND hwnd;
|
---|
927 |
|
---|
928 | dprintf(("WindowFromPoint (%d,%d)\n", point.x, point.y));
|
---|
929 | hwnd = OSLibWinWindowFromPoint(OSLIB_HWND_DESKTOP, (PVOID)&point);
|
---|
930 | if(hwnd) {
|
---|
931 | return Win32BaseWindow::OS2ToWin32Handle(hwnd);
|
---|
932 | }
|
---|
933 | return 0;
|
---|
934 | }
|
---|
935 | //******************************************************************************
|
---|
936 | //******************************************************************************
|
---|
937 | BOOL WIN32API IsWindowUnicode(HWND hwnd)
|
---|
938 | {
|
---|
939 | Win32BaseWindow *window;
|
---|
940 |
|
---|
941 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
942 | if(!window) {
|
---|
943 | dprintf(("IsWindowUnicode, window %x not found", hwnd));
|
---|
944 | return 0;
|
---|
945 | }
|
---|
946 | return window->IsUnicode();
|
---|
947 | }
|
---|
948 | /*****************************************************************************
|
---|
949 | * Name : WORD WIN32API CascadeWindows
|
---|
950 | * Purpose : The CascadeWindows function cascades the specified windows or
|
---|
951 | * the child windows of the specified parent window.
|
---|
952 | * Parameters: HWND hwndParent handle of parent window
|
---|
953 | * UINT wHow types of windows not to arrange
|
---|
954 | * CONST RECT * lpRect rectangle to arrange windows in
|
---|
955 | * UINT cKids number of windows to arrange
|
---|
956 | * const HWND FAR * lpKids array of window handles
|
---|
957 | * Variables :
|
---|
958 | * Result : If the function succeeds, the return value is the number of windows arranged.
|
---|
959 | * If the function fails, the return value is zero.
|
---|
960 | * Remark :
|
---|
961 | * Status : UNTESTED STUB
|
---|
962 | *
|
---|
963 | * Author : Patrick Haller [Thu, 1998/02/26 11:55]
|
---|
964 | *****************************************************************************/
|
---|
965 |
|
---|
966 | WORD WIN32API CascadeWindows(HWND hwndParent,
|
---|
967 | UINT wHow,
|
---|
968 | CONST LPRECT lpRect,
|
---|
969 | UINT cKids,
|
---|
970 | const HWND *lpKids)
|
---|
971 | {
|
---|
972 | dprintf(("USER32:CascadeWindows(%08xh,%u,%08xh,%u,%08x) not implemented.\n",
|
---|
973 | hwndParent,
|
---|
974 | wHow,
|
---|
975 | lpRect,
|
---|
976 | cKids,
|
---|
977 | lpKids));
|
---|
978 |
|
---|
979 | return (0);
|
---|
980 | }
|
---|
981 | /*****************************************************************************
|
---|
982 | * Name : BOOL WIN32API SwitchToThisWindow
|
---|
983 | * Purpose : Unknown
|
---|
984 | * Parameters: Unknown
|
---|
985 | * Variables :
|
---|
986 | * Result :
|
---|
987 | * Remark :
|
---|
988 | * Status : UNTESTED UNKNOWN STUB
|
---|
989 | *
|
---|
990 | * Author : Patrick Haller [Wed, 1998/06/16 11:55]
|
---|
991 | *****************************************************************************/
|
---|
992 |
|
---|
993 | BOOL WIN32API SwitchToThisWindow(HWND hwnd,
|
---|
994 | BOOL x2)
|
---|
995 | {
|
---|
996 | dprintf(("USER32: SwitchToThisWindow(%08xh,%08xh) not implemented.\n",
|
---|
997 | hwnd,
|
---|
998 | x2));
|
---|
999 |
|
---|
1000 | return (FALSE); /* default */
|
---|
1001 | }
|
---|
1002 | //******************************************************************************
|
---|
1003 | //******************************************************************************
|
---|
1004 | BOOL WIN32API EnumThreadWindows(DWORD dwThreadId, WNDENUMPROC lpfn, LPARAM lParam)
|
---|
1005 | {
|
---|
1006 | Win32BaseWindow *window;
|
---|
1007 | BOOL rc;
|
---|
1008 | ULONG henum;
|
---|
1009 | HWND hwndNext;
|
---|
1010 | ULONG tid;
|
---|
1011 | ULONG pid, curpid;
|
---|
1012 |
|
---|
1013 | dprintf(("EnumThreadWindows\n"));
|
---|
1014 |
|
---|
1015 | curpid = GetCurrentProcessId();
|
---|
1016 |
|
---|
1017 | henum = OSLibWinBeginEnumWindows(OSLIB_HWND_DESKTOP);
|
---|
1018 | while ((hwndNext = OSLibWinGetNextWindow(henum)) != 0)
|
---|
1019 | {
|
---|
1020 | OSLibWinQueryWindowProcess(hwndNext, &pid, &tid);
|
---|
1021 | if(!(curpid == pid && dwThreadId == tid))
|
---|
1022 | continue;
|
---|
1023 |
|
---|
1024 | window = Win32BaseWindow::GetWindowFromHandle(hwndNext);
|
---|
1025 | if(window == NULL) {
|
---|
1026 | //OS/2 window or non-frame window, so skip it
|
---|
1027 | continue;
|
---|
1028 | }
|
---|
1029 | if((rc = lpfn(window->getWindowHandle(), lParam)) == FALSE)
|
---|
1030 | break;
|
---|
1031 | }
|
---|
1032 | OSLibWinEndEnumWindows (henum);
|
---|
1033 | return TRUE;
|
---|
1034 | }
|
---|
1035 | //******************************************************************************
|
---|
1036 | //******************************************************************************
|
---|
1037 | BOOL WIN32API EnumChildWindows(HWND hwnd, WNDENUMPROC lpfn, LPARAM lParam)
|
---|
1038 | {
|
---|
1039 | Win32BaseWindow *window, *parentwindow;
|
---|
1040 | BOOL rc = TRUE;
|
---|
1041 | ULONG henum;
|
---|
1042 | HWND hwndNext;
|
---|
1043 |
|
---|
1044 | dprintf(("EnumChildWindows %x %x\n", hwnd, lParam));
|
---|
1045 |
|
---|
1046 | parentwindow = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
---|
1047 | if(!parentwindow) {
|
---|
1048 | dprintf(("EnumChildWindows, window %x not found", hwnd));
|
---|
1049 | return FALSE;
|
---|
1050 | }
|
---|
1051 |
|
---|
1052 | henum = OSLibWinBeginEnumWindows(OSLIB_HWND_DESKTOP);
|
---|
1053 | while ((hwndNext = OSLibWinGetNextWindow(henum)) != 0)
|
---|
1054 | {
|
---|
1055 | window = Win32BaseWindow::GetWindowFromHandle(hwndNext);
|
---|
1056 | if(window == NULL) {
|
---|
1057 | //OS/2 window or non-frame window, so skip it
|
---|
1058 | continue;
|
---|
1059 | }
|
---|
1060 | if((rc = lpfn(window->getWindowHandle(), lParam)) == FALSE)
|
---|
1061 | {
|
---|
1062 | rc = FALSE;
|
---|
1063 | break;
|
---|
1064 | }
|
---|
1065 | }
|
---|
1066 | OSLibWinEndEnumWindows(henum);
|
---|
1067 | return rc;
|
---|
1068 | }
|
---|
1069 | //******************************************************************************
|
---|
1070 | //******************************************************************************
|
---|
1071 | BOOL WIN32API EnumWindows(WNDENUMPROC lpfn, LPARAM lParam)
|
---|
1072 | {
|
---|
1073 | Win32BaseWindow *window;
|
---|
1074 | BOOL rc;
|
---|
1075 | ULONG henum;
|
---|
1076 | HWND hwndNext, hwndParent = OSLIB_HWND_DESKTOP;
|
---|
1077 |
|
---|
1078 | dprintf(("EnumThreadWindows\n"));
|
---|
1079 |
|
---|
1080 | do {
|
---|
1081 | henum = OSLibWinBeginEnumWindows(hwndParent);
|
---|
1082 | while ((hwndNext = OSLibWinGetNextWindow(henum)) != 0)
|
---|
1083 | {
|
---|
1084 | window = Win32BaseWindow::GetWindowFromHandle(hwndNext);
|
---|
1085 | if(window == NULL) {
|
---|
1086 | //OS/2 window or non-frame window, so skip it
|
---|
1087 | continue;
|
---|
1088 | }
|
---|
1089 | if((rc = lpfn(window->getWindowHandle(), lParam)) == FALSE) {
|
---|
1090 | goto Abort;
|
---|
1091 | }
|
---|
1092 | }
|
---|
1093 | if(hwndParent == OSLIB_HWND_OBJECT)
|
---|
1094 | break;
|
---|
1095 | hwndParent = OSLIB_HWND_OBJECT;
|
---|
1096 | OSLibWinEndEnumWindows(henum);
|
---|
1097 | }
|
---|
1098 | while(TRUE);
|
---|
1099 |
|
---|
1100 | Abort:
|
---|
1101 | OSLibWinEndEnumWindows(henum);
|
---|
1102 | return TRUE;
|
---|
1103 | }
|
---|
1104 | //******************************************************************************
|
---|
1105 | //******************************************************************************
|
---|
1106 | #if 0
|
---|
1107 | BOOL WIN32API GetUpdateRect( HWND hwnd, PRECT lpRect, BOOL bErase)
|
---|
1108 | {
|
---|
1109 | dprintf(("GetUpdateRect %x %d\n", hwnd, bErase));
|
---|
1110 | if (!lpRect) return FALSE;
|
---|
1111 |
|
---|
1112 | return OSLibWinQueryUpdateRect(Win32BaseWindow::Win32ToOS2Handle(hwnd), lpRect);
|
---|
1113 | }
|
---|
1114 | #endif
|
---|
1115 | //******************************************************************************
|
---|
1116 | //******************************************************************************
|
---|
1117 | #if 0
|
---|
1118 | BOOL WIN32API InvalidateRect(HWND hWnd, const RECT *lpRect, BOOL bErase)
|
---|
1119 | {
|
---|
1120 | #ifdef DEBUG
|
---|
1121 | if(lpRect)
|
---|
1122 | WriteLog("USER32: InvalidateRect for window %X (%d,%d)(%d,%d) %d\n", hWnd, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, bErase);
|
---|
1123 | else WriteLog("USER32: InvalidateRect for window %X NULL, %d\n", hWnd, bErase);
|
---|
1124 | #endif
|
---|
1125 |
|
---|
1126 | //CB: bErase no quite the same
|
---|
1127 | hWnd = Win32BaseWindow::Win32ToOS2Handle(hWnd);
|
---|
1128 | if (lpRect)
|
---|
1129 | {
|
---|
1130 | return OSLibWinInvalidateRect(hWnd, (PRECT)lpRect, bErase);
|
---|
1131 | }
|
---|
1132 | else return OSLibWinInvalidateRect(hWnd,NULL,bErase);
|
---|
1133 | }
|
---|
1134 | #endif
|
---|
1135 | //******************************************************************************
|
---|
1136 | //******************************************************************************
|
---|
1137 | UINT WIN32API ArrangeIconicWindows( HWND arg1)
|
---|
1138 | {
|
---|
1139 | #ifdef DEBUG
|
---|
1140 | WriteLog("USER32: ArrangeIconicWindows\n");
|
---|
1141 | #endif
|
---|
1142 | return O32_ArrangeIconicWindows(arg1);
|
---|
1143 | }
|
---|
1144 | //******************************************************************************
|
---|
1145 | //restores iconized window to previous size/position
|
---|
1146 | //******************************************************************************
|
---|
1147 | BOOL WIN32API OpenIcon(HWND hwnd)
|
---|
1148 | {
|
---|
1149 | #ifdef DEBUG
|
---|
1150 | WriteLog("USER32: OpenIcon\n");
|
---|
1151 | #endif
|
---|
1152 | if(!IsIconic(hwnd))
|
---|
1153 | return FALSE;
|
---|
1154 | ShowWindow(hwnd, SW_SHOWNORMAL);
|
---|
1155 | return TRUE;
|
---|
1156 | }
|
---|
1157 | //******************************************************************************
|
---|
1158 | //******************************************************************************
|
---|
1159 | BOOL WIN32API ShowOwnedPopups( HWND arg1, BOOL arg2)
|
---|
1160 | {
|
---|
1161 | dprintf(("USER32: ShowOwnedPopups\n"));
|
---|
1162 | return O32_ShowOwnedPopups(arg1, arg2);
|
---|
1163 | }
|
---|
1164 | //******************************************************************************
|
---|
1165 | //******************************************************************************
|
---|
1166 |
|
---|