From 7beaa88ed9efcb048595f56e403dca16363a4486 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 13 Oct 2009 04:16:31 +0400 Subject: [PATCH] comctl32/monthcal: Implement handler for WM_ERASEBKGND. --- dlls/comctl32/monthcal.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index dc61d01f4d5..8440e15a095 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -1015,8 +1015,7 @@ static void MONTHCAL_PaintCalendar(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTS static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRUCT *ps) { - RECT *title=&infoPtr->title; - HBRUSH hbr; + RECT *title = &infoPtr->title; COLORREF old_text_clr, old_bk_clr; HFONT old_font; RECT r_temp; @@ -1025,11 +1024,6 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRUCT old_bk_clr = GetBkColor(hdc); old_font = GetCurrentObject(hdc, OBJ_FONT); - /* fill background */ - hbr = CreateSolidBrush (infoPtr->bk); - FillRect(hdc, &ps->rcPaint, hbr); - DeleteObject(hbr); - /* draw title, redraw all its elements */ if(IntersectRect(&r_temp, &(ps->rcPaint), title)) MONTHCAL_PaintTitle(infoPtr, hdc, ps); @@ -1048,7 +1042,6 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRUCT SetTextColor(hdc, old_text_clr); } - static LRESULT MONTHCAL_GetMinReqRect(const MONTHCAL_INFO *infoPtr, LPRECT lpRect) { @@ -2113,6 +2106,22 @@ MONTHCAL_Paint(MONTHCAL_INFO *infoPtr, HDC hdc_paint) return 0; } +static LRESULT +MONTHCAL_EraseBkgnd(const MONTHCAL_INFO *infoPtr, HDC hdc) +{ + HBRUSH hbr; + RECT rc; + + if (!GetClipBox(hdc, &rc)) return FALSE; + + /* fill background */ + hbr = CreateSolidBrush (infoPtr->bk); + FillRect(hdc, &rc, hbr); + DeleteObject(hbr); + + return TRUE; +} + static LRESULT MONTHCAL_SetFocus(const MONTHCAL_INFO *infoPtr) { @@ -2529,6 +2538,9 @@ MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_PAINT: return MONTHCAL_Paint(infoPtr, (HDC)wParam); + case WM_ERASEBKGND: + return MONTHCAL_EraseBkgnd(infoPtr, (HDC)wParam); + case WM_SETFOCUS: return MONTHCAL_SetFocus(infoPtr);