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