]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/combobox.cpp
*** empty log message ***
[wxWidgets.git] / src / msw / combobox.cpp
index cf49b661e85542931fb3d3812489d6401955b2c5..dd0de6353c03b705e5be31e52c7f190a7b5e465e 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)
   {
-    wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId);
-    event.SetInt(GetSelection());
-    event.SetEventObject(this);
-    event.SetString(GetStringSelection());
-    ProcessCommand(event);
+    if (GetSelection() > -1)
+    {
+        wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId);
+        event.SetInt(GetSelection());
+        event.SetEventObject(this);
+        event.SetString(GetStringSelection());
+        ProcessCommand(event);
+    }
 
     return TRUE;
   }
@@ -71,7 +72,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;
@@ -86,7 +92,8 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
   int width = size.x;
   int height = size.y;
 
-  long msStyle = WS_CHILD | WS_TABSTOP | WS_VISIBLE | CBS_NOINTEGRALHEIGHT;
+  long msStyle = WS_CHILD | WS_TABSTOP | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL |
+      CBS_NOINTEGRALHEIGHT;
 
   if (m_windowStyle & wxCB_READONLY)
     msStyle |= CBS_DROPDOWNLIST;
@@ -106,12 +113,12 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
   if ( want3D || wxStyleHasBorder(m_windowStyle) )
     msStyle |= WS_BORDER;
 
-  m_hWnd = (WXHWND)::CreateWindowEx(exStyle, _T("COMBOBOX"), NULL,
+  m_hWnd = (WXHWND)::CreateWindowEx(exStyle, wxT("COMBOBOX"), NULL,
                    msStyle,
                    0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
                    wxGetInstance(), NULL);
 
-  wxCHECK_MSG( m_hWnd, FALSE, _T("Failed to create combobox") );
+  wxCHECK_MSG( m_hWnd, FALSE, wxT("Failed to create combobox") );
 
 /*
 #if wxUSE_CTL3D