commctrl.c 28.8 KB
Newer Older
1
/*
Alexandre Julliard's avatar
Alexandre Julliard committed
2 3 4
 * Common controls functions
 *
 * Copyright 1997 Dimitrie O. Paun
5
 * Copyright 1998,2000 Eric Kohl
Alexandre Julliard's avatar
Alexandre Julliard committed
6
 *
7 8 9 10 11 12 13 14 15 16 17 18 19
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
Alexandre Julliard's avatar
Alexandre Julliard committed
20 21
 */

22
#include <string.h>
23
#include <stdlib.h>
24

25
#include "winbase.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
26
#include "commctrl.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
27
#include "winerror.h"
28
#include "winreg.h"
29
#define NO_SHLWAPI_STREAM
30
#include "shlwapi.h"
Gerard Patel's avatar
Gerard Patel committed
31
#include "comctl32.h"
32
#include "wine/debug.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
33

34
WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75

extern void ANIMATE_Register(void);
extern void ANIMATE_Unregister(void);
extern void COMBOEX_Register(void);
extern void COMBOEX_Unregister(void);
extern void DATETIME_Register(void);
extern void DATETIME_Unregister(void);
extern void FLATSB_Register(void);
extern void FLATSB_Unregister(void);
extern void HEADER_Register(void);
extern void HEADER_Unregister(void);
extern void HOTKEY_Register(void);
extern void HOTKEY_Unregister(void);
extern void IPADDRESS_Register(void);
extern void IPADDRESS_Unregister(void);
extern void LISTVIEW_Register(void);
extern void LISTVIEW_Unregister(void);
extern void MONTHCAL_Register(void);
extern void MONTHCAL_Unregister(void);
extern void NATIVEFONT_Register(void);
extern void NATIVEFONT_Unregister(void);
extern void PAGER_Register(void);
extern void PAGER_Unregister(void);
extern void PROGRESS_Register(void);
extern void PROGRESS_Unregister(void);
extern void REBAR_Register(void);
extern void REBAR_Unregister(void);
extern void STATUS_Register(void);
extern void STATUS_Unregister(void);
extern void TAB_Register(void);
extern void TAB_Unregister(void);
extern void TOOLBAR_Register(void);
extern void TOOLBAR_Unregister(void);
extern void TOOLTIPS_Register(void);
extern void TOOLTIPS_Unregister(void);
extern void TRACKBAR_Register(void);
extern void TRACKBAR_Unregister(void);
extern void TREEVIEW_Register(void);
extern void TREEVIEW_Unregister(void);
extern void UPDOWN_Register(void);
extern void UPDOWN_Unregister(void);
76

Alexandre Julliard's avatar
Alexandre Julliard committed
77

78
HANDLE COMCTL32_hHeap = (HANDLE)NULL;
79
LPSTR    COMCTL32_aSubclass = (LPSTR)NULL;
80
HMODULE COMCTL32_hModule = 0;
81
LANGID  COMCTL32_uiLang = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
82
HBRUSH  COMCTL32_hPattern55AABrush = (HANDLE)NULL;
83
COMCTL32_SysColor  comctl32_color;
84 85 86 87 88 89 90 91

static HBITMAP COMCTL32_hPattern55AABitmap = (HANDLE)NULL;

static const WORD wPattern55AA[] =
{
    0x5555, 0xaaaa, 0x5555, 0xaaaa,
    0x5555, 0xaaaa, 0x5555, 0xaaaa
};
92 93


Alexandre Julliard's avatar
Alexandre Julliard committed
94
/***********************************************************************
95
 * COMCTL32_LibMain [Internal] Initializes the internal 'COMCTL32.DLL'.
Alexandre Julliard's avatar
Alexandre Julliard committed
96 97
 *
 * PARAMS
Alexandre Julliard's avatar
Alexandre Julliard committed
98
 *     hinstDLL    [I] handle to the 'dlls' instance
Alexandre Julliard's avatar
Alexandre Julliard committed
99
 *     fdwReason   [I]
100
 *     lpvReserved [I] reserverd, must be NULL
Alexandre Julliard's avatar
Alexandre Julliard committed
101
 *
Alexandre Julliard's avatar
Alexandre Julliard committed
102 103 104
 * RETURNS
 *     Success: TRUE
 *     Failure: FALSE
Alexandre Julliard's avatar
Alexandre Julliard committed
105
 */
Alexandre Julliard's avatar
Alexandre Julliard committed
106

107 108
BOOL WINAPI
COMCTL32_LibMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
Alexandre Julliard's avatar
Alexandre Julliard committed
109
{
110
    TRACE("%x,%lx,%p\n", hinstDLL, fdwReason, lpvReserved);
Alexandre Julliard's avatar
Alexandre Julliard committed
111 112 113

    switch (fdwReason) {
	case DLL_PROCESS_ATTACH:
114 115 116 117 118 119 120 121 122 123 124 125 126 127
            COMCTL32_hModule = (HMODULE)hinstDLL;

            /* create private heap */
            COMCTL32_hHeap = HeapCreate (0, 0x10000, 0);
            TRACE("Heap created: 0x%x\n", COMCTL32_hHeap);

            /* add global subclassing atom (used by 'tooltip' and 'updown') */
            COMCTL32_aSubclass = (LPSTR)(DWORD)GlobalAddAtomA ("CC32SubclassInfo");
            TRACE("Subclassing atom added: %p\n", COMCTL32_aSubclass);

            /* create local pattern brush */
            COMCTL32_hPattern55AABitmap = CreateBitmap (8, 8, 1, 1, wPattern55AA);
            COMCTL32_hPattern55AABrush = CreatePatternBrush (COMCTL32_hPattern55AABitmap);

128 129 130
	    /* Get all the colors at DLL load */
	    COMCTL32_RefreshSysColors();

131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
            /* register all Win95 common control classes */
            ANIMATE_Register ();
            FLATSB_Register ();
            HEADER_Register ();
            HOTKEY_Register ();
            LISTVIEW_Register ();
            PROGRESS_Register ();
            STATUS_Register ();
            TAB_Register ();
            TOOLBAR_Register ();
            TOOLTIPS_Register ();
            TRACKBAR_Register ();
            TREEVIEW_Register ();
            UPDOWN_Register ();
            break;
146 147

	case DLL_PROCESS_DETACH:
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
            /* unregister all common control classes */
            ANIMATE_Unregister ();
            COMBOEX_Unregister ();
            DATETIME_Unregister ();
            FLATSB_Unregister ();
            HEADER_Unregister ();
            HOTKEY_Unregister ();
            IPADDRESS_Unregister ();
            LISTVIEW_Unregister ();
            MONTHCAL_Unregister ();
            NATIVEFONT_Unregister ();
            PAGER_Unregister ();
            PROGRESS_Unregister ();
            REBAR_Unregister ();
            STATUS_Unregister ();
            TAB_Unregister ();
            TOOLBAR_Unregister ();
            TOOLTIPS_Unregister ();
            TRACKBAR_Unregister ();
            TREEVIEW_Unregister ();
            UPDOWN_Unregister ();

            /* delete local pattern brush */
            DeleteObject (COMCTL32_hPattern55AABrush);
            COMCTL32_hPattern55AABrush = (HANDLE)NULL;
            DeleteObject (COMCTL32_hPattern55AABitmap);
            COMCTL32_hPattern55AABitmap = (HANDLE)NULL;

            /* delete global subclassing atom */
            GlobalDeleteAtom (LOWORD(COMCTL32_aSubclass));
            TRACE("Subclassing atom deleted: %p\n", COMCTL32_aSubclass);
            COMCTL32_aSubclass = (LPSTR)NULL;

            /* destroy private heap */
            HeapDestroy (COMCTL32_hHeap);
            TRACE("Heap destroyed: 0x%x\n", COMCTL32_hHeap);
            COMCTL32_hHeap = (HANDLE)NULL;
            break;
Alexandre Julliard's avatar
Alexandre Julliard committed
186
    }
Alexandre Julliard's avatar
Alexandre Julliard committed
187

Alexandre Julliard's avatar
Alexandre Julliard committed
188
    return TRUE;
Alexandre Julliard's avatar
Alexandre Julliard committed
189
}
Alexandre Julliard's avatar
Alexandre Julliard committed
190 191


Alexandre Julliard's avatar
Alexandre Julliard committed
192 193 194 195
/***********************************************************************
 * MenuHelp [COMCTL32.2]
 *
 * PARAMS
196 197 198 199 200
 *     uMsg       [I] message (WM_MENUSELECT) (see NOTES)
 *     wParam     [I] wParam of the message uMsg
 *     lParam     [I] lParam of the message uMsg
 *     hMainMenu  [I] handle to the application's main menu
 *     hInst      [I] handle to the module that contains string resources
Alexandre Julliard's avatar
Alexandre Julliard committed
201
 *     hwndStatus [I] handle to the status bar window
202
 *     lpwIDs     [I] pointer to an array of integers (see NOTES)
Alexandre Julliard's avatar
Alexandre Julliard committed
203 204
 *
 * RETURNS
Alexandre Julliard's avatar
Alexandre Julliard committed
205
 *     No return value
Alexandre Julliard's avatar
Alexandre Julliard committed
206 207
 *
 * NOTES
Alexandre Julliard's avatar
Alexandre Julliard committed
208
 *     The official documentation is incomplete!
209 210 211
 *     This is the correct documentation:
 *
 *     uMsg:
Andreas Mohr's avatar
Andreas Mohr committed
212
 *     MenuHelp() does NOT handle WM_COMMAND messages! It only handles
213 214 215 216
 *     WM_MENUSELECT messages.
 *
 *     lpwIDs:
 *     (will be written ...)
Alexandre Julliard's avatar
Alexandre Julliard committed
217 218 219
 */

VOID WINAPI
220 221
MenuHelp (UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu,
	  HINSTANCE hInst, HWND hwndStatus, LPUINT lpwIDs)
Alexandre Julliard's avatar
Alexandre Julliard committed
222
{
223
    UINT uMenuID = 0;
Alexandre Julliard's avatar
Alexandre Julliard committed
224

225
    if (!IsWindow (hwndStatus))
Alexandre Julliard's avatar
Alexandre Julliard committed
226
	return;
Alexandre Julliard's avatar
Alexandre Julliard committed
227 228 229

    switch (uMsg) {
	case WM_MENUSELECT:
230
	    TRACE("WM_MENUSELECT wParam=0x%X lParam=0x%lX\n",
Alexandre Julliard's avatar
Alexandre Julliard committed
231
		   wParam, lParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
232 233 234

            if ((HIWORD(wParam) == 0xFFFF) && (lParam == 0)) {
                /* menu was closed */
235
		TRACE("menu was closed!\n");
236
                SendMessageA (hwndStatus, SB_SIMPLE, FALSE, 0);
Alexandre Julliard's avatar
Alexandre Julliard committed
237
            }
Alexandre Julliard's avatar
Alexandre Julliard committed
238 239 240
	    else {
		/* menu item was selected */
		if (HIWORD(wParam) & MF_POPUP)
241
		    uMenuID = (UINT)*(lpwIDs+1);
Alexandre Julliard's avatar
Alexandre Julliard committed
242
		else
243
		    uMenuID = (UINT)LOWORD(wParam);
244
		TRACE("uMenuID = %u\n", uMenuID);
Alexandre Julliard's avatar
Alexandre Julliard committed
245 246 247 248

		if (uMenuID) {
		    CHAR szText[256];

249
		    if (!LoadStringA (hInst, uMenuID, szText, 256))
250
			szText[0] = '\0';
Alexandre Julliard's avatar
Alexandre Julliard committed
251

252
		    SendMessageA (hwndStatus, SB_SETTEXTA,
Alexandre Julliard's avatar
Alexandre Julliard committed
253
				    255 | SBT_NOBORDERS, (LPARAM)szText);
254
		    SendMessageA (hwndStatus, SB_SIMPLE, TRUE, 0);
Alexandre Julliard's avatar
Alexandre Julliard committed
255 256 257
		}
	    }
	    break;
Alexandre Julliard's avatar
Alexandre Julliard committed
258

259 260 261 262 263 264 265 266 267 268
        case WM_COMMAND :
	    TRACE("WM_COMMAND wParam=0x%X lParam=0x%lX\n",
		   wParam, lParam);
	    /* WM_COMMAND is not invalid since it is documented
	     * in the windows api reference. So don't output
             * any FIXME for WM_COMMAND
             */
	    WARN("We don't care about the WM_COMMAND\n");
	    break;

Alexandre Julliard's avatar
Alexandre Julliard committed
269
	default:
270
	    FIXME("Invalid Message 0x%x!\n", uMsg);
Alexandre Julliard's avatar
Alexandre Julliard committed
271
	    break;
Alexandre Julliard's avatar
Alexandre Julliard committed
272 273 274 275 276
    }
}


/***********************************************************************
277
 * ShowHideMenuCtl [COMCTL32.3]
Alexandre Julliard's avatar
Alexandre Julliard committed
278 279 280 281 282 283 284 285 286 287 288 289 290
 *
 * Shows or hides controls and updates the corresponding menu item.
 *
 * PARAMS
 *     hwnd   [I] handle to the client window.
 *     uFlags [I] menu command id.
 *     lpInfo [I] pointer to an array of integers. (See NOTES.)
 *
 * RETURNS
 *     Success: TRUE
 *     Failure: FALSE
 *
 * NOTES
291 292 293 294 295 296 297 298
 *     The official documentation is incomplete!
 *     This is the correct documentation:
 *
 *     hwnd
 *     Handle to the window that contains the menu and controls.
 *
 *     uFlags
 *     Identifier of the menu item to receive or loose a check mark.
Alexandre Julliard's avatar
Alexandre Julliard committed
299 300 301
 *
 *     lpInfo
 *     The array of integers contains pairs of values. BOTH values of
302
 *     the first pair must be the handles to the application's main menu.
Alexandre Julliard's avatar
Alexandre Julliard committed
303 304 305
 *     Each subsequent pair consists of a menu id and control id.
 */

306 307
BOOL WINAPI
ShowHideMenuCtl (HWND hwnd, UINT uFlags, LPINT lpInfo)
Alexandre Julliard's avatar
Alexandre Julliard committed
308
{
309
    LPINT lpMenuId;
Alexandre Julliard's avatar
Alexandre Julliard committed
310

311
    TRACE("%x, %x, %p\n", hwnd, uFlags, lpInfo);
Alexandre Julliard's avatar
Alexandre Julliard committed
312 313 314 315 316 317 318 319 320 321 322 323

    if (lpInfo == NULL)
	return FALSE;

    if (!(lpInfo[0]) || !(lpInfo[1]))
	return FALSE;

    /* search for control */
    lpMenuId = &lpInfo[2];
    while (*lpMenuId != uFlags)
	lpMenuId += 2;

324
    if (GetMenuState (lpInfo[1], uFlags, MF_BYCOMMAND) & MFS_CHECKED) {
Alexandre Julliard's avatar
Alexandre Julliard committed
325
	/* uncheck menu item */
326
	CheckMenuItem (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_UNCHECKED);
Alexandre Julliard's avatar
Alexandre Julliard committed
327 328 329

	/* hide control */
	lpMenuId++;
330
	SetWindowPos (GetDlgItem (hwnd, *lpMenuId), 0, 0, 0, 0, 0,
Alexandre Julliard's avatar
Alexandre Julliard committed
331 332 333 334
			SWP_HIDEWINDOW);
    }
    else {
	/* check menu item */
335
	CheckMenuItem (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_CHECKED);
Alexandre Julliard's avatar
Alexandre Julliard committed
336 337 338

	/* show control */
	lpMenuId++;
339
	SetWindowPos (GetDlgItem (hwnd, *lpMenuId), 0, 0, 0, 0, 0,
Alexandre Julliard's avatar
Alexandre Julliard committed
340 341 342 343 344 345 346 347 348 349 350 351 352
			SWP_SHOWWINDOW);
    }

    return TRUE;
}


/***********************************************************************
 * GetEffectiveClientRect [COMCTL32.4]
 *
 * PARAMS
 *     hwnd   [I] handle to the client window.
 *     lpRect [O] pointer to the rectangle of the client window
353
 *     lpInfo [I] pointer to an array of integers (see NOTES)
Alexandre Julliard's avatar
Alexandre Julliard committed
354 355
 *
 * RETURNS
Alexandre Julliard's avatar
Alexandre Julliard committed
356
 *     No return value.
Alexandre Julliard's avatar
Alexandre Julliard committed
357 358
 *
 * NOTES
Alexandre Julliard's avatar
Alexandre Julliard committed
359
 *     The official documentation is incomplete!
360 361 362 363
 *     This is the correct documentation:
 *
 *     lpInfo
 *     (will be written...)
Alexandre Julliard's avatar
Alexandre Julliard committed
364 365 366
 */

VOID WINAPI
367
GetEffectiveClientRect (HWND hwnd, LPRECT lpRect, LPINT lpInfo)
Alexandre Julliard's avatar
Alexandre Julliard committed
368
{
369 370 371
    RECT rcCtrl;
    INT  *lpRun;
    HWND hwndCtrl;
Alexandre Julliard's avatar
Alexandre Julliard committed
372

373
    TRACE("(0x%08lx 0x%08lx 0x%08lx)\n",
Alexandre Julliard's avatar
Alexandre Julliard committed
374 375
	   (DWORD)hwnd, (DWORD)lpRect, (DWORD)lpInfo);

376
    GetClientRect (hwnd, lpRect);
Alexandre Julliard's avatar
Alexandre Julliard committed
377 378 379 380 381 382 383
    lpRun = lpInfo;

    do {
	lpRun += 2;
	if (*lpRun == 0)
	    return;
	lpRun++;
384 385
	hwndCtrl = GetDlgItem (hwnd, *lpRun);
	if (GetWindowLongA (hwndCtrl, GWL_STYLE) & WS_VISIBLE) {
386
	    TRACE("control id 0x%x\n", *lpRun);
387 388 389
	    GetWindowRect (hwndCtrl, &rcCtrl);
	    MapWindowPoints ((HWND)0, hwnd, (LPPOINT)&rcCtrl, 2);
	    SubtractRect (lpRect, lpRect, &rcCtrl);
Alexandre Julliard's avatar
Alexandre Julliard committed
390 391 392 393 394 395
	}
	lpRun++;
    } while (*lpRun);
}


Alexandre Julliard's avatar
Alexandre Julliard committed
396
/***********************************************************************
397
 * DrawStatusTextW [COMCTL32.@]
Alexandre Julliard's avatar
Alexandre Julliard committed
398 399 400 401 402 403 404
 *
 * Draws text with borders, like in a status bar.
 *
 * PARAMS
 *     hdc   [I] handle to the window's display context
 *     lprc  [I] pointer to a rectangle
 *     text  [I] pointer to the text
405
 *     style [I] drawing style
Alexandre Julliard's avatar
Alexandre Julliard committed
406 407 408
 *
 * RETURNS
 *     No return value.
409 410 411 412
 *
 * NOTES
 *     The style variable can have one of the following values:
 *     (will be written ...)
Alexandre Julliard's avatar
Alexandre Julliard committed
413
 */
Alexandre Julliard's avatar
Alexandre Julliard committed
414

415
void WINAPI DrawStatusTextW (HDC hdc, LPRECT lprc, LPCWSTR text, UINT style)
Alexandre Julliard's avatar
Alexandre Julliard committed
416
{
417 418
    RECT r = *lprc;
    UINT border = BDR_SUNKENOUTER;
Alexandre Julliard's avatar
Alexandre Julliard committed
419

420
    if (style & SBT_POPOUT)
421
        border = BDR_RAISEDOUTER;
422
    else if (style & SBT_NOBORDERS)
423
        border = 0;
Alexandre Julliard's avatar
Alexandre Julliard committed
424

425
    DrawEdge (hdc, &r, border, BF_RECT|BF_ADJUST);
Alexandre Julliard's avatar
Alexandre Julliard committed
426 427 428

    /* now draw text */
    if (text) {
429 430 431 432 433 434 435 436 437 438 439 440
        int oldbkmode = SetBkMode (hdc, TRANSPARENT);
        UINT align = DT_LEFT;
        if (*text == L'\t') {
	    text++;
	    align = DT_CENTER;
	    if (*text == L'\t') {
	        text++;
	        align = DT_RIGHT;
	    }
        }
        r.left += 3;
        if (style & SBT_RTLREADING)
441
	    FIXME("Unsupported RTL style!\n");
442
        DrawTextW (hdc, text, -1, &r, align|DT_VCENTER|DT_SINGLELINE);
443
	SetBkMode(hdc, oldbkmode);
Alexandre Julliard's avatar
Alexandre Julliard committed
444 445 446
    }
}

Alexandre Julliard's avatar
Alexandre Julliard committed
447

Alexandre Julliard's avatar
Alexandre Julliard committed
448
/***********************************************************************
449
 * DrawStatusText  [COMCTL32.@]
450
 * DrawStatusTextA [COMCTL32.5]
Alexandre Julliard's avatar
Alexandre Julliard committed
451 452 453 454 455 456 457
 *
 * Draws text with borders, like in a status bar.
 *
 * PARAMS
 *     hdc   [I] handle to the window's display context
 *     lprc  [I] pointer to a rectangle
 *     text  [I] pointer to the text
458
 *     style [I] drawing style
Alexandre Julliard's avatar
Alexandre Julliard committed
459 460 461
 *
 * RETURNS
 *     No return value.
Alexandre Julliard's avatar
Alexandre Julliard committed
462
 */
Alexandre Julliard's avatar
Alexandre Julliard committed
463

464
void WINAPI DrawStatusTextA (HDC hdc, LPRECT lprc, LPCSTR text, UINT style)
Alexandre Julliard's avatar
Alexandre Julliard committed
465
{
466 467 468 469 470 471 472 473 474 475 476
    INT len;
    LPWSTR textW = NULL;

    if ( text ) {
	if ( (len = MultiByteToWideChar( CP_ACP, 0, text, -1, NULL, 0 )) ) {
	    if ( (textW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )) )
		MultiByteToWideChar( CP_ACP, 0, text, -1, textW, len );
	}
    }
    DrawStatusTextW( hdc, lprc, textW, style );
    HeapFree( GetProcessHeap(), 0, textW );
Alexandre Julliard's avatar
Alexandre Julliard committed
477 478
}

Alexandre Julliard's avatar
Alexandre Julliard committed
479

Alexandre Julliard's avatar
Alexandre Julliard committed
480
/***********************************************************************
481
 * CreateStatusWindow  [COMCTL32.@]
482
 * CreateStatusWindowA [COMCTL32.6]
483 484
 *
 * Creates a status bar
Alexandre Julliard's avatar
Alexandre Julliard committed
485 486
 *
 * PARAMS
487 488
 *     style  [I] window style
 *     text   [I] pointer to the window text
Alexandre Julliard's avatar
Alexandre Julliard committed
489
 *     parent [I] handle to the parent window
490
 *     wid    [I] control id of the status bar
Alexandre Julliard's avatar
Alexandre Julliard committed
491 492
 *
 * RETURNS
493
 *     Success: handle to the status window
Alexandre Julliard's avatar
Alexandre Julliard committed
494
 *     Failure: 0
Alexandre Julliard's avatar
Alexandre Julliard committed
495
 */
Alexandre Julliard's avatar
Alexandre Julliard committed
496

497 498
HWND WINAPI
CreateStatusWindowA (INT style, LPCSTR text, HWND parent, UINT wid)
Alexandre Julliard's avatar
Alexandre Julliard committed
499
{
500 501
    return CreateWindowA(STATUSCLASSNAMEA, text, style,
			   CW_USEDEFAULT, CW_USEDEFAULT,
502
			   CW_USEDEFAULT, CW_USEDEFAULT,
Alexandre Julliard's avatar
Alexandre Julliard committed
503 504 505
			   parent, wid, 0, 0);
}

Alexandre Julliard's avatar
Alexandre Julliard committed
506

Alexandre Julliard's avatar
Alexandre Julliard committed
507
/***********************************************************************
508
 * CreateStatusWindowW [COMCTL32.@] Creates a status bar control
Alexandre Julliard's avatar
Alexandre Julliard committed
509 510
 *
 * PARAMS
511 512
 *     style  [I] window style
 *     text   [I] pointer to the window text
513 514
 *     parent [I] handle to the parent window
 *     wid    [I] control id of the status bar
Alexandre Julliard's avatar
Alexandre Julliard committed
515 516
 *
 * RETURNS
517
 *     Success: handle to the status window
Alexandre Julliard's avatar
Alexandre Julliard committed
518
 *     Failure: 0
Alexandre Julliard's avatar
Alexandre Julliard committed
519
 */
Alexandre Julliard's avatar
Alexandre Julliard committed
520

521 522
HWND WINAPI
CreateStatusWindowW (INT style, LPCWSTR text, HWND parent, UINT wid)
Alexandre Julliard's avatar
Alexandre Julliard committed
523
{
524 525 526
    return CreateWindowW(STATUSCLASSNAMEW, text, style,
			   CW_USEDEFAULT, CW_USEDEFAULT,
			   CW_USEDEFAULT, CW_USEDEFAULT,
Alexandre Julliard's avatar
Alexandre Julliard committed
527 528 529
			   parent, wid, 0, 0);
}

Alexandre Julliard's avatar
Alexandre Julliard committed
530

531
/***********************************************************************
532
 * CreateUpDownControl [COMCTL32.16] Creates an up-down control
533 534
 *
 * PARAMS
535 536 537 538 539
 *     style  [I] window styles
 *     x      [I] horizontal position of the control
 *     y      [I] vertical position of the control
 *     cx     [I] with of the control
 *     cy     [I] height of the control
540
 *     parent [I] handle to the parent window
541 542 543 544 545 546
 *     id     [I] the control's identifier
 *     inst   [I] handle to the application's module instance
 *     buddy  [I] handle to the buddy window, can be NULL
 *     maxVal [I] upper limit of the control
 *     minVal [I] lower limit of the control
 *     curVal [I] current value of the control
Alexandre Julliard's avatar
Alexandre Julliard committed
547 548
 *
 * RETURNS
549
 *     Success: handle to the updown control
Alexandre Julliard's avatar
Alexandre Julliard committed
550
 *     Failure: 0
Alexandre Julliard's avatar
Alexandre Julliard committed
551
 */
Alexandre Julliard's avatar
Alexandre Julliard committed
552

553 554 555 556
HWND WINAPI
CreateUpDownControl (DWORD style, INT x, INT y, INT cx, INT cy,
		     HWND parent, INT id, HINSTANCE inst,
		     HWND buddy, INT maxVal, INT minVal, INT curVal)
Alexandre Julliard's avatar
Alexandre Julliard committed
557
{
558 559
    HWND hUD =
	CreateWindowA (UPDOWN_CLASSA, 0, style, x, y, cx, cy,
Alexandre Julliard's avatar
Alexandre Julliard committed
560 561
			 parent, id, inst, 0);
    if (hUD) {
562
	SendMessageA (hUD, UDM_SETBUDDY, buddy, 0);
563
	SendMessageA (hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal));
564
	SendMessageA (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0));
Alexandre Julliard's avatar
Alexandre Julliard committed
565 566 567
    }

    return hUD;
Alexandre Julliard's avatar
Alexandre Julliard committed
568 569 570 571
}


/***********************************************************************
Alexandre Julliard's avatar
Alexandre Julliard committed
572 573
 * InitCommonControls [COMCTL32.17]
 *
Alexandre Julliard's avatar
Alexandre Julliard committed
574
 * Registers the common controls.
Alexandre Julliard's avatar
Alexandre Julliard committed
575
 *
Alexandre Julliard's avatar
Alexandre Julliard committed
576
 * PARAMS
Alexandre Julliard's avatar
Alexandre Julliard committed
577 578 579 580
 *     No parameters.
 *
 * RETURNS
 *     No return values.
Alexandre Julliard's avatar
Alexandre Julliard committed
581
 *
Alexandre Julliard's avatar
Alexandre Julliard committed
582
 * NOTES
Alexandre Julliard's avatar
Alexandre Julliard committed
583 584
 *     This function is just a dummy.
 *     The Win95 controls are registered at the DLL's initialization.
585
 *     To register other controls InitCommonControlsEx() must be used.
Alexandre Julliard's avatar
Alexandre Julliard committed
586 587 588
 */

VOID WINAPI
589
InitCommonControls (void)
Alexandre Julliard's avatar
Alexandre Julliard committed
590 591 592 593 594
{
}


/***********************************************************************
595
 * InitCommonControlsEx [COMCTL32.@]
Alexandre Julliard's avatar
Alexandre Julliard committed
596
 *
Alexandre Julliard's avatar
Alexandre Julliard committed
597
 * Registers the common controls.
Alexandre Julliard's avatar
Alexandre Julliard committed
598
 *
Alexandre Julliard's avatar
Alexandre Julliard committed
599
 * PARAMS
Alexandre Julliard's avatar
Alexandre Julliard committed
600 601 602 603 604
 *     lpInitCtrls [I] pointer to an INITCOMMONCONTROLS structure.
 *
 * RETURNS
 *     Success: TRUE
 *     Failure: FALSE
Alexandre Julliard's avatar
Alexandre Julliard committed
605 606
 *
 * NOTES
Andreas Mohr's avatar
Andreas Mohr committed
607
 *     Only the additional common controls are registered by this function.
Alexandre Julliard's avatar
Alexandre Julliard committed
608
 *     The Win95 controls are registered at the DLL's initialization.
Alexandre Julliard's avatar
Alexandre Julliard committed
609
 */
Alexandre Julliard's avatar
Alexandre Julliard committed
610

611
BOOL WINAPI
Alexandre Julliard's avatar
Alexandre Julliard committed
612
InitCommonControlsEx (LPINITCOMMONCONTROLSEX lpInitCtrls)
Alexandre Julliard's avatar
Alexandre Julliard committed
613
{
614
    INT cCount;
Alexandre Julliard's avatar
Alexandre Julliard committed
615
    DWORD dwMask;
Alexandre Julliard's avatar
Alexandre Julliard committed
616

617 618 619 620 621
    if (!lpInitCtrls)
	return FALSE;
    if (lpInitCtrls->dwSize != sizeof(INITCOMMONCONTROLSEX))
	return FALSE;

622
    TRACE("(0x%08lx)\n", lpInitCtrls->dwICC);
Alexandre Julliard's avatar
Alexandre Julliard committed
623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639

    for (cCount = 0; cCount < 32; cCount++) {
	dwMask = 1 << cCount;
	if (!(lpInitCtrls->dwICC & dwMask))
	    continue;

	switch (lpInitCtrls->dwICC & dwMask) {
	    /* dummy initialization */
	    case ICC_ANIMATE_CLASS:
	    case ICC_BAR_CLASSES:
	    case ICC_LISTVIEW_CLASSES:
	    case ICC_TREEVIEW_CLASSES:
	    case ICC_TAB_CLASSES:
	    case ICC_UPDOWN_CLASS:
	    case ICC_PROGRESS_CLASS:
	    case ICC_HOTKEY_CLASS:
		break;
Alexandre Julliard's avatar
Alexandre Julliard committed
640

Alexandre Julliard's avatar
Alexandre Julliard committed
641 642
	    /* advanced classes - not included in Win95 */
	    case ICC_DATE_CLASSES:
643 644
		MONTHCAL_Register ();
		DATETIME_Register ();
Alexandre Julliard's avatar
Alexandre Julliard committed
645 646 647 648 649 650 651 652 653 654 655
		break;

	    case ICC_USEREX_CLASSES:
		COMBOEX_Register ();
		break;

	    case ICC_COOL_CLASSES:
		REBAR_Register ();
		break;

	    case ICC_INTERNET_CLASSES:
656
		IPADDRESS_Register ();
Alexandre Julliard's avatar
Alexandre Julliard committed
657 658 659 660 661 662 663
		break;

	    case ICC_PAGESCROLLER_CLASS:
		PAGER_Register ();
		break;

	    case ICC_NATIVEFNTCTL_CLASS:
664
		NATIVEFONT_Register ();
Alexandre Julliard's avatar
Alexandre Julliard committed
665 666 667
		break;

	    default:
668
		FIXME("Unknown class! dwICC=0x%lX\n", dwMask);
Alexandre Julliard's avatar
Alexandre Julliard committed
669
		break;
Alexandre Julliard's avatar
Alexandre Julliard committed
670
	}
Alexandre Julliard's avatar
Alexandre Julliard committed
671
    }
Alexandre Julliard's avatar
Alexandre Julliard committed
672

Alexandre Julliard's avatar
Alexandre Julliard committed
673
    return TRUE;
Alexandre Julliard's avatar
Alexandre Julliard committed
674
}
Alexandre Julliard's avatar
Alexandre Julliard committed
675 676 677


/***********************************************************************
678
 * CreateToolbarEx [COMCTL32.@] Creates a tool bar window
Alexandre Julliard's avatar
Alexandre Julliard committed
679
 *
Alexandre Julliard's avatar
Alexandre Julliard committed
680 681 682 683 684 685 686 687 688 689 690 691 692 693
 * PARAMS
 *     hwnd
 *     style
 *     wID
 *     nBitmaps
 *     hBMInst
 *     wBMID
 *     lpButtons
 *     iNumButtons
 *     dxButton
 *     dyButton
 *     dxBitmap
 *     dyBitmap
 *     uStructSize
Alexandre Julliard's avatar
Alexandre Julliard committed
694
 *
Alexandre Julliard's avatar
Alexandre Julliard committed
695 696 697
 * RETURNS
 *     Success: handle to the tool bar control
 *     Failure: 0
Alexandre Julliard's avatar
Alexandre Julliard committed
698 699
 */

700 701 702 703 704
HWND WINAPI
CreateToolbarEx (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,
                 HINSTANCE hBMInst, UINT wBMID, LPCTBBUTTON lpButtons,
                 INT iNumButtons, INT dxButton, INT dyButton,
                 INT dxBitmap, INT dyBitmap, UINT uStructSize)
Alexandre Julliard's avatar
Alexandre Julliard committed
705
{
706 707 708 709 710 711 712 713 714
    HWND hwndTB;

    /* If not position is specified then put it at the top */
    if ((style & CCS_BOTTOM) == 0) {
      style|=CCS_TOP;
    }

    hwndTB =
        CreateWindowExA (0, TOOLBARCLASSNAMEA, "", style|WS_CHILD, 0, 0, 0, 0,
715
			   hwnd, (HMENU)wID, 0, NULL);
Alexandre Julliard's avatar
Alexandre Julliard committed
716 717 718
    if(hwndTB) {
	TBADDBITMAP tbab;

719 720
        SendMessageA (hwndTB, TB_BUTTONSTRUCTSIZE,
			(WPARAM)uStructSize, 0);
Alexandre Julliard's avatar
Alexandre Julliard committed
721

722 723 724 725 726 727 728 729 730 731 732 733 734 735 736
       /* set bitmap and button size */
       /*If CreateToolbarEx receives 0, windows sets default values*/
       if (dxBitmap <= 0)
           dxBitmap = 16;
       if (dyBitmap <= 0)
           dyBitmap = 15;
       SendMessageA (hwndTB, TB_SETBITMAPSIZE, 0,
                       MAKELPARAM((WORD)dxBitmap, (WORD)dyBitmap));

       if (dxButton <= 0)
           dxButton = 24;
       if (dyButton <= 0)
           dyButton = 22;
       SendMessageA (hwndTB, TB_SETBUTTONSIZE, 0,
                       MAKELPARAM((WORD)dxButton, (WORD)dyButton));
737

Alexandre Julliard's avatar
Alexandre Julliard committed
738 739

	/* add bitmaps */
740 741
	if (nBitmaps > 0)
	{
Alexandre Julliard's avatar
Alexandre Julliard committed
742 743
	tbab.hInst = hBMInst;
	tbab.nID   = wBMID;
744

745 746
	SendMessageA (hwndTB, TB_ADDBITMAP,
			(WPARAM)nBitmaps, (LPARAM)&tbab);
747
	}
Alexandre Julliard's avatar
Alexandre Julliard committed
748
	/* add buttons */
749
	if(iNumButtons > 0)
750 751
	SendMessageA (hwndTB, TB_ADDBUTTONSA,
			(WPARAM)iNumButtons, (LPARAM)lpButtons);
Alexandre Julliard's avatar
Alexandre Julliard committed
752 753
    }

Alexandre Julliard's avatar
Alexandre Julliard committed
754
    return hwndTB;
Alexandre Julliard's avatar
Alexandre Julliard committed
755 756 757 758 759 760
}


/***********************************************************************
 * CreateMappedBitmap [COMCTL32.8]
 *
Alexandre Julliard's avatar
Alexandre Julliard committed
761
 * PARAMS
762 763 764 765 766
 *     hInstance  [I]
 *     idBitmap   [I]
 *     wFlags     [I]
 *     lpColorMap [I]
 *     iNumMaps   [I]
Alexandre Julliard's avatar
Alexandre Julliard committed
767 768
 *
 * RETURNS
769
 *     Success: handle to the new bitmap
Alexandre Julliard's avatar
Alexandre Julliard committed
770
 *     Failure: 0
Alexandre Julliard's avatar
Alexandre Julliard committed
771 772
 */

773 774 775
HBITMAP WINAPI
CreateMappedBitmap (HINSTANCE hInstance, INT idBitmap, UINT wFlags,
		    LPCOLORMAP lpColorMap, INT iNumMaps)
Alexandre Julliard's avatar
Alexandre Julliard committed
776
{
777 778
    HGLOBAL hglb;
    HRSRC hRsrc;
Alexandre Julliard's avatar
Alexandre Julliard committed
779
    LPBITMAPINFOHEADER lpBitmap, lpBitmapInfo;
780
    UINT nSize, nColorTableSize;
781
    RGBQUAD *pColorTable;
782 783 784
    INT iColor, i, iMaps, nWidth, nHeight;
    HDC hdcScreen;
    HBITMAP hbm;
Alexandre Julliard's avatar
Alexandre Julliard committed
785
    LPCOLORMAP sysColorMap;
786
    COLORREF cRef;
Alexandre Julliard's avatar
Alexandre Julliard committed
787 788 789 790 791 792 793 794 795
    COLORMAP internalColorMap[4] =
	{{0x000000, 0}, {0x808080, 0}, {0xC0C0C0, 0}, {0xFFFFFF, 0}};

    /* initialize pointer to colortable and default color table */
    if (lpColorMap) {
	iMaps = iNumMaps;
	sysColorMap = lpColorMap;
    }
    else {
796 797 798 799
	internalColorMap[0].to = GetSysColor (COLOR_BTNTEXT);
	internalColorMap[1].to = GetSysColor (COLOR_BTNSHADOW);
	internalColorMap[2].to = GetSysColor (COLOR_BTNFACE);
	internalColorMap[3].to = GetSysColor (COLOR_BTNHIGHLIGHT);
Alexandre Julliard's avatar
Alexandre Julliard committed
800 801 802
	iMaps = 4;
	sysColorMap = (LPCOLORMAP)internalColorMap;
    }
Alexandre Julliard's avatar
Alexandre Julliard committed
803

804
    hRsrc = FindResourceA (hInstance, (LPSTR)idBitmap, RT_BITMAPA);
Alexandre Julliard's avatar
Alexandre Julliard committed
805 806
    if (hRsrc == 0)
	return 0;
807
    hglb = LoadResource (hInstance, hRsrc);
Alexandre Julliard's avatar
Alexandre Julliard committed
808 809
    if (hglb == 0)
	return 0;
810
    lpBitmap = (LPBITMAPINFOHEADER)LockResource (hglb);
Alexandre Julliard's avatar
Alexandre Julliard committed
811
    if (lpBitmap == NULL)
Alexandre Julliard's avatar
Alexandre Julliard committed
812
	return 0;
Alexandre Julliard's avatar
Alexandre Julliard committed
813 814 815

    nColorTableSize = (1 << lpBitmap->biBitCount);
    nSize = lpBitmap->biSize + nColorTableSize * sizeof(RGBQUAD);
816
    lpBitmapInfo = (LPBITMAPINFOHEADER)GlobalAlloc (GMEM_FIXED, nSize);
Alexandre Julliard's avatar
Alexandre Julliard committed
817
    if (lpBitmapInfo == NULL)
Alexandre Julliard's avatar
Alexandre Julliard committed
818
	return 0;
Alexandre Julliard's avatar
Alexandre Julliard committed
819 820
    RtlMoveMemory (lpBitmapInfo, lpBitmap, nSize);

821
    pColorTable = (RGBQUAD*)(((LPBYTE)lpBitmapInfo)+(UINT)lpBitmapInfo->biSize);
Alexandre Julliard's avatar
Alexandre Julliard committed
822 823 824

    for (iColor = 0; iColor < nColorTableSize; iColor++) {
	for (i = 0; i < iMaps; i++) {
825 826 827 828
            cRef = RGB(pColorTable[iColor].rgbRed,
                       pColorTable[iColor].rgbGreen,
                       pColorTable[iColor].rgbBlue);
	    if ( cRef  == sysColorMap[i].from) {
Alexandre Julliard's avatar
Alexandre Julliard committed
829 830 831 832 833 834 835
#if 0
		if (wFlags & CBS_MASKED) {
		    if (sysColorMap[i].to != COLOR_BTNTEXT)
			pColorTable[iColor] = RGB(255, 255, 255);
		}
		else
#endif
836 837 838
                    pColorTable[iColor].rgbBlue  = GetBValue(sysColorMap[i].to);
                    pColorTable[iColor].rgbGreen = GetGValue(sysColorMap[i].to);
                    pColorTable[iColor].rgbRed   = GetRValue(sysColorMap[i].to);
Alexandre Julliard's avatar
Alexandre Julliard committed
839 840 841 842
		break;
	    }
	}
    }
843 844 845 846
    nWidth  = (INT)lpBitmapInfo->biWidth;
    nHeight = (INT)lpBitmapInfo->biHeight;
    hdcScreen = GetDC ((HWND)0);
    hbm = CreateCompatibleBitmap (hdcScreen, nWidth, nHeight);
Alexandre Julliard's avatar
Alexandre Julliard committed
847
    if (hbm) {
848 849
	HDC hdcDst = CreateCompatibleDC (hdcScreen);
	HBITMAP hbmOld = SelectObject (hdcDst, hbm);
Alexandre Julliard's avatar
Alexandre Julliard committed
850 851
	LPBYTE lpBits = (LPBYTE)(lpBitmap + 1);
	lpBits += (1 << (lpBitmapInfo->biBitCount)) * sizeof(RGBQUAD);
852
	StretchDIBits (hdcDst, 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight,
Alexandre Julliard's avatar
Alexandre Julliard committed
853 854
		         lpBits, (LPBITMAPINFO)lpBitmapInfo, DIB_RGB_COLORS,
		         SRCCOPY);
855 856
	SelectObject (hdcDst, hbmOld);
	DeleteDC (hdcDst);
Alexandre Julliard's avatar
Alexandre Julliard committed
857
    }
858 859 860
    ReleaseDC ((HWND)0, hdcScreen);
    GlobalFree ((HGLOBAL)lpBitmapInfo);
    FreeResource (hglb);
Alexandre Julliard's avatar
Alexandre Julliard committed
861 862

    return hbm;
Alexandre Julliard's avatar
Alexandre Julliard committed
863
}
Alexandre Julliard's avatar
Alexandre Julliard committed
864 865 866


/***********************************************************************
Alexandre Julliard's avatar
Alexandre Julliard committed
867
 * CreateToolbar [COMCTL32.7] Creates a tool bar control
Alexandre Julliard's avatar
Alexandre Julliard committed
868
 *
Alexandre Julliard's avatar
Alexandre Julliard committed
869 870 871 872 873 874 875 876 877
 * PARAMS
 *     hwnd
 *     style
 *     wID
 *     nBitmaps
 *     hBMInst
 *     wBMID
 *     lpButtons
 *     iNumButtons
Alexandre Julliard's avatar
Alexandre Julliard committed
878
 *
Alexandre Julliard's avatar
Alexandre Julliard committed
879 880 881
 * RETURNS
 *     Success: handle to the tool bar control
 *     Failure: 0
Alexandre Julliard's avatar
Alexandre Julliard committed
882
 *
Alexandre Julliard's avatar
Alexandre Julliard committed
883 884
 * NOTES
 *     Do not use this functions anymore. Use CreateToolbarEx instead.
Alexandre Julliard's avatar
Alexandre Julliard committed
885 886
 */

887 888 889 890
HWND WINAPI
CreateToolbar (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,
	       HINSTANCE hBMInst, UINT wBMID,
	       LPCOLDTBBUTTON lpButtons,INT iNumButtons)
Alexandre Julliard's avatar
Alexandre Julliard committed
891 892 893 894 895 896
{
    return CreateToolbarEx (hwnd, style | CCS_NODIVIDER, wID, nBitmaps,
			    hBMInst, wBMID, (LPCTBBUTTON)lpButtons,
			    iNumButtons, 0, 0, 0, 0, sizeof (OLDTBBUTTON));
}

Alexandre Julliard's avatar
Alexandre Julliard committed
897 898

/***********************************************************************
899
 * DllGetVersion [COMCTL32.@]
Alexandre Julliard's avatar
Alexandre Julliard committed
900
 *
Alexandre Julliard's avatar
Alexandre Julliard committed
901
 * Retrieves version information of the 'COMCTL32.DLL'
Alexandre Julliard's avatar
Alexandre Julliard committed
902 903
 *
 * PARAMS
Alexandre Julliard's avatar
Alexandre Julliard committed
904
 *     pdvi [O] pointer to version information structure.
Alexandre Julliard's avatar
Alexandre Julliard committed
905
 *
Alexandre Julliard's avatar
Alexandre Julliard committed
906
 * RETURNS
Alexandre Julliard's avatar
Alexandre Julliard committed
907 908
 *     Success: S_OK
 *     Failure: E_INVALIDARG
Alexandre Julliard's avatar
Alexandre Julliard committed
909 910 911
 *
 * NOTES
 *     Returns version of a comctl32.dll from IE4.01 SP1.
Alexandre Julliard's avatar
Alexandre Julliard committed
912 913
 */

Alexandre Julliard's avatar
Alexandre Julliard committed
914 915
HRESULT WINAPI
COMCTL32_DllGetVersion (DLLVERSIONINFO *pdvi)
Alexandre Julliard's avatar
Alexandre Julliard committed
916
{
Alexandre Julliard's avatar
Alexandre Julliard committed
917
    if (pdvi->cbSize != sizeof(DLLVERSIONINFO)) {
918
        WARN("wrong DLLVERSIONINFO size from app\n");
Alexandre Julliard's avatar
Alexandre Julliard committed
919
	return E_INVALIDARG;
Alexandre Julliard's avatar
Alexandre Julliard committed
920 921
    }

Gerard Patel's avatar
Gerard Patel committed
922 923
    pdvi->dwMajorVersion = COMCTL32_VERSION;
    pdvi->dwMinorVersion = COMCTL32_VERSION_MINOR;
924 925
    pdvi->dwBuildNumber = 2919;
    pdvi->dwPlatformID = 6304;
Alexandre Julliard's avatar
Alexandre Julliard committed
926

927
    TRACE("%lu.%lu.%lu.%lu\n",
Alexandre Julliard's avatar
Alexandre Julliard committed
928 929 930 931
	   pdvi->dwMajorVersion, pdvi->dwMinorVersion,
	   pdvi->dwBuildNumber, pdvi->dwPlatformID);

    return S_OK;
Alexandre Julliard's avatar
Alexandre Julliard committed
932
}
933

934
/***********************************************************************
935
 *		DllInstall (COMCTL32.@)
936 937 938
 */
HRESULT WINAPI COMCTL32_DllInstall(BOOL bInstall, LPCWSTR cmdline)
{
939
  FIXME("(%s, %s): stub\n", bInstall?"TRUE":"FALSE",
940 941 942 943
	debugstr_w(cmdline));

  return S_OK;
}
944 945

/***********************************************************************
946
 * _TrackMouseEvent [COMCTL32.@]
947 948 949
 *
 * Requests notification of mouse events
 *
950 951 952 953 954 955 956 957
 * During mouse tracking WM_MOUSEHOVER or WM_MOUSELEAVE events are posted
 * to the hwnd specified in the ptme structure.  After the event message
 * is posted to the hwnd, the entry in the queue is removed.
 *
 * If the current hwnd isn't ptme->hwndTrack the TME_HOVER flag is completely
 * ignored. The TME_LEAVE flag results in a WM_MOUSELEAVE message being posted
 * immediately and the TME_LEAVE flag being ignored.
 *
958 959 960 961 962 963 964
 * PARAMS
 *     ptme [I,O] pointer to TRACKMOUSEEVENT information structure.
 *
 * RETURNS
 *     Success: non-zero
 *     Failure: zero
 *
965 966
 * IMPLEMENTATION moved to USER32.TrackMouseEvent
 *
967 968 969 970 971
 */

BOOL WINAPI
_TrackMouseEvent (TRACKMOUSEEVENT *ptme)
{
972
    return TrackMouseEvent (ptme);
973
}
974 975

/*************************************************************************
976
 * GetMUILanguage [COMCTL32.@]
977 978 979 980 981 982 983 984 985 986 987
 *
 * FIXME: What's this supposed to do?  Apparently some i18n thing.
 *
 */
LANGID WINAPI GetMUILanguage (VOID)
{
    return COMCTL32_uiLang;
}


/*************************************************************************
988
 * InitMUILanguage [COMCTL32.@]
989 990 991 992 993 994 995 996 997
 *
 * FIXME: What's this supposed to do?  Apparently some i18n thing.
 *
 */

VOID WINAPI InitMUILanguage (LANGID uiLang)
{
   COMCTL32_uiLang = uiLang;
}
998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026


/***********************************************************************
 * COMCTL32_CreateToolTip [NOT AN API]
 *
 * Creates a tooltip for the control specified in hwnd and does all
 * necessary setup and notifications.
 *
 * PARAMS
 *     hwndOwner [I] Handle to the window that will own the tool tip.
 *
 * RETURNS
 *     Success: Handle of tool tip window.
 *     Failure: NULL
 */
HWND
COMCTL32_CreateToolTip(HWND hwndOwner)
{
    HWND hwndToolTip;

    hwndToolTip = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, 0,
				  CW_USEDEFAULT, CW_USEDEFAULT,
				  CW_USEDEFAULT, CW_USEDEFAULT, hwndOwner,
				  0, 0, 0);

    /* Send NM_TOOLTIPSCREATED notification */
    if (hwndToolTip)
    {
	NMTOOLTIPSCREATED nmttc;
1027 1028 1029 1030
        /* true owner can be different if hwndOwner is a child window */
        HWND hwndTrueOwner = GetWindow(hwndToolTip, GW_OWNER);
        nmttc.hdr.hwndFrom = hwndTrueOwner;
        nmttc.hdr.idFrom = GetWindowLongA(hwndTrueOwner, GWL_ID);
1031 1032 1033
	nmttc.hdr.code = NM_TOOLTIPSCREATED;
	nmttc.hwndToolTips = hwndToolTip;

1034 1035
       SendMessageA(GetParent(hwndTrueOwner), WM_NOTIFY,
                    (WPARAM)GetWindowLongA(hwndTrueOwner, GWL_ID),
1036 1037 1038 1039 1040
		     (LPARAM)&nmttc);
    }

    return hwndToolTip;
}
1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074


/***********************************************************************
 * COMCTL32_RefreshSysColors [NOT AN API]
 *
 * Invoked on any control recognizing a WM_SYSCOLORCHANGE message to
 * refresh the color values in the color structure
 *
 * PARAMS
 *     none
 *
 * RETURNS
 *     none
 */
VOID
COMCTL32_RefreshSysColors(void)
{
    comctl32_color.clrBtnHighlight = GetSysColor (COLOR_BTNHIGHLIGHT);
    comctl32_color.clrBtnShadow = GetSysColor (COLOR_BTNSHADOW);
    comctl32_color.clrBtnText = GetSysColor (COLOR_BTNTEXT);
    comctl32_color.clrBtnFace = GetSysColor (COLOR_BTNFACE);
    comctl32_color.clrHighlight = GetSysColor (COLOR_HIGHLIGHT);
    comctl32_color.clrHighlightText = GetSysColor (COLOR_HIGHLIGHTTEXT);
    comctl32_color.clr3dHilight = GetSysColor (COLOR_3DHILIGHT);
    comctl32_color.clr3dShadow = GetSysColor (COLOR_3DSHADOW);
    comctl32_color.clr3dDkShadow = GetSysColor (COLOR_3DDKSHADOW);
    comctl32_color.clr3dFace = GetSysColor (COLOR_3DFACE);
    comctl32_color.clrWindow = GetSysColor (COLOR_WINDOW);
    comctl32_color.clrWindowText = GetSysColor (COLOR_WINDOWTEXT);
    comctl32_color.clrGrayText = GetSysColor (COLOR_GRAYTEXT);
    comctl32_color.clrActiveCaption = GetSysColor (COLOR_ACTIVECAPTION);
    comctl32_color.clrInfoBk = GetSysColor (COLOR_INFOBK);
    comctl32_color.clrInfoText = GetSysColor (COLOR_INFOTEXT);
}