Commit 026233c4 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

comctl32/button: Implement NM_CUSTOMDRAW for BS_USERBUTTON.

parent 04de7c9f
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
* - BN_PAINT * - BN_PAINT
* + BN_SETFOCUS: is it OK? * + BN_SETFOCUS: is it OK?
* - BN_UNPUSHED/BN_UNHILITE * - BN_UNPUSHED/BN_UNHILITE
* - NM_CUSTOMDRAW
* *
* Structures/Macros/Definitions * Structures/Macros/Definitions
* - NMBCHOTITEM * - NMBCHOTITEM
...@@ -1864,7 +1863,9 @@ static void UB_Paint( const BUTTON_INFO *infoPtr, HDC hDC, UINT action ) ...@@ -1864,7 +1863,9 @@ static void UB_Paint( const BUTTON_INFO *infoPtr, HDC hDC, UINT action )
{ {
RECT rc; RECT rc;
HBRUSH hBrush; HBRUSH hBrush;
LRESULT cdrf;
HFONT hFont; HFONT hFont;
NMCUSTOMDRAW nmcd;
LONG state = infoPtr->state; LONG state = infoPtr->state;
HWND parent; HWND parent;
...@@ -1878,10 +1879,39 @@ static void UB_Paint( const BUTTON_INFO *infoPtr, HDC hDC, UINT action ) ...@@ -1878,10 +1879,39 @@ static void UB_Paint( const BUTTON_INFO *infoPtr, HDC hDC, UINT action )
if (!hBrush) /* did the app forget to call defwindowproc ? */ if (!hBrush) /* did the app forget to call defwindowproc ? */
hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)infoPtr->hwnd); hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)infoPtr->hwnd);
if (action == ODA_FOCUS || (state & BST_FOCUS))
{
init_custom_draw(&nmcd, infoPtr, hDC, &rc);
/* Send erase notifications */
cdrf = SendMessageW(parent, WM_NOTIFY, nmcd.hdr.idFrom, (LPARAM)&nmcd);
if (cdrf & CDRF_SKIPDEFAULT) goto notify;
}
FillRect( hDC, &rc, hBrush ); FillRect( hDC, &rc, hBrush );
if (action == ODA_FOCUS || (state & BST_FOCUS)) if (action == ODA_FOCUS || (state & BST_FOCUS))
DrawFocusRect( hDC, &rc ); {
if (cdrf & CDRF_NOTIFYPOSTERASE)
{
nmcd.dwDrawStage = CDDS_POSTERASE;
SendMessageW(parent, WM_NOTIFY, nmcd.hdr.idFrom, (LPARAM)&nmcd);
}
/* Send paint notifications */
nmcd.dwDrawStage = CDDS_PREPAINT;
cdrf = SendMessageW(parent, WM_NOTIFY, nmcd.hdr.idFrom, (LPARAM)&nmcd);
if (cdrf & CDRF_SKIPDEFAULT) goto notify;
if (cdrf & CDRF_NOTIFYPOSTPAINT)
{
nmcd.dwDrawStage = CDDS_POSTPAINT;
SendMessageW(parent, WM_NOTIFY, nmcd.hdr.idFrom, (LPARAM)&nmcd);
}
if (!(cdrf & CDRF_SKIPPOSTPAINT))
DrawFocusRect( hDC, &rc );
}
notify:
switch (action) switch (action)
{ {
case ODA_FOCUS: case ODA_FOCUS:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment