+
+ GtkScrolledWindowSetBorder(m_widget, style);
+
+ m_treeview = GTK_TREE_VIEW( gtk_tree_view_new( ) );
+
+ //wxListBox doesn't have a header :)
+ //NB: If enabled SetFirstItem doesn't work correctly
+ gtk_tree_view_set_headers_visible(m_treeview, FALSE);
+
+#if wxUSE_CHECKLISTBOX && wxUSE_NATIVEGTKCHECKLIST
+ if(m_hasCheckBoxes)
+ ((wxCheckListBox*)this)->DoCreateCheckList();
+#endif // wxUSE_CHECKLISTBOX && wxUSE_NATIVEGTKCHECKLIST
+
+ // Create the data column
+ gtk_tree_view_insert_column_with_attributes(m_treeview, -1, "",
+ gtk_cell_renderer_text_new(),
+ "text",
+ WXLISTBOX_DATACOLUMN, NULL);
+
+ // Now create+set the model (GtkListStore) - first argument # of columns
+#if wxUSE_CHECKLISTBOX && wxUSE_NATIVEGTKCHECKLIST
+ if(m_hasCheckBoxes)
+ m_liststore = gtk_list_store_new(2, G_TYPE_BOOLEAN,
+ GTK_TYPE_TREE_ENTRY);
+ else
+#endif
+ m_liststore = gtk_list_store_new(1, GTK_TYPE_TREE_ENTRY);
+
+ gtk_tree_view_set_model(m_treeview, GTK_TREE_MODEL(m_liststore));
+
+ g_object_unref(G_OBJECT(m_liststore)); //free on treeview destruction
+
+ // Disable the pop-up textctrl that enables searching - note that
+ // the docs specify that even if this disabled (which we are doing)
+ // the user can still have it through the start-interactive-search
+ // key binding...either way we want to provide a searchequal callback
+ // NB: If this is enabled a doubleclick event (activate) gets sent
+ // on a successful search
+ gtk_tree_view_set_search_column(m_treeview, WXLISTBOX_DATACOLUMN);
+ gtk_tree_view_set_search_equal_func(m_treeview,
+ (GtkTreeViewSearchEqualFunc) gtk_listbox_searchequal_callback,
+ this,
+ NULL);
+
+ gtk_tree_view_set_enable_search(m_treeview, FALSE);
+
+
+ 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