+ GtkTreeSelection* selection = gtk_tree_view_get_selection( m_treeview );
+ gtk_tree_selection_set_select_function(selection,
+ (GtkTreeSelectionFunc)gtk_listitem_select_cb,
+ this, NULL); //NULL == destroycb
+
+ GtkSelectionMode mode;
+ if (style & wxLB_MULTIPLE)
+ {
+ mode = GTK_SELECTION_MULTIPLE;
+ }
+ else if (style & wxLB_EXTENDED)
+ {
+ mode = GTK_SELECTION_EXTENDED;
+ }
+ else
+ {
+ // if style was 0 set single mode
+ m_windowStyle |= wxLB_SINGLE;
+ mode = GTK_SELECTION_SINGLE;
+ }
+
+ gtk_tree_selection_set_mode( selection, mode );
+
+ //Handle sortable stuff
+ if(style & wxLB_SORT)
+ {
+ //Setup sorting in ascending (wx) order
+ gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(m_liststore),
+ WXLISTBOX_DATACOLUMN,
+ GTK_SORT_ASCENDING);
+
+ //Set the sort callback
+ gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(m_liststore),
+ WXLISTBOX_DATACOLUMN,
+ (GtkTreeIterCompareFunc) gtk_listbox_sort_callback,
+ this, //userdata
+ NULL //"destroy notifier"
+ );
+ }
+
+
+ gtk_container_add (GTK_CONTAINER (m_widget), GTK_WIDGET(m_treeview) );
+
+ gtk_widget_show( GTK_WIDGET(m_treeview) );
+
+ wxListBox::DoInsertItems(wxArrayString(n, choices), 0); // insert initial items
+
+ //treeview-specific events
+ g_signal_connect(m_treeview, "row-activated",
+ G_CALLBACK(gtk_listbox_row_activated_callback), this);
+
+ // other events
+ g_signal_connect (m_treeview, "button_press_event",
+ G_CALLBACK (gtk_listbox_button_press_callback),
+ this);
+ g_signal_connect (m_treeview, "key_press_event",
+ G_CALLBACK (gtk_listbox_key_press_callback),
+ this);
+
+ m_parent->DoAddChild( this );
+
+ PostCreation(size);
+ SetBestSize(size); // need this too because this is a wxControlWithItems
+
+ return true;