From 07d18635095fa13a7be974db2d9d990bd12d2cc1 Mon Sep 17 00:00:00 2001 From: Jonas Kümmerlin Date: Sun, 31 May 2020 20:40:31 +0200 Subject: combo: implement WM_PAINT, WM_ERASEBKGND, fix WM_CTLCOLORLISTBOX and styles --- alf/alfcombobox.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/alf/alfcombobox.cpp b/alf/alfcombobox.cpp index ca0924d..86ba4ea 100644 --- a/alf/alfcombobox.cpp +++ b/alf/alfcombobox.cpp @@ -31,7 +31,7 @@ ALF_Combo_InitializePriv(HWND hwnd, ALFComboCreateParams *params) priv->hwndChild = CreateWindowEx(0, TEXT("COMBOBOX"), TEXT(""), - WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | comboStyle, + WS_CHILD | WS_VISIBLE | WS_TABSTOP | comboStyle, 0, 0, 100, 200 /* FIXME needed for commctl32 v5, what is the best value here? */, hwnd, (HMENU) GetWindowLongPtrW(hwnd, GWLP_ID), @@ -269,9 +269,26 @@ ALF__ComboWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return TRUE; } + if (uMsg == WM_PAINT) { + PAINTSTRUCT ps; + HDC dc = BeginPaint(hwnd, &ps); + + FillRect(dc, &ps.rcPaint, GetSysColorBrush(COLOR_BTNFACE)); + + EndPaint(hwnd, &ps); + + return 0; + } + + if (uMsg == WM_ERASEBKGND) { + return TRUE; + } + if (!ALF_Compat_IsMinWindowsVersion(4, 0)) { // HACK to draw the space between edit control and button as COLOR_BTNFACE if (uMsg == WM_CTLCOLORLISTBOX && priv && !(GetWindowLong(priv->hwndChild, GWL_STYLE) & 1)) { + SetTextColor((HDC)wParam, GetSysColor(COLOR_BTNTEXT)); + SetBkColor((HDC)wParam, GetSysColor(COLOR_BTNFACE)); return (LRESULT)GetSysColorBrush(COLOR_BTNFACE); } } -- cgit v1.2.3