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