]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/combobox.cpp
font size fix for <PRE>
[wxWidgets.git] / src / msw / combobox.cpp
index 0593b9342e9d804ce2ce2af40e1f41fc0b5a533d..d4ec3f017a87955daaa47c53d98e9807a99b7dfa 100644 (file)
 #pragma hdrstop
 #endif
 
+#if wxUSE_COMBOBOX
+
 #ifndef WX_PRECOMP
-#include "wx/setup.h"
+#include "wx/settings.h"
 #endif
 
-#if wxUSE_COMBOBOX
-
 #include "wx/combobox.h"
 #include "wx/clipbrd.h"
 #include "wx/msw/private.h"
 
-#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
-#endif
 
 bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
 {
-  if (param == CBN_SELCHANGE)
-  {
-    if (GetSelection() > -1)
+    switch ( param )
     {
-        wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId);
-        event.SetInt(GetSelection());
-        event.SetEventObject(this);
-        event.SetString(GetStringSelection());
-        ProcessCommand(event);
+        case CBN_SELCHANGE:
+            if (GetSelection() > -1)
+            {
+                wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, GetId());
+                event.SetInt(GetSelection());
+                event.SetEventObject(this);
+                event.SetString(GetStringSelection());
+                ProcessCommand(event);
+            }
+            break;
+
+        case CBN_EDITCHANGE:
+            {
+                wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, GetId());
+                event.SetString(GetValue());
+                event.SetEventObject(this);
+                ProcessCommand(event);
+            }
+            break;
     }
 
-    return TRUE;
-  }
-  else if (param == CBN_EDITCHANGE)
-  {
-    wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
-    event.SetString(GetValue());
-    event.SetEventObject(this);
-    ProcessCommand(event);
-
-    return TRUE;
-  }
-  else
-      return FALSE;
+    // there is no return value for the CBN_ notifications, so always return
+    // FALSE from here to pass the message to DefWindowProc()
+    return FALSE;
 }
 
 bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
@@ -74,7 +74,12 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
   SetName(name);
   SetValidator(validator);
   if (parent) parent->AddChild(this);
-  SetBackgroundColour(parent->GetBackgroundColour()) ;
+//  SetBackgroundColour(parent->GetBackgroundColour()) ;
+
+  // A choice/combobox normally has a white background (or other, depending
+  // on global settings) rather than inheriting the parent's background colour.
+  SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
+
   SetForegroundColour(parent->GetForegroundColour()) ;
 
   m_windowStyle = style;