]> 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 e9540a1e4465624029bea7b50555c593117fc7fe..9f06846793b89a0ec9f6bc8d1c08952555abad4d 100644 (file)
@@ -8,10 +8,13 @@
 /////////////////////////////////////////////////////////////////////////////
 
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation "listbox.h"
 #endif
 
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
 #include "wx/defs.h"
 
 #if wxUSE_LISTBOX
@@ -313,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[],
@@ -389,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;
 }
@@ -1081,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