]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/listbox.cpp
Use gtk_init_check instead of gtk_init so that we can racefully exit
[wxWidgets.git] / src / gtk / listbox.cpp
index fc1783f95459a5ac3fd05d00c10d44410636896f..9f06846793b89a0ec9f6bc8d1c08952555abad4d 100644 (file)
@@ -8,15 +8,20 @@
 /////////////////////////////////////////////////////////////////////////////
 
 
 /////////////////////////////////////////////////////////////////////////////
 
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation "listbox.h"
 #endif
 
 #pragma implementation "listbox.h"
 #endif
 
-#include "wx/listbox.h"
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#include "wx/defs.h"
 
 #if wxUSE_LISTBOX
 
 
 #if wxUSE_LISTBOX
 
+#include "wx/listbox.h"
 #include "wx/dynarray.h"
 #include "wx/dynarray.h"
+#include "wx/arrstr.h"
 #include "wx/utils.h"
 #include "wx/intl.h"
 #include "wx/checklst.h"
 #include "wx/utils.h"
 #include "wx/intl.h"
 #include "wx/checklst.h"
@@ -311,6 +316,18 @@ wxListBox::wxListBox()
 #endif // wxUSE_CHECKLISTBOX
 }
 
 #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[],
 bool wxListBox::Create( wxWindow *parent, wxWindowID id,
                         const wxPoint &pos, const wxSize &size,
                         int n, const wxString choices[],
@@ -387,19 +404,10 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
         DoAppend(choices[i]);
     }
 
         DoAppend(choices[i]);
     }
 
-    // call it after appending the strings to the listbox, otherwise it doesn't
-    // work correctly
-    SetBestSize( size );
-
     m_parent->DoAddChild( this );
 
     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;
 }
 
     return TRUE;
 }
@@ -1079,5 +1087,13 @@ void wxListBox::FixUpMouseEvent(GtkWidget *widget, wxCoord& x, wxCoord& y)
     y += widget->allocation.y;
 }
 
     y += widget->allocation.y;
 }
 
+
+// static
+wxVisualAttributes
+wxListBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    return GetDefaultAttributesFromGTKWidget(gtk_list_new, true);
+}
+
 #endif // wxUSE_LISTBOX
 
 #endif // wxUSE_LISTBOX