From f499e61407a950d2b2568556b100630998f1581c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 10 Sep 2004 20:36:50 +0000 Subject: [PATCH] make background colour apply to choice/combobox dropdown listbox as well as the main part (patch 1023669) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29083 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/msw/choice.cpp | 41 ++++++++++++++++++++++++++++++----------- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 6c437c0f75..c45e203de8 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -269,6 +269,7 @@ wxMSW: - fixed wxTextCtrl::SetMaxLength for rich edit controls - fixed flat style for toolbars under XP, Windows Classic style - fixed truncation of transferred data in wxConnection under unicode build +- wxChoice and wxComboBox dropdown background can be set now too (Adrian Lupei) wxUniv/X11: diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index 7faa959c51..1ebacc20e4 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -539,18 +539,37 @@ wxSize wxChoice::DoGetBestSize() const WXLRESULT wxChoice::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { - if ( nMsg == WM_LBUTTONUP ) + switch ( nMsg ) { - int x = (int)LOWORD(lParam); - int y = (int)HIWORD(lParam); - - // Ok, this is truly weird, but if a panel with a wxChoice loses the - // focus, then you get a *fake* WM_LBUTTONUP message with x = 65535 and - // y = 65535. Filter out this nonsense. - // - // VZ: I'd like to know how to reproduce this please... - if ( x == 65535 && y == 65535 ) - return 0; + case WM_LBUTTONUP: + { + int x = (int)LOWORD(lParam); + int y = (int)HIWORD(lParam); + + // Ok, this is truly weird, but if a panel with a wxChoice + // loses the focus, then you get a *fake* WM_LBUTTONUP message + // with x = 65535 and y = 65535. Filter out this nonsense. + // + // VZ: I'd like to know how to reproduce this please... + if ( x == 65535 && y == 65535 ) + return 0; + } + break; + + // we have to handle both: one for the normal case and the other + // for readonly + case WM_CTLCOLOREDIT: + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORSTATIC: + { + WXWORD nCtlColor; + WXHDC hdc; + WXHWND hwnd; + UnpackCtlColor(wParam, lParam, &nCtlColor, &hdc, &hwnd); + + return (WXLRESULT)OnCtlColor(hdc, hwnd, nCtlColor, + nMsg, wParam, lParam); + } } return wxWindow::MSWWindowProc(nMsg, wParam, lParam); -- 2.45.2