1 | /* $Id: win32wbase.cpp,v 1.163 2000-02-16 14:28:22 sandervl Exp $ */
|
---|
2 | /*
|
---|
3 | * Win32 Window Base Class for OS/2
|
---|
4 | *
|
---|
5 | * Copyright 1998-2000 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
6 | * Copyright 1999 Daniela Engert (dani@ngrt.de)
|
---|
7 | * Copyright 1999-2000 Christoph Bratschi (cbratschi@datacomm.ch)
|
---|
8 | *
|
---|
9 | * Parts based on Wine Windows code (windows\win.c)
|
---|
10 | *
|
---|
11 | * Copyright 1993, 1994, 1996 Alexandre Julliard
|
---|
12 | * 1995 Alex Korobka
|
---|
13 | *
|
---|
14 | * TODO: Not thread/process safe
|
---|
15 | *
|
---|
16 | * NOTE: Client rectangle always relative to frame window; window rectangle in screen coordinates
|
---|
17 | *
|
---|
18 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
19 | *
|
---|
20 | */
|
---|
21 | #include <os2win.h>
|
---|
22 | #include <win.h>
|
---|
23 | #include <stdlib.h>
|
---|
24 | #include <string.h>
|
---|
25 | #include <stdarg.h>
|
---|
26 | #include <assert.h>
|
---|
27 | #include <misc.h>
|
---|
28 | #include <heapstring.h>
|
---|
29 | #include <win32wbase.h>
|
---|
30 | #include <winres.h>
|
---|
31 | #include "wndmsg.h"
|
---|
32 | #include "oslibwin.h"
|
---|
33 | #include "oslibmsg.h"
|
---|
34 | #include "oslibutil.h"
|
---|
35 | #include "oslibgdi.h"
|
---|
36 | #include "oslibres.h"
|
---|
37 | #include "oslibdos.h"
|
---|
38 | #include "syscolor.h"
|
---|
39 | #include "win32wndhandle.h"
|
---|
40 | #include "dc.h"
|
---|
41 | #include "pmframe.h"
|
---|
42 | #include "win32wdesktop.h"
|
---|
43 | #include "pmwindow.h"
|
---|
44 | #include "controls.h"
|
---|
45 | #include <wprocess.h>
|
---|
46 | #include "winmouse.h"
|
---|
47 | #include <win\hook.h>
|
---|
48 | #include <menu.h>
|
---|
49 | #define INCL_TIMERWIN32
|
---|
50 | #include "timer.h"
|
---|
51 |
|
---|
52 | #define DBG_LOCALLOG DBG_win32wbase
|
---|
53 | #include "dbglocal.h"
|
---|
54 |
|
---|
55 | #define SC_ABOUTWINE (SC_SCREENSAVE+1)
|
---|
56 | #define SC_PUTMARK (SC_SCREENSAVE+2)
|
---|
57 |
|
---|
58 | /* bits in the dwKeyData */
|
---|
59 | #define KEYDATA_ALT 0x2000
|
---|
60 | #define KEYDATA_PREVSTATE 0x4000
|
---|
61 |
|
---|
62 | void PrintWindowStyle(DWORD dwStyle, DWORD dwExStyle);
|
---|
63 |
|
---|
64 | static fDestroyAll = FALSE;
|
---|
65 | //For quick lookup of current process id
|
---|
66 | static ULONG currentProcessId = -1;
|
---|
67 |
|
---|
68 | //******************************************************************************
|
---|
69 | //******************************************************************************
|
---|
70 | Win32BaseWindow::Win32BaseWindow(DWORD objType) : GenericObject(&windows, objType)
|
---|
71 | {
|
---|
72 | Init();
|
---|
73 | }
|
---|
74 | //******************************************************************************
|
---|
75 | //******************************************************************************
|
---|
76 | Win32BaseWindow::Win32BaseWindow(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode)
|
---|
77 | : GenericObject(&windows, OBJTYPE_WINDOW), ChildWindow()
|
---|
78 | {
|
---|
79 | Init();
|
---|
80 | this->isUnicode = isUnicode;
|
---|
81 | CreateWindowExA(lpCreateStructA, classAtom);
|
---|
82 | }
|
---|
83 | //******************************************************************************
|
---|
84 | //******************************************************************************
|
---|
85 | void Win32BaseWindow::Init()
|
---|
86 | {
|
---|
87 | isUnicode = FALSE;
|
---|
88 | fFirstShow = TRUE;
|
---|
89 | fIsDialog = FALSE;
|
---|
90 | fIsModalDialogOwner = FALSE;
|
---|
91 | OS2HwndModalDialog = 0;
|
---|
92 | fInternalMsg = FALSE;
|
---|
93 | fNoSizeMsg = FALSE;
|
---|
94 | fIsDestroyed = FALSE;
|
---|
95 | fDestroyWindowCalled = FALSE;
|
---|
96 | fCreated = FALSE;
|
---|
97 | fTaskList = FALSE;
|
---|
98 | fParentDC = FALSE;
|
---|
99 |
|
---|
100 | windowNameA = NULL;
|
---|
101 | windowNameW = NULL;
|
---|
102 | wndNameLength = 0;
|
---|
103 |
|
---|
104 | userWindowLong = NULL;;
|
---|
105 | nrUserWindowLong = 0;
|
---|
106 |
|
---|
107 | magic = WIN32PM_MAGIC;
|
---|
108 | OS2Hwnd = 0;
|
---|
109 | OS2HwndFrame = 0;
|
---|
110 | hSysMenu = 0;
|
---|
111 | Win32Hwnd = 0;
|
---|
112 |
|
---|
113 | if(HwAllocateWindowHandle(&Win32Hwnd, (ULONG)this) == FALSE)
|
---|
114 | {
|
---|
115 | dprintf(("Win32BaseWindow::Init HwAllocateWindowHandle failed!!"));
|
---|
116 | DebugInt3();
|
---|
117 | }
|
---|
118 |
|
---|
119 | posx = posy = 0;
|
---|
120 | width = height = 0;
|
---|
121 |
|
---|
122 | dwExStyle = 0;
|
---|
123 | dwStyle = 0;
|
---|
124 | win32wndproc = 0;
|
---|
125 | hInstance = 0;
|
---|
126 | dwIDMenu = 0; //0xFFFFFFFF; //default -1
|
---|
127 | userData = 0;
|
---|
128 | contextHelpId = 0;
|
---|
129 | hotkey = 0;
|
---|
130 |
|
---|
131 | pOldFrameProc = NULL;
|
---|
132 |
|
---|
133 | hwndLinkAfter = HWND_BOTTOM;
|
---|
134 | flags = 0;
|
---|
135 | isIcon = FALSE;
|
---|
136 | lastHitTestVal = HTOS_NORMAL;
|
---|
137 | owner = NULL;
|
---|
138 | windowClass = 0;
|
---|
139 |
|
---|
140 | iconResource = NULL;
|
---|
141 |
|
---|
142 | EraseBkgndFlag = TRUE;
|
---|
143 | PSEraseFlag = FALSE;
|
---|
144 | SuppressEraseFlag = FALSE;
|
---|
145 |
|
---|
146 | horzScrollInfo = NULL;
|
---|
147 | vertScrollInfo = NULL;
|
---|
148 |
|
---|
149 | ownDC = 0;
|
---|
150 | hWindowRegion = 0;
|
---|
151 | hClipRegion = 0;
|
---|
152 |
|
---|
153 | if(currentProcessId == -1)
|
---|
154 | {
|
---|
155 | currentProcessId = GetCurrentProcessId();
|
---|
156 | }
|
---|
157 | dwThreadId = GetCurrentThreadId();
|
---|
158 | dwProcessId = currentProcessId;
|
---|
159 | }
|
---|
160 | //******************************************************************************
|
---|
161 | //todo get rid of resources (menu, icon etc)
|
---|
162 | //******************************************************************************
|
---|
163 | Win32BaseWindow::~Win32BaseWindow()
|
---|
164 | {
|
---|
165 | OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, 0);
|
---|
166 | OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, 0);
|
---|
167 |
|
---|
168 | if(!fDestroyAll && getParent() && getParent()->getFirstChild() == this && getNextChild() == NULL)
|
---|
169 | {
|
---|
170 | //if we're the last child that's being destroyed and our
|
---|
171 | //parent window was also destroyed, then we delete the parent object
|
---|
172 | if(getParent()->IsWindowDestroyed())
|
---|
173 | {
|
---|
174 | dprintf(("Last Child (%x) destroyed, get rid of our parent window (%x)", getWindowHandle(), getParent()->getWindowHandle()));
|
---|
175 | delete getParent();
|
---|
176 | setParent(NULL); //or else we'll crash in the dtor of the ChildWindow class
|
---|
177 | }
|
---|
178 | }
|
---|
179 | else
|
---|
180 | if(fDestroyAll) {
|
---|
181 | dprintf(("Destroying window %x %s", getWindowHandle(), windowNameA));
|
---|
182 | setParent(NULL); //or else we'll crash in the dtor of the ChildWindow class
|
---|
183 | }
|
---|
184 |
|
---|
185 | if(isOwnDC())
|
---|
186 | releaseOwnDC(ownDC);
|
---|
187 |
|
---|
188 | if(Win32Hwnd)
|
---|
189 | HwFreeWindowHandle(Win32Hwnd);
|
---|
190 |
|
---|
191 | if(userWindowLong)
|
---|
192 | free(userWindowLong);
|
---|
193 |
|
---|
194 | if(windowNameA) {
|
---|
195 | free(windowNameA);
|
---|
196 | windowNameA = NULL;
|
---|
197 | }
|
---|
198 | if(windowNameW) {
|
---|
199 | free(windowNameW);
|
---|
200 | windowNameW = NULL;
|
---|
201 | }
|
---|
202 | if(vertScrollInfo) {
|
---|
203 | free(vertScrollInfo);
|
---|
204 | vertScrollInfo = NULL;
|
---|
205 | }
|
---|
206 | if(horzScrollInfo) {
|
---|
207 | free(horzScrollInfo);
|
---|
208 | horzScrollInfo = NULL;
|
---|
209 | }
|
---|
210 | }
|
---|
211 | //******************************************************************************
|
---|
212 | //******************************************************************************
|
---|
213 | void Win32BaseWindow::DestroyAll()
|
---|
214 | {
|
---|
215 | fDestroyAll = TRUE;
|
---|
216 | GenericObject::DestroyAll(windows);
|
---|
217 | }
|
---|
218 | //******************************************************************************
|
---|
219 | //******************************************************************************
|
---|
220 | BOOL Win32BaseWindow::isChild()
|
---|
221 | {
|
---|
222 | return ((dwStyle & WS_CHILD) != 0);
|
---|
223 | }
|
---|
224 | //******************************************************************************
|
---|
225 | //******************************************************************************
|
---|
226 | BOOL Win32BaseWindow::IsWindowUnicode()
|
---|
227 | {
|
---|
228 | dprintf2(("IsWindowUnicode %x %d", getWindowHandle(), WINPROC_GetProcType(getWindowProc()) == WIN_PROC_32W));
|
---|
229 | return (WINPROC_GetProcType(getWindowProc()) == WIN_PROC_32W);
|
---|
230 | }
|
---|
231 | //******************************************************************************
|
---|
232 | //******************************************************************************
|
---|
233 | BOOL Win32BaseWindow::CreateWindowExA(CREATESTRUCTA *cs, ATOM classAtom)
|
---|
234 | {
|
---|
235 | char buffer[256];
|
---|
236 |
|
---|
237 | #ifdef DEBUG
|
---|
238 | PrintWindowStyle(cs->style, cs->dwExStyle);
|
---|
239 | #endif
|
---|
240 |
|
---|
241 | sw = SW_SHOW;
|
---|
242 | SetLastError(0);
|
---|
243 |
|
---|
244 | /* Find the parent window */
|
---|
245 | if (cs->hwndParent)
|
---|
246 | {
|
---|
247 | Win32BaseWindow *window = GetWindowFromHandle(cs->hwndParent);
|
---|
248 | if(!window) {
|
---|
249 | dprintf(("Bad parent %04x\n", cs->hwndParent ));
|
---|
250 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
251 | return FALSE;
|
---|
252 | }
|
---|
253 | /* Make sure parent is valid */
|
---|
254 | if (!window->IsWindow() )
|
---|
255 | {
|
---|
256 | dprintf(("Bad parent %04x\n", cs->hwndParent ));
|
---|
257 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
258 | return FALSE;
|
---|
259 | }
|
---|
260 | }
|
---|
261 | else
|
---|
262 | if ((cs->style & WS_CHILD) && !(cs->style & WS_POPUP)) {
|
---|
263 | dprintf(("No parent for child window\n" ));
|
---|
264 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
265 | return FALSE; /* WS_CHILD needs a parent, but WS_POPUP doesn't */
|
---|
266 | }
|
---|
267 |
|
---|
268 | /* Find the window class */
|
---|
269 | windowClass = Win32WndClass::FindClass(cs->hInstance, (LPSTR)classAtom);
|
---|
270 | if (!windowClass)
|
---|
271 | {
|
---|
272 | GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) );
|
---|
273 | dprintf(("Bad class '%s'\n", buffer ));
|
---|
274 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
275 | return 0;
|
---|
276 | }
|
---|
277 | #ifdef DEBUG
|
---|
278 | if(HIWORD(cs->lpszClass))
|
---|
279 | {
|
---|
280 | char *astring;
|
---|
281 |
|
---|
282 | if(isUnicode) astring = UnicodeToAsciiString((LPWSTR)cs->lpszClass);
|
---|
283 | else astring = (char *)cs->lpszClass;
|
---|
284 |
|
---|
285 | dprintf(("Window class %s", astring));
|
---|
286 | if(isUnicode) FreeAsciiString(astring);
|
---|
287 | }
|
---|
288 | else dprintf(("Window class %x", cs->lpszClass));
|
---|
289 | #endif
|
---|
290 |
|
---|
291 | /* Fix the lpszClass field: from existing programs, it seems ok to call a CreateWindowXXX
|
---|
292 | * with an atom as the class name, put some programs expect to have a *REAL* string in
|
---|
293 | * lpszClass when the CREATESTRUCT is sent with WM_CREATE
|
---|
294 | */
|
---|
295 | if (!HIWORD(cs->lpszClass) ) {
|
---|
296 | if (isUnicode) {
|
---|
297 | GlobalGetAtomNameW( classAtom, (LPWSTR)buffer, sizeof(buffer) );
|
---|
298 | }
|
---|
299 | else {
|
---|
300 | GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) );
|
---|
301 | }
|
---|
302 | cs->lpszClass = buffer;
|
---|
303 | }
|
---|
304 |
|
---|
305 | /* Fix the coordinates */
|
---|
306 | fXDefault = FALSE;
|
---|
307 | fCXDefault = FALSE;
|
---|
308 | if ((cs->x == CW_USEDEFAULT) || (cs->x == CW_USEDEFAULT16))
|
---|
309 | {
|
---|
310 | /* Never believe Microsoft's documentation... CreateWindowEx doc says
|
---|
311 | * that if an overlapped window is created with WS_VISIBLE style bit
|
---|
312 | * set and the x parameter is set to CW_USEDEFAULT, the system ignores
|
---|
313 | * the y parameter. However, disassembling NT implementation (WIN32K.SYS)
|
---|
314 | * reveals that
|
---|
315 | *
|
---|
316 | * 1) not only if checks for CW_USEDEFAULT but also for CW_USEDEFAULT16
|
---|
317 | * 2) it does not ignore the y parameter as the docs claim; instead, it
|
---|
318 | * uses it as second parameter to ShowWindow() unless y is either
|
---|
319 | * CW_USEDEFAULT or CW_USEDEFAULT16.
|
---|
320 | *
|
---|
321 | * The fact that we didn't do 2) caused bogus windows pop up when wine
|
---|
322 | * was running apps that were using this obscure feature. Example -
|
---|
323 | * calc.exe that comes with Win98 (only Win98, it's different from
|
---|
324 | * the one that comes with Win95 and NT)
|
---|
325 | */
|
---|
326 | if ((cs->y != CW_USEDEFAULT) && (cs->y != CW_USEDEFAULT16)) sw = cs->y;
|
---|
327 |
|
---|
328 | /* We have saved cs->y, now we can trash it */
|
---|
329 | cs->x = 0;
|
---|
330 | cs->y = 0;
|
---|
331 | fXDefault = TRUE;
|
---|
332 | }
|
---|
333 | if ((cs->cx == CW_USEDEFAULT) || (cs->cx == CW_USEDEFAULT16))
|
---|
334 | {
|
---|
335 | cs->cx = 600; /* FIXME */
|
---|
336 | cs->cy = 400;
|
---|
337 | fCXDefault = TRUE;
|
---|
338 | }
|
---|
339 | if (cs->style & (WS_POPUP | WS_CHILD))
|
---|
340 | {
|
---|
341 | fXDefault = FALSE;
|
---|
342 | if (fCXDefault)
|
---|
343 | {
|
---|
344 | fCXDefault = FALSE;
|
---|
345 | cs->cx = cs->cy = 0;
|
---|
346 | }
|
---|
347 | }
|
---|
348 | if (fXDefault && !fCXDefault) fXDefault = FALSE; //CB: only x positioning doesn't work (calc.exe,cdrlabel.exe)
|
---|
349 |
|
---|
350 | if (cs->x < 0) cs->x = 0;
|
---|
351 | if (cs->y < 0) cs->y = 0;
|
---|
352 |
|
---|
353 | //Allocate window words
|
---|
354 | nrUserWindowLong = windowClass->getExtraWndWords();
|
---|
355 | if(nrUserWindowLong) {
|
---|
356 | userWindowLong = (ULONG *)_smalloc(nrUserWindowLong);
|
---|
357 | memset(userWindowLong, 0, nrUserWindowLong);
|
---|
358 | }
|
---|
359 |
|
---|
360 | if ((cs->style & WS_CHILD) && cs->hwndParent)
|
---|
361 | {
|
---|
362 | SetParent(cs->hwndParent);
|
---|
363 | owner = GetWindowFromHandle(cs->hwndParent);
|
---|
364 | if(owner == NULL)
|
---|
365 | {
|
---|
366 | dprintf(("HwGetWindowHandleData couldn't find owner window %x!!!", cs->hwndParent));
|
---|
367 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
368 | return FALSE;
|
---|
369 | }
|
---|
370 | //SvL: Shell positioning shouldn't be done for child windows! (breaks Notes)
|
---|
371 | fXDefault = fCXDefault = FALSE;
|
---|
372 | }
|
---|
373 | else
|
---|
374 | {
|
---|
375 | SetParent(0);
|
---|
376 | if (!cs->hwndParent || (cs->hwndParent == windowDesktop->getWindowHandle())) {
|
---|
377 | owner = NULL;
|
---|
378 | }
|
---|
379 | else
|
---|
380 | {
|
---|
381 | owner = GetWindowFromHandle(cs->hwndParent)->GetTopParent();
|
---|
382 | if(owner == NULL)
|
---|
383 | {
|
---|
384 | dprintf(("HwGetWindowHandleData couldn't find owner window %x!!!", cs->hwndParent));
|
---|
385 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
386 | return FALSE;
|
---|
387 | }
|
---|
388 | }
|
---|
389 | }
|
---|
390 |
|
---|
391 | WINPROC_SetProc((HWINDOWPROC *)&win32wndproc, windowClass->getWindowProc(), WINPROC_GetProcType(windowClass->getWindowProc()), WIN_PROC_WINDOW);
|
---|
392 | hInstance = cs->hInstance;
|
---|
393 | dwStyle = cs->style & ~WS_VISIBLE;
|
---|
394 | dwExStyle = cs->dwExStyle;
|
---|
395 |
|
---|
396 | hwndLinkAfter = HWND_TOP;
|
---|
397 | if(CONTROLS_IsControl(this, BUTTON_CONTROL) && ((dwStyle & 0x0f) == BS_GROUPBOX))
|
---|
398 | {
|
---|
399 | hwndLinkAfter = HWND_BOTTOM;
|
---|
400 | dwStyle |= WS_CLIPSIBLINGS;
|
---|
401 | }
|
---|
402 | else
|
---|
403 | if(CONTROLS_IsControl(this, STATIC_CONTROL) && !(dwStyle & WS_GROUP)) {
|
---|
404 | dwStyle |= WS_CLIPSIBLINGS;
|
---|
405 | }
|
---|
406 |
|
---|
407 | /* Increment class window counter */
|
---|
408 | windowClass->IncreaseWindowCount();
|
---|
409 |
|
---|
410 | if (HOOK_IsHooked( WH_CBT ))
|
---|
411 | {
|
---|
412 | CBT_CREATEWNDA cbtc;
|
---|
413 | LRESULT ret;
|
---|
414 |
|
---|
415 | cbtc.lpcs = cs;
|
---|
416 | cbtc.hwndInsertAfter = hwndLinkAfter;
|
---|
417 | ret = HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND, getWindowHandle(), (LPARAM)&cbtc);
|
---|
418 | if(ret)
|
---|
419 | {
|
---|
420 | dprintf(("CBT-hook returned 0!!"));
|
---|
421 | SetLastError(ERROR_CAN_NOT_COMPLETE); //todo: wrong error
|
---|
422 | return FALSE;
|
---|
423 | }
|
---|
424 | }
|
---|
425 |
|
---|
426 | /* Correct the window style */
|
---|
427 | if (!(cs->style & WS_CHILD))
|
---|
428 | {
|
---|
429 | dwStyle |= WS_CLIPSIBLINGS;
|
---|
430 | if (!(cs->style & WS_POPUP))
|
---|
431 | {
|
---|
432 | dwStyle |= WS_CAPTION;
|
---|
433 | flags |= WIN_NEED_SIZE;
|
---|
434 | }
|
---|
435 | }
|
---|
436 | if (cs->dwExStyle & WS_EX_DLGMODALFRAME) dwStyle &= ~WS_THICKFRAME;
|
---|
437 |
|
---|
438 | if (cs->style & WS_HSCROLL)
|
---|
439 | {
|
---|
440 | horzScrollInfo = (SCROLLBAR_INFO*)malloc(sizeof(SCROLLBAR_INFO));
|
---|
441 | horzScrollInfo->MinVal = horzScrollInfo->CurVal = horzScrollInfo->Page = 0;
|
---|
442 | horzScrollInfo->MaxVal = 100;
|
---|
443 | horzScrollInfo->flags = ESB_ENABLE_BOTH;
|
---|
444 | }
|
---|
445 |
|
---|
446 | if (cs->style & WS_VSCROLL)
|
---|
447 | {
|
---|
448 | vertScrollInfo = (SCROLLBAR_INFO*)malloc(sizeof(SCROLLBAR_INFO));
|
---|
449 | vertScrollInfo->MinVal = vertScrollInfo->CurVal = vertScrollInfo->Page = 0;
|
---|
450 | vertScrollInfo->MaxVal = 100;
|
---|
451 | vertScrollInfo->flags = ESB_ENABLE_BOTH;
|
---|
452 | }
|
---|
453 |
|
---|
454 | if(HIWORD(cs->lpszName))
|
---|
455 | {
|
---|
456 | if (!isUnicode)
|
---|
457 | {
|
---|
458 | wndNameLength = strlen(cs->lpszName);
|
---|
459 | windowNameA = (LPSTR)_smalloc(wndNameLength+1);
|
---|
460 | strcpy(windowNameA,cs->lpszName);
|
---|
461 | windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR));
|
---|
462 | lstrcpyAtoW(windowNameW,windowNameA);
|
---|
463 | windowNameA[wndNameLength] = 0;
|
---|
464 | windowNameW[wndNameLength] = 0;
|
---|
465 | }
|
---|
466 | else
|
---|
467 | {
|
---|
468 | wndNameLength = lstrlenW((LPWSTR)cs->lpszName);
|
---|
469 | windowNameA = (LPSTR)_smalloc(wndNameLength+1);
|
---|
470 | lstrcpyWtoA(windowNameA,(LPWSTR)cs->lpszName);
|
---|
471 | windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR));
|
---|
472 | lstrcpyW(windowNameW,(LPWSTR)cs->lpszName);
|
---|
473 | windowNameA[wndNameLength] = 0;
|
---|
474 | windowNameW[wndNameLength] = 0;
|
---|
475 | }
|
---|
476 | }
|
---|
477 |
|
---|
478 | //copy pointer of CREATESTRUCT for usage in MsgCreate method
|
---|
479 | tmpcs = cs;
|
---|
480 |
|
---|
481 | //Store our window object pointer in thread local memory, so PMWINDOW.CPP can retrieve it
|
---|
482 | THDB *thdb = GetThreadTHDB();
|
---|
483 |
|
---|
484 | if(thdb == NULL) {
|
---|
485 | dprintf(("Window creation failed - thdb == NULL")); //this is VERY bad
|
---|
486 | ExitProcess(666);
|
---|
487 | return FALSE;
|
---|
488 | }
|
---|
489 |
|
---|
490 | thdb->newWindow = (ULONG)this;
|
---|
491 |
|
---|
492 | DWORD dwOSWinStyle;
|
---|
493 |
|
---|
494 | OSLibWinConvertStyle(dwStyle,dwExStyle,&dwOSWinStyle);
|
---|
495 | if (((dwStyle & (WS_CAPTION | WS_SYSMENU | 0xC0000000)) == (WS_CAPTION | WS_SYSMENU))) fTaskList = TRUE;
|
---|
496 |
|
---|
497 | OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP,
|
---|
498 | dwOSWinStyle,(char *)windowNameA,
|
---|
499 | (owner) ? owner->getOS2WindowHandle() : OSLIB_HWND_DESKTOP,
|
---|
500 | (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
|
---|
501 | &OS2HwndFrame, 0, fTaskList,fXDefault | fCXDefault,windowClass->getStyle() & CS_SAVEBITS);
|
---|
502 | if(OS2Hwnd == 0) {
|
---|
503 | dprintf(("Window creation failed!!"));
|
---|
504 | SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
|
---|
505 | return FALSE;
|
---|
506 | }
|
---|
507 |
|
---|
508 | SetLastError(0);
|
---|
509 | return TRUE;
|
---|
510 | }
|
---|
511 | //******************************************************************************
|
---|
512 | //******************************************************************************
|
---|
513 | BOOL Win32BaseWindow::MsgCreate(HWND hwndFrame, HWND hwndClient)
|
---|
514 | {
|
---|
515 | CREATESTRUCTA *cs = tmpcs; //pointer to CREATESTRUCT used in CreateWindowExA method
|
---|
516 | POINT maxSize, maxPos, minTrack, maxTrack;
|
---|
517 |
|
---|
518 | OS2Hwnd = hwndClient;
|
---|
519 | OS2HwndFrame = hwndFrame;
|
---|
520 |
|
---|
521 | fNoSizeMsg = TRUE;
|
---|
522 |
|
---|
523 | if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) {
|
---|
524 | dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2Hwnd));
|
---|
525 | SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
|
---|
526 | return FALSE;
|
---|
527 | }
|
---|
528 | if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) {
|
---|
529 | dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2Hwnd));
|
---|
530 | SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
|
---|
531 | return FALSE;
|
---|
532 | }
|
---|
533 |
|
---|
534 | //adjust CW_USEDEFAULT position
|
---|
535 | if (fXDefault | fCXDefault)
|
---|
536 | {
|
---|
537 | RECT rect;
|
---|
538 |
|
---|
539 | OSLibWinQueryWindowRect(OS2HwndFrame,&rect,RELATIVE_TO_SCREEN);
|
---|
540 | if (getParent()) mapWin32Rect(OSLIB_HWND_DESKTOP,getParent()->getOS2WindowHandle(),&rect);
|
---|
541 | if (fXDefault)
|
---|
542 | {
|
---|
543 | cs->x = rect.left;
|
---|
544 | cs->y = rect.top;
|
---|
545 | if (!fCXDefault)
|
---|
546 | {
|
---|
547 | //CB: todo: adjust pos to screen rect
|
---|
548 | }
|
---|
549 | }
|
---|
550 | if (fCXDefault)
|
---|
551 | {
|
---|
552 | cs->cx = rect.right-rect.left;
|
---|
553 | cs->cy = rect.bottom-rect.top;
|
---|
554 | }
|
---|
555 | }
|
---|
556 |
|
---|
557 | /* Send the WM_GETMINMAXINFO message and fix the size if needed */
|
---|
558 | if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD)))
|
---|
559 | {
|
---|
560 | GetMinMaxInfo(&maxSize, &maxPos, &minTrack, &maxTrack);
|
---|
561 | if (maxSize.x < cs->cx) cs->cx = maxSize.x;
|
---|
562 | if (maxSize.y < cs->cy) cs->cy = maxSize.y;
|
---|
563 | if (cs->cx < minTrack.x) cs->cx = minTrack.x;
|
---|
564 | if (cs->cy < minTrack.y) cs->cy = minTrack.y;
|
---|
565 | }
|
---|
566 |
|
---|
567 | if(cs->style & WS_CHILD)
|
---|
568 | {
|
---|
569 | if(cs->cx < 0) cs->cx = 0;
|
---|
570 | if(cs->cy < 0) cs->cy = 0;
|
---|
571 | }
|
---|
572 | else
|
---|
573 | {
|
---|
574 | if (cs->cx <= 0) cs->cx = 1;
|
---|
575 | if (cs->cy <= 0) cs->cy = 1;
|
---|
576 | }
|
---|
577 |
|
---|
578 | OSLibWinSetOwner(OS2Hwnd, OS2HwndFrame);
|
---|
579 |
|
---|
580 | fakeWinBase.hwndThis = OS2Hwnd;
|
---|
581 | fakeWinBase.pWindowClass = windowClass;
|
---|
582 |
|
---|
583 | //Set icon from class
|
---|
584 | if(windowClass->getIcon())
|
---|
585 | SetIcon(windowClass->getIcon());
|
---|
586 | /* Get class or window DC if needed */
|
---|
587 | if(windowClass->getStyle() & CS_OWNDC) {
|
---|
588 | dprintf(("Class with CS_OWNDC style"));
|
---|
589 | ownDC = GetDC(getWindowHandle()); //TODO: or GetWindowDC???
|
---|
590 | }
|
---|
591 | else
|
---|
592 | if (windowClass->getStyle() & CS_PARENTDC) {
|
---|
593 | dprintf(("WARNING: Class with CS_PARENTDC style!"));
|
---|
594 | fParentDC = TRUE;
|
---|
595 | ownDC = 0;
|
---|
596 | }
|
---|
597 | else
|
---|
598 | if (windowClass->getStyle() & CS_CLASSDC) {
|
---|
599 | dprintf(("WARNING: Class with CS_CLASSDC style!"));
|
---|
600 | ownDC = 0;
|
---|
601 | }
|
---|
602 | /* Set the window menu */
|
---|
603 | if ((dwStyle & (WS_CAPTION | WS_CHILD)) == WS_CAPTION )
|
---|
604 | {
|
---|
605 | if (cs->hMenu) {
|
---|
606 | ::SetMenu(getWindowHandle(), cs->hMenu);
|
---|
607 | }
|
---|
608 | else {
|
---|
609 | if (windowClass->getMenuNameA()) {
|
---|
610 | cs->hMenu = LoadMenuA(cs->hInstance, windowClass->getMenuNameA());
|
---|
611 | if (cs->hMenu) ::SetMenu(getWindowHandle(), cs->hMenu );
|
---|
612 | }
|
---|
613 | }
|
---|
614 | }
|
---|
615 | else
|
---|
616 | {
|
---|
617 | setWindowId((DWORD)cs->hMenu);
|
---|
618 | }
|
---|
619 | hSysMenu = (dwStyle & WS_SYSMENU) ? MENU_GetSysMenu(Win32Hwnd,0):0;
|
---|
620 |
|
---|
621 | // Subclass frame
|
---|
622 | pOldFrameProc = FrameSubclassFrameWindow(this);
|
---|
623 |
|
---|
624 | //preset rects
|
---|
625 | rectWindow.left = cs->x;
|
---|
626 | rectWindow.right = cs->x+cs->cx;
|
---|
627 | rectWindow.top = cs->y;
|
---|
628 | rectWindow.bottom = cs->y+cs->cy;
|
---|
629 | rectClient = rectWindow; //dummy client rect
|
---|
630 | OffsetRect(&rectClient, -rectClient.left, -rectClient.top);
|
---|
631 |
|
---|
632 | if (getParent()) mapWin32Rect(getParent()->getOS2WindowHandle(),OSLIB_HWND_DESKTOP,&rectWindow);
|
---|
633 | /* Send the WM_CREATE message
|
---|
634 | * Perhaps we shouldn't allow width/height changes as well.
|
---|
635 | * See p327 in "Internals".
|
---|
636 | */
|
---|
637 | maxPos.x = rectWindow.left; maxPos.y = rectWindow.top;
|
---|
638 |
|
---|
639 | //Note: Solitaire crashes when receiving WM_SIZE messages before WM_CREATE
|
---|
640 | //fNoSizeMsg = FALSE;
|
---|
641 | fCreated = TRUE;
|
---|
642 |
|
---|
643 | if (SendInternalMessageA(WM_NCCREATE,0,(LPARAM)cs))
|
---|
644 | {
|
---|
645 | RECT tmpRect;
|
---|
646 |
|
---|
647 | //update rect
|
---|
648 | rectWindow.left = cs->x;
|
---|
649 | rectWindow.right = cs->x+cs->cx;
|
---|
650 | rectWindow.top = cs->y;
|
---|
651 | rectWindow.bottom = cs->y+cs->cy;
|
---|
652 | tmpRect = rectWindow;
|
---|
653 | if (getParent()) mapWin32Rect(getParent()->getOS2WindowHandle(),OSLIB_HWND_DESKTOP,&rectWindow);
|
---|
654 | OffsetRect(&rectWindow, maxPos.x - rectWindow.left, maxPos.y - rectWindow.top);
|
---|
655 |
|
---|
656 | rectClient = rectWindow;
|
---|
657 | OffsetRect(&rectClient, -rectClient.left, -rectClient.top);
|
---|
658 |
|
---|
659 | //set the window size and update the client
|
---|
660 | SetWindowPos(hwndLinkAfter, tmpRect.left, tmpRect.top, tmpRect.right-tmpRect.left, tmpRect.bottom-tmpRect.top,SWP_NOACTIVATE | SWP_NOREDRAW | SWP_FRAMECHANGED);
|
---|
661 | fNoSizeMsg = FALSE;
|
---|
662 | if (cs->style & WS_VISIBLE) dwStyle |= WS_VISIBLE; //program could change position in WM_CREATE
|
---|
663 | if( (SendInternalMessageA(WM_CREATE, 0, (LPARAM)cs )) != -1 )
|
---|
664 | {
|
---|
665 | if(!(flags & WIN_NEED_SIZE))
|
---|
666 | {
|
---|
667 | SendInternalMessageA(WM_SIZE, SIZE_RESTORED,
|
---|
668 | MAKELONG(rectClient.right-rectClient.left,
|
---|
669 | rectClient.bottom-rectClient.top));
|
---|
670 |
|
---|
671 | SendInternalMessageA(WM_MOVE,0,MAKELONG(rectClient.left,rectClient.top));
|
---|
672 | }
|
---|
673 |
|
---|
674 | if( (getStyle() & WS_CHILD) && !(getExStyle() & WS_EX_NOPARENTNOTIFY) )
|
---|
675 | {
|
---|
676 | /* Notify the parent window only */
|
---|
677 | SendInternalMessageA(WM_PARENTNOTIFY, MAKEWPARAM(WM_CREATE, getWindowId()), (LPARAM)getWindowHandle());
|
---|
678 | if(!::IsWindow(getWindowHandle()))
|
---|
679 | {
|
---|
680 | dprintf(("Createwindow: WM_PARENTNOTIFY destroyed window"));
|
---|
681 | goto end;
|
---|
682 | }
|
---|
683 | }
|
---|
684 |
|
---|
685 | //CB: timew32.exe, blockcad.exe -> children not shown!!!
|
---|
686 | if (cs->style & WS_VISIBLE) ShowWindow(sw);
|
---|
687 |
|
---|
688 | /* Call WH_SHELL hook */
|
---|
689 | if (!(getStyle() & WS_CHILD) && !owner)
|
---|
690 | HOOK_CallHooksA(WH_SHELL, HSHELL_WINDOWCREATED, getWindowHandle(), 0 );
|
---|
691 |
|
---|
692 | SetLastError(0);
|
---|
693 | return TRUE;
|
---|
694 | }
|
---|
695 | }
|
---|
696 | dprintf(("Window creation FAILED (NCCREATE cancelled creation)"));
|
---|
697 | SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
|
---|
698 | end:
|
---|
699 | return FALSE;
|
---|
700 | }
|
---|
701 | //******************************************************************************
|
---|
702 | //******************************************************************************
|
---|
703 | ULONG Win32BaseWindow::MsgQuit()
|
---|
704 | {
|
---|
705 | return SendInternalMessageA(WM_QUIT, 0, 0);
|
---|
706 | }
|
---|
707 | //******************************************************************************
|
---|
708 | //******************************************************************************
|
---|
709 | ULONG Win32BaseWindow::MsgClose()
|
---|
710 | {
|
---|
711 | return SendInternalMessageA(WM_CLOSE,0,0);
|
---|
712 | }
|
---|
713 | //******************************************************************************
|
---|
714 | //******************************************************************************
|
---|
715 | ULONG Win32BaseWindow::MsgDestroy()
|
---|
716 | {
|
---|
717 | ULONG rc;
|
---|
718 | Win32BaseWindow *child;
|
---|
719 | HWND hwnd = getWindowHandle();
|
---|
720 |
|
---|
721 | fIsDestroyed = TRUE;
|
---|
722 |
|
---|
723 | if(fDestroyWindowCalled == FALSE)
|
---|
724 | {//this window was destroyed because DestroyWindow was called for it's parent
|
---|
725 | //so: send a WM_PARENTNOTIFY now as that hasn't happened yet
|
---|
726 | if((getStyle() & WS_CHILD) && !(getExStyle() & WS_EX_NOPARENTNOTIFY))
|
---|
727 | {
|
---|
728 | if(getParent())
|
---|
729 | {
|
---|
730 | /* Notify the parent window only */
|
---|
731 | getParent()->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(WM_DESTROY, getWindowId()), (LPARAM)getWindowHandle());
|
---|
732 | }
|
---|
733 | else DebugInt3();
|
---|
734 | }
|
---|
735 | }
|
---|
736 | SendInternalMessageA(WM_DESTROY, 0, 0);
|
---|
737 | if(::IsWindow(hwnd) == FALSE) {
|
---|
738 | //object already destroyed, so return immediately
|
---|
739 | return 1;
|
---|
740 | }
|
---|
741 | SendInternalMessageA(WM_NCDESTROY, 0, 0);
|
---|
742 |
|
---|
743 | TIMER_KillTimerFromWindow(OS2Hwnd);
|
---|
744 |
|
---|
745 | if(getFirstChild() == NULL) {
|
---|
746 | delete this;
|
---|
747 | }
|
---|
748 | return 1;
|
---|
749 | }
|
---|
750 | //******************************************************************************
|
---|
751 | //******************************************************************************
|
---|
752 | ULONG Win32BaseWindow::MsgEnable(BOOL fEnable)
|
---|
753 | {
|
---|
754 | if(fEnable) {
|
---|
755 | dwStyle &= ~WS_DISABLED;
|
---|
756 | }
|
---|
757 | else dwStyle |= WS_DISABLED;
|
---|
758 |
|
---|
759 | return SendInternalMessageA(WM_ENABLE, fEnable, 0);
|
---|
760 | }
|
---|
761 | //******************************************************************************
|
---|
762 | //TODO: SW_PARENTCLOSING/OPENING flag (lParam)
|
---|
763 | //******************************************************************************
|
---|
764 | ULONG Win32BaseWindow::MsgShow(BOOL fShow)
|
---|
765 | {
|
---|
766 | if(fNoSizeMsg) {
|
---|
767 | return 1;
|
---|
768 | }
|
---|
769 |
|
---|
770 | if(fShow) {
|
---|
771 | setStyle(getStyle() | WS_VISIBLE);
|
---|
772 | }
|
---|
773 | else setStyle(getStyle() & ~WS_VISIBLE);
|
---|
774 |
|
---|
775 | return SendInternalMessageA(WM_SHOWWINDOW, fShow, 0);
|
---|
776 | }
|
---|
777 | //******************************************************************************
|
---|
778 | //******************************************************************************
|
---|
779 | ULONG Win32BaseWindow::MsgPosChanging(LPARAM lp)
|
---|
780 | {
|
---|
781 | //SvL: Notes crashes when switching views (calls DestroyWindow -> PM sends
|
---|
782 | // a WM_WINDOWPOSCHANGED msg -> crash)
|
---|
783 | if(fNoSizeMsg || fDestroyWindowCalled)
|
---|
784 | return 0;
|
---|
785 |
|
---|
786 | return SendInternalMessageA(WM_WINDOWPOSCHANGING, 0, lp);
|
---|
787 | }
|
---|
788 | //******************************************************************************
|
---|
789 | //******************************************************************************
|
---|
790 | ULONG Win32BaseWindow::MsgPosChanged(LPARAM lp)
|
---|
791 | {
|
---|
792 | //SvL: Notes crashes when switching views (calls DestroyWindow -> PM sends
|
---|
793 | // a WM_WINDOWPOSCHANGED msg -> crash)
|
---|
794 | if(fNoSizeMsg || fDestroyWindowCalled)
|
---|
795 | return 1;
|
---|
796 |
|
---|
797 | return SendInternalMessageA(WM_WINDOWPOSCHANGED, 0, lp);
|
---|
798 | }
|
---|
799 | //******************************************************************************
|
---|
800 | //******************************************************************************
|
---|
801 | #if 0
|
---|
802 | ULONG Win32BaseWindow::MsgMinMax()
|
---|
803 | {
|
---|
804 |
|
---|
805 | }
|
---|
806 | #endif
|
---|
807 | //******************************************************************************
|
---|
808 | //******************************************************************************
|
---|
809 | ULONG Win32BaseWindow::MsgScroll(ULONG msg, ULONG scrollCode, ULONG scrollPos)
|
---|
810 | {
|
---|
811 | //According to the SDK docs, the scrollbar handle (lParam) is 0 when the standard
|
---|
812 | //window scrollbars send these messages
|
---|
813 | return SendInternalMessageA(msg, MAKELONG(scrollCode, scrollPos), 0);
|
---|
814 | }
|
---|
815 | //******************************************************************************
|
---|
816 | //******************************************************************************
|
---|
817 | ULONG Win32BaseWindow::MsgHitTest(ULONG x, ULONG y)
|
---|
818 | {
|
---|
819 | lastHitTestVal = SendInternalMessageA(WM_NCHITTEST, 0, MAKELONG((USHORT)x, (USHORT)y));
|
---|
820 | dprintf2(("MsgHitTest (%d,%d) (%d,%d) (%d,%d) returned %x", x, y, rectWindow.left, rectWindow.right, rectWindow.top, rectWindow.bottom, lastHitTestVal));
|
---|
821 | return lastHitTestVal;
|
---|
822 | }
|
---|
823 | //******************************************************************************
|
---|
824 | //******************************************************************************
|
---|
825 | ULONG Win32BaseWindow::MsgActivate(BOOL fActivate, BOOL fMinimized, HWND hwnd, HWND hwndOS2Win)
|
---|
826 | {
|
---|
827 | ULONG rc, procidhwnd = -1, threadidhwnd = 0;
|
---|
828 |
|
---|
829 |
|
---|
830 | //According to SDK docs, if app returns FALSE & window is being deactivated,
|
---|
831 | //default processing is cancelled
|
---|
832 | //TODO: According to Wine we should proceed anyway if window is sysmodal
|
---|
833 | #if 0
|
---|
834 | if(SendInternalMessageA(WM_NCACTIVATE, fActivate, 0) == FALSE && !fActivate)
|
---|
835 | {
|
---|
836 | return 0;
|
---|
837 | }
|
---|
838 | #endif
|
---|
839 | /* child windows get WM_CHILDACTIVATE message */
|
---|
840 | if((getStyle() & (WS_CHILD | WS_POPUP)) == WS_CHILD )
|
---|
841 | {
|
---|
842 | SendInternalMessageA(WM_CHILDACTIVATE, 0, 0L);
|
---|
843 | return 0;
|
---|
844 | }
|
---|
845 |
|
---|
846 | rc = SendInternalMessageA(WM_ACTIVATE, MAKELONG((fActivate) ? WA_ACTIVE : WA_INACTIVE, fMinimized), hwnd);
|
---|
847 |
|
---|
848 | if(hwndOS2Win) {
|
---|
849 | threadidhwnd = O32_GetWindowThreadProcessId(hwndOS2Win, &procidhwnd);
|
---|
850 | }
|
---|
851 |
|
---|
852 | if(fActivate) {
|
---|
853 | SendInternalMessageA(WM_ACTIVATEAPP, 1, dwThreadId); //activate; specify window thread id
|
---|
854 | }
|
---|
855 | else SendInternalMessageA(WM_ACTIVATEAPP, 0, threadidhwnd); //deactivate; specify thread id of other process
|
---|
856 | return rc;
|
---|
857 | }
|
---|
858 | //******************************************************************************
|
---|
859 | //TODO: Is this correct and complete?
|
---|
860 | //Add print screen, break & numlock
|
---|
861 | //******************************************************************************
|
---|
862 | void Win32BaseWindow::setExtendedKey(ULONG virtualkey, ULONG *lParam)
|
---|
863 | {
|
---|
864 | switch(virtualkey) {
|
---|
865 | case VK_DOWN:
|
---|
866 | case VK_UP:
|
---|
867 | case VK_PRIOR:
|
---|
868 | case VK_NEXT:
|
---|
869 | case VK_END:
|
---|
870 | case VK_DIVIDE:
|
---|
871 | case VK_DELETE:
|
---|
872 | case VK_EXECUTE: //Numeric enter key?
|
---|
873 | case VK_HOME:
|
---|
874 | case VK_INSERT:
|
---|
875 | case VK_RCONTROL:
|
---|
876 | case VK_RMENU: //is this the right alt???
|
---|
877 | *lParam = *lParam | (1<<24);
|
---|
878 | }
|
---|
879 | }
|
---|
880 | //******************************************************************************
|
---|
881 | //******************************************************************************
|
---|
882 | ULONG Win32BaseWindow::DispatchMsgA(MSG *msg)
|
---|
883 | {
|
---|
884 | return SendInternalMessageA(msg->message, msg->wParam, msg->lParam);
|
---|
885 | }
|
---|
886 | //******************************************************************************
|
---|
887 | //******************************************************************************
|
---|
888 | ULONG Win32BaseWindow::DispatchMsgW(MSG *msg)
|
---|
889 | {
|
---|
890 | return SendInternalMessageW(msg->message, msg->wParam, msg->lParam);
|
---|
891 | }
|
---|
892 | //******************************************************************************
|
---|
893 | //******************************************************************************
|
---|
894 | ULONG Win32BaseWindow::MsgSetFocus(HWND hwnd)
|
---|
895 | {
|
---|
896 | return SendInternalMessageA(WM_SETFOCUS, hwnd, 0);
|
---|
897 | }
|
---|
898 | //******************************************************************************
|
---|
899 | //******************************************************************************
|
---|
900 | ULONG Win32BaseWindow::MsgKillFocus(HWND hwnd)
|
---|
901 | {
|
---|
902 | return SendInternalMessageA(WM_KILLFOCUS, hwnd, 0);
|
---|
903 | }
|
---|
904 | //******************************************************************************
|
---|
905 | //******************************************************************************
|
---|
906 | ULONG Win32BaseWindow::MsgButton(MSG *msg)
|
---|
907 | {
|
---|
908 | BOOL fClick = FALSE;
|
---|
909 |
|
---|
910 | // dprintf(("MsgButton at (%d,%d)", msg->pt.x, msg->pt.y));
|
---|
911 | switch(msg->message) {
|
---|
912 | case WM_LBUTTONDBLCLK:
|
---|
913 | case WM_RBUTTONDBLCLK:
|
---|
914 | case WM_MBUTTONDBLCLK:
|
---|
915 | if (!(windowClass && windowClass->getClassLongA(GCL_STYLE) & CS_DBLCLKS))
|
---|
916 | {
|
---|
917 | msg->message = msg->message - (WM_LBUTTONDBLCLK - WM_LBUTTONDOWN); //dblclick -> down
|
---|
918 | MsgButton(msg);
|
---|
919 | msg->message++; //button-up
|
---|
920 | return MsgButton(msg);
|
---|
921 | }
|
---|
922 | break;
|
---|
923 | case WM_NCLBUTTONDBLCLK:
|
---|
924 | case WM_NCRBUTTONDBLCLK:
|
---|
925 | case WM_NCMBUTTONDBLCLK:
|
---|
926 | //Docs say CS_DBLCLKS style doesn't matter for non-client double clicks
|
---|
927 | fClick = TRUE;
|
---|
928 | break;
|
---|
929 |
|
---|
930 | case WM_LBUTTONDOWN:
|
---|
931 | case WM_RBUTTONDOWN:
|
---|
932 | case WM_MBUTTONDOWN:
|
---|
933 | case WM_NCLBUTTONDOWN:
|
---|
934 | case WM_NCRBUTTONDOWN:
|
---|
935 | case WM_NCMBUTTONDOWN:
|
---|
936 | fClick = TRUE;
|
---|
937 | break;
|
---|
938 | }
|
---|
939 |
|
---|
940 | if(ISMOUSE_CAPTURED())
|
---|
941 | {
|
---|
942 | if(DInputMouseHandler(getWindowHandle(), MOUSEMSG_BUTTON, msg->pt.x, msg->pt.y))
|
---|
943 | return 0;
|
---|
944 | }
|
---|
945 |
|
---|
946 | if(fClick)
|
---|
947 | {
|
---|
948 | HWND hwndTop;
|
---|
949 |
|
---|
950 | /* Activate the window if needed */
|
---|
951 | hwndTop = (GetTopParent()) ? GetTopParent()->getWindowHandle() : 0;
|
---|
952 |
|
---|
953 | HWND hwndActive = GetActiveWindow();
|
---|
954 | if (hwndTop && (getWindowHandle() != hwndActive))
|
---|
955 | {
|
---|
956 | LONG ret = SendInternalMessageA(WM_MOUSEACTIVATE, hwndTop,
|
---|
957 | MAKELONG( lastHitTestVal, msg->message) );
|
---|
958 |
|
---|
959 | #if 0
|
---|
960 | if ((ret == MA_ACTIVATEANDEAT) || (ret == MA_NOACTIVATEANDEAT))
|
---|
961 | eatMsg = TRUE;
|
---|
962 | #endif
|
---|
963 | if(((ret == MA_ACTIVATE) || (ret == MA_ACTIVATEANDEAT))
|
---|
964 | && (hwndTop != GetForegroundWindow()) )
|
---|
965 | {
|
---|
966 | ::SetActiveWindow(hwndTop);
|
---|
967 | }
|
---|
968 | }
|
---|
969 | }
|
---|
970 |
|
---|
971 | SendInternalMessageA(WM_SETCURSOR, getWindowHandle(), MAKELONG(lastHitTestVal, msg->message));
|
---|
972 |
|
---|
973 | return SendInternalMessageA(msg->message, msg->wParam, msg->lParam);
|
---|
974 | }
|
---|
975 | //******************************************************************************
|
---|
976 | //******************************************************************************
|
---|
977 | ULONG Win32BaseWindow::MsgPaint(ULONG tmp1, BOOL select)
|
---|
978 | {
|
---|
979 | if (select && isIcon)
|
---|
980 | return SendInternalMessageA(WM_PAINTICON, 0, 0);
|
---|
981 | else
|
---|
982 | return SendInternalMessageA(WM_PAINT, 0, 0);
|
---|
983 | }
|
---|
984 | //******************************************************************************
|
---|
985 | //TODO: Is the clipper region of the window DC equal to the invalidated rectangle?
|
---|
986 | // (or are we simply erasing too much here)
|
---|
987 | //******************************************************************************
|
---|
988 | ULONG Win32BaseWindow::MsgEraseBackGround(HDC hdc)
|
---|
989 | {
|
---|
990 | ULONG rc;
|
---|
991 | HDC hdcErase = hdc;
|
---|
992 |
|
---|
993 | if (hdcErase == 0)
|
---|
994 | hdcErase = O32_GetDC(OS2Hwnd);
|
---|
995 |
|
---|
996 | if(isIcon)
|
---|
997 | rc = SendInternalMessageA(WM_ICONERASEBKGND, hdcErase, 0);
|
---|
998 | else
|
---|
999 | rc = SendInternalMessageA(WM_ERASEBKGND, hdcErase, 0);
|
---|
1000 | if (hdc == 0)
|
---|
1001 | O32_ReleaseDC(OS2Hwnd, hdcErase);
|
---|
1002 | return (rc);
|
---|
1003 | }
|
---|
1004 | //******************************************************************************
|
---|
1005 | //******************************************************************************
|
---|
1006 | ULONG Win32BaseWindow::MsgMouseMove(MSG *msg)
|
---|
1007 | {
|
---|
1008 | if(ISMOUSE_CAPTURED()) {
|
---|
1009 | if(DInputMouseHandler(getWindowHandle(), MOUSEMSG_MOVE, msg->pt.x, msg->pt.y))
|
---|
1010 | return 0;
|
---|
1011 | }
|
---|
1012 |
|
---|
1013 | //TODO: hiword should be 0 if window enters menu mode (SDK docs)
|
---|
1014 | SendInternalMessageA(WM_SETCURSOR, Win32Hwnd, MAKELONG(lastHitTestVal, msg->message));
|
---|
1015 |
|
---|
1016 | //translated message == WM_(NC)MOUSEMOVE
|
---|
1017 | return SendInternalMessageA(msg->message, msg->wParam, msg->lParam);
|
---|
1018 | }
|
---|
1019 | //******************************************************************************
|
---|
1020 | //******************************************************************************
|
---|
1021 | ULONG Win32BaseWindow::MsgChar(MSG *msg)
|
---|
1022 | {
|
---|
1023 | if(ISKDB_CAPTURED())
|
---|
1024 | {
|
---|
1025 | DInputKeyBoardHandler(msg);
|
---|
1026 | }
|
---|
1027 | return DispatchMsgA(msg);
|
---|
1028 | }
|
---|
1029 | //******************************************************************************
|
---|
1030 | //******************************************************************************
|
---|
1031 | ULONG Win32BaseWindow::MsgNCPaint()
|
---|
1032 | {
|
---|
1033 | RECT rect;
|
---|
1034 |
|
---|
1035 | if (GetOS2UpdateRect(OS2HwndFrame,&rect))
|
---|
1036 | {
|
---|
1037 | HRGN hrgn;
|
---|
1038 | ULONG rc;
|
---|
1039 | RECT client = rectClient;
|
---|
1040 |
|
---|
1041 | //// mapWin32Rect(getParent() ? getParent()->getOS2WindowHandle():OSLIB_HWND_DESKTOP,OS2HwndFrame,&client);
|
---|
1042 | if ((rect.left >= client.left) && (rect.left < client.right) &&
|
---|
1043 | (rect.right >= client.left) && (rect.right < client.right) &&
|
---|
1044 | (rect.top >= client.top) && (rect.top < client.bottom) &&
|
---|
1045 | (rect.bottom >= client.top) && (rect.bottom < client.bottom))
|
---|
1046 | return 0;
|
---|
1047 |
|
---|
1048 | dprintf(("MsgNCPaint (%d,%d)(%d,%d)", rect.left, rect.top, rect.right, rect.bottom));
|
---|
1049 | hrgn = CreateRectRgnIndirect(&rect);
|
---|
1050 | if (!hrgn) return 0;
|
---|
1051 | rc = SendInternalMessageA(WM_NCPAINT,hrgn,0);
|
---|
1052 | DeleteObject(hrgn);
|
---|
1053 |
|
---|
1054 | return rc;
|
---|
1055 | }
|
---|
1056 | else return 0;
|
---|
1057 | }
|
---|
1058 | //******************************************************************************
|
---|
1059 | //Called when either the frame's size or position has changed (lpWndPos != NULL)
|
---|
1060 | //or when the frame layout has changed (i.e. scrollbars added/removed) (lpWndPos == NULL)
|
---|
1061 | //******************************************************************************
|
---|
1062 | ULONG Win32BaseWindow::MsgFormatFrame(WINDOWPOS *lpWndPos)
|
---|
1063 | {
|
---|
1064 | RECT oldWindowRect = rectWindow, client = rectClient, newWindowRect;
|
---|
1065 | WINDOWPOS wndPos;
|
---|
1066 | ULONG rc;
|
---|
1067 |
|
---|
1068 | if(lpWndPos)
|
---|
1069 | {
|
---|
1070 | POINT point;
|
---|
1071 |
|
---|
1072 | //set new window rectangle
|
---|
1073 | point.x = lpWndPos->x;
|
---|
1074 | point.y = lpWndPos->y;
|
---|
1075 | if (getParent()) ClientToScreen(getParent()->getWindowHandle(),&point);
|
---|
1076 |
|
---|
1077 | setWindowRect(point.x,point.y,point.x+lpWndPos->cx,point.y+lpWndPos->cy);
|
---|
1078 | newWindowRect = rectWindow;
|
---|
1079 | }
|
---|
1080 | else {
|
---|
1081 | wndPos.hwnd = getWindowHandle();
|
---|
1082 | wndPos.hwndInsertAfter = 0;
|
---|
1083 | newWindowRect= rectWindow;
|
---|
1084 | if (getParent()) {
|
---|
1085 | mapWin32Rect(OSLIB_HWND_DESKTOP,getParent()->getOS2WindowHandle(),&newWindowRect);
|
---|
1086 | }
|
---|
1087 | wndPos.x = newWindowRect.left;
|
---|
1088 | wndPos.y = newWindowRect.top;
|
---|
1089 | wndPos.cx = newWindowRect.right - newWindowRect.left;
|
---|
1090 | wndPos.cy = newWindowRect.bottom - newWindowRect.top;
|
---|
1091 | wndPos.flags = SWP_FRAMECHANGED;
|
---|
1092 | lpWndPos = &wndPos;
|
---|
1093 |
|
---|
1094 | if (getParent()) {
|
---|
1095 | newWindowRect= rectWindow; //reset; was modified
|
---|
1096 | }
|
---|
1097 | }
|
---|
1098 |
|
---|
1099 | rc = SendNCCalcSize(TRUE, &newWindowRect, &oldWindowRect, &client, lpWndPos, &rectClient);
|
---|
1100 |
|
---|
1101 | dprintf(("MsgFormatFrame: old client rect (%d,%d)(%d,%d), new client (%d,%d)(%d,%d)", client.left, client.top, client.right, client.bottom, rectClient.left, rectClient.top, rectClient.right, rectClient.bottom));
|
---|
1102 | return rc;
|
---|
1103 | }
|
---|
1104 | //******************************************************************************
|
---|
1105 | //******************************************************************************
|
---|
1106 | ULONG Win32BaseWindow::MsgSetText(LPSTR lpsz, LONG cch)
|
---|
1107 | {
|
---|
1108 | return SendInternalMessageA(WM_SETTEXT, 0, (LPARAM)lpsz);
|
---|
1109 | }
|
---|
1110 | //******************************************************************************
|
---|
1111 | //******************************************************************************
|
---|
1112 | ULONG Win32BaseWindow::MsgGetTextLength()
|
---|
1113 | {
|
---|
1114 | return SendInternalMessageA(WM_GETTEXTLENGTH, 0, 0);
|
---|
1115 | }
|
---|
1116 | //******************************************************************************
|
---|
1117 | //******************************************************************************
|
---|
1118 | void Win32BaseWindow::MsgGetText(char *wndtext, ULONG textlength)
|
---|
1119 | {
|
---|
1120 | SendInternalMessageA(WM_GETTEXT, textlength, (LPARAM)wndtext);
|
---|
1121 | }
|
---|
1122 | //******************************************************************************
|
---|
1123 | //******************************************************************************
|
---|
1124 | BOOL Win32BaseWindow::isMDIClient()
|
---|
1125 | {
|
---|
1126 | return FALSE;
|
---|
1127 | }
|
---|
1128 | //******************************************************************************
|
---|
1129 | //******************************************************************************
|
---|
1130 | BOOL Win32BaseWindow::isMDIChild()
|
---|
1131 | {
|
---|
1132 | return FALSE;
|
---|
1133 | }
|
---|
1134 | //******************************************************************************
|
---|
1135 | //TODO: Not complete
|
---|
1136 | //******************************************************************************
|
---|
1137 | BOOL Win32BaseWindow::isFrameWindow()
|
---|
1138 | {
|
---|
1139 | // if(isMDIChild() || IsDialog() || (getParent() == NULL || getParent() == windowDesktop) && ((dwStyle & WS_CAPTION) == WS_CAPTION))
|
---|
1140 | if((dwStyle & WS_CAPTION) == WS_CAPTION || dwStyle & (WS_VSCROLL|WS_HSCROLL))
|
---|
1141 | return TRUE;
|
---|
1142 |
|
---|
1143 | return FALSE;
|
---|
1144 | }
|
---|
1145 | //******************************************************************************
|
---|
1146 | //******************************************************************************
|
---|
1147 | SCROLLBAR_INFO *Win32BaseWindow::getScrollInfo(int nBar)
|
---|
1148 | {
|
---|
1149 | switch(nBar)
|
---|
1150 | {
|
---|
1151 | case SB_HORZ:
|
---|
1152 | if (!horzScrollInfo)
|
---|
1153 | {
|
---|
1154 | horzScrollInfo = (SCROLLBAR_INFO*)malloc(sizeof(SCROLLBAR_INFO));
|
---|
1155 | if (!horzScrollInfo) break;
|
---|
1156 | horzScrollInfo->MinVal = horzScrollInfo->CurVal = horzScrollInfo->Page = 0;
|
---|
1157 | horzScrollInfo->MaxVal = 100;
|
---|
1158 | horzScrollInfo->flags = ESB_ENABLE_BOTH;
|
---|
1159 | }
|
---|
1160 | return horzScrollInfo;
|
---|
1161 |
|
---|
1162 | case SB_VERT:
|
---|
1163 | if (!vertScrollInfo)
|
---|
1164 | {
|
---|
1165 | vertScrollInfo = (SCROLLBAR_INFO*)malloc(sizeof(SCROLLBAR_INFO));
|
---|
1166 | if (!vertScrollInfo) break;
|
---|
1167 | vertScrollInfo->MinVal = vertScrollInfo->CurVal = vertScrollInfo->Page = 0;
|
---|
1168 | vertScrollInfo->MaxVal = 100;
|
---|
1169 | vertScrollInfo->flags = ESB_ENABLE_BOTH;
|
---|
1170 | }
|
---|
1171 | return vertScrollInfo;
|
---|
1172 | }
|
---|
1173 |
|
---|
1174 | return NULL;
|
---|
1175 | }
|
---|
1176 | //******************************************************************************
|
---|
1177 | //******************************************************************************
|
---|
1178 | LRESULT Win32BaseWindow::DefWndControlColor(UINT ctlType, HDC hdc)
|
---|
1179 | {
|
---|
1180 | //SvL: Set background color to default button color (not window (white))
|
---|
1181 | if(ctlType == CTLCOLOR_BTN)
|
---|
1182 | {
|
---|
1183 | SetBkColor(hdc, GetSysColor(COLOR_BTNFACE));
|
---|
1184 | SetTextColor(hdc, GetSysColor(COLOR_WINDOWTEXT));
|
---|
1185 | return GetSysColorBrush(COLOR_BTNFACE);
|
---|
1186 | }
|
---|
1187 | //SvL: Set background color to default dialog color if window is dialog
|
---|
1188 | if((ctlType == CTLCOLOR_DLG || ctlType == CTLCOLOR_STATIC) && IsDialog()) {
|
---|
1189 | SetBkColor(hdc, GetSysColor(COLOR_BTNFACE));
|
---|
1190 | SetTextColor(hdc, GetSysColor(COLOR_WINDOWTEXT));
|
---|
1191 | return GetSysColorBrush(COLOR_BTNFACE);
|
---|
1192 | }
|
---|
1193 |
|
---|
1194 | if( ctlType == CTLCOLOR_SCROLLBAR)
|
---|
1195 | {
|
---|
1196 | HBRUSH hb = GetSysColorBrush(COLOR_SCROLLBAR);
|
---|
1197 | COLORREF bk = GetSysColor(COLOR_3DHILIGHT);
|
---|
1198 | SetTextColor( hdc, GetSysColor(COLOR_3DFACE));
|
---|
1199 | SetBkColor( hdc, bk);
|
---|
1200 |
|
---|
1201 | //TODO?
|
---|
1202 | #if 0
|
---|
1203 | /* if COLOR_WINDOW happens to be the same as COLOR_3DHILIGHT
|
---|
1204 | * we better use 0x55aa bitmap brush to make scrollbar's background
|
---|
1205 | * look different from the window background.
|
---|
1206 | */
|
---|
1207 | if (bk == GetSysColor(COLOR_WINDOW)) {
|
---|
1208 | return CACHE_GetPattern55AABrush();
|
---|
1209 | }
|
---|
1210 | #endif
|
---|
1211 | UnrealizeObject( hb );
|
---|
1212 | return (LRESULT)hb;
|
---|
1213 | }
|
---|
1214 |
|
---|
1215 | SetTextColor( hdc, GetSysColor(COLOR_WINDOWTEXT));
|
---|
1216 |
|
---|
1217 | if ((ctlType == CTLCOLOR_EDIT) || (ctlType == CTLCOLOR_LISTBOX))
|
---|
1218 | {
|
---|
1219 | SetBkColor( hdc, GetSysColor(COLOR_WINDOW) );
|
---|
1220 | }
|
---|
1221 | else
|
---|
1222 | {
|
---|
1223 | SetBkColor( hdc, GetSysColor(COLOR_3DFACE) );
|
---|
1224 | return (LRESULT)GetSysColorBrush(COLOR_3DFACE);
|
---|
1225 | }
|
---|
1226 | return (LRESULT)GetSysColorBrush(COLOR_WINDOW);
|
---|
1227 | }
|
---|
1228 | //******************************************************************************
|
---|
1229 | //******************************************************************************
|
---|
1230 | LRESULT Win32BaseWindow::DefWndPrint(HDC hdc,ULONG uFlags)
|
---|
1231 | {
|
---|
1232 | /*
|
---|
1233 | * Visibility flag.
|
---|
1234 | */
|
---|
1235 | if ( (uFlags & PRF_CHECKVISIBLE) &&
|
---|
1236 | !IsWindowVisible() )
|
---|
1237 | return 0;
|
---|
1238 |
|
---|
1239 | /*
|
---|
1240 | * Unimplemented flags.
|
---|
1241 | */
|
---|
1242 | if ( (uFlags & PRF_CHILDREN) ||
|
---|
1243 | (uFlags & PRF_OWNED) ||
|
---|
1244 | (uFlags & PRF_NONCLIENT) )
|
---|
1245 | {
|
---|
1246 | dprintf(("WM_PRINT message with unsupported flags\n"));
|
---|
1247 | }
|
---|
1248 |
|
---|
1249 | /*
|
---|
1250 | * Background
|
---|
1251 | */
|
---|
1252 | if ( uFlags & PRF_ERASEBKGND)
|
---|
1253 | SendInternalMessageA(WM_ERASEBKGND, (WPARAM)hdc, 0);
|
---|
1254 |
|
---|
1255 | /*
|
---|
1256 | * Client area
|
---|
1257 | */
|
---|
1258 | if ( uFlags & PRF_CLIENT)
|
---|
1259 | SendInternalMessageA(WM_PRINTCLIENT, (WPARAM)hdc, PRF_CLIENT);
|
---|
1260 |
|
---|
1261 |
|
---|
1262 | return 0;
|
---|
1263 | }
|
---|
1264 | //******************************************************************************
|
---|
1265 | //******************************************************************************
|
---|
1266 | LRESULT Win32BaseWindow::DefWindowProcA(UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
1267 | {
|
---|
1268 | switch(Msg)
|
---|
1269 | {
|
---|
1270 | case WM_CLOSE:
|
---|
1271 | dprintf(("DefWindowProcA: WM_CLOSE %x", getWindowHandle()));
|
---|
1272 | DestroyWindow();
|
---|
1273 | return 0;
|
---|
1274 |
|
---|
1275 | case WM_GETTEXTLENGTH:
|
---|
1276 | return wndNameLength;
|
---|
1277 |
|
---|
1278 | case WM_GETTEXT:
|
---|
1279 | if (!lParam || !wParam) return 0;
|
---|
1280 | if (!windowNameA) ((LPSTR)lParam)[0] = 0;
|
---|
1281 | else lstrcpynA((LPSTR)lParam, windowNameA, wParam);
|
---|
1282 | return min(wndNameLength, wParam);
|
---|
1283 |
|
---|
1284 | case WM_SETTEXT:
|
---|
1285 | {
|
---|
1286 | LPCSTR lpsz = (LPCSTR)lParam;
|
---|
1287 |
|
---|
1288 | if(windowNameA) free(windowNameA);
|
---|
1289 | if(windowNameW) free(windowNameW);
|
---|
1290 | if (lParam)
|
---|
1291 | {
|
---|
1292 | wndNameLength = strlen(lpsz);
|
---|
1293 | windowNameA = (LPSTR)_smalloc(wndNameLength+1);
|
---|
1294 | strcpy(windowNameA, lpsz);
|
---|
1295 | windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR));
|
---|
1296 | lstrcpyAtoW(windowNameW, windowNameA);
|
---|
1297 | }
|
---|
1298 | else
|
---|
1299 | {
|
---|
1300 | windowNameA = NULL;
|
---|
1301 | windowNameW = NULL;
|
---|
1302 | wndNameLength = 0;
|
---|
1303 | }
|
---|
1304 | dprintf(("WM_SETTEXT of %x to %s\n", Win32Hwnd, lParam));
|
---|
1305 | if ((dwStyle & WS_CAPTION) == WS_CAPTION)
|
---|
1306 | {
|
---|
1307 | HandleNCPaint((HRGN)1);
|
---|
1308 | OSLibWinSetWindowText(OS2HwndFrame,(LPSTR)windowNameA);
|
---|
1309 | }
|
---|
1310 |
|
---|
1311 | return TRUE;
|
---|
1312 | }
|
---|
1313 |
|
---|
1314 | case WM_SETREDRAW:
|
---|
1315 | {
|
---|
1316 | if (wParam)
|
---|
1317 | {
|
---|
1318 | setStyle(getStyle() | WS_VISIBLE);
|
---|
1319 | OSLibWinEnableWindowUpdate(OS2HwndFrame,TRUE);
|
---|
1320 | }
|
---|
1321 | else
|
---|
1322 | {
|
---|
1323 | if (getStyle() & WS_VISIBLE)
|
---|
1324 | {
|
---|
1325 | setStyle(getStyle() & ~WS_VISIBLE);
|
---|
1326 | OSLibWinEnableWindowUpdate(OS2HwndFrame,FALSE);
|
---|
1327 | }
|
---|
1328 | }
|
---|
1329 | return 0;
|
---|
1330 | }
|
---|
1331 |
|
---|
1332 | case WM_CTLCOLORMSGBOX:
|
---|
1333 | case WM_CTLCOLOREDIT:
|
---|
1334 | case WM_CTLCOLORLISTBOX:
|
---|
1335 | case WM_CTLCOLORBTN:
|
---|
1336 | case WM_CTLCOLORDLG:
|
---|
1337 | case WM_CTLCOLORSTATIC:
|
---|
1338 | case WM_CTLCOLORSCROLLBAR:
|
---|
1339 | return DefWndControlColor(Msg - WM_CTLCOLORMSGBOX, (HDC)wParam);
|
---|
1340 |
|
---|
1341 | case WM_CTLCOLOR:
|
---|
1342 | return DefWndControlColor(HIWORD(lParam), (HDC)wParam);
|
---|
1343 |
|
---|
1344 | case WM_VKEYTOITEM:
|
---|
1345 | case WM_CHARTOITEM:
|
---|
1346 | return -1;
|
---|
1347 |
|
---|
1348 | case WM_PARENTNOTIFY:
|
---|
1349 | return 0;
|
---|
1350 |
|
---|
1351 | case WM_MOUSEACTIVATE:
|
---|
1352 | {
|
---|
1353 | dprintf(("DefWndProc: WM_MOUSEACTIVATE for %x Msg %s", Win32Hwnd, GetMsgText(HIWORD(lParam))));
|
---|
1354 | if(getStyle() & WS_CHILD && !(getExStyle() & WS_EX_NOPARENTNOTIFY) )
|
---|
1355 | {
|
---|
1356 | if(getParent()) {
|
---|
1357 | LRESULT rc = getParent()->SendInternalMessageA(WM_MOUSEACTIVATE, wParam, lParam );
|
---|
1358 | if(rc) return rc;
|
---|
1359 | }
|
---|
1360 | }
|
---|
1361 | return (LOWORD(lParam) == HTCAPTION) ? MA_NOACTIVATE : MA_ACTIVATE;
|
---|
1362 | }
|
---|
1363 |
|
---|
1364 | case WM_ACTIVATE:
|
---|
1365 | return 0;
|
---|
1366 |
|
---|
1367 | case WM_SETCURSOR:
|
---|
1368 | {
|
---|
1369 | dprintf(("DefWndProc: WM_SETCURSOR for %x Msg %s", Win32Hwnd, GetMsgText(HIWORD(lParam))));
|
---|
1370 | if((getStyle() & WS_CHILD) && !(getExStyle() & WS_EX_NOPARENTNOTIFY))
|
---|
1371 | {
|
---|
1372 | if(getParent()) {
|
---|
1373 | LRESULT rc = getParent()->SendInternalMessageA(WM_SETCURSOR, wParam, lParam);
|
---|
1374 | if(rc) return rc;
|
---|
1375 | }
|
---|
1376 | }
|
---|
1377 | if (wParam == Win32Hwnd)
|
---|
1378 | {
|
---|
1379 | HCURSOR hCursor;
|
---|
1380 |
|
---|
1381 | switch(LOWORD(lParam))
|
---|
1382 | {
|
---|
1383 | case HTCLIENT:
|
---|
1384 | hCursor = windowClass ? windowClass->getCursor():LoadCursorA(0,IDC_ARROWA);
|
---|
1385 | break;
|
---|
1386 |
|
---|
1387 | case HTLEFT:
|
---|
1388 | case HTRIGHT:
|
---|
1389 | hCursor = LoadCursorA(0,IDC_SIZEWEA);
|
---|
1390 | break;
|
---|
1391 |
|
---|
1392 | case HTTOP:
|
---|
1393 | case HTBOTTOM:
|
---|
1394 | hCursor = LoadCursorA(0,IDC_SIZENSA);
|
---|
1395 | break;
|
---|
1396 |
|
---|
1397 | case HTTOPLEFT:
|
---|
1398 | case HTBOTTOMRIGHT:
|
---|
1399 | hCursor = LoadCursorA(0,IDC_SIZENWSEA);
|
---|
1400 | break;
|
---|
1401 |
|
---|
1402 | case HTTOPRIGHT:
|
---|
1403 | case HTBOTTOMLEFT:
|
---|
1404 | hCursor = LoadCursorA(0,IDC_SIZENESWA);
|
---|
1405 | break;
|
---|
1406 |
|
---|
1407 | default:
|
---|
1408 | hCursor = LoadCursorA(0,IDC_ARROWA);
|
---|
1409 | break;
|
---|
1410 | }
|
---|
1411 |
|
---|
1412 | if (hCursor)
|
---|
1413 | {
|
---|
1414 | SetCursor(hCursor);
|
---|
1415 | return 1;
|
---|
1416 | }
|
---|
1417 | else return 0;
|
---|
1418 | }
|
---|
1419 | else return 0;
|
---|
1420 | }
|
---|
1421 |
|
---|
1422 | case WM_MOUSEMOVE:
|
---|
1423 | return 0;
|
---|
1424 |
|
---|
1425 | case WM_WINDOWPOSCHANGED:
|
---|
1426 | {
|
---|
1427 | PWINDOWPOS wpos = (PWINDOWPOS)lParam;
|
---|
1428 | WPARAM wp = SIZE_RESTORED;
|
---|
1429 |
|
---|
1430 | if (!(wpos->flags & SWP_NOMOVE) && !(wpos->flags & SWP_NOCLIENTMOVE))
|
---|
1431 | {
|
---|
1432 | SendInternalMessageA(WM_MOVE, 0, MAKELONG(rectClient.left,rectClient.top));
|
---|
1433 | }
|
---|
1434 | if (!(wpos->flags & SWP_NOSIZE) && !(wpos->flags & SWP_NOCLIENTSIZE))
|
---|
1435 | {
|
---|
1436 | if (dwStyle & WS_MAXIMIZE) wp = SIZE_MAXIMIZED;
|
---|
1437 | else
|
---|
1438 | if (dwStyle & WS_MINIMIZE) wp = SIZE_MINIMIZED;
|
---|
1439 |
|
---|
1440 | SendInternalMessageA(WM_SIZE, wp, MAKELONG(rectClient.right - rectClient.left,
|
---|
1441 | rectClient.bottom - rectClient.top));
|
---|
1442 | }
|
---|
1443 | return 0;
|
---|
1444 | }
|
---|
1445 | case WM_WINDOWPOSCHANGING:
|
---|
1446 | return HandleWindowPosChanging((WINDOWPOS *)lParam);
|
---|
1447 |
|
---|
1448 | case WM_ERASEBKGND:
|
---|
1449 | case WM_ICONERASEBKGND:
|
---|
1450 | {
|
---|
1451 | RECT rect;
|
---|
1452 | int rc;
|
---|
1453 |
|
---|
1454 | if (!windowClass || !windowClass->getBackgroundBrush()) return 0;
|
---|
1455 |
|
---|
1456 | rc = GetClipBox( (HDC)wParam, &rect );
|
---|
1457 | if ((rc == SIMPLEREGION) || (rc == COMPLEXREGION))
|
---|
1458 | {
|
---|
1459 | HBRUSH hBrush = windowClass->getBackgroundBrush();
|
---|
1460 |
|
---|
1461 | if (hBrush <= (HBRUSH)(SYSCOLOR_GetLastColor()+1))
|
---|
1462 | hBrush = GetSysColorBrush(hBrush-1);
|
---|
1463 |
|
---|
1464 | FillRect( (HDC)wParam, &rect, hBrush);
|
---|
1465 | }
|
---|
1466 | return 1;
|
---|
1467 | }
|
---|
1468 |
|
---|
1469 | case WM_PRINT:
|
---|
1470 | return DefWndPrint(wParam,lParam);
|
---|
1471 |
|
---|
1472 | case WM_PAINTICON:
|
---|
1473 | case WM_PAINT:
|
---|
1474 | {
|
---|
1475 | PAINTSTRUCT ps;
|
---|
1476 | HDC hdc = BeginPaint(getWindowHandle(), &ps );
|
---|
1477 | if( hdc )
|
---|
1478 | {
|
---|
1479 | if( (getStyle() & WS_MINIMIZE) && getWindowClass()->getIcon())
|
---|
1480 | {
|
---|
1481 | int x = (rectWindow.right - rectWindow.left - GetSystemMetrics(SM_CXICON))/2;
|
---|
1482 | int y = (rectWindow.bottom - rectWindow.top - GetSystemMetrics(SM_CYICON))/2;
|
---|
1483 | dprintf(("Painting class icon: vis rect=(%i,%i - %i,%i)\n", ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom ));
|
---|
1484 | DrawIcon(hdc, x, y, getWindowClass()->getIcon() );
|
---|
1485 | }
|
---|
1486 | EndPaint(getWindowHandle(), &ps );
|
---|
1487 | }
|
---|
1488 | return 0;
|
---|
1489 | }
|
---|
1490 |
|
---|
1491 | case WM_GETDLGCODE:
|
---|
1492 | return 0;
|
---|
1493 |
|
---|
1494 | case WM_NCPAINT:
|
---|
1495 | return HandleNCPaint((HRGN)wParam);
|
---|
1496 |
|
---|
1497 | case WM_NCACTIVATE:
|
---|
1498 | return HandleNCActivate(wParam);
|
---|
1499 |
|
---|
1500 | case WM_NCCREATE:
|
---|
1501 | return(TRUE);
|
---|
1502 |
|
---|
1503 | case WM_NCDESTROY:
|
---|
1504 | return 0;
|
---|
1505 |
|
---|
1506 | case WM_NCCALCSIZE:
|
---|
1507 | return HandleNCCalcSize((BOOL)wParam,(RECT*)lParam);
|
---|
1508 |
|
---|
1509 | case WM_NCLBUTTONDOWN:
|
---|
1510 | return HandleNCLButtonDown(wParam,lParam);
|
---|
1511 |
|
---|
1512 | case WM_LBUTTONDBLCLK:
|
---|
1513 | case WM_NCLBUTTONDBLCLK:
|
---|
1514 | return HandleNCLButtonDblClk(wParam,lParam);
|
---|
1515 |
|
---|
1516 | case WM_NCRBUTTONDOWN:
|
---|
1517 | case WM_NCRBUTTONDBLCLK:
|
---|
1518 | case WM_NCMBUTTONDOWN:
|
---|
1519 | case WM_NCMBUTTONDBLCLK:
|
---|
1520 | if (lastHitTestVal == HTERROR) MessageBeep(MB_ICONEXCLAMATION);
|
---|
1521 | return 0;
|
---|
1522 |
|
---|
1523 | case WM_NCRBUTTONUP:
|
---|
1524 | return HandleNCRButtonUp(wParam,lParam);
|
---|
1525 |
|
---|
1526 | case WM_NCMBUTTONUP:
|
---|
1527 | return 0;
|
---|
1528 |
|
---|
1529 | case WM_NCHITTEST:
|
---|
1530 | {
|
---|
1531 | POINT point;
|
---|
1532 |
|
---|
1533 | point.x = (SHORT)LOWORD(lParam);
|
---|
1534 | point.y = (SHORT)HIWORD(lParam);
|
---|
1535 |
|
---|
1536 | return HandleNCHitTest(point);
|
---|
1537 | }
|
---|
1538 |
|
---|
1539 | case WM_SYSCOMMAND:
|
---|
1540 | {
|
---|
1541 | POINT point;
|
---|
1542 |
|
---|
1543 | point.x = LOWORD(lParam);
|
---|
1544 | point.y = HIWORD(lParam);
|
---|
1545 | return HandleSysCommand(wParam,&point);
|
---|
1546 | }
|
---|
1547 |
|
---|
1548 | case WM_SYSKEYDOWN:
|
---|
1549 | if(wParam == VK_F4) /* try to close the window */
|
---|
1550 | {
|
---|
1551 | Win32BaseWindow *window = GetTopParent();
|
---|
1552 | if(window && !(window->getClass()->getStyle() & CS_NOCLOSE))
|
---|
1553 | PostMessageA(getWindowHandle(), WM_SYSCOMMAND, SC_CLOSE, 0);
|
---|
1554 | }
|
---|
1555 |
|
---|
1556 | Win32BaseWindow *siblingWindow;
|
---|
1557 | HWND sibling;
|
---|
1558 | char nameBuffer [40], mnemonic;
|
---|
1559 | int nameLength;
|
---|
1560 |
|
---|
1561 | GetWindowTextA (nameBuffer, 40);
|
---|
1562 |
|
---|
1563 | // search all sibling to see it this key is their mnemonic
|
---|
1564 | sibling = GetWindow (GW_HWNDFIRST);
|
---|
1565 | while (sibling != 0) {
|
---|
1566 | siblingWindow = GetWindowFromHandle (sibling);
|
---|
1567 | nameLength = siblingWindow->GetWindowTextA (nameBuffer, 40);
|
---|
1568 |
|
---|
1569 | // find the siblings mnemonic
|
---|
1570 | mnemonic = '\0';
|
---|
1571 | for (int i=0 ; i<nameLength ; i++) {
|
---|
1572 | if (nameBuffer [i] == '&') {
|
---|
1573 | mnemonic = nameBuffer [i+1];
|
---|
1574 | if ((mnemonic >= 'a') && (mnemonic <= 'z'))
|
---|
1575 | mnemonic -= 32; // make it uppercase
|
---|
1576 | break; // stop searching
|
---|
1577 | }
|
---|
1578 | }
|
---|
1579 |
|
---|
1580 | // key matches siblings mnemonic, send mouseclick
|
---|
1581 | if (mnemonic == (char) wParam) {
|
---|
1582 | siblingWindow->SendInternalMessageA (BM_CLICK, 0, 0);
|
---|
1583 | }
|
---|
1584 |
|
---|
1585 | sibling = siblingWindow->GetNextWindow (GW_HWNDNEXT);
|
---|
1586 | }
|
---|
1587 |
|
---|
1588 | return 0;
|
---|
1589 |
|
---|
1590 | case WM_SYSCHAR:
|
---|
1591 | {
|
---|
1592 | int iMenuSysKey = 0;
|
---|
1593 | if (wParam == VK_RETURN && (getStyle() & WS_MINIMIZE))
|
---|
1594 | {
|
---|
1595 | PostMessageA(getWindowHandle(), WM_SYSCOMMAND,
|
---|
1596 | (WPARAM)SC_RESTORE, 0L );
|
---|
1597 | break;
|
---|
1598 | }
|
---|
1599 | if ((HIWORD(lParam) & KEYDATA_ALT) && wParam)
|
---|
1600 | {
|
---|
1601 | if (wParam == VK_TAB || wParam == VK_ESCAPE) break;
|
---|
1602 | if (wParam == VK_SPACE && (getStyle() & WS_CHILD))
|
---|
1603 | getParent()->SendMessageA(Msg, wParam, lParam );
|
---|
1604 | else
|
---|
1605 | SendMessageA(WM_SYSCOMMAND, (WPARAM)SC_KEYMENU, (LPARAM)(DWORD)wParam );
|
---|
1606 | }
|
---|
1607 | else /* check for Ctrl-Esc */
|
---|
1608 | if (wParam != VK_ESCAPE) MessageBeep(0);
|
---|
1609 | break;
|
---|
1610 | }
|
---|
1611 | case WM_SETHOTKEY:
|
---|
1612 | hotkey = wParam;
|
---|
1613 | return 1; //CB: always successful
|
---|
1614 |
|
---|
1615 | case WM_GETHOTKEY:
|
---|
1616 | return hotkey;
|
---|
1617 |
|
---|
1618 | case WM_CONTEXTMENU:
|
---|
1619 | if ((dwStyle & WS_CHILD) && getParent())
|
---|
1620 | getParent()->SendInternalMessageA(WM_CONTEXTMENU,wParam,lParam);
|
---|
1621 | return 0;
|
---|
1622 |
|
---|
1623 | case WM_SHOWWINDOW:
|
---|
1624 | if (!lParam) return 0; /* sent from ShowWindow */
|
---|
1625 | if (!(dwStyle & WS_POPUP) || !owner) return 0;
|
---|
1626 | if ((dwStyle & WS_VISIBLE) && wParam) return 0;
|
---|
1627 | else if (!(dwStyle & WS_VISIBLE) && !wParam) return 0;
|
---|
1628 | ShowWindow(wParam ? SW_SHOWNOACTIVATE : SW_HIDE);
|
---|
1629 | return 0;
|
---|
1630 |
|
---|
1631 | case WM_CANCELMODE:
|
---|
1632 | if (getParent() == windowDesktop) EndMenu();
|
---|
1633 | if (GetCapture() == Win32Hwnd) ReleaseCapture();
|
---|
1634 | return 0;
|
---|
1635 |
|
---|
1636 | case WM_DROPOBJECT:
|
---|
1637 | return DRAG_FILE;
|
---|
1638 |
|
---|
1639 | case WM_QUERYDROPOBJECT:
|
---|
1640 | return (dwExStyle & WS_EX_ACCEPTFILES) ? 1:0;
|
---|
1641 |
|
---|
1642 | case WM_QUERYDRAGICON:
|
---|
1643 | {
|
---|
1644 | HICON hIcon = windowClass->getCursor();
|
---|
1645 | UINT len;
|
---|
1646 |
|
---|
1647 | if(hIcon) return (LRESULT)hIcon;
|
---|
1648 | for(len = 1; len < 64; len++)
|
---|
1649 | {
|
---|
1650 | hIcon = LoadIconA(hInstance,MAKEINTRESOURCEA(len));
|
---|
1651 | if(hIcon)
|
---|
1652 | return (LRESULT)hIcon;
|
---|
1653 | }
|
---|
1654 | return (LRESULT)LoadIconA(0,IDI_APPLICATIONA);
|
---|
1655 | }
|
---|
1656 |
|
---|
1657 | case WM_QUERYOPEN:
|
---|
1658 | case WM_QUERYENDSESSION:
|
---|
1659 | return 1;
|
---|
1660 |
|
---|
1661 | case WM_NOTIFYFORMAT:
|
---|
1662 | return IsWindowUnicode() ? NFR_UNICODE:NFR_ANSI;
|
---|
1663 |
|
---|
1664 | case WM_SETICON:
|
---|
1665 | case WM_GETICON:
|
---|
1666 | {
|
---|
1667 | LRESULT result = 0;
|
---|
1668 | if (!windowClass) return result;
|
---|
1669 | int index = GCL_HICON;
|
---|
1670 |
|
---|
1671 | if (wParam == ICON_SMALL)
|
---|
1672 | index = GCL_HICONSM;
|
---|
1673 |
|
---|
1674 | result = windowClass->getClassLongA(index);
|
---|
1675 |
|
---|
1676 | if (Msg == WM_SETICON)
|
---|
1677 | windowClass->setClassLongA(index, lParam);
|
---|
1678 |
|
---|
1679 | return result;
|
---|
1680 | }
|
---|
1681 |
|
---|
1682 | case WM_NOTIFY:
|
---|
1683 | return 0; //comctl32 controls expect this
|
---|
1684 |
|
---|
1685 | default:
|
---|
1686 | return 0;
|
---|
1687 | }
|
---|
1688 | return 0;
|
---|
1689 | }
|
---|
1690 | //******************************************************************************
|
---|
1691 | //******************************************************************************
|
---|
1692 | LRESULT Win32BaseWindow::DefWindowProcW(UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
1693 | {
|
---|
1694 | switch(Msg)
|
---|
1695 | {
|
---|
1696 | case WM_GETTEXTLENGTH:
|
---|
1697 | return wndNameLength;
|
---|
1698 |
|
---|
1699 | case WM_GETTEXT:
|
---|
1700 | if (!lParam || !wParam) return 0;
|
---|
1701 | if (!windowNameW) ((LPWSTR)lParam)[0] = 0;
|
---|
1702 | else lstrcpynW((LPWSTR)lParam,windowNameW,wParam);
|
---|
1703 | return min(wndNameLength,wParam);
|
---|
1704 |
|
---|
1705 | case WM_SETTEXT:
|
---|
1706 | {
|
---|
1707 | LPWSTR lpsz = (LPWSTR)lParam;
|
---|
1708 |
|
---|
1709 | if(windowNameA) free(windowNameA);
|
---|
1710 | if(windowNameW) free(windowNameW);
|
---|
1711 | if (lParam)
|
---|
1712 | {
|
---|
1713 | wndNameLength = lstrlenW(lpsz);
|
---|
1714 | windowNameA = (LPSTR)_smalloc(wndNameLength+1);
|
---|
1715 | lstrcpyWtoA(windowNameA,lpsz);
|
---|
1716 | windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR));
|
---|
1717 | lstrcpyW(windowNameW,lpsz);
|
---|
1718 | }
|
---|
1719 | else
|
---|
1720 | {
|
---|
1721 | windowNameA = NULL;
|
---|
1722 | windowNameW = NULL;
|
---|
1723 | wndNameLength = 0;
|
---|
1724 | }
|
---|
1725 | dprintf(("WM_SETTEXT of %x\n",Win32Hwnd));
|
---|
1726 | if ((dwStyle & WS_CAPTION) == WS_CAPTION)
|
---|
1727 | {
|
---|
1728 | HandleNCPaint((HRGN)1);
|
---|
1729 | OSLibWinSetWindowText(OS2HwndFrame,(LPSTR)windowNameA);
|
---|
1730 | }
|
---|
1731 |
|
---|
1732 | return TRUE;
|
---|
1733 | }
|
---|
1734 |
|
---|
1735 | default:
|
---|
1736 | return DefWindowProcA(Msg, wParam, lParam);
|
---|
1737 | }
|
---|
1738 | }
|
---|
1739 | //******************************************************************************
|
---|
1740 | //******************************************************************************
|
---|
1741 | LRESULT Win32BaseWindow::SendMessageA(ULONG Msg, WPARAM wParam, LPARAM lParam)
|
---|
1742 | {
|
---|
1743 | //if the destination window is created by this process & thread, call window proc directly
|
---|
1744 | if(dwProcessId == currentProcessId && dwThreadId == GetCurrentThreadId()) {
|
---|
1745 | return SendInternalMessageA(Msg, wParam, lParam);
|
---|
1746 | }
|
---|
1747 | //otherwise use WinSendMsg to send it to the right process/thread
|
---|
1748 | dprintf(("SendMessages (inter-process) %x %x %x %x", getWindowHandle(), Msg, wParam, lParam));
|
---|
1749 | return OSLibSendMessage(getOS2WindowHandle(), Msg, wParam, lParam, FALSE);
|
---|
1750 | }
|
---|
1751 | //******************************************************************************
|
---|
1752 | //******************************************************************************
|
---|
1753 | LRESULT Win32BaseWindow::SendMessageW(ULONG Msg, WPARAM wParam, LPARAM lParam)
|
---|
1754 | {
|
---|
1755 | //if the destination window is created by this process & thread, call window proc directly
|
---|
1756 | if(dwProcessId == currentProcessId && dwThreadId == GetCurrentThreadId()) {
|
---|
1757 | return SendInternalMessageW(Msg, wParam, lParam);
|
---|
1758 | }
|
---|
1759 | //otherwise use WinSendMsg to send it to the right process/thread
|
---|
1760 | return OSLibSendMessage(getOS2WindowHandle(), Msg, wParam, lParam, TRUE);
|
---|
1761 | }
|
---|
1762 | //******************************************************************************
|
---|
1763 | //Called as a result of an OS/2 message or called from a class method
|
---|
1764 | //******************************************************************************
|
---|
1765 | LRESULT Win32BaseWindow::SendInternalMessageA(ULONG Msg, WPARAM wParam, LPARAM lParam)
|
---|
1766 | {
|
---|
1767 | LRESULT rc;
|
---|
1768 | BOOL fInternalMsgBackup = fInternalMsg;
|
---|
1769 |
|
---|
1770 | DebugPrintMessage(getWindowHandle(), Msg, wParam, lParam, FALSE, TRUE);
|
---|
1771 |
|
---|
1772 | CallWindowHookProc(WH_CALLWNDPROC, Msg, wParam, lParam, FALSE);
|
---|
1773 |
|
---|
1774 | fInternalMsg = TRUE;
|
---|
1775 | switch(Msg)
|
---|
1776 | {
|
---|
1777 | case WM_CREATE:
|
---|
1778 | {
|
---|
1779 | if(CallWindowProcA(win32wndproc, getWindowHandle(), WM_CREATE, 0, lParam) == -1) {
|
---|
1780 | dprintf(("WM_CREATE returned -1\n"));
|
---|
1781 | rc = -1; //don't create window
|
---|
1782 | break;
|
---|
1783 | }
|
---|
1784 | rc = 0;
|
---|
1785 | break;
|
---|
1786 | }
|
---|
1787 | case WM_LBUTTONDOWN:
|
---|
1788 | case WM_MBUTTONDOWN:
|
---|
1789 | case WM_RBUTTONDOWN:
|
---|
1790 | {
|
---|
1791 | if (getParent())
|
---|
1792 | {
|
---|
1793 | POINTS pt = MAKEPOINTS(lParam);
|
---|
1794 | POINT point;
|
---|
1795 |
|
---|
1796 | point.x = pt.x;
|
---|
1797 | point.y = pt.y;
|
---|
1798 | mapWin32Point(OS2Hwnd,getParent()->getOS2WindowHandle(),(OSLIBPOINT*)&point);
|
---|
1799 | NotifyParent(Msg,wParam,MAKELPARAM(point.x,point.y));
|
---|
1800 | }
|
---|
1801 | rc = win32wndproc(getWindowHandle(), Msg, wParam, lParam);
|
---|
1802 | break;
|
---|
1803 | }
|
---|
1804 |
|
---|
1805 | case WM_DESTROY:
|
---|
1806 | rc = win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);
|
---|
1807 | break;
|
---|
1808 |
|
---|
1809 | default:
|
---|
1810 | rc = CallWindowProcA(win32wndproc, getWindowHandle(), Msg, wParam, lParam);
|
---|
1811 | break;
|
---|
1812 | }
|
---|
1813 | fInternalMsg = fInternalMsgBackup;
|
---|
1814 | return rc;
|
---|
1815 | }
|
---|
1816 | //******************************************************************************
|
---|
1817 | //Called as a result of an OS/2 message or called from a class method
|
---|
1818 | //******************************************************************************
|
---|
1819 | LRESULT Win32BaseWindow::SendInternalMessageW(ULONG Msg, WPARAM wParam, LPARAM lParam)
|
---|
1820 | {
|
---|
1821 | LRESULT rc;
|
---|
1822 | BOOL fInternalMsgBackup = fInternalMsg;
|
---|
1823 |
|
---|
1824 | DebugPrintMessage(getWindowHandle(), Msg, wParam, lParam, TRUE, TRUE);
|
---|
1825 |
|
---|
1826 | CallWindowHookProc(WH_CALLWNDPROC, Msg, wParam, lParam, TRUE);
|
---|
1827 |
|
---|
1828 | fInternalMsg = TRUE;
|
---|
1829 | switch(Msg)
|
---|
1830 | {
|
---|
1831 | case WM_CREATE:
|
---|
1832 | {
|
---|
1833 | if(CallWindowProcW(win32wndproc, getWindowHandle(), WM_CREATE, 0, lParam) == -1) {
|
---|
1834 | dprintf(("WM_CREATE returned -1\n"));
|
---|
1835 | rc = -1; //don't create window
|
---|
1836 | break;
|
---|
1837 | }
|
---|
1838 | rc = 0;
|
---|
1839 | break;
|
---|
1840 | }
|
---|
1841 | case WM_LBUTTONDOWN:
|
---|
1842 | case WM_MBUTTONDOWN:
|
---|
1843 | case WM_RBUTTONDOWN:
|
---|
1844 | NotifyParent(Msg, wParam, lParam);
|
---|
1845 | rc = win32wndproc(getWindowHandle(), Msg, wParam, lParam);
|
---|
1846 | break;
|
---|
1847 |
|
---|
1848 | case WM_DESTROY:
|
---|
1849 | rc = win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);
|
---|
1850 | break;
|
---|
1851 | default:
|
---|
1852 | rc = CallWindowProcW(win32wndproc, getWindowHandle(), Msg, wParam, lParam);
|
---|
1853 | break;
|
---|
1854 | }
|
---|
1855 | fInternalMsg = fInternalMsgBackup;
|
---|
1856 | return rc;
|
---|
1857 | }
|
---|
1858 | //******************************************************************************
|
---|
1859 | //******************************************************************************
|
---|
1860 | void Win32BaseWindow::CallWindowHookProc(ULONG hooktype, ULONG Msg, WPARAM wParam, LPARAM lParam, BOOL fUnicode)
|
---|
1861 | {
|
---|
1862 | CWPSTRUCT cwp;
|
---|
1863 |
|
---|
1864 | cwp.lParam = lParam;
|
---|
1865 | cwp.wParam = wParam;
|
---|
1866 | cwp.message = Msg;
|
---|
1867 | cwp.hwnd = getWindowHandle();
|
---|
1868 |
|
---|
1869 | switch(hooktype) {
|
---|
1870 | case WH_CALLWNDPROC:
|
---|
1871 | if(fUnicode) {
|
---|
1872 | HOOK_CallHooksW(WH_CALLWNDPROC, HC_ACTION, 1, (LPARAM)&cwp);
|
---|
1873 | }
|
---|
1874 | else HOOK_CallHooksA(WH_CALLWNDPROC, HC_ACTION, 1, (LPARAM)&cwp);
|
---|
1875 | break;
|
---|
1876 | }
|
---|
1877 | }
|
---|
1878 | //******************************************************************************
|
---|
1879 | //TODO: Do this more efficiently
|
---|
1880 | //******************************************************************************
|
---|
1881 | LRESULT Win32BaseWindow::BroadcastMessageA(int type, UINT msg, WPARAM wParam, LPARAM lParam)
|
---|
1882 | {
|
---|
1883 | Win32BaseWindow *window;
|
---|
1884 | HWND hwnd = WNDHANDLE_MAGIC_HIGHWORD;
|
---|
1885 |
|
---|
1886 | dprintf(("BroadCastMessageA %x %x %x", msg, wParam, lParam, GetFS()));
|
---|
1887 |
|
---|
1888 | for(int i=0;i<MAX_WINDOW_HANDLES;i++) {
|
---|
1889 | window = GetWindowFromHandle(hwnd++);
|
---|
1890 | if(window) {
|
---|
1891 | if ((window->getStyle() & WS_POPUP) || ((window->getStyle() & WS_CAPTION) == WS_CAPTION))
|
---|
1892 | {
|
---|
1893 |
|
---|
1894 | if(type == BROADCAST_SEND) {
|
---|
1895 | window->SendInternalMessageA(msg, wParam, lParam);
|
---|
1896 | }
|
---|
1897 | else PostMessageA(window->getWindowHandle(), msg, wParam, lParam);
|
---|
1898 | }
|
---|
1899 | }
|
---|
1900 | }
|
---|
1901 | return 0;
|
---|
1902 | }
|
---|
1903 | //******************************************************************************
|
---|
1904 | //TODO: Do this more efficiently
|
---|
1905 | //******************************************************************************
|
---|
1906 | LRESULT Win32BaseWindow::BroadcastMessageW(int type, UINT msg, WPARAM wParam, LPARAM lParam)
|
---|
1907 | {
|
---|
1908 | Win32BaseWindow *window;
|
---|
1909 | HWND hwnd = WNDHANDLE_MAGIC_HIGHWORD;
|
---|
1910 |
|
---|
1911 | dprintf(("BroadCastMessageW %x %x %x", msg, wParam, lParam));
|
---|
1912 |
|
---|
1913 | for(int i=0;i<MAX_WINDOW_HANDLES;i++) {
|
---|
1914 | window = GetWindowFromHandle(hwnd++);
|
---|
1915 | if(window) {
|
---|
1916 | if ((window->getStyle() & WS_POPUP) || ((window->getStyle() & WS_CAPTION) == WS_CAPTION))
|
---|
1917 | {
|
---|
1918 |
|
---|
1919 | if(type == BROADCAST_SEND) {
|
---|
1920 | window->SendInternalMessageW(msg, wParam, lParam);
|
---|
1921 | }
|
---|
1922 | else PostMessageW(window->getWindowHandle(), msg, wParam, lParam);
|
---|
1923 | }
|
---|
1924 | }
|
---|
1925 | }
|
---|
1926 | return 0;
|
---|
1927 | }
|
---|
1928 | //******************************************************************************
|
---|
1929 | //******************************************************************************
|
---|
1930 | void Win32BaseWindow::NotifyParent(UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
1931 | {
|
---|
1932 | Win32BaseWindow *window = this;
|
---|
1933 | Win32BaseWindow *parentwindow;
|
---|
1934 |
|
---|
1935 | while(window)
|
---|
1936 | {
|
---|
1937 | if(window->getStyle() & WS_CHILD && !(window->getExStyle() & WS_EX_NOPARENTNOTIFY) )
|
---|
1938 | {
|
---|
1939 | /* Notify the parent window only */
|
---|
1940 | parentwindow = window->getParent();
|
---|
1941 | if(parentwindow) {
|
---|
1942 | parentwindow->SendInternalMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, getWindowId()), lParam );
|
---|
1943 | }
|
---|
1944 | }
|
---|
1945 | else break;
|
---|
1946 |
|
---|
1947 | window = parentwindow;
|
---|
1948 | }
|
---|
1949 | }
|
---|
1950 | //******************************************************************************
|
---|
1951 | //******************************************************************************
|
---|
1952 | BOOL Win32BaseWindow::SetIcon(HICON hIcon)
|
---|
1953 | {
|
---|
1954 | dprintf(("Win32BaseWindow::SetIcon %x", hIcon));
|
---|
1955 | if(OSLibWinSetIcon(OS2HwndFrame, hIcon) == TRUE) {
|
---|
1956 | //TODO: Wine does't send these. Correct?
|
---|
1957 | // SendInternalMessageA(WM_SETICON, ICON_BIG, hIcon);
|
---|
1958 | return TRUE;
|
---|
1959 | }
|
---|
1960 | return FALSE;
|
---|
1961 | }
|
---|
1962 | //******************************************************************************
|
---|
1963 | //******************************************************************************
|
---|
1964 | BOOL Win32BaseWindow::ShowWindow(ULONG nCmdShow)
|
---|
1965 | {
|
---|
1966 | ULONG showstate = 0;
|
---|
1967 | HWND hWinAfter;
|
---|
1968 |
|
---|
1969 | dprintf(("ShowWindow %x %x", getWindowHandle(), nCmdShow));
|
---|
1970 |
|
---|
1971 | if (flags & WIN_NEED_SIZE)
|
---|
1972 | {
|
---|
1973 | /* should happen only in CreateWindowEx() */
|
---|
1974 | int wParam = SIZE_RESTORED;
|
---|
1975 |
|
---|
1976 | flags &= ~WIN_NEED_SIZE;
|
---|
1977 | if (dwStyle & WS_MAXIMIZE)
|
---|
1978 | wParam = SIZE_MAXIMIZED;
|
---|
1979 | else
|
---|
1980 | if (dwStyle & WS_MINIMIZE)
|
---|
1981 | wParam = SIZE_MINIMIZED;
|
---|
1982 |
|
---|
1983 | SendInternalMessageA(WM_SIZE, wParam,
|
---|
1984 | MAKELONG(rectClient.right-rectClient.left,
|
---|
1985 | rectClient.bottom-rectClient.top));
|
---|
1986 | SendInternalMessageA(WM_MOVE,0,MAKELONG(rectClient.left,rectClient.top));
|
---|
1987 | }
|
---|
1988 | switch(nCmdShow)
|
---|
1989 | {
|
---|
1990 | case SW_SHOW:
|
---|
1991 | case SW_SHOWDEFAULT: //todo
|
---|
1992 | showstate = SWPOS_SHOW | SWPOS_ACTIVATE;
|
---|
1993 | break;
|
---|
1994 | case SW_HIDE:
|
---|
1995 | showstate = SWPOS_HIDE;
|
---|
1996 | break;
|
---|
1997 | case SW_RESTORE:
|
---|
1998 | showstate = SWPOS_RESTORE | SWPOS_SHOW | SWPOS_ACTIVATE;
|
---|
1999 | break;
|
---|
2000 | case SW_MINIMIZE:
|
---|
2001 | showstate = SWPOS_MINIMIZE;
|
---|
2002 | break;
|
---|
2003 | case SW_SHOWMAXIMIZED:
|
---|
2004 | showstate = SWPOS_MAXIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;
|
---|
2005 | break;
|
---|
2006 | case SW_SHOWMINIMIZED:
|
---|
2007 | showstate = SWPOS_MINIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;
|
---|
2008 | break;
|
---|
2009 | case SW_SHOWMINNOACTIVE:
|
---|
2010 | showstate = SWPOS_MINIMIZE | SWPOS_SHOW;
|
---|
2011 | break;
|
---|
2012 | case SW_SHOWNA:
|
---|
2013 | showstate = SWPOS_SHOW;
|
---|
2014 | break;
|
---|
2015 | case SW_SHOWNOACTIVATE:
|
---|
2016 | showstate = SWPOS_SHOW;
|
---|
2017 | break;
|
---|
2018 | case SW_SHOWNORMAL:
|
---|
2019 | showstate = SWPOS_RESTORE | SWPOS_ACTIVATE | SWPOS_SHOW;
|
---|
2020 | break;
|
---|
2021 | }
|
---|
2022 |
|
---|
2023 | /* We can't activate a child window (WINE) */
|
---|
2024 | if(getStyle() & WS_CHILD)
|
---|
2025 | showstate &= ~SWPOS_ACTIVATE;
|
---|
2026 |
|
---|
2027 | if(showstate & SWPOS_SHOW) {
|
---|
2028 | setStyle(getStyle() | WS_VISIBLE);
|
---|
2029 | }
|
---|
2030 | else setStyle(getStyle() & ~WS_VISIBLE);
|
---|
2031 |
|
---|
2032 | BOOL rc = OSLibWinShowWindow(OS2HwndFrame, showstate);
|
---|
2033 |
|
---|
2034 | return rc;
|
---|
2035 | }
|
---|
2036 | //******************************************************************************
|
---|
2037 | //******************************************************************************
|
---|
2038 | BOOL Win32BaseWindow::SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags)
|
---|
2039 | {
|
---|
2040 | BOOL rc = FALSE;
|
---|
2041 | Win32BaseWindow *window;
|
---|
2042 | HWND hParent = 0;
|
---|
2043 | BOOL fShow = FALSE, fHide = FALSE;
|
---|
2044 |
|
---|
2045 | if (fuFlags &
|
---|
2046 | ~(SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER |
|
---|
2047 | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_FRAMECHANGED |
|
---|
2048 | SWP_SHOWWINDOW | SWP_HIDEWINDOW | SWP_NOCOPYBITS |
|
---|
2049 | SWP_NOOWNERZORDER))
|
---|
2050 | {
|
---|
2051 | return FALSE;
|
---|
2052 | }
|
---|
2053 |
|
---|
2054 | if(IsWindowDestroyed()) {
|
---|
2055 | //changing the position of a window that's being destroyed can cause crashes in PMMERGE
|
---|
2056 | dprintf(("SetWindowPos; window already destroyed"));
|
---|
2057 | return TRUE;
|
---|
2058 | }
|
---|
2059 | WINDOWPOS wpos;
|
---|
2060 | SWP swp, swpOld;
|
---|
2061 |
|
---|
2062 | #if 0 //CB: test: MSIE 2.0 displays the tool-/addressbar this way -> to check
|
---|
2063 | //CB: -> comctl32: toolbar (WM_SIZE), same bug: statusbar height
|
---|
2064 | //CB: cx or cy are 0
|
---|
2065 |
|
---|
2066 | if (cx == 0)
|
---|
2067 | {
|
---|
2068 | dprintf(("CB: cx is 0! %d",fuFlags));
|
---|
2069 | if (fuFlags & SWP_NOSIZE) dprintf(("CB: nosize"));
|
---|
2070 | cx = 50;
|
---|
2071 | }
|
---|
2072 | if (cy == 0)
|
---|
2073 | {
|
---|
2074 | dprintf(("CB: cy is 0! %d",fuFlags));
|
---|
2075 | if (fuFlags & SWP_NOSIZE) dprintf(("CB: nosize"));
|
---|
2076 | cy = 50;
|
---|
2077 | }
|
---|
2078 |
|
---|
2079 | #endif
|
---|
2080 |
|
---|
2081 | if(fuFlags & SWP_SHOWWINDOW) {
|
---|
2082 | fShow = TRUE;
|
---|
2083 | fuFlags &= ~SWP_SHOWWINDOW;
|
---|
2084 | }
|
---|
2085 | else
|
---|
2086 | if(fuFlags & SWP_HIDEWINDOW) {
|
---|
2087 | fHide = TRUE;
|
---|
2088 | fuFlags &= ~SWP_HIDEWINDOW;
|
---|
2089 | }
|
---|
2090 | wpos.flags = fuFlags;
|
---|
2091 | wpos.cy = cy;
|
---|
2092 | wpos.cx = cx;
|
---|
2093 | wpos.x = x;
|
---|
2094 | wpos.y = y;
|
---|
2095 | wpos.hwndInsertAfter = hwndInsertAfter;
|
---|
2096 | wpos.hwnd = getWindowHandle();
|
---|
2097 |
|
---|
2098 | if(~fuFlags & (SWP_NOMOVE | SWP_NOSIZE))
|
---|
2099 | {
|
---|
2100 | if (isChild())
|
---|
2101 | {
|
---|
2102 | Win32BaseWindow *windowParent = getParent();
|
---|
2103 | if(windowParent) {
|
---|
2104 | hParent = getParent()->getOS2WindowHandle();
|
---|
2105 | }
|
---|
2106 | else dprintf(("WARNING: Win32BaseWindow::SetWindowPos window %x is child but has no parent!!", getWindowHandle()));
|
---|
2107 | }
|
---|
2108 | OSLibWinQueryWindowPos(OS2HwndFrame, &swpOld);
|
---|
2109 | }
|
---|
2110 |
|
---|
2111 | OSLibMapWINDOWPOStoSWP(&wpos, &swp, &swpOld, hParent, OS2HwndFrame);
|
---|
2112 | if (swp.fl == 0) {
|
---|
2113 | if (fuFlags & SWP_FRAMECHANGED)
|
---|
2114 | {
|
---|
2115 | FrameUpdateClient(this);
|
---|
2116 | }
|
---|
2117 | if(fHide) {
|
---|
2118 | ShowWindow(SW_HIDE);
|
---|
2119 | }
|
---|
2120 | if(fShow) {
|
---|
2121 | ShowWindow(SW_SHOWNA);
|
---|
2122 | }
|
---|
2123 | return TRUE;
|
---|
2124 | }
|
---|
2125 |
|
---|
2126 | // if ((swp.fl & SWPOS_ZORDER) && (swp.hwndInsertBehind > HWNDOS_BOTTOM))
|
---|
2127 | if ((swp.hwndInsertBehind > HWNDOS_BOTTOM))
|
---|
2128 | {
|
---|
2129 | Win32BaseWindow *wndBehind = Win32BaseWindow::GetWindowFromHandle(swp.hwndInsertBehind);
|
---|
2130 | if(wndBehind) {
|
---|
2131 | swp.hwndInsertBehind = wndBehind->getOS2FrameWindowHandle();
|
---|
2132 | }
|
---|
2133 | else {
|
---|
2134 | dprintf(("ERROR: SetWindowPos: hwndInsertBehind %x invalid!",swp.hwndInsertBehind));
|
---|
2135 | swp.hwndInsertBehind = 0;
|
---|
2136 | }
|
---|
2137 | }
|
---|
2138 | swp.hwnd = OS2HwndFrame;
|
---|
2139 |
|
---|
2140 | dprintf (("WinSetWindowPos %x %x (%d,%d)(%d,%d) %x", swp.hwnd, swp.hwndInsertBehind, swp.x, swp.y, swp.cx, swp.cy, swp.fl));
|
---|
2141 |
|
---|
2142 | //SvL: For some reason WinSetMultWindowPos doesn't work for showing windows when they are hidden..
|
---|
2143 | if(fHide) {
|
---|
2144 | ShowWindow(SW_HIDE);
|
---|
2145 | }
|
---|
2146 | rc = OSLibWinSetMultWindowPos(&swp, 1);
|
---|
2147 | if(fShow) {
|
---|
2148 | ShowWindow(SW_SHOWNA);
|
---|
2149 | }
|
---|
2150 |
|
---|
2151 | if (rc == FALSE)
|
---|
2152 | {
|
---|
2153 | dprintf(("OSLibWinSetMultWindowPos failed! Error %x",OSLibWinGetLastError()));
|
---|
2154 | }
|
---|
2155 |
|
---|
2156 | if(fuFlags & SWP_FRAMECHANGED && (fuFlags & (SWP_NOMOVE | SWP_NOSIZE) == (SWP_NOMOVE | SWP_NOSIZE)))
|
---|
2157 | {
|
---|
2158 | FrameUpdateClient(this);
|
---|
2159 | }
|
---|
2160 |
|
---|
2161 | return (rc);
|
---|
2162 | }
|
---|
2163 | //******************************************************************************
|
---|
2164 | //TODO: WPF_RESTOREMAXIMIZED
|
---|
2165 | //******************************************************************************
|
---|
2166 | BOOL Win32BaseWindow::SetWindowPlacement(WINDOWPLACEMENT *winpos)
|
---|
2167 | {
|
---|
2168 | if(isFrameWindow())
|
---|
2169 | {
|
---|
2170 | // Set the minimized position
|
---|
2171 | if (winpos->flags & WPF_SETMINPOSITION)
|
---|
2172 | {
|
---|
2173 | OSLibSetWindowMinPos(OS2HwndFrame, winpos->ptMinPosition.x, winpos->ptMinPosition.y);
|
---|
2174 | }
|
---|
2175 |
|
---|
2176 | //TODO: Max position
|
---|
2177 |
|
---|
2178 | // Set the new restore position.
|
---|
2179 | OSLibSetWindowRestoreRect(OS2HwndFrame, &winpos->rcNormalPosition);
|
---|
2180 | }
|
---|
2181 |
|
---|
2182 | return ShowWindow(winpos->showCmd);
|
---|
2183 | }
|
---|
2184 | //******************************************************************************
|
---|
2185 | //Also destroys all the child windows (destroy children first, parent last)
|
---|
2186 | //******************************************************************************
|
---|
2187 | BOOL Win32BaseWindow::DestroyWindow()
|
---|
2188 | {
|
---|
2189 | /* Call hooks */
|
---|
2190 | if(HOOK_CallHooksA( WH_CBT, HCBT_DESTROYWND, getWindowHandle(), 0L))
|
---|
2191 | {
|
---|
2192 | return FALSE;
|
---|
2193 | }
|
---|
2194 |
|
---|
2195 | if(!(getStyle() & WS_CHILD) && getOwner() == NULL)
|
---|
2196 | {
|
---|
2197 | HOOK_CallHooksA(WH_SHELL, HSHELL_WINDOWDESTROYED, getWindowHandle(), 0L);
|
---|
2198 | /* FIXME: clean up palette - see "Internals" p.352 */
|
---|
2199 | }
|
---|
2200 |
|
---|
2201 | if((getStyle() & WS_CHILD) && !(getExStyle() & WS_EX_NOPARENTNOTIFY))
|
---|
2202 | {
|
---|
2203 | if(getParent())
|
---|
2204 | {
|
---|
2205 | /* Notify the parent window only */
|
---|
2206 | getParent()->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(WM_DESTROY, getWindowId()), (LPARAM)getWindowHandle());
|
---|
2207 | if( !::IsWindow(getWindowHandle()) )
|
---|
2208 | {
|
---|
2209 | return TRUE;
|
---|
2210 | }
|
---|
2211 | }
|
---|
2212 | else DebugInt3();
|
---|
2213 | }
|
---|
2214 | fDestroyWindowCalled = TRUE;
|
---|
2215 | return OSLibWinDestroyWindow(OS2HwndFrame);
|
---|
2216 | }
|
---|
2217 | //******************************************************************************
|
---|
2218 | //******************************************************************************
|
---|
2219 | Win32BaseWindow *Win32BaseWindow::getParent()
|
---|
2220 | {
|
---|
2221 | Win32BaseWindow *wndparent = (Win32BaseWindow *)ChildWindow::GetParent();
|
---|
2222 | return ((ULONG)wndparent == (ULONG)windowDesktop) ? NULL : wndparent;
|
---|
2223 | }
|
---|
2224 | //******************************************************************************
|
---|
2225 | //******************************************************************************
|
---|
2226 | HWND Win32BaseWindow::GetParent()
|
---|
2227 | {
|
---|
2228 | Win32BaseWindow *wndparent;
|
---|
2229 |
|
---|
2230 | if ((!(getStyle() & (WS_POPUP|WS_CHILD))))
|
---|
2231 | {
|
---|
2232 | return 0;
|
---|
2233 | }
|
---|
2234 | wndparent = ((getStyle() & WS_CHILD) ? getParent() : getOwner());
|
---|
2235 |
|
---|
2236 | return (wndparent) ? wndparent->getWindowHandle() : 0;
|
---|
2237 | }
|
---|
2238 | //******************************************************************************
|
---|
2239 | //******************************************************************************
|
---|
2240 | HWND Win32BaseWindow::SetParent(HWND hwndNewParent)
|
---|
2241 | {
|
---|
2242 | HWND oldhwnd;
|
---|
2243 | Win32BaseWindow *newparent;
|
---|
2244 |
|
---|
2245 | if(getParent()) {
|
---|
2246 | oldhwnd = getParent()->getWindowHandle();
|
---|
2247 | getParent()->RemoveChild(this);
|
---|
2248 | }
|
---|
2249 | else oldhwnd = 0;
|
---|
2250 |
|
---|
2251 | newparent = GetWindowFromHandle(hwndNewParent);
|
---|
2252 | if(newparent)
|
---|
2253 | {
|
---|
2254 | setParent(newparent);
|
---|
2255 | getParent()->AddChild(this);
|
---|
2256 | OSLibWinSetParent(getOS2FrameWindowHandle(), getParent()->getOS2WindowHandle());
|
---|
2257 | return oldhwnd;
|
---|
2258 | }
|
---|
2259 | else {
|
---|
2260 | setParent(windowDesktop);
|
---|
2261 | windowDesktop->AddChild(this);
|
---|
2262 | OSLibWinSetParent(getOS2FrameWindowHandle(), OSLIB_HWND_DESKTOP);
|
---|
2263 | return oldhwnd;
|
---|
2264 | }
|
---|
2265 | }
|
---|
2266 | //******************************************************************************
|
---|
2267 | //******************************************************************************
|
---|
2268 | BOOL Win32BaseWindow::IsChild(HWND hwndParent)
|
---|
2269 | {
|
---|
2270 | if(getParent()) {
|
---|
2271 | return getParent()->getWindowHandle() == hwndParent;
|
---|
2272 | }
|
---|
2273 | else return 0;
|
---|
2274 | }
|
---|
2275 | //******************************************************************************
|
---|
2276 | //******************************************************************************
|
---|
2277 | HWND Win32BaseWindow::GetTopWindow()
|
---|
2278 | {
|
---|
2279 | return GetWindow(GW_CHILD);
|
---|
2280 | }
|
---|
2281 | //******************************************************************************
|
---|
2282 | // Get the top-level parent for a child window.
|
---|
2283 | //******************************************************************************
|
---|
2284 | Win32BaseWindow *Win32BaseWindow::GetTopParent()
|
---|
2285 | {
|
---|
2286 | Win32BaseWindow *window = this;
|
---|
2287 |
|
---|
2288 | while(window && (window->getStyle() & WS_CHILD))
|
---|
2289 | {
|
---|
2290 | window = window->getParent();
|
---|
2291 | }
|
---|
2292 | return window;
|
---|
2293 | }
|
---|
2294 | //******************************************************************************
|
---|
2295 | //Don't call WinUpdateWindow as that one also updates the child windows
|
---|
2296 | //Also need to send WM_PAINT directly to the window procedure, which doesn't
|
---|
2297 | //always happen with WinUpdateWindow (could be posted if thread doesn't own window)
|
---|
2298 | //******************************************************************************
|
---|
2299 | BOOL Win32BaseWindow::UpdateWindow()
|
---|
2300 | {
|
---|
2301 | RECT rect;
|
---|
2302 |
|
---|
2303 | if(OSLibWinQueryUpdateRect(OS2Hwnd, &rect))
|
---|
2304 | {//update region not empty
|
---|
2305 | HDC hdc;
|
---|
2306 |
|
---|
2307 | hdc = O32_GetDC(OS2Hwnd);
|
---|
2308 | if (isIcon)
|
---|
2309 | {
|
---|
2310 | SendInternalMessageA(WM_ICONERASEBKGND, (WPARAM)hdc, 0);
|
---|
2311 | SendInternalMessageA(WM_PAINTICON, 0, 0);
|
---|
2312 | }
|
---|
2313 | else
|
---|
2314 | {
|
---|
2315 | SendInternalMessageA(WM_ERASEBKGND, (WPARAM)hdc, 0);
|
---|
2316 | SendInternalMessageA(WM_PAINT, 0, 0);
|
---|
2317 | }
|
---|
2318 | O32_ReleaseDC(OS2Hwnd, hdc);
|
---|
2319 | }
|
---|
2320 | return TRUE;
|
---|
2321 | }
|
---|
2322 | //******************************************************************************
|
---|
2323 | //******************************************************************************
|
---|
2324 | BOOL Win32BaseWindow::IsIconic()
|
---|
2325 | {
|
---|
2326 | return OSLibWinIsIconic(OS2Hwnd);
|
---|
2327 | }
|
---|
2328 | //******************************************************************************
|
---|
2329 | //TODO: Should not enumerate children that are created during the enumeration!
|
---|
2330 | //******************************************************************************
|
---|
2331 | BOOL Win32BaseWindow::EnumChildWindows(WNDENUMPROC lpfn, LPARAM lParam)
|
---|
2332 | {
|
---|
2333 | BOOL rc = TRUE;
|
---|
2334 | HWND hwnd;
|
---|
2335 | Win32BaseWindow *prevchild = 0, *child = 0;
|
---|
2336 |
|
---|
2337 | dprintf(("EnumChildWindows of %x parameter %x %x (%x)", getWindowHandle(), lpfn, lParam, getFirstChild()));
|
---|
2338 | for (child = (Win32BaseWindow *)getFirstChild(); child; child = (Win32BaseWindow *)child->getNextChild())
|
---|
2339 | {
|
---|
2340 | dprintf(("EnumChildWindows: enumerating child %x", child->getWindowHandle()));
|
---|
2341 | hwnd = child->getWindowHandle();
|
---|
2342 | if(child->getOwner()) {
|
---|
2343 | continue; //shouldn't have an owner (Wine)
|
---|
2344 | }
|
---|
2345 | if(lpfn(hwnd, lParam) == FALSE)
|
---|
2346 | {
|
---|
2347 | rc = FALSE;
|
---|
2348 | break;
|
---|
2349 | }
|
---|
2350 | //check if the window still exists
|
---|
2351 | if(!::IsWindow(hwnd))
|
---|
2352 | {
|
---|
2353 | child = prevchild;
|
---|
2354 | continue;
|
---|
2355 | }
|
---|
2356 | if(child->getFirstChild() != NULL)
|
---|
2357 | {
|
---|
2358 | dprintf(("EnumChildWindows: Enumerate children of %x", child->getWindowHandle()));
|
---|
2359 | if(child->EnumChildWindows(lpfn, lParam) == FALSE)
|
---|
2360 | {
|
---|
2361 | rc = FALSE;
|
---|
2362 | break;
|
---|
2363 | }
|
---|
2364 | }
|
---|
2365 | prevchild = child;
|
---|
2366 | }
|
---|
2367 | return rc;
|
---|
2368 | }
|
---|
2369 | //******************************************************************************
|
---|
2370 | //Enumerate first-level children only and check thread id
|
---|
2371 | //******************************************************************************
|
---|
2372 | BOOL Win32BaseWindow::EnumThreadWindows(DWORD dwThreadId, WNDENUMPROC lpfn, LPARAM lParam)
|
---|
2373 | {
|
---|
2374 | Win32BaseWindow *child = 0;
|
---|
2375 | ULONG tid, pid;
|
---|
2376 | BOOL rc;
|
---|
2377 | HWND hwnd;
|
---|
2378 |
|
---|
2379 | dprintf(("EnumThreadWindows %x %x %x", dwThreadId, lpfn, lParam));
|
---|
2380 |
|
---|
2381 | for (child = (Win32BaseWindow *)getFirstChild(); child; child = (Win32BaseWindow *)child->getNextChild())
|
---|
2382 | {
|
---|
2383 | OSLibWinQueryWindowProcess(child->getOS2WindowHandle(), &pid, &tid);
|
---|
2384 |
|
---|
2385 | if(dwThreadId == tid) {
|
---|
2386 | dprintf2(("EnumThreadWindows: Found Window %x", child->getWindowHandle()));
|
---|
2387 | if((rc = lpfn(child->getWindowHandle(), lParam)) == FALSE) {
|
---|
2388 | break;
|
---|
2389 | }
|
---|
2390 | }
|
---|
2391 | }
|
---|
2392 | return TRUE;
|
---|
2393 | }
|
---|
2394 | //******************************************************************************
|
---|
2395 | //Enumerate first-level children only
|
---|
2396 | //******************************************************************************
|
---|
2397 | BOOL Win32BaseWindow::EnumWindows(WNDENUMPROC lpfn, LPARAM lParam)
|
---|
2398 | {
|
---|
2399 | Win32BaseWindow *child = 0;
|
---|
2400 | BOOL rc;
|
---|
2401 | HWND hwnd;
|
---|
2402 |
|
---|
2403 | dprintf(("EnumWindows %x %x", lpfn, lParam));
|
---|
2404 |
|
---|
2405 | for (child = (Win32BaseWindow *)getFirstChild(); child; child = (Win32BaseWindow *)child->getNextChild())
|
---|
2406 | {
|
---|
2407 | hwnd = child->getWindowHandle();
|
---|
2408 |
|
---|
2409 | dprintf2(("EnumWindows: Found Window %x", child->getWindowHandle()));
|
---|
2410 | if((rc = lpfn(child->getWindowHandle(), lParam)) == FALSE) {
|
---|
2411 | break;
|
---|
2412 | }
|
---|
2413 | }
|
---|
2414 | return TRUE;
|
---|
2415 | }
|
---|
2416 | //******************************************************************************
|
---|
2417 | //******************************************************************************
|
---|
2418 | Win32BaseWindow *Win32BaseWindow::FindWindowById(int id)
|
---|
2419 | {
|
---|
2420 | for (Win32BaseWindow *child = (Win32BaseWindow *)getFirstChild(); child; child = (Win32BaseWindow *)child->getNextChild())
|
---|
2421 | {
|
---|
2422 | if (child->getWindowId() == id)
|
---|
2423 | {
|
---|
2424 | return child;
|
---|
2425 | }
|
---|
2426 | }
|
---|
2427 | return 0;
|
---|
2428 | }
|
---|
2429 | //******************************************************************************
|
---|
2430 | //TODO:
|
---|
2431 | //We assume (for now) that if hwndParent or hwndChildAfter are real window handles, that
|
---|
2432 | //the current process owns them.
|
---|
2433 | //******************************************************************************
|
---|
2434 | HWND Win32BaseWindow::FindWindowEx(HWND hwndParent, HWND hwndChildAfter, LPSTR lpszClass, LPSTR lpszWindow,
|
---|
2435 | BOOL fUnicode)
|
---|
2436 | {
|
---|
2437 | Win32BaseWindow *parent = GetWindowFromHandle(hwndParent);
|
---|
2438 | Win32BaseWindow *child = GetWindowFromHandle(hwndChildAfter);
|
---|
2439 |
|
---|
2440 | if((hwndParent != OSLIB_HWND_DESKTOP && !parent) ||
|
---|
2441 | (hwndChildAfter != 0 && !child) ||
|
---|
2442 | (hwndParent == OSLIB_HWND_DESKTOP && hwndChildAfter != 0))
|
---|
2443 | {
|
---|
2444 | dprintf(("Win32BaseWindow::FindWindowEx: parent or child not found %x %x", hwndParent, hwndChildAfter));
|
---|
2445 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
---|
2446 | return 0;
|
---|
2447 | }
|
---|
2448 | if(hwndParent != OSLIB_HWND_DESKTOP)
|
---|
2449 | {//if the current process owns the window, just do a quick search
|
---|
2450 | child = (Win32BaseWindow *)parent->getFirstChild();
|
---|
2451 | if(hwndChildAfter != 0)
|
---|
2452 | {
|
---|
2453 | while(child)
|
---|
2454 | {
|
---|
2455 | if(child->getWindowHandle() == hwndChildAfter)
|
---|
2456 | {
|
---|
2457 | child = (Win32BaseWindow *)child->getNextChild();
|
---|
2458 | break;
|
---|
2459 | }
|
---|
2460 | child = (Win32BaseWindow *)child->getNextChild();
|
---|
2461 | }
|
---|
2462 | }
|
---|
2463 | while(child)
|
---|
2464 | {
|
---|
2465 | if(child->getWindowClass()->hasClassName(lpszClass, fUnicode) &&
|
---|
2466 | (!lpszWindow || child->hasWindowName(lpszWindow, fUnicode)))
|
---|
2467 | {
|
---|
2468 | dprintf(("FindWindowEx: Found window %x", child->getWindowHandle()));
|
---|
2469 | return child->getWindowHandle();
|
---|
2470 | }
|
---|
2471 | child = (Win32BaseWindow *)child->getNextChild();
|
---|
2472 | }
|
---|
2473 | }
|
---|
2474 | else {
|
---|
2475 | Win32BaseWindow *wnd;
|
---|
2476 | HWND henum, hwnd;
|
---|
2477 |
|
---|
2478 | henum = OSLibWinBeginEnumWindows(OSLIB_HWND_DESKTOP);
|
---|
2479 | hwnd = OSLibWinGetNextWindow(henum);
|
---|
2480 |
|
---|
2481 | while(hwnd)
|
---|
2482 | {
|
---|
2483 | wnd = GetWindowFromOS2Handle(hwnd);
|
---|
2484 | if(wnd == NULL) {
|
---|
2485 | hwnd = OSLibWinQueryClientWindow(hwnd);
|
---|
2486 | if(hwnd) wnd = GetWindowFromOS2Handle(hwnd);
|
---|
2487 | if(!hwnd) wnd = GetWindowFromOS2FrameHandle(hwnd);
|
---|
2488 | }
|
---|
2489 |
|
---|
2490 | if(wnd) {
|
---|
2491 | if(wnd->getWindowClass()->hasClassName(lpszClass, fUnicode) &&
|
---|
2492 | (!lpszWindow || wnd->hasWindowName(lpszWindow, fUnicode)))
|
---|
2493 | {
|
---|
2494 | OSLibWinEndEnumWindows(henum);
|
---|
2495 | dprintf(("FindWindowEx: Found window %x", wnd->getWindowHandle()));
|
---|
2496 | return wnd->getWindowHandle();
|
---|
2497 | }
|
---|
2498 | }
|
---|
2499 | hwnd = OSLibWinGetNextWindow(henum);
|
---|
2500 | }
|
---|
2501 | OSLibWinEndEnumWindows(henum);
|
---|
2502 | }
|
---|
2503 | SetLastError(ERROR_CANNOT_FIND_WND_CLASS); //TODO: not always correct
|
---|
2504 | return 0;
|
---|
2505 | }
|
---|
2506 | //******************************************************************************
|
---|
2507 | //******************************************************************************
|
---|
2508 | HWND Win32BaseWindow::GetWindow(UINT uCmd)
|
---|
2509 | {
|
---|
2510 | HWND hwndRelated = 0;
|
---|
2511 | Win32BaseWindow *window;
|
---|
2512 |
|
---|
2513 | switch(uCmd)
|
---|
2514 | {
|
---|
2515 | case GW_HWNDFIRST:
|
---|
2516 | if(getParent()) {
|
---|
2517 | window = (Win32BaseWindow *)getParent()->getFirstChild();
|
---|
2518 | hwndRelated = window->getWindowHandle();
|
---|
2519 | }
|
---|
2520 | break;
|
---|
2521 |
|
---|
2522 | case GW_HWNDLAST:
|
---|
2523 | if(!getParent())
|
---|
2524 | {
|
---|
2525 | goto end;
|
---|
2526 | }
|
---|
2527 |
|
---|
2528 | window = this;
|
---|
2529 | while(window->getNextChild())
|
---|
2530 | {
|
---|
2531 | window = (Win32BaseWindow *)window->getNextChild();
|
---|
2532 | }
|
---|
2533 | hwndRelated = window->getWindowHandle();
|
---|
2534 | break;
|
---|
2535 |
|
---|
2536 | case GW_HWNDNEXT:
|
---|
2537 | window = (Win32BaseWindow *)getNextChild();
|
---|
2538 | if(window) {
|
---|
2539 | hwndRelated = window->getWindowHandle();
|
---|
2540 | }
|
---|
2541 | break;
|
---|
2542 |
|
---|
2543 | case GW_HWNDPREV:
|
---|
2544 | if(!getParent())
|
---|
2545 | {
|
---|
2546 | goto end;
|
---|
2547 | }
|
---|
2548 | window = (Win32BaseWindow *)(getParent()->getFirstChild()); /* First sibling */
|
---|
2549 | if(window == this)
|
---|
2550 | {
|
---|
2551 | hwndRelated = 0; /* First in list */
|
---|
2552 | goto end;
|
---|
2553 | }
|
---|
2554 | while(window->getNextChild())
|
---|
2555 | {
|
---|
2556 | if (window->getNextChild() == this)
|
---|
2557 | {
|
---|
2558 | hwndRelated = window->getWindowHandle();
|
---|
2559 | goto end;
|
---|
2560 | }
|
---|
2561 | window = (Win32BaseWindow *)window->getNextChild();
|
---|
2562 | }
|
---|
2563 | break;
|
---|
2564 |
|
---|
2565 | case GW_OWNER:
|
---|
2566 | if(getOwner()) {
|
---|
2567 | hwndRelated = getOwner()->getWindowHandle();
|
---|
2568 | }
|
---|
2569 | break;
|
---|
2570 |
|
---|
2571 | case GW_CHILD:
|
---|
2572 | if(getFirstChild()) {
|
---|
2573 | hwndRelated = ((Win32BaseWindow *)getFirstChild())->getWindowHandle();
|
---|
2574 | }
|
---|
2575 | break;
|
---|
2576 | }
|
---|
2577 | end:
|
---|
2578 | dprintf(("GetWindow %x %d returned %x", getWindowHandle(), uCmd, hwndRelated));
|
---|
2579 | return hwndRelated;
|
---|
2580 | }
|
---|
2581 | //******************************************************************************
|
---|
2582 | //******************************************************************************
|
---|
2583 | HWND Win32BaseWindow::SetActiveWindow()
|
---|
2584 | {
|
---|
2585 | HWND hwndActive;
|
---|
2586 | Win32BaseWindow *win32wnd;
|
---|
2587 | ULONG magic;
|
---|
2588 |
|
---|
2589 | dprintf(("SetActiveWindow %x", getWindowHandle()));
|
---|
2590 | hwndActive = OSLibWinSetActiveWindow(OS2HwndFrame);
|
---|
2591 | win32wnd = (Win32BaseWindow *)OSLibWinGetWindowULong(hwndActive, OFFSET_WIN32WNDPTR);
|
---|
2592 | magic = OSLibWinGetWindowULong(hwndActive, OFFSET_WIN32PM_MAGIC);
|
---|
2593 | if(CheckMagicDword(magic) && win32wnd)
|
---|
2594 | {
|
---|
2595 | return win32wnd->getWindowHandle();
|
---|
2596 | }
|
---|
2597 | return windowDesktop->getWindowHandle(); //pretend the desktop was active
|
---|
2598 | }
|
---|
2599 | //******************************************************************************
|
---|
2600 | //WM_ENABLE is sent to hwnd, but not to it's children (as it should be)
|
---|
2601 | //******************************************************************************
|
---|
2602 | BOOL Win32BaseWindow::EnableWindow(BOOL fEnable)
|
---|
2603 | {
|
---|
2604 | return OSLibWinEnableWindow(OS2HwndFrame, fEnable);
|
---|
2605 | }
|
---|
2606 | //******************************************************************************
|
---|
2607 | //******************************************************************************
|
---|
2608 | BOOL Win32BaseWindow::CloseWindow()
|
---|
2609 | {
|
---|
2610 | return OSLibWinMinimizeWindow(OS2HwndFrame);
|
---|
2611 | }
|
---|
2612 | //******************************************************************************
|
---|
2613 | //******************************************************************************
|
---|
2614 | HWND Win32BaseWindow::GetActiveWindow()
|
---|
2615 | {
|
---|
2616 | HWND hwndActive;
|
---|
2617 | Win32BaseWindow *win32wnd;
|
---|
2618 | ULONG magic;
|
---|
2619 |
|
---|
2620 | hwndActive = OSLibWinQueryActiveWindow();
|
---|
2621 |
|
---|
2622 | return OS2ToWin32Handle(hwndActive);
|
---|
2623 | }
|
---|
2624 | //******************************************************************************
|
---|
2625 | //******************************************************************************
|
---|
2626 | BOOL Win32BaseWindow::IsWindowEnabled()
|
---|
2627 | {
|
---|
2628 | return OSLibWinIsWindowEnabled(OS2HwndFrame);
|
---|
2629 | }
|
---|
2630 | //******************************************************************************
|
---|
2631 | //******************************************************************************
|
---|
2632 | BOOL Win32BaseWindow::IsWindowVisible()
|
---|
2633 | {
|
---|
2634 | #if 1
|
---|
2635 | return (dwStyle & WS_VISIBLE) == WS_VISIBLE;
|
---|
2636 | #else
|
---|
2637 | return OSLibWinIsWindowVisible(OS2HwndFrame);
|
---|
2638 | #endif
|
---|
2639 | }
|
---|
2640 | //******************************************************************************
|
---|
2641 | //******************************************************************************
|
---|
2642 | BOOL Win32BaseWindow::hasWindowName(LPSTR wndname, BOOL fUnicode)
|
---|
2643 | {
|
---|
2644 | INT len = GetWindowTextLength();
|
---|
2645 | BOOL res;
|
---|
2646 |
|
---|
2647 | if (wndname == NULL)
|
---|
2648 | return (len == 0);
|
---|
2649 |
|
---|
2650 | len++;
|
---|
2651 | if (fUnicode)
|
---|
2652 | {
|
---|
2653 | WCHAR *text = (WCHAR*)malloc(len*sizeof(WCHAR));
|
---|
2654 |
|
---|
2655 | GetWindowTextW(text,len);
|
---|
2656 | res = (lstrcmpW(text,(LPWSTR)wndname) == 0);
|
---|
2657 | free(text);
|
---|
2658 | } else
|
---|
2659 | {
|
---|
2660 | CHAR *text = (CHAR*)malloc(len*sizeof(CHAR));
|
---|
2661 |
|
---|
2662 | GetWindowTextA(text,len);
|
---|
2663 | res = (strcmp(text,wndname) == 0);
|
---|
2664 | free(text);
|
---|
2665 | }
|
---|
2666 |
|
---|
2667 | return res;
|
---|
2668 | }
|
---|
2669 | //******************************************************************************
|
---|
2670 | //******************************************************************************
|
---|
2671 | CHAR *Win32BaseWindow::getWindowNamePtrA()
|
---|
2672 | {
|
---|
2673 | INT len = GetWindowTextLength();
|
---|
2674 | CHAR *text;
|
---|
2675 |
|
---|
2676 | if (len == 0) return NULL;
|
---|
2677 | len++;
|
---|
2678 | text = (CHAR*)malloc(len*sizeof(CHAR));
|
---|
2679 | GetWindowTextA(text,len);
|
---|
2680 |
|
---|
2681 | return text;
|
---|
2682 | }
|
---|
2683 | //******************************************************************************
|
---|
2684 | //******************************************************************************
|
---|
2685 | WCHAR *Win32BaseWindow::getWindowNamePtrW()
|
---|
2686 | {
|
---|
2687 | INT len = GetWindowTextLength();
|
---|
2688 | WCHAR *text;
|
---|
2689 |
|
---|
2690 | if (len == 0) return NULL;
|
---|
2691 | len++;
|
---|
2692 | text = (WCHAR*)malloc(len*sizeof(WCHAR));
|
---|
2693 | GetWindowTextW(text,len);
|
---|
2694 |
|
---|
2695 | return text;
|
---|
2696 | }
|
---|
2697 | //******************************************************************************
|
---|
2698 | //******************************************************************************
|
---|
2699 | VOID Win32BaseWindow::freeWindowNamePtr(PVOID namePtr)
|
---|
2700 | {
|
---|
2701 | if (namePtr) free(namePtr);
|
---|
2702 | }
|
---|
2703 | //******************************************************************************
|
---|
2704 | //******************************************************************************
|
---|
2705 | int Win32BaseWindow::GetWindowTextLength()
|
---|
2706 | {
|
---|
2707 | return SendInternalMessageA(WM_GETTEXTLENGTH,0,0);
|
---|
2708 | }
|
---|
2709 | //******************************************************************************
|
---|
2710 | //******************************************************************************
|
---|
2711 | int Win32BaseWindow::GetWindowTextA(LPSTR lpsz, int cch)
|
---|
2712 | {
|
---|
2713 | return SendInternalMessageA(WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz);
|
---|
2714 | }
|
---|
2715 | //******************************************************************************
|
---|
2716 | //******************************************************************************
|
---|
2717 | int Win32BaseWindow::GetWindowTextW(LPWSTR lpsz, int cch)
|
---|
2718 | {
|
---|
2719 | return SendInternalMessageW(WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz);
|
---|
2720 | }
|
---|
2721 | //******************************************************************************
|
---|
2722 | //******************************************************************************
|
---|
2723 | BOOL Win32BaseWindow::SetWindowTextA(LPSTR lpsz)
|
---|
2724 | {
|
---|
2725 | return SendInternalMessageA(WM_SETTEXT,0,(LPARAM)lpsz);
|
---|
2726 | }
|
---|
2727 | //******************************************************************************
|
---|
2728 | //******************************************************************************
|
---|
2729 | BOOL Win32BaseWindow::SetWindowTextW(LPWSTR lpsz)
|
---|
2730 | {
|
---|
2731 | return SendInternalMessageW(WM_SETTEXT,0,(LPARAM)lpsz);
|
---|
2732 | }
|
---|
2733 | //******************************************************************************
|
---|
2734 | //******************************************************************************
|
---|
2735 | LONG Win32BaseWindow::SetWindowLongA(int index, ULONG value, BOOL fUnicode)
|
---|
2736 | {
|
---|
2737 | LONG oldval;
|
---|
2738 |
|
---|
2739 | dprintf2(("SetWindowLong%c %x %d %x", (fUnicode) ? 'W' : 'A', getWindowHandle(), index, value));
|
---|
2740 | switch(index) {
|
---|
2741 | case GWL_EXSTYLE:
|
---|
2742 | {
|
---|
2743 | STYLESTRUCT ss;
|
---|
2744 |
|
---|
2745 | if(dwExStyle == value)
|
---|
2746 | return value;
|
---|
2747 |
|
---|
2748 | ss.styleOld = dwExStyle;
|
---|
2749 | ss.styleNew = value;
|
---|
2750 | dprintf(("SetWindowLong GWL_EXSTYLE %x old %x new style %x", getWindowHandle(), dwExStyle, value));
|
---|
2751 | SendInternalMessageA(WM_STYLECHANGING,GWL_EXSTYLE,(LPARAM)&ss);
|
---|
2752 | setExStyle(ss.styleNew);
|
---|
2753 | SendInternalMessageA(WM_STYLECHANGED,GWL_EXSTYLE,(LPARAM)&ss);
|
---|
2754 | return ss.styleOld;
|
---|
2755 | }
|
---|
2756 | case GWL_STYLE:
|
---|
2757 | {
|
---|
2758 | STYLESTRUCT ss;
|
---|
2759 |
|
---|
2760 | if(dwStyle == value)
|
---|
2761 | return value;
|
---|
2762 |
|
---|
2763 | value &= ~(WS_VISIBLE | WS_CHILD); /* Some bits can't be changed this way (WINE) */
|
---|
2764 | ss.styleOld = getStyle();
|
---|
2765 | ss.styleNew = value | (ss.styleOld & (WS_VISIBLE | WS_CHILD));
|
---|
2766 | dprintf(("SetWindowLong GWL_STYLE %x old %x new style %x", getWindowHandle(), ss.styleOld, ss.styleNew));
|
---|
2767 | SendInternalMessageA(WM_STYLECHANGING,GWL_STYLE,(LPARAM)&ss);
|
---|
2768 | setStyle(ss.styleNew);
|
---|
2769 | SendInternalMessageA(WM_STYLECHANGED,GWL_STYLE,(LPARAM)&ss);
|
---|
2770 | //// OSLibSetWindowStyle(getOS2FrameWindowHandle(), getStyle(), getExStyle(),
|
---|
2771 | //// windowClass->getStyle() & CS_SAVEBITS);
|
---|
2772 | #ifdef DEBUG
|
---|
2773 | PrintWindowStyle(ss.styleNew, 0);
|
---|
2774 | #endif
|
---|
2775 | return ss.styleOld;
|
---|
2776 | }
|
---|
2777 | case GWL_WNDPROC:
|
---|
2778 | oldval = (LONG)WINPROC_GetProc(win32wndproc, (fUnicode) ? WIN_PROC_32W : WIN_PROC_32A);
|
---|
2779 | WINPROC_SetProc((HWINDOWPROC *)&win32wndproc, (WNDPROC)value, WINPROC_GetProcType(win32wndproc), WIN_PROC_WINDOW);
|
---|
2780 | return oldval;
|
---|
2781 |
|
---|
2782 | case GWL_HINSTANCE:
|
---|
2783 | oldval = hInstance;
|
---|
2784 | hInstance = value;
|
---|
2785 | return oldval;
|
---|
2786 |
|
---|
2787 | case GWL_HWNDPARENT:
|
---|
2788 | return SetParent((HWND)value);
|
---|
2789 |
|
---|
2790 | case GWL_ID:
|
---|
2791 | oldval = getWindowId();
|
---|
2792 | setWindowId(value);
|
---|
2793 | return oldval;
|
---|
2794 |
|
---|
2795 | case GWL_USERDATA:
|
---|
2796 | oldval = userData;
|
---|
2797 | userData = value;
|
---|
2798 | return oldval;
|
---|
2799 |
|
---|
2800 | default:
|
---|
2801 | if(index >= 0 && index/4 < nrUserWindowLong)
|
---|
2802 | {
|
---|
2803 | oldval = userWindowLong[index/4];
|
---|
2804 | userWindowLong[index/4] = value;
|
---|
2805 | return oldval;
|
---|
2806 | }
|
---|
2807 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
2808 | return 0;
|
---|
2809 | }
|
---|
2810 | }
|
---|
2811 | //******************************************************************************
|
---|
2812 | //******************************************************************************
|
---|
2813 | ULONG Win32BaseWindow::GetWindowLongA(int index, BOOL fUnicode)
|
---|
2814 | {
|
---|
2815 | ULONG value;
|
---|
2816 |
|
---|
2817 | switch(index) {
|
---|
2818 | case GWL_EXSTYLE:
|
---|
2819 | value = dwExStyle;
|
---|
2820 | break;
|
---|
2821 | case GWL_STYLE:
|
---|
2822 | value = dwStyle;
|
---|
2823 | break;
|
---|
2824 | case GWL_WNDPROC:
|
---|
2825 | value = (LONG)WINPROC_GetProc(win32wndproc, (fUnicode) ? WIN_PROC_32W : WIN_PROC_32A);
|
---|
2826 | break;
|
---|
2827 | case GWL_HINSTANCE:
|
---|
2828 | value = hInstance;
|
---|
2829 | break;
|
---|
2830 | case GWL_HWNDPARENT:
|
---|
2831 | if(getParent()) {
|
---|
2832 | value = getParent()->getWindowHandle();
|
---|
2833 | }
|
---|
2834 | else value = 0;
|
---|
2835 | break;
|
---|
2836 | case GWL_ID:
|
---|
2837 | value = getWindowId();
|
---|
2838 | break;
|
---|
2839 | case GWL_USERDATA:
|
---|
2840 | value = userData;
|
---|
2841 | break;
|
---|
2842 | default:
|
---|
2843 | if(index >= 0 && index/4 < nrUserWindowLong)
|
---|
2844 | {
|
---|
2845 | value = userWindowLong[index/4];
|
---|
2846 | break;
|
---|
2847 | }
|
---|
2848 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
2849 | return 0;
|
---|
2850 | }
|
---|
2851 | dprintf2(("GetWindowLongA %x %d %x", getWindowHandle(), index, value));
|
---|
2852 | return value;
|
---|
2853 | }
|
---|
2854 | //******************************************************************************
|
---|
2855 | //******************************************************************************
|
---|
2856 | WORD Win32BaseWindow::SetWindowWord(int index, WORD value)
|
---|
2857 | {
|
---|
2858 | WORD oldval;
|
---|
2859 |
|
---|
2860 | if(index >= 0 && index/4 < nrUserWindowLong)
|
---|
2861 | {
|
---|
2862 | oldval = ((WORD *)userWindowLong)[index/2];
|
---|
2863 | ((WORD *)userWindowLong)[index/2] = value;
|
---|
2864 | return oldval;
|
---|
2865 | }
|
---|
2866 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
2867 | return 0;
|
---|
2868 | }
|
---|
2869 | //******************************************************************************
|
---|
2870 | //******************************************************************************
|
---|
2871 | WORD Win32BaseWindow::GetWindowWord(int index)
|
---|
2872 | {
|
---|
2873 | if(index >= 0 && index/4 < nrUserWindowLong)
|
---|
2874 | {
|
---|
2875 | return ((WORD *)userWindowLong)[index/2];
|
---|
2876 | }
|
---|
2877 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
2878 | return 0;
|
---|
2879 | }
|
---|
2880 | //******************************************************************************
|
---|
2881 | //******************************************************************************
|
---|
2882 | void Win32BaseWindow::setWindowId(DWORD id)
|
---|
2883 | {
|
---|
2884 | dwIDMenu = id;
|
---|
2885 | }
|
---|
2886 | //******************************************************************************
|
---|
2887 | //******************************************************************************
|
---|
2888 | Win32BaseWindow *Win32BaseWindow::GetWindowFromHandle(HWND hwnd)
|
---|
2889 | {
|
---|
2890 | Win32BaseWindow *window;
|
---|
2891 |
|
---|
2892 | if(HwGetWindowHandleData(hwnd, (DWORD *)&window) == TRUE) {
|
---|
2893 | return window;
|
---|
2894 | }
|
---|
2895 | // dprintf2(("Win32BaseWindow::GetWindowFromHandle: not a win32 window %x", hwnd));
|
---|
2896 | return NULL;
|
---|
2897 | }
|
---|
2898 | //******************************************************************************
|
---|
2899 | //******************************************************************************
|
---|
2900 | Win32BaseWindow *Win32BaseWindow::GetWindowFromOS2Handle(HWND hwnd)
|
---|
2901 | {
|
---|
2902 | Win32BaseWindow *win32wnd;
|
---|
2903 | DWORD magic;
|
---|
2904 |
|
---|
2905 | if(hwnd == OSLIB_HWND_DESKTOP)
|
---|
2906 | {
|
---|
2907 | return windowDesktop;
|
---|
2908 | }
|
---|
2909 |
|
---|
2910 | win32wnd = (Win32BaseWindow *)OSLibWinGetWindowULong(hwnd, OFFSET_WIN32WNDPTR);
|
---|
2911 | magic = OSLibWinGetWindowULong(hwnd, OFFSET_WIN32PM_MAGIC);
|
---|
2912 |
|
---|
2913 | if(win32wnd && CheckMagicDword(magic)) {
|
---|
2914 | return win32wnd;
|
---|
2915 | }
|
---|
2916 | // dprintf2(("Win32BaseWindow::GetWindowFromOS2Handle: not an Odin os2 window %x", hwnd));
|
---|
2917 | return 0;
|
---|
2918 | }
|
---|
2919 | //******************************************************************************
|
---|
2920 | //******************************************************************************
|
---|
2921 | Win32BaseWindow *Win32BaseWindow::GetWindowFromOS2FrameHandle(HWND hwnd)
|
---|
2922 | {
|
---|
2923 | return GetWindowFromOS2Handle(OSLibWinWindowFromID(hwnd,OSLIB_FID_CLIENT));
|
---|
2924 | }
|
---|
2925 | //******************************************************************************
|
---|
2926 | //******************************************************************************
|
---|
2927 | HWND Win32BaseWindow::Win32ToOS2Handle(HWND hwnd)
|
---|
2928 | {
|
---|
2929 | Win32BaseWindow *window = GetWindowFromHandle(hwnd);
|
---|
2930 |
|
---|
2931 | if(window) {
|
---|
2932 | return window->getOS2WindowHandle();
|
---|
2933 | }
|
---|
2934 | // dprintf2(("Win32BaseWindow::Win32ToOS2Handle: not a win32 window %x", hwnd));
|
---|
2935 | return hwnd;
|
---|
2936 | }
|
---|
2937 | //******************************************************************************
|
---|
2938 | //******************************************************************************
|
---|
2939 | HWND Win32BaseWindow::Win32ToOS2FrameHandle(HWND hwnd)
|
---|
2940 | {
|
---|
2941 | Win32BaseWindow *window = GetWindowFromHandle(hwnd);
|
---|
2942 |
|
---|
2943 | if(window) {
|
---|
2944 | return window->getOS2FrameWindowHandle();
|
---|
2945 | }
|
---|
2946 | // dprintf2(("Win32BaseWindow::Win32ToOS2FrameHandle: not a win32 window %x", hwnd));
|
---|
2947 | return hwnd;
|
---|
2948 | }
|
---|
2949 | //******************************************************************************
|
---|
2950 | //******************************************************************************
|
---|
2951 | HWND Win32BaseWindow::OS2ToWin32Handle(HWND hwnd)
|
---|
2952 | {
|
---|
2953 | Win32BaseWindow *window = GetWindowFromOS2Handle(hwnd);
|
---|
2954 |
|
---|
2955 | if(window) {
|
---|
2956 | return window->getWindowHandle();
|
---|
2957 | }
|
---|
2958 | window = GetWindowFromOS2FrameHandle(hwnd);
|
---|
2959 | if(window) {
|
---|
2960 | return window->getWindowHandle();
|
---|
2961 | }
|
---|
2962 | // dprintf2(("Win32BaseWindow::OS2ToWin32Handle: not a win32 window %x", hwnd));
|
---|
2963 | return 0;
|
---|
2964 | // else return hwnd; //OS/2 window handle
|
---|
2965 | }
|
---|
2966 | //******************************************************************************
|
---|
2967 | // GetNextDlgTabItem32 (USER32.276)
|
---|
2968 | //******************************************************************************
|
---|
2969 | HWND Win32BaseWindow::getNextDlgTabItem(HWND hwndCtrl, BOOL fPrevious)
|
---|
2970 | {
|
---|
2971 | Win32BaseWindow *child, *nextchild, *lastchild;
|
---|
2972 | HWND retvalue;
|
---|
2973 |
|
---|
2974 | if (hwndCtrl)
|
---|
2975 | {
|
---|
2976 | child = GetWindowFromHandle(hwndCtrl);
|
---|
2977 | if (!child)
|
---|
2978 | {
|
---|
2979 | retvalue = 0;
|
---|
2980 | goto END;
|
---|
2981 | }
|
---|
2982 | /* Make sure hwndCtrl is a top-level child */
|
---|
2983 | while ((child->getStyle() & WS_CHILD) && (child->getParent() != this))
|
---|
2984 | {
|
---|
2985 | child = child->getParent();
|
---|
2986 | if(child == NULL) break;
|
---|
2987 | }
|
---|
2988 |
|
---|
2989 | if (!child || (child->getParent() != this))
|
---|
2990 | {
|
---|
2991 | retvalue = 0;
|
---|
2992 | goto END;
|
---|
2993 | }
|
---|
2994 | }
|
---|
2995 | else
|
---|
2996 | {
|
---|
2997 | /* No ctrl specified -> start from the beginning */
|
---|
2998 | child = (Win32BaseWindow *)getFirstChild();
|
---|
2999 | if (!child)
|
---|
3000 | {
|
---|
3001 | retvalue = 0;
|
---|
3002 | goto END;
|
---|
3003 | }
|
---|
3004 |
|
---|
3005 | if (!fPrevious)
|
---|
3006 | {
|
---|
3007 | while (child->getNextChild())
|
---|
3008 | {
|
---|
3009 | child = (Win32BaseWindow *)child->getNextChild();
|
---|
3010 | }
|
---|
3011 | }
|
---|
3012 | }
|
---|
3013 |
|
---|
3014 | lastchild = child;
|
---|
3015 | nextchild = (Win32BaseWindow *)child->getNextChild();
|
---|
3016 | while (TRUE)
|
---|
3017 | {
|
---|
3018 | if (!nextchild) nextchild = (Win32BaseWindow *)getFirstChild();
|
---|
3019 |
|
---|
3020 | if (child == nextchild) break;
|
---|
3021 |
|
---|
3022 | if ((nextchild->getStyle() & WS_TABSTOP) && (nextchild->getStyle() & WS_VISIBLE) &&
|
---|
3023 | !(nextchild->getStyle() & WS_DISABLED))
|
---|
3024 | {
|
---|
3025 | lastchild = nextchild;
|
---|
3026 | if (!fPrevious) break;
|
---|
3027 | }
|
---|
3028 | nextchild = (Win32BaseWindow *)nextchild->getNextChild();
|
---|
3029 | }
|
---|
3030 | retvalue = lastchild->getWindowHandle();
|
---|
3031 |
|
---|
3032 | END:
|
---|
3033 | return retvalue;
|
---|
3034 | }
|
---|
3035 | //******************************************************************************
|
---|
3036 | //******************************************************************************
|
---|
3037 | HWND Win32BaseWindow::getNextDlgGroupItem(HWND hwndCtrl, BOOL fPrevious)
|
---|
3038 | {
|
---|
3039 | Win32BaseWindow *child, *nextchild, *lastchild;
|
---|
3040 | HWND retvalue;
|
---|
3041 |
|
---|
3042 | if (hwndCtrl)
|
---|
3043 | {
|
---|
3044 | child = GetWindowFromHandle(hwndCtrl);
|
---|
3045 | if (!child)
|
---|
3046 | {
|
---|
3047 | retvalue = 0;
|
---|
3048 | goto END;
|
---|
3049 | }
|
---|
3050 | /* Make sure hwndCtrl is a top-level child */
|
---|
3051 | while ((child->getStyle() & WS_CHILD) && (child->getParent() != this))
|
---|
3052 | {
|
---|
3053 | child = child->getParent();
|
---|
3054 | if(child == NULL) break;
|
---|
3055 | }
|
---|
3056 |
|
---|
3057 | if (!child || (child->getParent() != this))
|
---|
3058 | {
|
---|
3059 | retvalue = 0;
|
---|
3060 | goto END;
|
---|
3061 | }
|
---|
3062 | }
|
---|
3063 | else
|
---|
3064 | {
|
---|
3065 | /* No ctrl specified -> start from the beginning */
|
---|
3066 | child = (Win32BaseWindow *)getFirstChild();
|
---|
3067 | if (!child)
|
---|
3068 | {
|
---|
3069 | retvalue = 0;
|
---|
3070 | goto END;
|
---|
3071 | }
|
---|
3072 |
|
---|
3073 | if (fPrevious)
|
---|
3074 | {
|
---|
3075 | while (child->getNextChild())
|
---|
3076 | {
|
---|
3077 | child = (Win32BaseWindow *)child->getNextChild();
|
---|
3078 | }
|
---|
3079 | }
|
---|
3080 | }
|
---|
3081 |
|
---|
3082 | lastchild = child;
|
---|
3083 | nextchild = (Win32BaseWindow *)child->getNextChild();
|
---|
3084 | while (TRUE)
|
---|
3085 | {
|
---|
3086 | if (!nextchild || (nextchild->getStyle() & WS_GROUP))
|
---|
3087 | {
|
---|
3088 | /* Wrap-around to the beginning of the group */
|
---|
3089 | Win32BaseWindow *pWndTemp;
|
---|
3090 |
|
---|
3091 | nextchild = (Win32BaseWindow *)getFirstChild();
|
---|
3092 |
|
---|
3093 | for(pWndTemp = nextchild;pWndTemp;pWndTemp = (Win32BaseWindow *)pWndTemp->getNextChild())
|
---|
3094 | {
|
---|
3095 | if (pWndTemp->getStyle() & WS_GROUP)
|
---|
3096 | nextchild = pWndTemp;
|
---|
3097 |
|
---|
3098 | if (pWndTemp == child)
|
---|
3099 | break;
|
---|
3100 | }
|
---|
3101 |
|
---|
3102 | }
|
---|
3103 | if (nextchild == child)
|
---|
3104 | break;
|
---|
3105 |
|
---|
3106 | if ((nextchild->getStyle() & WS_VISIBLE) && !(nextchild->getStyle() & WS_DISABLED))
|
---|
3107 | {
|
---|
3108 | lastchild = nextchild;
|
---|
3109 |
|
---|
3110 | if (!fPrevious)
|
---|
3111 | break;
|
---|
3112 | }
|
---|
3113 |
|
---|
3114 | nextchild = (Win32BaseWindow *)nextchild->getNextChild();
|
---|
3115 | }
|
---|
3116 | retvalue = lastchild->getWindowHandle();
|
---|
3117 | END:
|
---|
3118 | return retvalue;
|
---|
3119 | }
|
---|
3120 | //******************************************************************************
|
---|
3121 | //******************************************************************************
|
---|
3122 | #ifdef DEBUG
|
---|
3123 | void PrintWindowStyle(DWORD dwStyle, DWORD dwExStyle)
|
---|
3124 | {
|
---|
3125 | char style[256] = "";
|
---|
3126 | char exstyle[256] = "";
|
---|
3127 |
|
---|
3128 | /* Window styles */
|
---|
3129 | if(dwStyle & WS_CHILD)
|
---|
3130 | strcat(style, "WS_CHILD ");
|
---|
3131 | if(dwStyle & WS_POPUP)
|
---|
3132 | strcat(style, "WS_POPUP ");
|
---|
3133 | if(dwStyle & WS_VISIBLE)
|
---|
3134 | strcat(style, "WS_VISIBLE ");
|
---|
3135 | if(dwStyle & WS_DISABLED)
|
---|
3136 | strcat(style, "WS_DISABLED ");
|
---|
3137 | if(dwStyle & WS_CLIPSIBLINGS)
|
---|
3138 | strcat(style, "WS_CLIPSIBLINGS ");
|
---|
3139 | if(dwStyle & WS_CLIPCHILDREN)
|
---|
3140 | strcat(style, "WS_CLIPCHILDREN ");
|
---|
3141 | if(dwStyle & WS_MAXIMIZE)
|
---|
3142 | strcat(style, "WS_MAXIMIZE ");
|
---|
3143 | if(dwStyle & WS_MINIMIZE)
|
---|
3144 | strcat(style, "WS_MINIMIZE ");
|
---|
3145 | if(dwStyle & WS_GROUP)
|
---|
3146 | strcat(style, "WS_GROUP ");
|
---|
3147 | if(dwStyle & WS_TABSTOP)
|
---|
3148 | strcat(style, "WS_TABSTOP ");
|
---|
3149 |
|
---|
3150 | if((dwStyle & WS_CAPTION) == WS_CAPTION)
|
---|
3151 | strcat(style, "WS_CAPTION ");
|
---|
3152 | if(dwStyle & WS_DLGFRAME)
|
---|
3153 | strcat(style, "WS_DLGFRAME ");
|
---|
3154 | if(dwStyle & WS_BORDER)
|
---|
3155 | strcat(style, "WS_BORDER ");
|
---|
3156 |
|
---|
3157 | if(dwStyle & WS_VSCROLL)
|
---|
3158 | strcat(style, "WS_VSCROLL ");
|
---|
3159 | if(dwStyle & WS_HSCROLL)
|
---|
3160 | strcat(style, "WS_HSCROLL ");
|
---|
3161 | if(dwStyle & WS_SYSMENU)
|
---|
3162 | strcat(style, "WS_SYSMENU ");
|
---|
3163 | if(dwStyle & WS_THICKFRAME)
|
---|
3164 | strcat(style, "WS_THICKFRAME ");
|
---|
3165 | if(dwStyle & WS_MINIMIZEBOX)
|
---|
3166 | strcat(style, "WS_MINIMIZEBOX ");
|
---|
3167 | if(dwStyle & WS_MAXIMIZEBOX)
|
---|
3168 | strcat(style, "WS_MAXIMIZEBOX ");
|
---|
3169 |
|
---|
3170 | if(dwExStyle & WS_EX_DLGMODALFRAME)
|
---|
3171 | strcat(exstyle, "WS_EX_DLGMODALFRAME ");
|
---|
3172 | if(dwExStyle & WS_EX_ACCEPTFILES)
|
---|
3173 | strcat(exstyle, "WS_EX_ACCEPTFILES ");
|
---|
3174 | if(dwExStyle & WS_EX_NOPARENTNOTIFY)
|
---|
3175 | strcat(exstyle, "WS_EX_NOPARENTNOTIFY ");
|
---|
3176 | if(dwExStyle & WS_EX_TOPMOST)
|
---|
3177 | strcat(exstyle, "WS_EX_TOPMOST ");
|
---|
3178 | if(dwExStyle & WS_EX_TRANSPARENT)
|
---|
3179 | strcat(exstyle, "WS_EX_TRANSPARENT ");
|
---|
3180 |
|
---|
3181 | if(dwExStyle & WS_EX_MDICHILD)
|
---|
3182 | strcat(exstyle, "WS_EX_MDICHILD ");
|
---|
3183 | if(dwExStyle & WS_EX_TOOLWINDOW)
|
---|
3184 | strcat(exstyle, "WS_EX_TOOLWINDOW ");
|
---|
3185 | if(dwExStyle & WS_EX_WINDOWEDGE)
|
---|
3186 | strcat(exstyle, "WS_EX_WINDOWEDGE ");
|
---|
3187 | if(dwExStyle & WS_EX_CLIENTEDGE)
|
---|
3188 | strcat(exstyle, "WS_EX_CLIENTEDGE ");
|
---|
3189 | if(dwExStyle & WS_EX_CONTEXTHELP)
|
---|
3190 | strcat(exstyle, "WS_EX_CONTEXTHELP ");
|
---|
3191 | if(dwExStyle & WS_EX_RIGHT)
|
---|
3192 | strcat(exstyle, "WS_EX_RIGHT ");
|
---|
3193 | if(dwExStyle & WS_EX_LEFT)
|
---|
3194 | strcat(exstyle, "WS_EX_LEFT ");
|
---|
3195 | if(dwExStyle & WS_EX_RTLREADING)
|
---|
3196 | strcat(exstyle, "WS_EX_RTLREADING ");
|
---|
3197 | if(dwExStyle & WS_EX_LTRREADING)
|
---|
3198 | strcat(exstyle, "WS_EX_LTRREADING ");
|
---|
3199 | if(dwExStyle & WS_EX_LEFTSCROLLBAR)
|
---|
3200 | strcat(exstyle, "WS_EX_LEFTSCROLLBAR ");
|
---|
3201 | if(dwExStyle & WS_EX_RIGHTSCROLLBAR)
|
---|
3202 | strcat(exstyle, "WS_EX_RIGHTSCROLLBAR ");
|
---|
3203 | if(dwExStyle & WS_EX_CONTROLPARENT)
|
---|
3204 | strcat(exstyle, "WS_EX_CONTROLPARENT ");
|
---|
3205 | if(dwExStyle & WS_EX_STATICEDGE)
|
---|
3206 | strcat(exstyle, "WS_EX_STATICEDGE ");
|
---|
3207 | if(dwExStyle & WS_EX_APPWINDOW)
|
---|
3208 | strcat(exstyle, "WS_EX_APPWINDOW ");
|
---|
3209 |
|
---|
3210 | dprintf(("Window style: %x %s", dwStyle, style));
|
---|
3211 | dprintf(("Window exStyle: %x %s (FS = %x)", dwExStyle, exstyle, GetFS()));
|
---|
3212 | }
|
---|
3213 | #endif
|
---|
3214 | //******************************************************************************
|
---|
3215 | //******************************************************************************
|
---|
3216 |
|
---|
3217 | GenericObject *Win32BaseWindow::windows = NULL;
|
---|