]> git.saurik.com Git - wxWidgets.git/commitdiff
background colour of a combobox may now be set (bug 805442)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 8 Feb 2004 00:59:23 +0000 (00:59 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 8 Feb 2004 00:59:23 +0000 (00:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25588 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/msw/combobox.h
src/msw/combobox.cpp

index 1035ac295d7be2f8eaf8331d46d3ba5896a2d8b8..9e8e4130e0c4bce65a01fac9981fe953e4f9fad4 100644 (file)
@@ -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:
 
index 8b6ed98e2501d8977a19c4b01377ade9db8c1c03..e7b3dc1f427ae77cde3712a0f58863cac55cecd6 100644 (file)
@@ -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);
 
index ebbd7b83e88e906b38210ae1135b12d208a9af82..4c07746705b74087975651a99d37dc8f31a95f5a 100644 (file)
@@ -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 )