]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wincmn.cpp
Have wxComboCtrl honour any custom foreground and background colour.
[wxWidgets.git] / src / common / wincmn.cpp
index 1a03e224efbbff798ddf748a495f025f410368c9..27a560c9b9e6953200998a08b20353b4f082c2ec 100644 (file)
@@ -213,9 +213,8 @@ wxWindowBase::wxWindowBase()
 bool wxWindowBase::CreateBase(wxWindowBase *parent,
                               wxWindowID id,
                               const wxPoint& WXUNUSED(pos),
-                              const wxSize& WXUNUSED(size),
+                              const wxSize& size,
                               long style,
-                              const wxValidator& wxVALIDATOR_PARAM(validator),
                               const wxString& name)
 {
     // ids are limited to 16 bits under MSW so if you care about portability,
@@ -240,9 +239,32 @@ bool wxWindowBase::CreateBase(wxWindowBase *parent,
     // flags by updating the window dynamically and we don't need this here
     m_windowStyle = style;
 
+    // assume the user doesn't want this window to shrink beneath its initial
+    // size, this worked like this in wxWidgets 2.8 and before and generally
+    // often makes sense for child windows (for top level ones it definitely
+    // does not as the user should be able to resize the window)
+    //
+    // note that we can't use IsTopLevel() from ctor
+    if ( !wxTopLevelWindows.Find((wxWindow *)this) )
+        SetMinSize(size);
+
     SetName(name);
     SetParent(parent);
 
+    return true;
+}
+
+bool wxWindowBase::CreateBase(wxWindowBase *parent,
+                              wxWindowID id,
+                              const wxPoint& pos,
+                              const wxSize& size,
+                              long style,
+                              const wxValidator& wxVALIDATOR_PARAM(validator),
+                              const wxString& name)
+{
+    if ( !CreateBase(parent, id, pos, size, style, name) )
+        return false;
+
 #if wxUSE_VALIDATORS
     SetValidator(validator);
 #endif // wxUSE_VALIDATORS
@@ -702,6 +724,21 @@ wxSize wxWindowBase::GetEffectiveMinSize() const
     return min;
 }
 
+wxSize wxWindowBase::DoGetBorderSize() const
+{
+    // there is one case in which we can implement it for all ports easily:
+    // do it as some classes used by both wxUniv and native ports (e.g.
+    // wxGenericStaticText) do override DoGetBestClientSize() and so this
+    // method must work for them and that ensures that it does, at least in
+    // the default case)
+    if ( GetBorder() == wxBORDER_NONE )
+        return wxSize(0, 0);
+
+    wxFAIL_MSG( "must be overridden if called" );
+
+    return wxDefaultSize;
+}
+
 wxSize wxWindowBase::GetBestSize() const
 {
     if ( !m_windowSizer && m_bestSizeCache.IsFullySpecified() )
@@ -2449,7 +2486,7 @@ wxPoint wxWindowBase::ConvertDialogToPixels(const wxPoint& pt)
 // ----------------------------------------------------------------------------
 
 // propagate the colour change event to the subwindows
-void wxWindowBase::OnSysColourChanged(wxSysColourChangedEvent& event)
+void wxWindowBase::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event))
 {
     wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
     while ( node )
@@ -2459,7 +2496,7 @@ void wxWindowBase::OnSysColourChanged(wxSysColourChangedEvent& event)
         if ( !win->IsTopLevel() )
         {
             wxSysColourChangedEvent event2;
-            event.SetEventObject(win);
+            event2.SetEventObject(win);
             win->GetEventHandler()->ProcessEvent(event2);
         }