Newer
Older
static void UB_Paint( HWND hwnd, HDC hDC, UINT action )
RECT rc;
HBRUSH hBrush;
HFONT hFont;
LONG state = get_button_state( hwnd );
GetClientRect( hwnd, &rc);
if ((hFont = get_button_font( hwnd ))) SelectObject( hDC, hFont );
hBrush = SendMessageW( GetParent(hwnd), WM_CTLCOLORBTN, hDC, (LPARAM)hwnd );
if (!hBrush) /* did the app forget to call defwindowproc ? */
hBrush = DefWindowProcW( GetParent(hwnd), WM_CTLCOLORBTN, hDC, (LPARAM)hwnd );
FillRect( hDC, &rc, hBrush );
((action == ODA_DRAWENTIRE) && (state & BUTTON_HASFOCUS)))
DrawFocusRect( hDC, &rc );
/**********************************************************************
* Ownerdrawn Button Functions
*/
static void OB_Paint( HWND hwnd, HDC hDC, UINT action )
LONG state = get_button_state( hwnd );
DRAWITEMSTRUCT dis;
HRGN clipRegion;
RECT clipRect;
UINT id = GetWindowLongA( hwnd, GWL_ID );
dis.CtlID = id;
dis.itemState = ((state & BUTTON_HASFOCUS) ? ODS_FOCUS : 0) |
((state & BUTTON_HIGHLIGHTED) ? ODS_SELECTED : 0) |
(IsWindowEnabled(hwnd) ? 0: ODS_DISABLED);
dis.hwndItem = hwnd;
GetClientRect( hwnd, &dis.rcItem );
clipRegion = CreateRectRgnIndirect(&dis.rcItem);
if (GetClipRgn(hDC, clipRegion) != 1)
{
DeleteObject(clipRegion);
clipRegion=(HRGN)NULL;
}
clipRect = dis.rcItem;
DPtoLP(hDC, (LPPOINT) &clipRect, 2);
IntersectClipRect(hDC, clipRect.left, clipRect.top, clipRect.right, clipRect.bottom);
SetBkColor( hDC, GetSysColor( COLOR_BTNFACE ) );
SendMessageW( GetParent(hwnd), WM_DRAWITEM, id, (LPARAM)&dis );
SelectClipRgn(hDC, clipRegion);