| 1 | /* $Id: comctl32.c,v 1.13 2000-02-04 17:02:06 cbratschi Exp $ */
|
|---|
| 2 | /*
|
|---|
| 3 | * Win32 common controls implementation
|
|---|
| 4 | *
|
|---|
| 5 | * Copyright (C) 1999 Achim Hasenmueller
|
|---|
| 6 | *
|
|---|
| 7 | * Based on the work of the WINE group (www.winehq.com)
|
|---|
| 8 | *
|
|---|
| 9 | *
|
|---|
| 10 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 11 | *
|
|---|
| 12 | */
|
|---|
| 13 |
|
|---|
| 14 | /* WINE 20000130 level (commctrl.c) */
|
|---|
| 15 |
|
|---|
| 16 | #include "comctl32.h"
|
|---|
| 17 | #include "winerror.h"
|
|---|
| 18 | #include "progress.h"
|
|---|
| 19 | #include "comboex.h"
|
|---|
| 20 | #include "animate.h"
|
|---|
| 21 | #include "datetime.h"
|
|---|
| 22 | #include "flatsb.h"
|
|---|
| 23 | #include "hotkey.h"
|
|---|
| 24 | #include "ipaddress.h"
|
|---|
| 25 | #include "monthcal.h"
|
|---|
| 26 | #include "nativefont.h"
|
|---|
| 27 | #include "pager.h"
|
|---|
| 28 | #include "tab.h"
|
|---|
| 29 | #include "status.h"
|
|---|
| 30 | #include "header.h"
|
|---|
| 31 | #include "updown.h"
|
|---|
| 32 | #include "rebar.h"
|
|---|
| 33 | #include "trackbar.h"
|
|---|
| 34 | #include "tooltips.h"
|
|---|
| 35 | #include "toolbar.h"
|
|---|
| 36 | #include "treeview.h"
|
|---|
| 37 | #include "listview.h"
|
|---|
| 38 |
|
|---|
| 39 | HANDLE COMCTL32_hHeap = (HANDLE)NULL;
|
|---|
| 40 | HMODULE COMCTL32_hModule = 0;
|
|---|
| 41 | LPSTR COMCTL32_aSubclass = (LPSTR)NULL;
|
|---|
| 42 |
|
|---|
| 43 | void CDECL RegisterCOMCTL32WindowClasses(unsigned long hinstDLL)
|
|---|
| 44 | {
|
|---|
| 45 | /* create private heap */
|
|---|
| 46 | COMCTL32_hHeap = HeapCreate(0, 0x10000, 0);
|
|---|
| 47 | /* add global subclassing atom (used by 'tooltip' and 'updown') */
|
|---|
| 48 | COMCTL32_aSubclass = (LPSTR)(DWORD)GlobalAddAtomA ("CC32SubclassInfo");
|
|---|
| 49 | /* This will be wrong for any other process attching in this address-space! */
|
|---|
| 50 | COMCTL32_hModule = (HMODULE)hinstDLL;
|
|---|
| 51 |
|
|---|
| 52 | /* register controls */
|
|---|
| 53 | PROGRESS_Register();
|
|---|
| 54 | COMBOEX_Register();
|
|---|
| 55 | ANIMATE_Register();
|
|---|
| 56 | DATETIME_Register();
|
|---|
| 57 | FLATSB_Register();
|
|---|
| 58 | HOTKEY_Register();
|
|---|
| 59 | IPADDRESS_Register();
|
|---|
| 60 | MONTHCAL_Register();
|
|---|
| 61 | NATIVEFONT_Register();
|
|---|
| 62 | PAGER_Register();
|
|---|
| 63 | TAB_Register();
|
|---|
| 64 | STATUS_Register();
|
|---|
| 65 | HEADER_Register();
|
|---|
| 66 | UPDOWN_Register();
|
|---|
| 67 | REBAR_Register();
|
|---|
| 68 | TRACKBAR_Register();
|
|---|
| 69 | TOOLTIPS_Register();
|
|---|
| 70 | TOOLBAR_Register();
|
|---|
| 71 | TREEVIEW_Register();
|
|---|
| 72 | LISTVIEW_Register();
|
|---|
| 73 | }
|
|---|
| 74 |
|
|---|
| 75 | void CDECL UnregisterCOMCTL32WindowClasses(void)
|
|---|
| 76 | {
|
|---|
| 77 | /* unregister controls */
|
|---|
| 78 | PROGRESS_Unregister();
|
|---|
| 79 | COMBOEX_Unregister();
|
|---|
| 80 | ANIMATE_Unregister();
|
|---|
| 81 | DATETIME_Unregister();
|
|---|
| 82 | FLATSB_Unregister();
|
|---|
| 83 | HOTKEY_Unregister();
|
|---|
| 84 | IPADDRESS_Unregister();
|
|---|
| 85 | MONTHCAL_Unregister();
|
|---|
| 86 | NATIVEFONT_Unregister();
|
|---|
| 87 | PAGER_Unregister();
|
|---|
| 88 | TAB_Unregister();
|
|---|
| 89 | STATUS_Unregister();
|
|---|
| 90 | HEADER_Unregister();
|
|---|
| 91 | UPDOWN_Unregister();
|
|---|
| 92 | REBAR_Unregister();
|
|---|
| 93 | TRACKBAR_Unregister();
|
|---|
| 94 | TOOLTIPS_Unregister();
|
|---|
| 95 | TOOLBAR_Unregister();
|
|---|
| 96 | TREEVIEW_Unregister();
|
|---|
| 97 | LISTVIEW_Unregister();
|
|---|
| 98 |
|
|---|
| 99 | /* destroy private heap */
|
|---|
| 100 | HeapDestroy(COMCTL32_hHeap);
|
|---|
| 101 | COMCTL32_hHeap = (HANDLE)NULL;
|
|---|
| 102 | }
|
|---|
| 103 |
|
|---|
| 104 | /***********************************************************************
|
|---|
| 105 | * MenuHelp [COMCTL32.2]
|
|---|
| 106 | *
|
|---|
| 107 | * PARAMS
|
|---|
| 108 | * uMsg [I] message (WM_MENUSELECT) (see NOTES)
|
|---|
| 109 | * wParam [I] wParam of the message uMsg
|
|---|
| 110 | * lParam [I] lParam of the message uMsg
|
|---|
| 111 | * hMainMenu [I] handle to the application's main menu
|
|---|
| 112 | * hInst [I] handle to the module that contains string resources
|
|---|
| 113 | * hwndStatus [I] handle to the status bar window
|
|---|
| 114 | * lpwIDs [I] pointer to an array of intergers (see NOTES)
|
|---|
| 115 | *
|
|---|
| 116 | * RETURNS
|
|---|
| 117 | * No return value
|
|---|
| 118 | *
|
|---|
| 119 | * NOTES
|
|---|
| 120 | * The official documentation is incomplete!
|
|---|
| 121 | * This is the correct documentation:
|
|---|
| 122 | *
|
|---|
| 123 | * uMsg:
|
|---|
| 124 | * MenuHelp() does NOT handle WM_COMMAND messages! It only handes
|
|---|
| 125 | * WM_MENUSELECT messages.
|
|---|
| 126 | *
|
|---|
| 127 | * lpwIDs:
|
|---|
| 128 | * (will be written ...)
|
|---|
| 129 | */
|
|---|
| 130 |
|
|---|
| 131 | VOID WINAPI
|
|---|
| 132 | MenuHelp (UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu,
|
|---|
| 133 | HINSTANCE hInst, HWND hwndStatus, LPUINT lpwIDs)
|
|---|
| 134 | {
|
|---|
| 135 | UINT uMenuID = 0;
|
|---|
| 136 |
|
|---|
| 137 | dprintf(("COMCTL32: MenuHelp"));
|
|---|
| 138 |
|
|---|
| 139 | if (!IsWindow (hwndStatus))
|
|---|
| 140 | return;
|
|---|
| 141 |
|
|---|
| 142 | switch (uMsg) {
|
|---|
| 143 | case WM_MENUSELECT:
|
|---|
| 144 | // TRACE (commctrl, "WM_MENUSELECT wParam=0x%X lParam=0x%lX\n",
|
|---|
| 145 | // wParam, lParam);
|
|---|
| 146 |
|
|---|
| 147 | if ((HIWORD(wParam) == 0xFFFF) && (lParam == 0)) {
|
|---|
| 148 | /* menu was closed */
|
|---|
| 149 | // TRACE (commctrl, "menu was closed!\n");
|
|---|
| 150 | SendMessageA (hwndStatus, SB_SIMPLE, FALSE, 0);
|
|---|
| 151 | }
|
|---|
| 152 | else {
|
|---|
| 153 | /* menu item was selected */
|
|---|
| 154 | if (HIWORD(wParam) & MF_POPUP)
|
|---|
| 155 | uMenuID = (UINT)*(lpwIDs+1);
|
|---|
| 156 | else
|
|---|
| 157 | uMenuID = (UINT)LOWORD(wParam);
|
|---|
| 158 | // TRACE (commctrl, "uMenuID = %u\n", uMenuID);
|
|---|
| 159 |
|
|---|
| 160 | if (uMenuID) {
|
|---|
| 161 | CHAR szText[256];
|
|---|
| 162 |
|
|---|
| 163 | if (!LoadStringA (hInst, uMenuID, szText, 256))
|
|---|
| 164 | szText[0] = '\0';
|
|---|
| 165 |
|
|---|
| 166 | SendMessageA (hwndStatus, SB_SETTEXTA,
|
|---|
| 167 | 255 | SBT_NOBORDERS, (LPARAM)szText);
|
|---|
| 168 | SendMessageA (hwndStatus, SB_SIMPLE, TRUE, 0);
|
|---|
| 169 | }
|
|---|
| 170 | }
|
|---|
| 171 | break;
|
|---|
| 172 |
|
|---|
| 173 | case WM_COMMAND :
|
|---|
| 174 | // TRACE("WM_COMMAND wParam=0x%X lParam=0x%lX\n",
|
|---|
| 175 | // wParam, lParam);
|
|---|
| 176 | /* WM_COMMAND is not invalid since it is documented
|
|---|
| 177 | * in the windows api reference. So don't output
|
|---|
| 178 | * any FIXME for WM_COMMAND
|
|---|
| 179 | */
|
|---|
| 180 | // WARN("We don't care about the WM_COMMAND\n");
|
|---|
| 181 | break;
|
|---|
| 182 |
|
|---|
| 183 | default:
|
|---|
| 184 | // FIXME (commctrl, "Invalid Message 0x%x!\n", uMsg);
|
|---|
| 185 | break;
|
|---|
| 186 | }
|
|---|
| 187 | }
|
|---|
| 188 |
|
|---|
| 189 | /***********************************************************************
|
|---|
| 190 | * ShowHideMenuCtl [COMCTL32.3]
|
|---|
| 191 | *
|
|---|
| 192 | * Shows or hides controls and updates the corresponding menu item.
|
|---|
| 193 | *
|
|---|
| 194 | * PARAMS
|
|---|
| 195 | * hwnd [I] handle to the client window.
|
|---|
| 196 | * uFlags [I] menu command id.
|
|---|
| 197 | * lpInfo [I] pointer to an array of integers. (See NOTES.)
|
|---|
| 198 | *
|
|---|
| 199 | * RETURNS
|
|---|
| 200 | * Success: TRUE
|
|---|
| 201 | * Failure: FALSE
|
|---|
| 202 | *
|
|---|
| 203 | * NOTES
|
|---|
| 204 | * The official documentation is incomplete!
|
|---|
| 205 | * This is the correct documentation:
|
|---|
| 206 | *
|
|---|
| 207 | * hwnd
|
|---|
| 208 | * Handle to the window that contains the menu and controls.
|
|---|
| 209 | *
|
|---|
| 210 | * uFlags
|
|---|
| 211 | * Identifier of the menu item to receive or loose a check mark.
|
|---|
| 212 | *
|
|---|
| 213 | * lpInfo
|
|---|
| 214 | * The array of integers contains pairs of values. BOTH values of
|
|---|
| 215 | * the first pair must be the handles to the application's main menu.
|
|---|
| 216 | * Each subsequent pair consists of a menu id and control id.
|
|---|
| 217 | */
|
|---|
| 218 |
|
|---|
| 219 | BOOL WINAPI
|
|---|
| 220 | ShowHideMenuCtl (HWND hwnd, UINT uFlags, LPINT lpInfo)
|
|---|
| 221 | {
|
|---|
| 222 | LPINT lpMenuId;
|
|---|
| 223 |
|
|---|
| 224 | // TRACE (commctrl, "%x, %x, %p\n", hwnd, uFlags, lpInfo);
|
|---|
| 225 |
|
|---|
| 226 | dprintf(("COMCTL32: ShowHideMenuCtl"));
|
|---|
| 227 |
|
|---|
| 228 | if (lpInfo == NULL)
|
|---|
| 229 | return FALSE;
|
|---|
| 230 |
|
|---|
| 231 | if (!(lpInfo[0]) || !(lpInfo[1]))
|
|---|
| 232 | return FALSE;
|
|---|
| 233 |
|
|---|
| 234 | /* search for control */
|
|---|
| 235 | lpMenuId = &lpInfo[2];
|
|---|
| 236 | while (*lpMenuId != uFlags)
|
|---|
| 237 | lpMenuId += 2;
|
|---|
| 238 |
|
|---|
| 239 | if (GetMenuState (lpInfo[1], uFlags, MF_BYCOMMAND) & MFS_CHECKED) {
|
|---|
| 240 | /* uncheck menu item */
|
|---|
| 241 | CheckMenuItem (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_UNCHECKED);
|
|---|
| 242 |
|
|---|
| 243 | /* hide control */
|
|---|
| 244 | lpMenuId++;
|
|---|
| 245 | SetWindowPos (GetDlgItem (hwnd, *lpMenuId), 0, 0, 0, 0, 0,
|
|---|
| 246 | SWP_HIDEWINDOW);
|
|---|
| 247 | }
|
|---|
| 248 | else {
|
|---|
| 249 | /* check menu item */
|
|---|
| 250 | CheckMenuItem (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_CHECKED);
|
|---|
| 251 |
|
|---|
| 252 | /* show control */
|
|---|
| 253 | lpMenuId++;
|
|---|
| 254 | SetWindowPos (GetDlgItem (hwnd, *lpMenuId), 0, 0, 0, 0, 0,
|
|---|
| 255 | SWP_SHOWWINDOW);
|
|---|
| 256 | }
|
|---|
| 257 |
|
|---|
| 258 | return TRUE;
|
|---|
| 259 | }
|
|---|
| 260 |
|
|---|
| 261 | /***********************************************************************
|
|---|
| 262 | * GetEffectiveClientRect [COMCTL32.4]
|
|---|
| 263 | *
|
|---|
| 264 | * PARAMS
|
|---|
| 265 | * hwnd [I] handle to the client window.
|
|---|
| 266 | * lpRect [O] pointer to the rectangle of the client window
|
|---|
| 267 | * lpInfo [I] pointer to an array of integers (see NOTES)
|
|---|
| 268 | *
|
|---|
| 269 | * RETURNS
|
|---|
| 270 | * No return value.
|
|---|
| 271 | *
|
|---|
| 272 | * NOTES
|
|---|
| 273 | * The official documentation is incomplete!
|
|---|
| 274 | * This is the correct documentation:
|
|---|
| 275 | *
|
|---|
| 276 | * lpInfo
|
|---|
| 277 | * (will be written...)
|
|---|
| 278 | */
|
|---|
| 279 |
|
|---|
| 280 | VOID WINAPI
|
|---|
| 281 | GetEffectiveClientRect (HWND hwnd, LPRECT lpRect, LPINT lpInfo)
|
|---|
| 282 | {
|
|---|
| 283 | RECT rcCtrl;
|
|---|
| 284 | INT *lpRun;
|
|---|
| 285 | HWND hwndCtrl;
|
|---|
| 286 |
|
|---|
| 287 | // TRACE (commctrl, "(0x%08lx 0x%08lx 0x%08lx)\n",
|
|---|
| 288 | // (DWORD)hwnd, (DWORD)lpRect, (DWORD)lpInfo);
|
|---|
| 289 |
|
|---|
| 290 | dprintf(("COMCTL32: GetEffectiveClientRect"));
|
|---|
| 291 |
|
|---|
| 292 | GetClientRect (hwnd, lpRect);
|
|---|
| 293 | lpRun = lpInfo;
|
|---|
| 294 |
|
|---|
| 295 | do {
|
|---|
| 296 | lpRun += 2;
|
|---|
| 297 | if (*lpRun == 0)
|
|---|
| 298 | return;
|
|---|
| 299 | lpRun++;
|
|---|
| 300 | hwndCtrl = GetDlgItem (hwnd, *lpRun);
|
|---|
| 301 | if (GetWindowLongA (hwndCtrl, GWL_STYLE) & WS_VISIBLE) {
|
|---|
| 302 | // TRACE (commctrl, "control id 0x%x\n", *lpRun);
|
|---|
| 303 | GetWindowRect (hwndCtrl, &rcCtrl);
|
|---|
| 304 | MapWindowPoints ((HWND)0, hwnd, (LPPOINT)&rcCtrl, 2);
|
|---|
| 305 | SubtractRect (lpRect, lpRect, &rcCtrl);
|
|---|
| 306 | }
|
|---|
| 307 | lpRun++;
|
|---|
| 308 | } while (*lpRun);
|
|---|
| 309 | }
|
|---|
| 310 |
|
|---|
| 311 | /***********************************************************************
|
|---|
| 312 | * DrawStatusText32A [COMCTL32.5][COMCTL32.27]
|
|---|
| 313 | *
|
|---|
| 314 | * Draws text with borders, like in a status bar.
|
|---|
| 315 | *
|
|---|
| 316 | * PARAMS
|
|---|
| 317 | * hdc [I] handle to the window's display context
|
|---|
| 318 | * lprc [I] pointer to a rectangle
|
|---|
| 319 | * text [I] pointer to the text
|
|---|
| 320 | * style [I] drawing style
|
|---|
| 321 | *
|
|---|
| 322 | * RETURNS
|
|---|
| 323 | * No return value.
|
|---|
| 324 | *
|
|---|
| 325 | * NOTES
|
|---|
| 326 | * The style variable can have one of the following values:
|
|---|
| 327 | * (will be written ...)
|
|---|
| 328 | */
|
|---|
| 329 |
|
|---|
| 330 | VOID WINAPI
|
|---|
| 331 | DrawStatusTextA (HDC hdc, LPRECT lprc, LPCSTR text, UINT style)
|
|---|
| 332 | {
|
|---|
| 333 | RECT r = *lprc;
|
|---|
| 334 | UINT border = BDR_SUNKENOUTER;
|
|---|
| 335 |
|
|---|
| 336 | dprintf(("COMCTL32: DrawStatusTextA"));
|
|---|
| 337 |
|
|---|
| 338 | if (style & SBT_POPOUT)
|
|---|
| 339 | border = BDR_RAISEDOUTER;
|
|---|
| 340 | else if (style & SBT_NOBORDERS)
|
|---|
| 341 | border = 0;
|
|---|
| 342 |
|
|---|
| 343 | DrawEdge (hdc, &r, border, BF_RECT|BF_ADJUST|BF_MIDDLE);
|
|---|
| 344 |
|
|---|
| 345 | /* now draw text */
|
|---|
| 346 | if (text) {
|
|---|
| 347 | int oldbkmode = SetBkMode (hdc, TRANSPARENT);
|
|---|
| 348 | r.left += 3;
|
|---|
| 349 | DrawTextA (hdc, text, lstrlenA(text),
|
|---|
| 350 | &r, DT_LEFT|DT_VCENTER|DT_SINGLELINE);
|
|---|
| 351 | if (oldbkmode != TRANSPARENT)
|
|---|
| 352 | SetBkMode(hdc, oldbkmode);
|
|---|
| 353 | }
|
|---|
| 354 | }
|
|---|
| 355 |
|
|---|
| 356 |
|
|---|
| 357 | /***********************************************************************
|
|---|
| 358 | * DrawStatusText32W [COMCTL32.28]
|
|---|
| 359 | *
|
|---|
| 360 | * Draws text with borders, like in a status bar.
|
|---|
| 361 | *
|
|---|
| 362 | * PARAMS
|
|---|
| 363 | * hdc [I] handle to the window's display context
|
|---|
| 364 | * lprc [I] pointer to a rectangle
|
|---|
| 365 | * text [I] pointer to the text
|
|---|
| 366 | * style [I] drawing style
|
|---|
| 367 | *
|
|---|
| 368 | * RETURNS
|
|---|
| 369 | * No return value.
|
|---|
| 370 | */
|
|---|
| 371 |
|
|---|
| 372 | VOID WINAPI
|
|---|
| 373 | DrawStatusTextW (HDC hdc, LPRECT lprc, LPCWSTR text, UINT style)
|
|---|
| 374 | {
|
|---|
| 375 | LPSTR p = HEAP_strdupWtoA (GetProcessHeap (), 0, text);
|
|---|
| 376 |
|
|---|
| 377 | dprintf(("COMCTL32: DrawStatusTextW"));
|
|---|
| 378 |
|
|---|
| 379 | DrawStatusTextA (hdc, lprc, p, style);
|
|---|
| 380 | HeapFree (GetProcessHeap (), 0, p );
|
|---|
| 381 | }
|
|---|
| 382 |
|
|---|
| 383 |
|
|---|
| 384 | /***********************************************************************
|
|---|
| 385 | * CreateStatusWindow32A [COMCTL32.6][COMCTL32.21]
|
|---|
| 386 | *
|
|---|
| 387 | * Creates a status bar
|
|---|
| 388 | *
|
|---|
| 389 | * PARAMS
|
|---|
| 390 | * style [I] window style
|
|---|
| 391 | * text [I] pointer to the window text
|
|---|
| 392 | * parent [I] handle to the parent window
|
|---|
| 393 | * wid [I] control id of the status bar
|
|---|
| 394 | *
|
|---|
| 395 | * RETURNS
|
|---|
| 396 | * Success: handle to the status window
|
|---|
| 397 | * Failure: 0
|
|---|
| 398 | */
|
|---|
| 399 |
|
|---|
| 400 | HWND WINAPI
|
|---|
| 401 | CreateStatusWindowA (INT style, LPCSTR text, HWND parent, UINT wid)
|
|---|
| 402 | {
|
|---|
| 403 | dprintf(("COMCTL32: CreateStatusWindowA"));
|
|---|
| 404 |
|
|---|
| 405 | return CreateWindowA(STATUSCLASSNAMEA, text, style,
|
|---|
| 406 | CW_USEDEFAULT, CW_USEDEFAULT,
|
|---|
| 407 | CW_USEDEFAULT, CW_USEDEFAULT,
|
|---|
| 408 | parent, wid, 0, 0);
|
|---|
| 409 | }
|
|---|
| 410 |
|
|---|
| 411 |
|
|---|
| 412 | /***********************************************************************
|
|---|
| 413 | * CreateStatusWindow32W [COMCTL32.22] Creates a status bar control
|
|---|
| 414 | *
|
|---|
| 415 | * PARAMS
|
|---|
| 416 | * style [I] window style
|
|---|
| 417 | * text [I] pointer to the window text
|
|---|
| 418 | * parent [I] handle to the parent window
|
|---|
| 419 | * wid [I] control id of the status bar
|
|---|
| 420 | *
|
|---|
| 421 | * RETURNS
|
|---|
| 422 | * Success: handle to the status window
|
|---|
| 423 | * Failure: 0
|
|---|
| 424 | */
|
|---|
| 425 |
|
|---|
| 426 | HWND WINAPI
|
|---|
| 427 | CreateStatusWindowW (INT style, LPCWSTR text, HWND parent, UINT wid)
|
|---|
| 428 | {
|
|---|
| 429 | dprintf(("COMCTL32: CreateStatusWindowW"));
|
|---|
| 430 |
|
|---|
| 431 | return CreateWindowW(STATUSCLASSNAMEW, text, style,
|
|---|
| 432 | CW_USEDEFAULT, CW_USEDEFAULT,
|
|---|
| 433 | CW_USEDEFAULT, CW_USEDEFAULT,
|
|---|
| 434 | parent, wid, 0, 0);
|
|---|
| 435 | }
|
|---|
| 436 |
|
|---|
| 437 |
|
|---|
| 438 | /***********************************************************************
|
|---|
| 439 | * CreateUpDownControl [COMCTL32.16] Creates an up-down control
|
|---|
| 440 | *
|
|---|
| 441 | * PARAMS
|
|---|
| 442 | * style [I] window styles
|
|---|
| 443 | * x [I] horizontal position of the control
|
|---|
| 444 | * y [I] vertical position of the control
|
|---|
| 445 | * cx [I] with of the control
|
|---|
| 446 | * cy [I] height of the control
|
|---|
| 447 | * parent [I] handle to the parent window
|
|---|
| 448 | * id [I] the control's identifier
|
|---|
| 449 | * inst [I] handle to the application's module instance
|
|---|
| 450 | * buddy [I] handle to the buddy window, can be NULL
|
|---|
| 451 | * maxVal [I] upper limit of the control
|
|---|
| 452 | * minVal [I] lower limit of the control
|
|---|
| 453 | * curVal [I] current value of the control
|
|---|
| 454 | *
|
|---|
| 455 | * RETURNS
|
|---|
| 456 | * Success: handle to the updown control
|
|---|
| 457 | * Failure: 0
|
|---|
| 458 | */
|
|---|
| 459 |
|
|---|
| 460 | HWND WINAPI
|
|---|
| 461 | CreateUpDownControl (DWORD style, INT x, INT y, INT cx, INT cy,
|
|---|
| 462 | HWND parent, INT id, HINSTANCE inst,
|
|---|
| 463 | HWND buddy, INT maxVal, INT minVal, INT curVal)
|
|---|
| 464 | {
|
|---|
| 465 | HWND hUD;
|
|---|
| 466 |
|
|---|
| 467 | dprintf(("COMCTL32: CreateUpDownControl"));
|
|---|
| 468 |
|
|---|
| 469 | hUD = CreateWindowA (UPDOWN_CLASSA, 0, style, x, y, cx, cy,
|
|---|
| 470 | parent, id, inst, 0);
|
|---|
| 471 | if (hUD) {
|
|---|
| 472 | SendMessageA (hUD, UDM_SETBUDDY, buddy, 0);
|
|---|
| 473 | SendMessageA (hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal));
|
|---|
| 474 | SendMessageA (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0));
|
|---|
| 475 | }
|
|---|
| 476 |
|
|---|
| 477 | return hUD;
|
|---|
| 478 | }
|
|---|
| 479 |
|
|---|
| 480 | /***********************************************************************
|
|---|
| 481 | * InitCommonControls [COMCTL32.17]
|
|---|
| 482 | *
|
|---|
| 483 | * Registers the common controls.
|
|---|
| 484 | *
|
|---|
| 485 | * PARAMS
|
|---|
| 486 | * No parameters.
|
|---|
| 487 | *
|
|---|
| 488 | * RETURNS
|
|---|
| 489 | * No return values.
|
|---|
| 490 | *
|
|---|
| 491 | * NOTES
|
|---|
| 492 | * This function is just a dummy.
|
|---|
| 493 | * The Win95 controls are registered at the DLL's initialization.
|
|---|
| 494 | * To register other controls InitCommonControlsEx() must be used.
|
|---|
| 495 | */
|
|---|
| 496 |
|
|---|
| 497 | VOID WINAPI InitCommonControls(VOID)
|
|---|
| 498 | {
|
|---|
| 499 | dprintf(("COMCTL32: InitCommonControls"));
|
|---|
| 500 | }
|
|---|
| 501 |
|
|---|
| 502 | /***********************************************************************
|
|---|
| 503 | * InitCommonControlsEx [COMCTL32.81]
|
|---|
| 504 | *
|
|---|
| 505 | * Registers the common controls.
|
|---|
| 506 | *
|
|---|
| 507 | * PARAMS
|
|---|
| 508 | * lpInitCtrls [I] pointer to an INITCOMMONCONTROLS structure.
|
|---|
| 509 | *
|
|---|
| 510 | * RETURNS
|
|---|
| 511 | * Success: TRUE
|
|---|
| 512 | * Failure: FALSE
|
|---|
| 513 | *
|
|---|
| 514 | * NOTES
|
|---|
| 515 | * Only the additinal common controls are registered by this function.
|
|---|
| 516 | * The Win95 controls are registered at the DLL's initialization.
|
|---|
| 517 | */
|
|---|
| 518 |
|
|---|
| 519 | BOOL WINAPI
|
|---|
| 520 | InitCommonControlsEx (LPINITCOMMONCONTROLSEX lpInitCtrls)
|
|---|
| 521 | {
|
|---|
| 522 | INT cCount;
|
|---|
| 523 | DWORD dwMask;
|
|---|
| 524 |
|
|---|
| 525 | dprintf(("COMCTL32: InitCommonControlsEx"));
|
|---|
| 526 |
|
|---|
| 527 | if (!lpInitCtrls)
|
|---|
| 528 | return FALSE;
|
|---|
| 529 | if (lpInitCtrls->dwSize != sizeof(INITCOMMONCONTROLSEX))
|
|---|
| 530 | return FALSE;
|
|---|
| 531 |
|
|---|
| 532 | // TRACE(commctrl,"(0x%08lx)\n", lpInitCtrls->dwICC);
|
|---|
| 533 |
|
|---|
| 534 | for (cCount = 0; cCount < 32; cCount++) {
|
|---|
| 535 | dwMask = 1 << cCount;
|
|---|
| 536 | if (!(lpInitCtrls->dwICC & dwMask))
|
|---|
| 537 | continue;
|
|---|
| 538 |
|
|---|
| 539 | switch (lpInitCtrls->dwICC & dwMask) {
|
|---|
| 540 | /* dummy initialization */
|
|---|
| 541 | case ICC_ANIMATE_CLASS:
|
|---|
| 542 | case ICC_BAR_CLASSES:
|
|---|
| 543 | case ICC_LISTVIEW_CLASSES:
|
|---|
| 544 | case ICC_TREEVIEW_CLASSES:
|
|---|
| 545 | case ICC_TAB_CLASSES:
|
|---|
| 546 | case ICC_UPDOWN_CLASS:
|
|---|
| 547 | case ICC_PROGRESS_CLASS:
|
|---|
| 548 | case ICC_HOTKEY_CLASS:
|
|---|
| 549 | break;
|
|---|
| 550 |
|
|---|
| 551 | /* advanced classes - not included in Win95 */
|
|---|
| 552 | case ICC_DATE_CLASSES:
|
|---|
| 553 | MONTHCAL_Register ();
|
|---|
| 554 | DATETIME_Register ();
|
|---|
| 555 | break;
|
|---|
| 556 |
|
|---|
| 557 | case ICC_USEREX_CLASSES:
|
|---|
| 558 | COMBOEX_Register ();
|
|---|
| 559 | break;
|
|---|
| 560 |
|
|---|
| 561 | case ICC_COOL_CLASSES:
|
|---|
| 562 | REBAR_Register ();
|
|---|
| 563 | break;
|
|---|
| 564 |
|
|---|
| 565 | case ICC_INTERNET_CLASSES:
|
|---|
| 566 | IPADDRESS_Register ();
|
|---|
| 567 | break;
|
|---|
| 568 |
|
|---|
| 569 | case ICC_PAGESCROLLER_CLASS:
|
|---|
| 570 | PAGER_Register ();
|
|---|
| 571 | break;
|
|---|
| 572 |
|
|---|
| 573 | case ICC_NATIVEFNTCTL_CLASS:
|
|---|
| 574 | NATIVEFONT_Register ();
|
|---|
| 575 | break;
|
|---|
| 576 |
|
|---|
| 577 | default:
|
|---|
| 578 | // FIXME (commctrl, "Unknown class! dwICC=0x%lX\n", dwMask);
|
|---|
| 579 | break;
|
|---|
| 580 | }
|
|---|
| 581 | }
|
|---|
| 582 |
|
|---|
| 583 | return TRUE;
|
|---|
| 584 | }
|
|---|
| 585 |
|
|---|
| 586 | /***********************************************************************
|
|---|
| 587 | * CreateToolbarEx [COMCTL32.32] Creates a tool bar window
|
|---|
| 588 | *
|
|---|
| 589 | * PARAMS
|
|---|
| 590 | * hwnd
|
|---|
| 591 | * style
|
|---|
| 592 | * wID
|
|---|
| 593 | * nBitmaps
|
|---|
| 594 | * hBMInst
|
|---|
| 595 | * wBMID
|
|---|
| 596 | * lpButtons
|
|---|
| 597 | * iNumButtons
|
|---|
| 598 | * dxButton
|
|---|
| 599 | * dyButton
|
|---|
| 600 | * dxBitmap
|
|---|
| 601 | * dyBitmap
|
|---|
| 602 | * uStructSize
|
|---|
| 603 | *
|
|---|
| 604 | * RETURNS
|
|---|
| 605 | * Success: handle to the tool bar control
|
|---|
| 606 | * Failure: 0
|
|---|
| 607 | */
|
|---|
| 608 |
|
|---|
| 609 | HWND WINAPI
|
|---|
| 610 | CreateToolbarEx (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,
|
|---|
| 611 | HINSTANCE hBMInst, UINT wBMID, LPCTBBUTTON lpButtons,
|
|---|
| 612 | INT iNumButtons, INT dxButton, INT dyButton,
|
|---|
| 613 | INT dxBitmap, INT dyBitmap, UINT uStructSize)
|
|---|
| 614 | {
|
|---|
| 615 | HWND hwndTB;
|
|---|
| 616 |
|
|---|
| 617 | dprintf(("COMCTL32: CreateToolbarEx"));
|
|---|
| 618 |
|
|---|
| 619 | hwndTB = CreateWindowExA (0, TOOLBARCLASSNAMEA, "", style, 0, 0, 0, 0,
|
|---|
| 620 | hwnd, (HMENU)wID, 0, NULL);
|
|---|
| 621 | if(hwndTB) {
|
|---|
| 622 | TBADDBITMAP tbab;
|
|---|
| 623 |
|
|---|
| 624 | SendMessageA (hwndTB, TB_BUTTONSTRUCTSIZE,
|
|---|
| 625 | (WPARAM)uStructSize, 0);
|
|---|
| 626 |
|
|---|
| 627 | /* set bitmap and button size */
|
|---|
| 628 | /*If CreateToolbarEx receive 0, windows set default values*/
|
|---|
| 629 | if (dyBitmap <= 0)
|
|---|
| 630 | dyBitmap = 16;
|
|---|
| 631 | if (dxBitmap <= 0)
|
|---|
| 632 | dxBitmap = 16;
|
|---|
| 633 |
|
|---|
| 634 | SendMessageA (hwndTB, TB_SETBITMAPSIZE, 0,
|
|---|
| 635 | MAKELPARAM((WORD)dyBitmap, (WORD)dxBitmap));
|
|---|
| 636 | SendMessageA (hwndTB, TB_SETBUTTONSIZE, 0,
|
|---|
| 637 | MAKELPARAM((WORD)dyButton, (WORD)dxButton));
|
|---|
| 638 |
|
|---|
| 639 |
|
|---|
| 640 | /* add bitmaps */
|
|---|
| 641 | if (nBitmaps > 0)
|
|---|
| 642 | {
|
|---|
| 643 | tbab.hInst = hBMInst;
|
|---|
| 644 | tbab.nID = wBMID;
|
|---|
| 645 |
|
|---|
| 646 | SendMessageA (hwndTB, TB_ADDBITMAP,
|
|---|
| 647 | (WPARAM)nBitmaps, (LPARAM)&tbab);
|
|---|
| 648 | }
|
|---|
| 649 | /* add buttons */
|
|---|
| 650 | if(iNumButtons > 0)
|
|---|
| 651 | SendMessageA (hwndTB, TB_ADDBUTTONSA,
|
|---|
| 652 | (WPARAM)iNumButtons, (LPARAM)lpButtons);
|
|---|
| 653 | }
|
|---|
| 654 |
|
|---|
| 655 | return hwndTB;
|
|---|
| 656 | }
|
|---|
| 657 |
|
|---|
| 658 |
|
|---|
| 659 | /***********************************************************************
|
|---|
| 660 | * CreateMappedBitmap [COMCTL32.8]
|
|---|
| 661 | *
|
|---|
| 662 | * PARAMS
|
|---|
| 663 | * hInstance [I]
|
|---|
| 664 | * idBitmap [I]
|
|---|
| 665 | * wFlags [I]
|
|---|
| 666 | * lpColorMap [I]
|
|---|
| 667 | * iNumMaps [I]
|
|---|
| 668 | *
|
|---|
| 669 | * RETURNS
|
|---|
| 670 | * Success: handle to the new bitmap
|
|---|
| 671 | * Failure: 0
|
|---|
| 672 | */
|
|---|
| 673 |
|
|---|
| 674 | HBITMAP WINAPI
|
|---|
| 675 | CreateMappedBitmap (HINSTANCE hInstance, INT idBitmap, UINT wFlags,
|
|---|
| 676 | LPCOLORMAP lpColorMap, INT iNumMaps)
|
|---|
| 677 | {
|
|---|
| 678 | HGLOBAL hglb;
|
|---|
| 679 | HRSRC hRsrc;
|
|---|
| 680 | LPBITMAPINFOHEADER lpBitmap, lpBitmapInfo;
|
|---|
| 681 | UINT nSize, nColorTableSize;
|
|---|
| 682 | RGBQUAD *pColorTable;
|
|---|
| 683 | INT iColor, i, iMaps, nWidth, nHeight;
|
|---|
| 684 | HDC hdcScreen;
|
|---|
| 685 | HBITMAP hbm;
|
|---|
| 686 | LPCOLORMAP sysColorMap;
|
|---|
| 687 | COLORREF cRef;
|
|---|
| 688 | COLORMAP internalColorMap[4] =
|
|---|
| 689 | {{0x000000, 0}, {0x808080, 0}, {0xC0C0C0, 0}, {0xFFFFFF, 0}};
|
|---|
| 690 |
|
|---|
| 691 | dprintf(("COMCTL32: CreateMappedBitmap"));
|
|---|
| 692 |
|
|---|
| 693 | /* initialize pointer to colortable and default color table */
|
|---|
| 694 | if (lpColorMap) {
|
|---|
| 695 | iMaps = iNumMaps;
|
|---|
| 696 | sysColorMap = lpColorMap;
|
|---|
| 697 | }
|
|---|
| 698 | else {
|
|---|
| 699 | internalColorMap[0].to = GetSysColor (COLOR_BTNTEXT);
|
|---|
| 700 | internalColorMap[1].to = GetSysColor (COLOR_BTNSHADOW);
|
|---|
| 701 | internalColorMap[2].to = GetSysColor (COLOR_BTNFACE);
|
|---|
| 702 | internalColorMap[3].to = GetSysColor (COLOR_BTNHIGHLIGHT);
|
|---|
| 703 | iMaps = 4;
|
|---|
| 704 | sysColorMap = (LPCOLORMAP)internalColorMap;
|
|---|
| 705 | }
|
|---|
| 706 |
|
|---|
| 707 | hRsrc = FindResourceA (hInstance, (LPSTR)idBitmap, RT_BITMAPA);
|
|---|
| 708 | if (hRsrc == 0)
|
|---|
| 709 | return 0;
|
|---|
| 710 | hglb = LoadResource (hInstance, hRsrc);
|
|---|
| 711 | if (hglb == 0)
|
|---|
| 712 | return 0;
|
|---|
| 713 | lpBitmap = (LPBITMAPINFOHEADER)LockResource (hglb);
|
|---|
| 714 | if (lpBitmap == NULL)
|
|---|
| 715 | return 0;
|
|---|
| 716 |
|
|---|
| 717 | nColorTableSize = (1 << lpBitmap->biBitCount);
|
|---|
| 718 | nSize = lpBitmap->biSize + nColorTableSize * sizeof(RGBQUAD);
|
|---|
| 719 | lpBitmapInfo = (LPBITMAPINFOHEADER)GlobalAlloc (GMEM_FIXED, nSize);
|
|---|
| 720 | if (lpBitmapInfo == NULL)
|
|---|
| 721 | return 0;
|
|---|
| 722 | RtlMoveMemory (lpBitmapInfo, lpBitmap, nSize);
|
|---|
| 723 |
|
|---|
| 724 | pColorTable = (RGBQUAD*)(((LPBYTE)lpBitmapInfo)+(UINT)lpBitmapInfo->biSize);
|
|---|
| 725 |
|
|---|
| 726 | for (iColor = 0; iColor < nColorTableSize; iColor++) {
|
|---|
| 727 | for (i = 0; i < iMaps; i++) {
|
|---|
| 728 | cRef = RGB(pColorTable[iColor].rgbRed,
|
|---|
| 729 | pColorTable[iColor].rgbGreen,
|
|---|
| 730 | pColorTable[iColor].rgbBlue);
|
|---|
| 731 | if ( cRef == sysColorMap[i].from) {
|
|---|
| 732 | #if 0
|
|---|
| 733 | if (wFlags & CBS_MASKED) {
|
|---|
| 734 | if (sysColorMap[i].to != COLOR_BTNTEXT)
|
|---|
| 735 | pColorTable[iColor] = RGB(255, 255, 255);
|
|---|
| 736 | }
|
|---|
| 737 | else
|
|---|
| 738 | #endif
|
|---|
| 739 | pColorTable[iColor].rgbBlue = GetBValue(sysColorMap[i].to);
|
|---|
| 740 | pColorTable[iColor].rgbGreen = GetGValue(sysColorMap[i].to);
|
|---|
| 741 | pColorTable[iColor].rgbRed = GetRValue(sysColorMap[i].to);
|
|---|
| 742 | break;
|
|---|
| 743 | }
|
|---|
| 744 | }
|
|---|
| 745 | }
|
|---|
| 746 | nWidth = (INT)lpBitmapInfo->biWidth;
|
|---|
| 747 | nHeight = (INT)lpBitmapInfo->biHeight;
|
|---|
| 748 | hdcScreen = GetDC ((HWND)0);
|
|---|
| 749 | hbm = CreateCompatibleBitmap (hdcScreen, nWidth, nHeight);
|
|---|
| 750 | if (hbm) {
|
|---|
| 751 | HDC hdcDst = CreateCompatibleDC (hdcScreen);
|
|---|
| 752 | HBITMAP hbmOld = SelectObject (hdcDst, hbm);
|
|---|
| 753 | LPBYTE lpBits = (LPBYTE)(lpBitmap + 1);
|
|---|
| 754 | lpBits += (1 << (lpBitmapInfo->biBitCount)) * sizeof(RGBQUAD);
|
|---|
| 755 | StretchDIBits (hdcDst, 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight,
|
|---|
| 756 | lpBits, (LPBITMAPINFO)lpBitmapInfo, DIB_RGB_COLORS,
|
|---|
| 757 | SRCCOPY);
|
|---|
| 758 | SelectObject (hdcDst, hbmOld);
|
|---|
| 759 | DeleteDC (hdcDst);
|
|---|
| 760 | }
|
|---|
| 761 | ReleaseDC ((HWND)0, hdcScreen);
|
|---|
| 762 | GlobalFree ((HGLOBAL)lpBitmapInfo);
|
|---|
| 763 | FreeResource (hglb);
|
|---|
| 764 |
|
|---|
| 765 | return hbm;
|
|---|
| 766 | }
|
|---|
| 767 |
|
|---|
| 768 |
|
|---|
| 769 | /***********************************************************************
|
|---|
| 770 | * CreateToolbar [COMCTL32.7] Creates a tool bar control
|
|---|
| 771 | *
|
|---|
| 772 | * PARAMS
|
|---|
| 773 | * hwnd
|
|---|
| 774 | * style
|
|---|
| 775 | * wID
|
|---|
| 776 | * nBitmaps
|
|---|
| 777 | * hBMInst
|
|---|
| 778 | * wBMID
|
|---|
| 779 | * lpButtons
|
|---|
| 780 | * iNumButtons
|
|---|
| 781 | *
|
|---|
| 782 | * RETURNS
|
|---|
| 783 | * Success: handle to the tool bar control
|
|---|
| 784 | * Failure: 0
|
|---|
| 785 | *
|
|---|
| 786 | * NOTES
|
|---|
| 787 | * Do not use this functions anymore. Use CreateToolbarEx instead.
|
|---|
| 788 | */
|
|---|
| 789 |
|
|---|
| 790 | HWND WINAPI
|
|---|
| 791 | CreateToolbar (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,
|
|---|
| 792 | HINSTANCE hBMInst, UINT wBMID,
|
|---|
| 793 | LPCOLDTBBUTTON lpButtons,INT iNumButtons)
|
|---|
| 794 | {
|
|---|
| 795 | dprintf(("COMCTL32: CreateToolbar"));
|
|---|
| 796 |
|
|---|
| 797 | return CreateToolbarEx (hwnd, style | CCS_NODIVIDER, wID, nBitmaps,
|
|---|
| 798 | hBMInst, wBMID, (LPCTBBUTTON)lpButtons,
|
|---|
| 799 | iNumButtons, 0, 0, 0, 0, sizeof (OLDTBBUTTON));
|
|---|
| 800 | }
|
|---|
| 801 |
|
|---|
| 802 |
|
|---|
| 803 | /***********************************************************************
|
|---|
| 804 | * DllGetVersion [COMCTL32.25]
|
|---|
| 805 | *
|
|---|
| 806 | * Retrieves version information of the 'COMCTL32.DLL'
|
|---|
| 807 | *
|
|---|
| 808 | * PARAMS
|
|---|
| 809 | * pdvi [O] pointer to version information structure.
|
|---|
| 810 | *
|
|---|
| 811 | * RETURNS
|
|---|
| 812 | * Success: S_OK
|
|---|
| 813 | * Failure: E_INVALIDARG
|
|---|
| 814 | *
|
|---|
| 815 | * NOTES
|
|---|
| 816 | * Returns version of a comctl32.dll from IE4.01 SP1.
|
|---|
| 817 | */
|
|---|
| 818 |
|
|---|
| 819 | HRESULT WINAPI
|
|---|
| 820 | COMCTL32_DllGetVersion (DLLVERSIONINFO *pdvi)
|
|---|
| 821 | {
|
|---|
| 822 | if (pdvi->cbSize != sizeof(DLLVERSIONINFO)) {
|
|---|
| 823 | // WARN (commctrl, "wrong DLLVERSIONINFO size from app");
|
|---|
| 824 | return E_INVALIDARG;
|
|---|
| 825 | }
|
|---|
| 826 |
|
|---|
| 827 | pdvi->dwMajorVersion = 4;
|
|---|
| 828 | pdvi->dwMinorVersion = 72;
|
|---|
| 829 | pdvi->dwBuildNumber = 3110;
|
|---|
| 830 | pdvi->dwPlatformID = 1;
|
|---|
| 831 |
|
|---|
| 832 | // TRACE (commctrl, "%lu.%lu.%lu.%lu\n",
|
|---|
| 833 | // pdvi->dwMajorVersion, pdvi->dwMinorVersion,
|
|---|
| 834 | // pdvi->dwBuildNumber, pdvi->dwPlatformID);
|
|---|
| 835 |
|
|---|
| 836 | return S_OK;
|
|---|
| 837 | }
|
|---|
| 838 |
|
|---|
| 839 | static int iTrackMax = 0;
|
|---|
| 840 | static HWND TrackingList[10];
|
|---|
| 841 | static UINT timer;
|
|---|
| 842 |
|
|---|
| 843 | static void CALLBACK TrackMouseEventProc(HWND hwndUnused, UINT uMsg, UINT idEvent, DWORD dwTime) {
|
|---|
| 844 | int i = 0;
|
|---|
| 845 | POINT pos;
|
|---|
| 846 | HWND hwnd;
|
|---|
| 847 | BOOL keepTracking = FALSE;
|
|---|
| 848 | GetCursorPos(&pos);
|
|---|
| 849 | hwnd = WindowFromPoint(pos);
|
|---|
| 850 | /* Loop through the list of windows waiting on mouse exit */
|
|---|
| 851 | while (i < iTrackMax) {
|
|---|
| 852 | if (TrackingList[i] != hwnd)
|
|---|
| 853 | PostMessageA(TrackingList[i], WM_MOUSELEAVE, 0, 0);
|
|---|
| 854 | else
|
|---|
| 855 | keepTracking = TRUE;
|
|---|
| 856 |
|
|---|
| 857 |
|
|---|
| 858 | i++;
|
|---|
| 859 | }
|
|---|
| 860 |
|
|---|
| 861 | if (keepTracking) {
|
|---|
| 862 | iTrackMax = 1;
|
|---|
| 863 | TrackingList[0] = hwnd;
|
|---|
| 864 | }
|
|---|
| 865 | else
|
|---|
| 866 | KillTimer(0, timer);
|
|---|
| 867 | }
|
|---|
| 868 |
|
|---|
| 869 | /***********************************************************************
|
|---|
| 870 | * _TrackMouseEvent [COMCTL32.25]
|
|---|
| 871 | *
|
|---|
| 872 | * Requests notification of mouse events
|
|---|
| 873 | *
|
|---|
| 874 | * PARAMS
|
|---|
| 875 | * ptme [I,O] pointer to TRACKMOUSEEVENT information structure.
|
|---|
| 876 | *
|
|---|
| 877 | * RETURNS
|
|---|
| 878 | * Success: non-zero
|
|---|
| 879 | * Failure: zero
|
|---|
| 880 | *
|
|---|
| 881 | */
|
|---|
| 882 |
|
|---|
| 883 | BOOL WINAPI
|
|---|
| 884 | _TrackMouseEvent (TRACKMOUSEEVENT *ptme)
|
|---|
| 885 | {
|
|---|
| 886 | DWORD flags = 0;
|
|---|
| 887 | int i;
|
|---|
| 888 | BOOL cancel = 0, hover = 0, leave = 0, query = 0;
|
|---|
| 889 | if (ptme->cbSize != sizeof(TRACKMOUSEEVENT)) {
|
|---|
| 890 | //WARN("wrong TRACKMOUSEEVENT size from app");
|
|---|
| 891 | return E_INVALIDARG;
|
|---|
| 892 | }
|
|---|
| 893 |
|
|---|
| 894 | //TRACE("%lx, %lx, %x, %lx\n", ptme->cbSize, ptme->dwFlags, ptme->hwndTrack, ptme->dwHoverTime);
|
|---|
| 895 |
|
|---|
| 896 | flags = ptme->dwFlags;
|
|---|
| 897 | if ( flags & TME_CANCEL ) {
|
|---|
| 898 | cancel = 1;
|
|---|
| 899 | flags &= ~ TME_CANCEL;
|
|---|
| 900 | }
|
|---|
| 901 | if ( flags & TME_HOVER ) {
|
|---|
| 902 | hover = 1;
|
|---|
| 903 | flags &= ~ TME_HOVER;
|
|---|
| 904 | //FIXME("TME_HOVER unimplemented\n" );
|
|---|
| 905 | }
|
|---|
| 906 | if ( flags & TME_LEAVE ) {
|
|---|
| 907 | leave = 1;
|
|---|
| 908 | flags &= ~ TME_LEAVE;
|
|---|
| 909 | }
|
|---|
| 910 | if ( flags & TME_QUERY ) {
|
|---|
| 911 | query = 1;
|
|---|
| 912 | flags &= ~ TME_QUERY;
|
|---|
| 913 | //FIXME("TME_QUERY unimplemented\n" );
|
|---|
| 914 | }
|
|---|
| 915 |
|
|---|
| 916 | //if ( flags )
|
|---|
| 917 | // FIXME("Unknown flag(s) %ld\n", flags & ~(TME_CANCEL | TME_HOVER | TME_LEAVE | TME_QUERY) );
|
|---|
| 918 |
|
|---|
| 919 | if (leave) {
|
|---|
| 920 | if (cancel) {
|
|---|
| 921 | for (i = 0; i < iTrackMax; i++)
|
|---|
| 922 | if (TrackingList[i] == ptme->hwndTrack)
|
|---|
| 923 | TrackingList[i] = TrackingList[--iTrackMax];
|
|---|
| 924 | }
|
|---|
| 925 | else {
|
|---|
| 926 | if (iTrackMax == sizeof (TrackingList) / sizeof *TrackingList)
|
|---|
| 927 | return FALSE;
|
|---|
| 928 |
|
|---|
| 929 | /* Add hwndTrack to the track list */
|
|---|
| 930 | TrackingList[iTrackMax++] = ptme->hwndTrack;
|
|---|
| 931 | if (!timer)
|
|---|
| 932 | timer = SetTimer(0, 0, 50, TrackMouseEventProc);
|
|---|
| 933 | }
|
|---|
| 934 | }
|
|---|
| 935 |
|
|---|
| 936 | return TRUE;
|
|---|
| 937 | }
|
|---|
| 938 |
|
|---|
| 939 |
|
|---|