+
+ gtk_widget_show(GTK_WIDGET(item));
+
+ gtk_signal_connect(GTK_OBJECT(item), "select",
+ GTK_SIGNAL_FUNC(gtk_treeitem_select_callback), (gpointer)this );
+
+ gtk_signal_connect(GTK_OBJECT(item), "deselect",
+ GTK_SIGNAL_FUNC(gtk_treeitem_select_callback), (gpointer)this );
+
+ gtk_signal_connect(GTK_OBJECT(item), "expand",
+ GTK_SIGNAL_FUNC(gtk_treeitem_expand_callback), (gpointer)this );
+ gtk_signal_connect(GTK_OBJECT(item), "collapse",
+ GTK_SIGNAL_FUNC(gtk_treeitem_collapse_callback), (gpointer)this );
+
+ return item;
+}
+
+void wxTreeCtrl::Delete(const wxTreeItemId& item) {
+ if (!item.IsOk())
+ return;
+
+ GtkTreeItem *parent = GTK_TREE_ITEM(GTK_WIDGET((GtkTreeItem *)item)->parent);
+ if (parent == NULL)
+ return;
+
+ gtk_container_remove(GTK_CONTAINER(parent), GTK_WIDGET((GtkTreeItem *)item));
+
+ return;
+}
+
+void wxTreeCtrl::DeleteAllItems() {
+ gtk_tree_item_remove_subtree(m_anchor);
+}
+
+void wxTreeCtrl::Expand(const wxTreeItemId& item) {
+ if (!item.IsOk())
+ return;
+
+ gtk_tree_item_expand(GTK_TREE_ITEM((GtkTreeItem *)item));
+}
+
+void wxTreeCtrl::Collapse(const wxTreeItemId& item) {
+ if (!item.IsOk())
+ return;
+
+ gtk_tree_item_collapse(GTK_TREE_ITEM((GtkTreeItem *)item));
+}
+
+void wxTreeCtrl::CollapseAndReset(const wxTreeItemId& item) {
+ if (!item.IsOk())
+ return;
+
+ gtk_tree_item_collapse(GTK_TREE_ITEM((GtkTreeItem *)item));
+ gtk_tree_item_remove_subtree(GTK_TREE_ITEM((GtkTreeItem *)item));
+}
+
+void wxTreeCtrl::Toggle(const wxTreeItemId& item) {
+ if (!item.IsOk())
+ return;
+
+ if (((GtkTreeItem *)item)->expanded)
+ gtk_tree_item_collapse(GTK_TREE_ITEM((GtkTreeItem *)item));
+ else
+ gtk_tree_item_expand(GTK_TREE_ITEM((GtkTreeItem *)item));
+}
+
+static void gtk_treectrl_unselect_callback(GtkWidget *widget, gpointer data) {
+ GtkTreeItem *p;
+
+ GtkTree *tree = GTK_TREE(GTK_TREE_ITEM(widget)->subtree);
+
+ if (tree->selection != NULL) {
+ guint len = g_list_length(tree->selection);
+ for (guint i=0; i<len; i++) {
+ p = GTK_TREE_ITEM((GtkTreeItem *)g_list_nth(tree->selection, i)->data);
+ gtk_tree_unselect_child(tree, GTK_WIDGET(p));
+ }
+ }
+
+ if (GTK_IS_CONTAINER(widget))
+ gtk_container_foreach(GTK_CONTAINER(widget), gtk_treectrl_unselect_callback, data);
+}
+
+void wxTreeCtrl::Unselect() {
+ if (m_anchor == NULL)
+ return;
+
+ gtk_treectrl_unselect_callback(GTK_WIDGET(m_anchor), NULL);
+}
+
+void wxTreeCtrl::SelectItem(const wxTreeItemId& item) {
+ if (!item.IsOk())
+ return;
+
+ gtk_tree_item_select((GtkTreeItem *)item);
+}
+
+void wxTreeCtrl::EnsureVisible(const wxTreeItemId& item) {
+#warning "Need to implement EnsureVisible"
+}
+
+void wxTreeCtrl::ScrollTo(const wxTreeItemId& item) {
+#warning "Need to implement ScrollTo"
+}
+
+wxTextCtrl* wxTreeCtrl::EditLabel(const wxTreeItemId& item,
+ wxClassInfo* textControlClass) {
+ wxASSERT( textControlClass->IsKindOf(CLASSINFO(wxTextCtrl)) );
+#warning "Need to implement EditLabel"
+/*
+ char *s;
+ m_editItem = item;
+
+ GtkLabel *m_label = (GtkLabel *)gtk_object_get_data(GTK_OBJECT((GtkTreeItem *)item), "w_label");
+ gtk_label_get(m_label, &s);
+
+ m_textCtrl = new wxTextCtrl(this, -1, s);
+// m_textCtrl->SetValue(s);
+
+ gtk_object_set_data(GTK_OBJECT((GtkTreeItem *)item), "w_edit", m_textCtrl->m_widget);
+
+ gtk_container_remove(GTK_CONTAINER((GtkTreeItem *)item), GTK_WIDGET(m_label));
+ gtk_container_add(GTK_CONTAINER((GtkTreeItem *)item), m_textCtrl->m_widget);
+