]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/combobox.cpp
SourceForge patch #654210 to fix naming/numbering shared libs under OS X
[wxWidgets.git] / src / gtk1 / combobox.cpp
index f5e045a71eb2534e4988695a84507a7227ea17a5..ee0cc2e8d5a590cf991002118210fa931b96e72c 100644 (file)
@@ -132,7 +132,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
     GtkWidget *list = GTK_COMBO(m_widget)->list;
 
 #ifndef __WXGTK20__
-    gtk_list_set_selection_mode( GTK_LIST(list), GTK_SELECTION_MULTIPLE );
+    // gtk_list_set_selection_mode( GTK_LIST(list), GTK_SELECTION_MULTIPLE );
 #endif
 
     for (int i = 0; i < n; i++)
@@ -209,6 +209,17 @@ wxComboBox::~wxComboBox()
     m_clientDataList.Clear();
 }
 
+void wxComboBox::SetFocus()
+{
+    if ( m_hasFocus )
+    {
+        // don't do anything if we already have focus
+        return;
+    }
+
+    gtk_widget_grab_focus( m_focusWidget );
+}
+
 void wxComboBox::AppendCommon( const wxString &item )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
@@ -364,8 +375,14 @@ int wxComboBox::FindString( const wxString &item )
     {
         GtkBin *bin = GTK_BIN( child->data );
         GtkLabel *label = GTK_LABEL( bin->child );
-        if (item == wxString(label->label,*wxConvCurrent))
+#ifdef __WXGTK20__
+        wxString str( wxGTK_CONV_BACK( gtk_label_get_text(label) ) );
+#else
+        wxString str( label->label );
+#endif
+        if (item == str)
             return count;
+            
         count++;
         child = child->next;
     }
@@ -408,7 +425,7 @@ wxString wxComboBox::GetString( int n ) const
         GtkBin *bin = GTK_BIN( child->data );
         GtkLabel *label = GTK_LABEL( bin->child );
 #ifdef __WXGTK20__
-        str = wxGTK_CONV_BACK( gtk_label_get_text( label) );
+        str = wxGTK_CONV_BACK( gtk_label_get_text(label) );
 #else
         str = wxString( label->label );
 #endif
@@ -431,7 +448,12 @@ wxString wxComboBox::GetStringSelection() const
     if (selection)
     {
         GtkBin *bin = GTK_BIN( selection->data );
-        wxString tmp = wxString(GTK_LABEL( bin->child )->label,*wxConvCurrent);
+        GtkLabel *label = GTK_LABEL( bin->child );
+#ifdef __WXGTK20__
+        wxString tmp( wxGTK_CONV_BACK( gtk_label_get_text(label) ) );
+#else
+        wxString tmp( label->label );
+#endif
         return tmp;
     }