]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/listbox.cpp
fixed background rendering if GetThemeEnabled()=true with GTK2
[wxWidgets.git] / src / gtk / listbox.cpp
index 56f3a233833e029fcc4d451dfadb32e08ca2d2a1..9f06846793b89a0ec9f6bc8d1c08952555abad4d 100644 (file)
@@ -316,6 +316,18 @@ wxListBox::wxListBox()
 #endif // wxUSE_CHECKLISTBOX
 }
 
+bool wxListBox::Create( wxWindow *parent, wxWindowID id,
+                        const wxPoint &pos, const wxSize &size,
+                        const wxArrayString& choices,
+                        long style, const wxValidator& validator,
+                        const wxString &name )
+{
+    wxCArrayString chs(choices);
+
+    return Create( parent, id, pos, size, chs.GetCount(), chs.GetStrings(),
+                   style, validator, name );
+}
+
 bool wxListBox::Create( wxWindow *parent, wxWindowID id,
                         const wxPoint &pos, const wxSize &size,
                         int n, const wxString choices[],
@@ -392,19 +404,10 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
         DoAppend(choices[i]);
     }
 
-    // call it after appending the strings to the listbox, otherwise it doesn't
-    // work correctly
-    SetBestSize( size );
-
     m_parent->DoAddChild( this );
 
-    PostCreation();
-
-    SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX ) );
-    SetForegroundColour( parent->GetForegroundColour() );
-    SetFont( parent->GetFont() );
-
-    Show( TRUE );
+    PostCreation(size);
+    SetBestSize(size); // need this too because this is a wxControlWithItems
 
     return TRUE;
 }
@@ -1084,5 +1087,13 @@ void wxListBox::FixUpMouseEvent(GtkWidget *widget, wxCoord& x, wxCoord& y)
     y += widget->allocation.y;
 }
 
+
+// static
+wxVisualAttributes
+wxListBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    return GetDefaultAttributesFromGTKWidget(gtk_list_new, true);
+}
+
 #endif // wxUSE_LISTBOX