2 * Common controls functions
4 * Copyright 1997 Dimitrie O. Paun
5 * Copyright 1998,2000 Eric Kohl
6 * Copyright 2014-2015 Michael Müller
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 * This code was audited for completeness against the documented features
25 * of Comctl32.dll version 6.0 on Oct. 21, 2002, by Christian Neumair.
27 * Unless otherwise noted, we believe this code to be complete, as per
28 * the specification mentioned above.
29 * If you discover missing features, or bugs, please note them below.
32 * -- implement GetMUILanguage + InitMUILanguage
33 * -- finish NOTES for MenuHelp, GetEffectiveClientRect and GetStatusTextW
34 * -- FIXMEs + BUGS (search for them)
37 * -- ICC_ANIMATE_CLASS
42 * -- ICC_INTERNET_CLASSES
44 * -- ICC_LISTVIEW_CLASSES
45 * -- ICC_NATIVEFNTCTL_CLASS
46 * -- ICC_PAGESCROLLER_CLASS
47 * -- ICC_PROGRESS_CLASS
48 * -- ICC_STANDARD_CLASSES (not yet implemented)
50 * -- ICC_TREEVIEW_CLASSES
52 * -- ICC_USEREX_CLASSES
53 * -- ICC_WIN95_CLASSES
68 #define NO_SHLWAPI_STREAM
71 #include "wine/debug.h"
73 WINE_DEFAULT_DEBUG_CHANNEL(commctrl
);
76 static LRESULT WINAPI
COMCTL32_SubclassProc (HWND hWnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
78 static LPWSTR COMCTL32_wSubclass
= NULL
;
79 HMODULE COMCTL32_hModule
= 0;
80 static LANGID COMCTL32_uiLang
= MAKELANGID(LANG_NEUTRAL
, SUBLANG_NEUTRAL
);
81 HBRUSH COMCTL32_hPattern55AABrush
= NULL
;
82 COMCTL32_SysColor comctl32_color
;
84 static HBITMAP COMCTL32_hPattern55AABitmap
= NULL
;
86 static const WORD wPattern55AA
[] =
88 0x5555, 0xaaaa, 0x5555, 0xaaaa,
89 0x5555, 0xaaaa, 0x5555, 0xaaaa
92 static const WCHAR strCC32SubclassInfo
[] = {
93 'C','C','3','2','S','u','b','c','l','a','s','s','I','n','f','o',0
96 static void unregister_versioned_classes(void)
98 #define VERSION "6.0.2600.2982!"
99 static const char *classes
[] =
102 VERSION WC_COMBOBOXA
,
110 for (i
= 0; i
< ARRAY_SIZE(classes
); i
++)
111 UnregisterClassA(classes
[i
], NULL
);
116 BOOL WINAPI
RegisterClassNameW(const WCHAR
*class)
120 const WCHAR nameW
[16];
121 void (*fn_register
)(void);
125 { {'B','u','t','t','o','n',0}, BUTTON_Register
},
126 { {'C','o','m','b','o','B','o','x',0}, COMBO_Register
},
127 { {'C','o','m','b','o','L','B','o','x',0}, COMBOLBOX_Register
},
128 { {'E','d','i','t',0}, EDIT_Register
},
129 { {'L','i','s','t','B','o','x',0}, LISTBOX_Register
},
130 { {'S','t','a','t','i','c',0}, STATIC_Register
},
133 int min
= 0, max
= ARRAY_SIZE(classes
) - 1;
137 int res
, pos
= (min
+ max
) / 2;
138 if (!(res
= wcsicmp(class, classes
[pos
].nameW
)))
140 classes
[pos
].fn_register();
143 if (res
< 0) max
= pos
- 1;
150 /***********************************************************************
153 * Initializes the internal 'COMCTL32.DLL'.
156 * hinstDLL [I] handle to the 'dlls' instance
158 * lpvReserved [I] reserved, must be NULL
165 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
167 TRACE("%p,%x,%p\n", hinstDLL
, fdwReason
, lpvReserved
);
170 case DLL_PROCESS_ATTACH
:
171 DisableThreadLibraryCalls(hinstDLL
);
173 COMCTL32_hModule
= hinstDLL
;
175 /* add global subclassing atom (used by 'tooltip' and 'updown') */
176 COMCTL32_wSubclass
= (LPWSTR
)(DWORD_PTR
)GlobalAddAtomW (strCC32SubclassInfo
);
177 TRACE("Subclassing atom added: %p\n", COMCTL32_wSubclass
);
179 /* create local pattern brush */
180 COMCTL32_hPattern55AABitmap
= CreateBitmap (8, 8, 1, 1, wPattern55AA
);
181 COMCTL32_hPattern55AABrush
= CreatePatternBrush (COMCTL32_hPattern55AABitmap
);
183 /* Get all the colors at DLL load */
184 COMCTL32_RefreshSysColors();
186 /* like comctl32 5.82+ register all the common control classes */
189 DATETIME_Register ();
193 IPADDRESS_Register ();
194 LISTVIEW_Register ();
195 MONTHCAL_Register ();
196 NATIVEFONT_Register ();
198 PROGRESS_Register ();
204 TOOLTIPS_Register ();
205 TRACKBAR_Register ();
206 TREEVIEW_Register ();
209 /* subclass user32 controls */
210 THEMING_Initialize ();
213 case DLL_PROCESS_DETACH
:
214 if (lpvReserved
) break;
215 /* clean up subclassing */
216 THEMING_Uninitialize();
218 /* unregister all common control classes */
219 ANIMATE_Unregister ();
220 COMBOEX_Unregister ();
221 DATETIME_Unregister ();
222 FLATSB_Unregister ();
223 HEADER_Unregister ();
224 HOTKEY_Unregister ();
225 IPADDRESS_Unregister ();
226 LISTVIEW_Unregister ();
227 MONTHCAL_Unregister ();
228 NATIVEFONT_Unregister ();
230 PROGRESS_Unregister ();
232 STATUS_Unregister ();
233 SYSLINK_Unregister ();
235 TOOLBAR_Unregister ();
236 TOOLTIPS_Unregister ();
237 TRACKBAR_Unregister ();
238 TREEVIEW_Unregister ();
239 UPDOWN_Unregister ();
241 unregister_versioned_classes ();
243 /* delete local pattern brush */
244 DeleteObject (COMCTL32_hPattern55AABrush
);
245 DeleteObject (COMCTL32_hPattern55AABitmap
);
247 /* delete global subclassing atom */
248 GlobalDeleteAtom (LOWORD(COMCTL32_wSubclass
));
249 TRACE("Subclassing atom deleted: %p\n", COMCTL32_wSubclass
);
257 /***********************************************************************
258 * MenuHelp [COMCTL32.2]
260 * Handles the setting of status bar help messages when the user
261 * selects menu items.
264 * uMsg [I] message (WM_MENUSELECT) (see NOTES)
265 * wParam [I] wParam of the message uMsg
266 * lParam [I] lParam of the message uMsg
267 * hMainMenu [I] handle to the application's main menu
268 * hInst [I] handle to the module that contains string resources
269 * hwndStatus [I] handle to the status bar window
270 * lpwIDs [I] pointer to an array of integers (see NOTES)
276 * The official documentation is incomplete!
277 * This is the correct documentation:
280 * MenuHelp() does NOT handle WM_COMMAND messages! It only handles
281 * WM_MENUSELECT messages.
284 * (will be written ...)
288 MenuHelp (UINT uMsg
, WPARAM wParam
, LPARAM lParam
, HMENU hMainMenu
,
289 HINSTANCE hInst
, HWND hwndStatus
, UINT
* lpwIDs
)
293 if (!IsWindow (hwndStatus
))
298 TRACE("WM_MENUSELECT wParam=0x%lX lParam=0x%lX\n",
301 if ((HIWORD(wParam
) == 0xFFFF) && (lParam
== 0)) {
302 /* menu was closed */
303 TRACE("menu was closed!\n");
304 SendMessageW (hwndStatus
, SB_SIMPLE
, FALSE
, 0);
307 /* menu item was selected */
308 if (HIWORD(wParam
) & MF_POPUP
)
309 uMenuID
= *(lpwIDs
+1);
311 uMenuID
= (UINT
)LOWORD(wParam
);
312 TRACE("uMenuID = %u\n", uMenuID
);
317 if (!LoadStringW (hInst
, uMenuID
, szText
, ARRAY_SIZE(szText
)))
320 SendMessageW (hwndStatus
, SB_SETTEXTW
,
321 255 | SBT_NOBORDERS
, (LPARAM
)szText
);
322 SendMessageW (hwndStatus
, SB_SIMPLE
, TRUE
, 0);
328 TRACE("WM_COMMAND wParam=0x%lX lParam=0x%lX\n",
330 /* WM_COMMAND is not invalid since it is documented
331 * in the windows api reference. So don't output
332 * any FIXME for WM_COMMAND
334 WARN("We don't care about the WM_COMMAND\n");
338 FIXME("Invalid Message 0x%x!\n", uMsg
);
344 /***********************************************************************
345 * ShowHideMenuCtl [COMCTL32.3]
347 * Shows or hides controls and updates the corresponding menu item.
350 * hwnd [I] handle to the client window.
351 * uFlags [I] menu command id.
352 * lpInfo [I] pointer to an array of integers. (See NOTES.)
359 * The official documentation is incomplete!
360 * This is the correct documentation:
363 * Handle to the window that contains the menu and controls.
366 * Identifier of the menu item to receive or lose a check mark.
369 * The array of integers contains pairs of values. BOTH values of
370 * the first pair must be the handles to the application's main menu.
371 * Each subsequent pair consists of a menu id and control id.
375 ShowHideMenuCtl (HWND hwnd
, UINT_PTR uFlags
, LPINT lpInfo
)
379 TRACE("%p, %lx, %p\n", hwnd
, uFlags
, lpInfo
);
384 if (!(lpInfo
[0]) || !(lpInfo
[1]))
387 /* search for control */
388 lpMenuId
= &lpInfo
[2];
389 while (*lpMenuId
!= uFlags
)
392 if (GetMenuState ((HMENU
)(DWORD_PTR
)lpInfo
[1], uFlags
, MF_BYCOMMAND
) & MFS_CHECKED
) {
393 /* uncheck menu item */
394 CheckMenuItem ((HMENU
)(DWORD_PTR
)lpInfo
[0], *lpMenuId
, MF_BYCOMMAND
| MF_UNCHECKED
);
398 SetWindowPos (GetDlgItem (hwnd
, *lpMenuId
), 0, 0, 0, 0, 0,
402 /* check menu item */
403 CheckMenuItem ((HMENU
)(DWORD_PTR
)lpInfo
[0], *lpMenuId
, MF_BYCOMMAND
| MF_CHECKED
);
407 SetWindowPos (GetDlgItem (hwnd
, *lpMenuId
), 0, 0, 0, 0, 0,
415 /***********************************************************************
416 * GetEffectiveClientRect [COMCTL32.4]
418 * Calculates the coordinates of a rectangle in the client area.
421 * hwnd [I] handle to the client window.
422 * lpRect [O] pointer to the rectangle of the client window
423 * lpInfo [I] pointer to an array of integers (see NOTES)
429 * The official documentation is incomplete!
430 * This is the correct documentation:
433 * (will be written ...)
437 GetEffectiveClientRect (HWND hwnd
, LPRECT lpRect
, const INT
*lpInfo
)
443 TRACE("(%p %p %p)\n",
444 hwnd
, lpRect
, lpInfo
);
446 GetClientRect (hwnd
, lpRect
);
454 hwndCtrl
= GetDlgItem (hwnd
, *lpRun
);
455 if (GetWindowLongW (hwndCtrl
, GWL_STYLE
) & WS_VISIBLE
) {
456 TRACE("control id 0x%x\n", *lpRun
);
457 GetWindowRect (hwndCtrl
, &rcCtrl
);
458 MapWindowPoints (NULL
, hwnd
, (LPPOINT
)&rcCtrl
, 2);
459 SubtractRect (lpRect
, lpRect
, &rcCtrl
);
466 /***********************************************************************
467 * DrawStatusTextW [COMCTL32.@]
469 * Draws text with borders, like in a status bar.
472 * hdc [I] handle to the window's display context
473 * lprc [I] pointer to a rectangle
474 * text [I] pointer to the text
475 * style [I] drawing style
481 * The style variable can have one of the following values:
482 * (will be written ...)
485 void WINAPI
DrawStatusTextW (HDC hdc
, LPCRECT lprc
, LPCWSTR text
, UINT style
)
488 UINT border
= BDR_SUNKENOUTER
;
491 if (style
& SBT_POPOUT
)
492 border
= BDR_RAISEDOUTER
;
493 else if (style
& SBT_NOBORDERS
)
496 oldbkcolor
= SetBkColor (hdc
, comctl32_color
.clrBtnFace
);
497 DrawEdge (hdc
, &r
, border
, BF_MIDDLE
|BF_RECT
|BF_ADJUST
);
501 int oldbkmode
= SetBkMode (hdc
, TRANSPARENT
);
502 COLORREF oldtextcolor
;
503 UINT align
= DT_LEFT
;
506 oldtextcolor
= SetTextColor (hdc
, comctl32_color
.clrBtnText
);
507 if (style
& SBT_RTLREADING
)
508 FIXME("Unsupported RTL style!\n");
513 DrawTextW (hdc
, text
- strCnt
, strCnt
, &r
, align
|DT_VCENTER
|DT_SINGLELINE
|DT_NOPREFIX
);
516 if (align
==DT_RIGHT
) {
519 align
= (align
==DT_LEFT
? DT_CENTER
: DT_RIGHT
);
525 if (strCnt
) DrawTextW (hdc
, text
- strCnt
, -1, &r
, align
|DT_VCENTER
|DT_SINGLELINE
|DT_NOPREFIX
);
526 SetBkMode (hdc
, oldbkmode
);
527 SetTextColor (hdc
, oldtextcolor
);
530 SetBkColor (hdc
, oldbkcolor
);
534 /***********************************************************************
535 * DrawStatusText [COMCTL32.@]
536 * DrawStatusTextA [COMCTL32.5]
538 * Draws text with borders, like in a status bar.
541 * hdc [I] handle to the window's display context
542 * lprc [I] pointer to a rectangle
543 * text [I] pointer to the text
544 * style [I] drawing style
550 void WINAPI
DrawStatusTextA (HDC hdc
, LPCRECT lprc
, LPCSTR text
, UINT style
)
556 if ( (len
= MultiByteToWideChar( CP_ACP
, 0, text
, -1, NULL
, 0 )) ) {
557 if ( (textW
= Alloc( len
* sizeof(WCHAR
) )) )
558 MultiByteToWideChar( CP_ACP
, 0, text
, -1, textW
, len
);
561 DrawStatusTextW( hdc
, lprc
, textW
, style
);
566 /***********************************************************************
567 * CreateStatusWindow [COMCTL32.@]
568 * CreateStatusWindowA [COMCTL32.6]
570 * Creates a status bar
573 * style [I] window style
574 * text [I] pointer to the window text
575 * parent [I] handle to the parent window
576 * wid [I] control id of the status bar
579 * Success: handle to the status window
584 CreateStatusWindowA (LONG style
, LPCSTR text
, HWND parent
, UINT wid
)
586 return CreateWindowA(STATUSCLASSNAMEA
, text
, style
,
587 CW_USEDEFAULT
, CW_USEDEFAULT
,
588 CW_USEDEFAULT
, CW_USEDEFAULT
,
589 parent
, (HMENU
)(DWORD_PTR
)wid
, 0, 0);
593 /***********************************************************************
594 * CreateStatusWindowW [COMCTL32.@]
596 * Creates a status bar control
599 * style [I] window style
600 * text [I] pointer to the window text
601 * parent [I] handle to the parent window
602 * wid [I] control id of the status bar
605 * Success: handle to the status window
610 CreateStatusWindowW (LONG style
, LPCWSTR text
, HWND parent
, UINT wid
)
612 return CreateWindowW(STATUSCLASSNAMEW
, text
, style
,
613 CW_USEDEFAULT
, CW_USEDEFAULT
,
614 CW_USEDEFAULT
, CW_USEDEFAULT
,
615 parent
, (HMENU
)(DWORD_PTR
)wid
, 0, 0);
619 /***********************************************************************
620 * CreateUpDownControl [COMCTL32.16]
622 * Creates an up-down control
625 * style [I] window styles
626 * x [I] horizontal position of the control
627 * y [I] vertical position of the control
628 * cx [I] with of the control
629 * cy [I] height of the control
630 * parent [I] handle to the parent window
631 * id [I] the control's identifier
632 * inst [I] handle to the application's module instance
633 * buddy [I] handle to the buddy window, can be NULL
634 * maxVal [I] upper limit of the control
635 * minVal [I] lower limit of the control
636 * curVal [I] current value of the control
639 * Success: handle to the updown control
644 CreateUpDownControl (DWORD style
, INT x
, INT y
, INT cx
, INT cy
,
645 HWND parent
, INT id
, HINSTANCE inst
,
646 HWND buddy
, INT maxVal
, INT minVal
, INT curVal
)
649 CreateWindowW (UPDOWN_CLASSW
, 0, style
, x
, y
, cx
, cy
,
650 parent
, (HMENU
)(DWORD_PTR
)id
, inst
, 0);
652 SendMessageW (hUD
, UDM_SETBUDDY
, (WPARAM
)buddy
, 0);
653 SendMessageW (hUD
, UDM_SETRANGE
, 0, MAKELONG(maxVal
, minVal
));
654 SendMessageW (hUD
, UDM_SETPOS
, 0, MAKELONG(curVal
, 0));
661 /***********************************************************************
662 * InitCommonControls [COMCTL32.17]
664 * Registers the common controls.
673 * This function is just a dummy - all the controls are registered at
674 * the DLL initialization time. See InitCommonControlsEx for details.
678 InitCommonControls (void)
683 /***********************************************************************
684 * InitCommonControlsEx [COMCTL32.@]
686 * Registers the common controls.
689 * lpInitCtrls [I] pointer to an INITCOMMONCONTROLS structure.
696 * Probably all versions of comctl32 initializes the Win95 controls in DllMain
697 * during DLL initialization. Starting from comctl32 v5.82 all the controls
698 * are initialized there. We follow this behaviour and this function is just
701 * Note: when writing programs under Windows, if you don't call any function
702 * from comctl32 the linker may not link this DLL. If InitCommonControlsEx
703 * was the only comctl32 function you were calling and you remove it you may
704 * have a false impression that InitCommonControlsEx actually did something.
708 InitCommonControlsEx (const INITCOMMONCONTROLSEX
*lpInitCtrls
)
710 if (!lpInitCtrls
|| lpInitCtrls
->dwSize
!= sizeof(INITCOMMONCONTROLSEX
))
713 TRACE("(0x%08x)\n", lpInitCtrls
->dwICC
);
718 /***********************************************************************
719 * CreateToolbarEx [COMCTL32.@]
721 * Creates a toolbar window.
739 * Success: handle to the tool bar control
744 CreateToolbarEx (HWND hwnd
, DWORD style
, UINT wID
, INT nBitmaps
,
745 HINSTANCE hBMInst
, UINT_PTR wBMID
, LPCTBBUTTON lpButtons
,
746 INT iNumButtons
, INT dxButton
, INT dyButton
,
747 INT dxBitmap
, INT dyBitmap
, UINT uStructSize
)
752 CreateWindowExW(0, TOOLBARCLASSNAMEW
, NULL
, style
|WS_CHILD
, 0,0,100,30,
753 hwnd
, (HMENU
)(DWORD_PTR
)wID
, COMCTL32_hModule
, NULL
);
757 SendMessageW (hwndTB
, TB_BUTTONSTRUCTSIZE
, uStructSize
, 0);
759 /* set bitmap and button size */
760 /*If CreateToolbarEx receives 0, windows sets default values*/
765 if (dxBitmap
== 0 || dyBitmap
== 0)
766 dxBitmap
= dyBitmap
= 16;
767 SendMessageW(hwndTB
, TB_SETBITMAPSIZE
, 0, MAKELPARAM(dxBitmap
, dyBitmap
));
773 /* TB_SETBUTTONSIZE -> TB_SETBITMAPSIZE bug introduced for Windows compatibility */
774 if (dxButton
!= 0 && dyButton
!= 0)
775 SendMessageW(hwndTB
, TB_SETBITMAPSIZE
, 0, MAKELPARAM(dxButton
, dyButton
));
779 if (nBitmaps
> 0 || hBMInst
== HINST_COMMCTRL
)
781 tbab
.hInst
= hBMInst
;
784 SendMessageW (hwndTB
, TB_ADDBITMAP
, nBitmaps
, (LPARAM
)&tbab
);
788 SendMessageW (hwndTB
, TB_ADDBUTTONSW
, iNumButtons
, (LPARAM
)lpButtons
);
795 /***********************************************************************
796 * CreateMappedBitmap [COMCTL32.8]
798 * Loads a bitmap resource using a colour map.
801 * hInstance [I] Handle to the module containing the bitmap.
802 * idBitmap [I] The bitmap resource ID.
803 * wFlags [I] CMB_MASKED for using bitmap as a mask or 0 for normal.
804 * lpColorMap [I] Colour information needed for the bitmap or NULL (uses system colours).
805 * iNumMaps [I] Number of COLORMAP's pointed to by lpColorMap.
808 * Success: handle to the new bitmap
813 CreateMappedBitmap (HINSTANCE hInstance
, INT_PTR idBitmap
, UINT wFlags
,
814 LPCOLORMAP lpColorMap
, INT iNumMaps
)
818 const BITMAPINFOHEADER
*lpBitmap
;
819 LPBITMAPINFOHEADER lpBitmapInfo
;
820 UINT nSize
, nColorTableSize
, iColor
;
821 RGBQUAD
*pColorTable
;
822 INT i
, iMaps
, nWidth
, nHeight
;
825 LPCOLORMAP sysColorMap
;
827 COLORMAP internalColorMap
[4] =
828 {{0x000000, 0}, {0x808080, 0}, {0xC0C0C0, 0}, {0xFFFFFF, 0}};
830 /* initialize pointer to colortable and default color table */
833 sysColorMap
= lpColorMap
;
836 internalColorMap
[0].to
= GetSysColor (COLOR_BTNTEXT
);
837 internalColorMap
[1].to
= GetSysColor (COLOR_BTNSHADOW
);
838 internalColorMap
[2].to
= GetSysColor (COLOR_BTNFACE
);
839 internalColorMap
[3].to
= GetSysColor (COLOR_BTNHIGHLIGHT
);
841 sysColorMap
= internalColorMap
;
844 hRsrc
= FindResourceW (hInstance
, (LPWSTR
)idBitmap
, (LPWSTR
)RT_BITMAP
);
847 hglb
= LoadResource (hInstance
, hRsrc
);
850 lpBitmap
= LockResource (hglb
);
851 if (lpBitmap
== NULL
)
854 if (lpBitmap
->biSize
>= sizeof(BITMAPINFOHEADER
) && lpBitmap
->biClrUsed
)
855 nColorTableSize
= lpBitmap
->biClrUsed
;
856 else if (lpBitmap
->biBitCount
<= 8)
857 nColorTableSize
= (1 << lpBitmap
->biBitCount
);
860 nSize
= lpBitmap
->biSize
;
861 if (nSize
== sizeof(BITMAPINFOHEADER
) && lpBitmap
->biCompression
== BI_BITFIELDS
)
862 nSize
+= 3 * sizeof(DWORD
);
863 nSize
+= nColorTableSize
* sizeof(RGBQUAD
);
864 lpBitmapInfo
= GlobalAlloc (GMEM_FIXED
, nSize
);
865 if (lpBitmapInfo
== NULL
)
867 RtlMoveMemory (lpBitmapInfo
, lpBitmap
, nSize
);
869 pColorTable
= (RGBQUAD
*)(((LPBYTE
)lpBitmapInfo
) + lpBitmapInfo
->biSize
);
871 for (iColor
= 0; iColor
< nColorTableSize
; iColor
++) {
872 for (i
= 0; i
< iMaps
; i
++) {
873 cRef
= RGB(pColorTable
[iColor
].rgbRed
,
874 pColorTable
[iColor
].rgbGreen
,
875 pColorTable
[iColor
].rgbBlue
);
876 if ( cRef
== sysColorMap
[i
].from
) {
878 if (wFlags
& CBS_MASKED
) {
879 if (sysColorMap
[i
].to
!= COLOR_BTNTEXT
)
880 pColorTable
[iColor
] = RGB(255, 255, 255);
884 pColorTable
[iColor
].rgbBlue
= GetBValue(sysColorMap
[i
].to
);
885 pColorTable
[iColor
].rgbGreen
= GetGValue(sysColorMap
[i
].to
);
886 pColorTable
[iColor
].rgbRed
= GetRValue(sysColorMap
[i
].to
);
891 nWidth
= lpBitmapInfo
->biWidth
;
892 nHeight
= lpBitmapInfo
->biHeight
;
893 hdcScreen
= GetDC (NULL
);
894 hbm
= CreateCompatibleBitmap (hdcScreen
, nWidth
, nHeight
);
896 HDC hdcDst
= CreateCompatibleDC (hdcScreen
);
897 HBITMAP hbmOld
= SelectObject (hdcDst
, hbm
);
898 const BYTE
*lpBits
= (const BYTE
*)lpBitmap
+ nSize
;
899 StretchDIBits (hdcDst
, 0, 0, nWidth
, nHeight
, 0, 0, nWidth
, nHeight
,
900 lpBits
, (LPBITMAPINFO
)lpBitmapInfo
, DIB_RGB_COLORS
,
902 SelectObject (hdcDst
, hbmOld
);
905 ReleaseDC (NULL
, hdcScreen
);
906 GlobalFree (lpBitmapInfo
);
913 /***********************************************************************
914 * CreateToolbar [COMCTL32.7]
916 * Creates a toolbar control.
929 * Success: handle to the tool bar control
933 * Do not use this function anymore. Use CreateToolbarEx instead.
937 CreateToolbar (HWND hwnd
, DWORD style
, UINT wID
, INT nBitmaps
,
938 HINSTANCE hBMInst
, UINT wBMID
,
939 LPCTBBUTTON lpButtons
,INT iNumButtons
)
941 return CreateToolbarEx (hwnd
, style
| CCS_NODIVIDER
, wID
, nBitmaps
,
942 hBMInst
, wBMID
, lpButtons
,
943 iNumButtons
, 0, 0, 0, 0, CCSIZEOF_STRUCT(TBBUTTON
, dwData
));
947 /***********************************************************************
948 * DllGetVersion [COMCTL32.@]
950 * Retrieves version information of the 'COMCTL32.DLL'
953 * pdvi [O] pointer to version information structure.
957 * Failure: E_INVALIDARG
960 * Returns version of a comctl32.dll from IE4.01 SP1.
963 HRESULT WINAPI
DllGetVersion (DLLVERSIONINFO
*pdvi
)
965 if (pdvi
->cbSize
!= sizeof(DLLVERSIONINFO
)) {
966 WARN("wrong DLLVERSIONINFO size from app\n");
970 pdvi
->dwMajorVersion
= COMCTL32_VERSION
;
971 pdvi
->dwMinorVersion
= COMCTL32_VERSION_MINOR
;
972 pdvi
->dwBuildNumber
= 2919;
973 pdvi
->dwPlatformID
= 6304;
975 TRACE("%u.%u.%u.%u\n",
976 pdvi
->dwMajorVersion
, pdvi
->dwMinorVersion
,
977 pdvi
->dwBuildNumber
, pdvi
->dwPlatformID
);
982 /***********************************************************************
983 * DllInstall (COMCTL32.@)
985 * Installs the ComCtl32 DLL.
989 * Failure: A HRESULT error
991 HRESULT WINAPI
DllInstall(BOOL bInstall
, LPCWSTR cmdline
)
993 TRACE("(%u, %s): stub\n", bInstall
, debugstr_w(cmdline
));
997 /***********************************************************************
998 * _TrackMouseEvent [COMCTL32.@]
1000 * Requests notification of mouse events
1002 * During mouse tracking WM_MOUSEHOVER or WM_MOUSELEAVE events are posted
1003 * to the hwnd specified in the ptme structure. After the event message
1004 * is posted to the hwnd, the entry in the queue is removed.
1006 * If the current hwnd isn't ptme->hwndTrack the TME_HOVER flag is completely
1007 * ignored. The TME_LEAVE flag results in a WM_MOUSELEAVE message being posted
1008 * immediately and the TME_LEAVE flag being ignored.
1011 * ptme [I,O] pointer to TRACKMOUSEEVENT information structure.
1017 * IMPLEMENTATION moved to USER32.TrackMouseEvent
1022 _TrackMouseEvent (TRACKMOUSEEVENT
*ptme
)
1024 return TrackMouseEvent (ptme
);
1027 /*************************************************************************
1028 * GetMUILanguage [COMCTL32.@]
1030 * Returns the user interface language in use by the current process.
1033 * Language ID in use by the current process.
1035 LANGID WINAPI
GetMUILanguage (VOID
)
1037 return COMCTL32_uiLang
;
1041 /*************************************************************************
1042 * InitMUILanguage [COMCTL32.@]
1044 * Sets the user interface language to be used by the current process.
1049 VOID WINAPI
InitMUILanguage (LANGID uiLang
)
1051 COMCTL32_uiLang
= uiLang
;
1055 /***********************************************************************
1056 * SetWindowSubclass [COMCTL32.410]
1058 * Starts a window subclass
1061 * hWnd [in] handle to window subclass.
1062 * pfnSubclass [in] Pointer to new window procedure.
1063 * uIDSubclass [in] Unique identifier of subclass together with pfnSubclass.
1064 * dwRef [in] Reference data to pass to window procedure.
1071 * If an application manually subclasses a window after subclassing it with
1072 * this API and then with this API again, then none of the previous
1073 * subclasses get called or the original window procedure.
1076 BOOL WINAPI
SetWindowSubclass (HWND hWnd
, SUBCLASSPROC pfnSubclass
,
1077 UINT_PTR uIDSubclass
, DWORD_PTR dwRef
)
1079 LPSUBCLASS_INFO stack
;
1080 LPSUBCLASSPROCS proc
;
1082 TRACE ("(%p, %p, %lx, %lx)\n", hWnd
, pfnSubclass
, uIDSubclass
, dwRef
);
1084 if (!hWnd
|| !pfnSubclass
)
1087 /* Since the window procedure that we set here has two additional arguments,
1088 * we can't simply set it as the new window procedure of the window. So we
1089 * set our own window procedure and then calculate the other two arguments
1092 /* See if we have been called for this window */
1093 stack
= GetPropW (hWnd
, COMCTL32_wSubclass
);
1095 /* allocate stack */
1096 stack
= Alloc (sizeof(SUBCLASS_INFO
));
1098 ERR ("Failed to allocate our Subclassing stack\n");
1101 SetPropW (hWnd
, COMCTL32_wSubclass
, stack
);
1103 /* set window procedure to our own and save the current one */
1104 if (IsWindowUnicode (hWnd
))
1105 stack
->origproc
= (WNDPROC
)SetWindowLongPtrW (hWnd
, GWLP_WNDPROC
,
1106 (DWORD_PTR
)COMCTL32_SubclassProc
);
1108 stack
->origproc
= (WNDPROC
)SetWindowLongPtrA (hWnd
, GWLP_WNDPROC
,
1109 (DWORD_PTR
)COMCTL32_SubclassProc
);
1112 /* Check to see if we have called this function with the same uIDSubClass
1113 * and pfnSubclass */
1114 proc
= stack
->SubclassProcs
;
1116 if ((proc
->id
== uIDSubclass
) &&
1117 (proc
->subproc
== pfnSubclass
)) {
1125 proc
= Alloc(sizeof(SUBCLASSPROCS
));
1127 ERR ("Failed to allocate subclass entry in stack\n");
1128 if (IsWindowUnicode (hWnd
))
1129 SetWindowLongPtrW (hWnd
, GWLP_WNDPROC
, (DWORD_PTR
)stack
->origproc
);
1131 SetWindowLongPtrA (hWnd
, GWLP_WNDPROC
, (DWORD_PTR
)stack
->origproc
);
1133 RemovePropW( hWnd
, COMCTL32_wSubclass
);
1137 proc
->subproc
= pfnSubclass
;
1139 proc
->id
= uIDSubclass
;
1140 proc
->next
= stack
->SubclassProcs
;
1141 stack
->SubclassProcs
= proc
;
1147 /***********************************************************************
1148 * GetWindowSubclass [COMCTL32.411]
1150 * Gets the Reference data from a subclass.
1153 * hWnd [in] Handle to the window which we are subclassing
1154 * pfnSubclass [in] Pointer to the subclass procedure
1155 * uID [in] Unique identifier of the subclassing procedure
1156 * pdwRef [out] Pointer to the reference data
1163 BOOL WINAPI
GetWindowSubclass (HWND hWnd
, SUBCLASSPROC pfnSubclass
,
1164 UINT_PTR uID
, DWORD_PTR
*pdwRef
)
1166 const SUBCLASS_INFO
*stack
;
1167 const SUBCLASSPROCS
*proc
;
1169 TRACE ("(%p, %p, %lx, %p)\n", hWnd
, pfnSubclass
, uID
, pdwRef
);
1171 /* See if we have been called for this window */
1172 stack
= GetPropW (hWnd
, COMCTL32_wSubclass
);
1176 proc
= stack
->SubclassProcs
;
1178 if ((proc
->id
== uID
) &&
1179 (proc
->subproc
== pfnSubclass
)) {
1180 *pdwRef
= proc
->ref
;
1190 /***********************************************************************
1191 * RemoveWindowSubclass [COMCTL32.412]
1193 * Removes a window subclass.
1196 * hWnd [in] Handle to the window which we are subclassing
1197 * pfnSubclass [in] Pointer to the subclass procedure
1198 * uID [in] Unique identifier of this subclass
1205 BOOL WINAPI
RemoveWindowSubclass(HWND hWnd
, SUBCLASSPROC pfnSubclass
, UINT_PTR uID
)
1207 LPSUBCLASS_INFO stack
;
1208 LPSUBCLASSPROCS prevproc
= NULL
;
1209 LPSUBCLASSPROCS proc
;
1212 TRACE ("(%p, %p, %lx)\n", hWnd
, pfnSubclass
, uID
);
1214 /* Find the Subclass to remove */
1215 stack
= GetPropW (hWnd
, COMCTL32_wSubclass
);
1219 proc
= stack
->SubclassProcs
;
1221 if ((proc
->id
== uID
) &&
1222 (proc
->subproc
== pfnSubclass
)) {
1225 stack
->SubclassProcs
= proc
->next
;
1227 prevproc
->next
= proc
->next
;
1229 if (stack
->stackpos
== proc
)
1230 stack
->stackpos
= stack
->stackpos
->next
;
1240 if (!stack
->SubclassProcs
&& !stack
->running
) {
1241 TRACE("Last Subclass removed, cleaning up\n");
1242 /* clean up our heap and reset the original window procedure */
1243 if (IsWindowUnicode (hWnd
))
1244 SetWindowLongPtrW (hWnd
, GWLP_WNDPROC
, (DWORD_PTR
)stack
->origproc
);
1246 SetWindowLongPtrA (hWnd
, GWLP_WNDPROC
, (DWORD_PTR
)stack
->origproc
);
1248 RemovePropW( hWnd
, COMCTL32_wSubclass
);
1254 /***********************************************************************
1255 * COMCTL32_SubclassProc (internal)
1257 * Window procedure for all subclassed windows.
1258 * Saves the current subclassing stack position to support nested messages
1260 static LRESULT WINAPI
COMCTL32_SubclassProc (HWND hWnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
1262 LPSUBCLASS_INFO stack
;
1263 LPSUBCLASSPROCS proc
;
1266 TRACE ("(%p, 0x%08x, 0x%08lx, 0x%08lx)\n", hWnd
, uMsg
, wParam
, lParam
);
1268 stack
= GetPropW (hWnd
, COMCTL32_wSubclass
);
1270 ERR ("Our sub classing stack got erased for %p!! Nothing we can do\n", hWnd
);
1274 /* Save our old stackpos to properly handle nested messages */
1275 proc
= stack
->stackpos
;
1276 stack
->stackpos
= stack
->SubclassProcs
;
1278 ret
= DefSubclassProc(hWnd
, uMsg
, wParam
, lParam
);
1280 stack
->stackpos
= proc
;
1282 if (!stack
->SubclassProcs
&& !stack
->running
) {
1283 TRACE("Last Subclass removed, cleaning up\n");
1284 /* clean up our heap and reset the original window procedure */
1285 if (IsWindowUnicode (hWnd
))
1286 SetWindowLongPtrW (hWnd
, GWLP_WNDPROC
, (DWORD_PTR
)stack
->origproc
);
1288 SetWindowLongPtrA (hWnd
, GWLP_WNDPROC
, (DWORD_PTR
)stack
->origproc
);
1290 RemovePropW( hWnd
, COMCTL32_wSubclass
);
1295 /***********************************************************************
1296 * DefSubclassProc [COMCTL32.413]
1298 * Calls the next window procedure (i.e. the one before this subclass)
1301 * hWnd [in] The window that we're subclassing
1303 * wParam [in] WPARAM
1304 * lParam [in] LPARAM
1311 LRESULT WINAPI
DefSubclassProc (HWND hWnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
1313 LPSUBCLASS_INFO stack
;
1316 TRACE ("(%p, 0x%08x, 0x%08lx, 0x%08lx)\n", hWnd
, uMsg
, wParam
, lParam
);
1318 /* retrieve our little stack from the Properties */
1319 stack
= GetPropW (hWnd
, COMCTL32_wSubclass
);
1321 ERR ("Our sub classing stack got erased for %p!! Nothing we can do\n", hWnd
);
1325 /* If we are at the end of stack then we have to call the original
1326 * window procedure */
1327 if (!stack
->stackpos
) {
1328 if (IsWindowUnicode (hWnd
))
1329 ret
= CallWindowProcW (stack
->origproc
, hWnd
, uMsg
, wParam
, lParam
);
1331 ret
= CallWindowProcA (stack
->origproc
, hWnd
, uMsg
, wParam
, lParam
);
1333 const SUBCLASSPROCS
*proc
= stack
->stackpos
;
1334 stack
->stackpos
= stack
->stackpos
->next
;
1335 /* call the Subclass procedure from the stack */
1336 ret
= proc
->subproc (hWnd
, uMsg
, wParam
, lParam
,
1337 proc
->id
, proc
->ref
);
1344 /***********************************************************************
1345 * COMCTL32_CreateToolTip [NOT AN API]
1347 * Creates a tooltip for the control specified in hwnd and does all
1348 * necessary setup and notifications.
1351 * hwndOwner [I] Handle to the window that will own the tool tip.
1354 * Success: Handle of tool tip window.
1359 COMCTL32_CreateToolTip(HWND hwndOwner
)
1363 hwndToolTip
= CreateWindowExW(0, TOOLTIPS_CLASSW
, NULL
, WS_POPUP
,
1364 CW_USEDEFAULT
, CW_USEDEFAULT
,
1365 CW_USEDEFAULT
, CW_USEDEFAULT
, hwndOwner
,
1368 /* Send NM_TOOLTIPSCREATED notification */
1371 NMTOOLTIPSCREATED nmttc
;
1372 /* true owner can be different if hwndOwner is a child window */
1373 HWND hwndTrueOwner
= GetWindow(hwndToolTip
, GW_OWNER
);
1374 nmttc
.hdr
.hwndFrom
= hwndTrueOwner
;
1375 nmttc
.hdr
.idFrom
= GetWindowLongPtrW(hwndTrueOwner
, GWLP_ID
);
1376 nmttc
.hdr
.code
= NM_TOOLTIPSCREATED
;
1377 nmttc
.hwndToolTips
= hwndToolTip
;
1379 SendMessageW(GetParent(hwndTrueOwner
), WM_NOTIFY
,
1380 GetWindowLongPtrW(hwndTrueOwner
, GWLP_ID
), (LPARAM
)&nmttc
);
1387 /***********************************************************************
1388 * COMCTL32_RefreshSysColors [NOT AN API]
1390 * Invoked on any control recognizing a WM_SYSCOLORCHANGE message to
1391 * refresh the color values in the color structure
1401 COMCTL32_RefreshSysColors(void)
1403 comctl32_color
.clrBtnHighlight
= GetSysColor (COLOR_BTNHIGHLIGHT
);
1404 comctl32_color
.clrBtnShadow
= GetSysColor (COLOR_BTNSHADOW
);
1405 comctl32_color
.clrBtnText
= GetSysColor (COLOR_BTNTEXT
);
1406 comctl32_color
.clrBtnFace
= GetSysColor (COLOR_BTNFACE
);
1407 comctl32_color
.clrHighlight
= GetSysColor (COLOR_HIGHLIGHT
);
1408 comctl32_color
.clrHighlightText
= GetSysColor (COLOR_HIGHLIGHTTEXT
);
1409 comctl32_color
.clrHotTrackingColor
= GetSysColor (COLOR_HOTLIGHT
);
1410 comctl32_color
.clr3dHilight
= GetSysColor (COLOR_3DHILIGHT
);
1411 comctl32_color
.clr3dShadow
= GetSysColor (COLOR_3DSHADOW
);
1412 comctl32_color
.clr3dDkShadow
= GetSysColor (COLOR_3DDKSHADOW
);
1413 comctl32_color
.clr3dFace
= GetSysColor (COLOR_3DFACE
);
1414 comctl32_color
.clrWindow
= GetSysColor (COLOR_WINDOW
);
1415 comctl32_color
.clrWindowText
= GetSysColor (COLOR_WINDOWTEXT
);
1416 comctl32_color
.clrGrayText
= GetSysColor (COLOR_GRAYTEXT
);
1417 comctl32_color
.clrActiveCaption
= GetSysColor (COLOR_ACTIVECAPTION
);
1418 comctl32_color
.clrInfoBk
= GetSysColor (COLOR_INFOBK
);
1419 comctl32_color
.clrInfoText
= GetSysColor (COLOR_INFOTEXT
);
1422 /***********************************************************************
1423 * COMCTL32_DrawInsertMark [NOT AN API]
1425 * Draws an insertion mark (which looks similar to an 'I').
1428 * hDC [I] Device context to draw onto.
1429 * lpRect [I] Co-ordinates of insertion mark.
1430 * clrInsertMark [I] Colour of the insertion mark.
1431 * bHorizontal [I] True if insert mark should be drawn horizontally,
1432 * vertical otherwise.
1438 * Draws up to but not including the bottom co-ordinate when drawing
1439 * vertically or the right co-ordinate when horizontal.
1441 void COMCTL32_DrawInsertMark(HDC hDC
, const RECT
*lpRect
, COLORREF clrInsertMark
, BOOL bHorizontal
)
1443 HPEN hPen
= CreatePen(PS_SOLID
, 1, clrInsertMark
);
1445 static const DWORD adwPolyPoints
[] = {4,4,4};
1446 LONG lCentre
= (bHorizontal
?
1447 lpRect
->top
+ (lpRect
->bottom
- lpRect
->top
)/2 :
1448 lpRect
->left
+ (lpRect
->right
- lpRect
->left
)/2);
1449 LONG l1
= (bHorizontal
? lpRect
->left
: lpRect
->top
);
1450 LONG l2
= (bHorizontal
? lpRect
->right
: lpRect
->bottom
);
1451 const POINT aptInsertMark
[] =
1453 /* top (V) or left (H) arrow */
1457 {lCentre
+ 1, l1
+ 2},
1461 {lCentre
+ 1, l1
- 1},
1462 {lCentre
+ 1, l2
- 2},
1463 /* bottom (V) or right (H) arrow */
1465 {lCentre
- 2, l2
- 1},
1466 {lCentre
+ 3, l2
- 1},
1467 {lCentre
+ 1, l2
- 3},
1469 hOldPen
= SelectObject(hDC
, hPen
);
1470 PolyPolyline(hDC
, aptInsertMark
, adwPolyPoints
, ARRAY_SIZE(adwPolyPoints
));
1471 SelectObject(hDC
, hOldPen
);
1475 /***********************************************************************
1476 * COMCTL32_EnsureBitmapSize [internal]
1478 * If needed, enlarge the bitmap so that the width is at least cxMinWidth and
1479 * the height is at least cyMinHeight. If the bitmap already has these
1480 * dimensions nothing changes.
1483 * hBitmap [I/O] Bitmap to modify. The handle may change
1484 * cxMinWidth [I] If the width of the bitmap is smaller, then it will
1485 * be enlarged to this value
1486 * cyMinHeight [I] If the height of the bitmap is smaller, then it will
1487 * be enlarged to this value
1488 * cyBackground [I] The color with which the new area will be filled
1493 void COMCTL32_EnsureBitmapSize(HBITMAP
*pBitmap
, int cxMinWidth
, int cyMinHeight
, COLORREF crBackground
)
1498 HBITMAP hNewDCBitmap
, hOldDCBitmap
;
1502 if (!GetObjectW(*pBitmap
, sizeof(BITMAP
), &bmp
))
1504 cxNew
= (cxMinWidth
> bmp
.bmWidth
? cxMinWidth
: bmp
.bmWidth
);
1505 cyNew
= (cyMinHeight
> bmp
.bmHeight
? cyMinHeight
: bmp
.bmHeight
);
1506 if (cxNew
== bmp
.bmWidth
&& cyNew
== bmp
.bmHeight
)
1509 hdcNew
= CreateCompatibleDC(NULL
);
1510 hNewBitmap
= CreateBitmap(cxNew
, cyNew
, bmp
.bmPlanes
, bmp
.bmBitsPixel
, NULL
);
1511 hNewDCBitmap
= SelectObject(hdcNew
, hNewBitmap
);
1512 hNewDCBrush
= SelectObject(hdcNew
, CreateSolidBrush(crBackground
));
1514 hdcOld
= CreateCompatibleDC(NULL
);
1515 hOldDCBitmap
= SelectObject(hdcOld
, *pBitmap
);
1517 BitBlt(hdcNew
, 0, 0, bmp
.bmWidth
, bmp
.bmHeight
, hdcOld
, 0, 0, SRCCOPY
);
1518 if (bmp
.bmWidth
< cxMinWidth
)
1519 PatBlt(hdcNew
, bmp
.bmWidth
, 0, cxNew
, bmp
.bmHeight
, PATCOPY
);
1520 if (bmp
.bmHeight
< cyMinHeight
)
1521 PatBlt(hdcNew
, 0, bmp
.bmHeight
, bmp
.bmWidth
, cyNew
, PATCOPY
);
1522 if (bmp
.bmWidth
< cxMinWidth
&& bmp
.bmHeight
< cyMinHeight
)
1523 PatBlt(hdcNew
, bmp
.bmWidth
, bmp
.bmHeight
, cxNew
, cyNew
, PATCOPY
);
1525 SelectObject(hdcNew
, hNewDCBitmap
);
1526 DeleteObject(SelectObject(hdcNew
, hNewDCBrush
));
1528 SelectObject(hdcOld
, hOldDCBitmap
);
1531 DeleteObject(*pBitmap
);
1532 *pBitmap
= hNewBitmap
;
1536 void COMCTL32_GetFontMetrics(HFONT hFont
, TEXTMETRICW
*ptm
)
1538 HDC hdc
= GetDC(NULL
);
1541 hOldFont
= SelectObject(hdc
, hFont
);
1542 GetTextMetricsW(hdc
, ptm
);
1543 SelectObject(hdc
, hOldFont
);
1544 ReleaseDC(NULL
, hdc
);
1547 #ifndef OCM__BASE /* avoid including olectl.h */
1548 #define OCM__BASE (WM_USER+0x1c00)
1551 /***********************************************************************
1552 * COMCTL32_IsReflectedMessage [internal]
1554 * Some parents reflect notify messages - for some messages sent by the child,
1555 * they send it back with the message code increased by OCM__BASE (0x2000).
1556 * This allows better subclassing of controls. We don't need to handle such
1557 * messages but we don't want to print ERRs for them, so this helper function
1560 * Some of the codes are in the CCM_FIRST..CCM_LAST range, but there is no
1561 * collision with defined CCM_ codes.
1563 BOOL
COMCTL32_IsReflectedMessage(UINT uMsg
)
1567 case OCM__BASE
+ WM_COMMAND
:
1568 case OCM__BASE
+ WM_CTLCOLORBTN
:
1569 case OCM__BASE
+ WM_CTLCOLOREDIT
:
1570 case OCM__BASE
+ WM_CTLCOLORDLG
:
1571 case OCM__BASE
+ WM_CTLCOLORLISTBOX
:
1572 case OCM__BASE
+ WM_CTLCOLORMSGBOX
:
1573 case OCM__BASE
+ WM_CTLCOLORSCROLLBAR
:
1574 case OCM__BASE
+ WM_CTLCOLORSTATIC
:
1575 case OCM__BASE
+ WM_DRAWITEM
:
1576 case OCM__BASE
+ WM_MEASUREITEM
:
1577 case OCM__BASE
+ WM_DELETEITEM
:
1578 case OCM__BASE
+ WM_VKEYTOITEM
:
1579 case OCM__BASE
+ WM_CHARTOITEM
:
1580 case OCM__BASE
+ WM_COMPAREITEM
:
1581 case OCM__BASE
+ WM_HSCROLL
:
1582 case OCM__BASE
+ WM_VSCROLL
:
1583 case OCM__BASE
+ WM_PARENTNOTIFY
:
1584 case OCM__BASE
+ WM_NOTIFY
:
1591 /***********************************************************************
1592 * MirrorIcon [COMCTL32.414]
1594 * Mirrors an icon so that it will appear correctly on a mirrored DC.
1597 * phicon1 [I/O] Icon.
1598 * phicon2 [I/O] Icon.
1604 BOOL WINAPI
MirrorIcon(HICON
*phicon1
, HICON
*phicon2
)
1606 FIXME("(%p, %p): stub\n", phicon1
, phicon2
);
1610 static inline BOOL
IsDelimiter(WCHAR c
)
1623 static int CALLBACK
PathWordBreakProc(LPCWSTR lpch
, int ichCurrent
, int cch
, int code
)
1625 if (code
== WB_ISDELIMITER
)
1626 return IsDelimiter(lpch
[ichCurrent
]);
1629 int dir
= (code
== WB_LEFT
) ? -1 : 1;
1630 for(; 0 <= ichCurrent
&& ichCurrent
< cch
; ichCurrent
+= dir
)
1631 if (IsDelimiter(lpch
[ichCurrent
])) return ichCurrent
;
1636 /***********************************************************************
1637 * SetPathWordBreakProc [COMCTL32.384]
1639 * Sets the word break procedure for an edit control to one that understands
1640 * paths so that the user can jump over directories.
1643 * hwnd [I] Handle to edit control.
1644 * bSet [I] If this is TRUE then the word break proc is set, otherwise it is removed.
1647 * Result from EM_SETWORDBREAKPROC message.
1649 LRESULT WINAPI
SetPathWordBreakProc(HWND hwnd
, BOOL bSet
)
1651 return SendMessageW(hwnd
, EM_SETWORDBREAKPROC
, 0,
1652 (LPARAM
)(bSet
? PathWordBreakProc
: NULL
));
1655 /***********************************************************************
1656 * DrawShadowText [COMCTL32.@]
1658 * Draw text with shadow.
1660 int WINAPI
DrawShadowText(HDC hdc
, LPCWSTR text
, UINT length
, RECT
*rect
, DWORD flags
,
1661 COLORREF crText
, COLORREF crShadow
, int offset_x
, int offset_y
)
1667 FIXME("(%p, %s, %d, %p, 0x%08x, 0x%08x, 0x%08x, %d, %d): semi-stub\n", hdc
, debugstr_w(text
),
1668 length
, rect
, flags
, crText
, crShadow
, offset_x
, offset_y
);
1670 bkmode
= SetBkMode(hdc
, TRANSPARENT
);
1671 clr
= SetTextColor(hdc
, crShadow
);
1673 /* FIXME: for shadow we need to render normally, blur it, and blend with current background. */
1675 OffsetRect(&r
, 1, 1);
1676 DrawTextW(hdc
, text
, length
, &r
, flags
);
1678 SetTextColor(hdc
, crText
);
1680 /* with text color on top of a shadow */
1681 ret
= DrawTextW(hdc
, text
, length
, rect
, flags
);
1683 SetTextColor(hdc
, clr
);
1684 SetBkMode(hdc
, bkmode
);
1689 /***********************************************************************
1690 * LoadIconWithScaleDown [COMCTL32.@]
1692 HRESULT WINAPI
LoadIconWithScaleDown(HINSTANCE hinst
, const WCHAR
*name
, int cx
, int cy
, HICON
*icon
)
1694 TRACE("(%p, %s, %d, %d, %p)\n", hinst
, debugstr_w(name
), cx
, cy
, icon
);
1699 return E_INVALIDARG
;
1701 *icon
= LoadImageW(hinst
, name
, IMAGE_ICON
, cx
, cy
,
1702 (hinst
|| IS_INTRESOURCE(name
)) ? 0 : LR_LOADFROMFILE
);
1704 return HRESULT_FROM_WIN32(GetLastError());
1709 /***********************************************************************
1710 * LoadIconMetric [COMCTL32.@]
1712 HRESULT WINAPI
LoadIconMetric(HINSTANCE hinst
, const WCHAR
*name
, int size
, HICON
*icon
)
1716 TRACE("(%p, %s, %d, %p)\n", hinst
, debugstr_w(name
), size
, icon
);
1718 if (size
== LIM_SMALL
)
1720 cx
= GetSystemMetrics(SM_CXSMICON
);
1721 cy
= GetSystemMetrics(SM_CYSMICON
);
1723 else if (size
== LIM_LARGE
)
1725 cx
= GetSystemMetrics(SM_CXICON
);
1726 cy
= GetSystemMetrics(SM_CYICON
);
1731 return E_INVALIDARG
;
1734 return LoadIconWithScaleDown(hinst
, name
, cx
, cy
, icon
);