From: Vadim Zeitlin Date: Sun, 8 Feb 2004 00:59:23 +0000 (+0000) Subject: background colour of a combobox may now be set (bug 805442) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/3a7d5f7cc3892d15ee8de373b8ab52d4bc1eabf8 background colour of a combobox may now be set (bug 805442) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25588 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/changes.txt b/docs/changes.txt index 1035ac295d..9e8e4130e0 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -154,6 +154,7 @@ wxMSW: - experimental wxURL implementation using WinInet functions (Hajo Kirchhoff) - fixed several bugs in wxNotebook with wxNB_MULTILINE style - accelerators are now initially hidden if appropriate (Peter Nielsen) +- background colour of a wxComboBox may now be set wxGTK: diff --git a/include/wx/msw/combobox.h b/include/wx/msw/combobox.h index 8b6ed98e25..e7b3dc1f42 100644 --- a/include/wx/msw/combobox.h +++ b/include/wx/msw/combobox.h @@ -95,6 +95,8 @@ public: // implementation only from now on virtual bool MSWCommand(WXUINT param, WXWORD id); bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam); + virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, WXUINT message, WXWPARAM wParam, WXLPARAM lParam); diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index ebbd7b83e8..4c07746705 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -213,11 +213,12 @@ LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd, return ::CallWindowProc(CASTWNDPROC gs_wndprocEdit, hWnd, message, wParam, lParam); } -WXHBRUSH wxComboBox::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor), - WXUINT WXUNUSED(message), - WXWPARAM WXUNUSED(wParam), - WXLPARAM WXUNUSED(lParam) - ) +WXHBRUSH wxComboBox::OnCtlColor(WXHDC pDC, + WXHWND WXUNUSED(pWnd), + WXUINT WXUNUSED(nCtlColor), + WXUINT WXUNUSED(message), + WXWPARAM WXUNUSED(wParam), + WXLPARAM WXUNUSED(lParam)) { HDC hdc = (HDC)pDC; wxColour colBack = GetBackgroundColour(); @@ -234,9 +235,30 @@ WXHBRUSH wxComboBox::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSE } // ---------------------------------------------------------------------------- -// wxComboBox +// wxComboBox callbacks // ---------------------------------------------------------------------------- +long wxComboBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) +{ + // handle WM_CTLCOLOR messages from our EDIT control to be able to set its + // colour correctly (to be the same as our own one) + switch ( nMsg ) + { + // we have to handle both: one for the normal case and the other for + // wxCB_READONLY + case WM_CTLCOLOREDIT: + case WM_CTLCOLORSTATIC: + WXWORD nCtlColor; + WXHDC hdc; + WXHWND hwnd; + UnpackCtlColor(wParam, lParam, &nCtlColor, &hdc, &hwnd); + + return OnCtlColor(hdc, hwnd, nCtlColor, nMsg, wParam, lParam); + } + + return wxChoice::MSWWindowProc(nMsg, wParam, lParam); +} + bool wxComboBox::MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam) { switch ( msg )