+ return p;
+}
+
+wxTreeItemId wxTreeCtrl::GetNextVisible(const wxTreeItemId& item) const {
+ GtkTreeItem *p = (GtkTreeItem *)item;
+ GtkTree *parent = GTK_TREE(GTK_WIDGET(p)->parent);
+ GtkTreeItem *q;
+
+ if (!GTK_IS_TREE(parent))
+ return NULL;
+
+ if (parent->children == NULL)
+ return NULL;
+
+ q = GTK_TREE_ITEM(g_list_next(g_list_find(GTK_TREE(parent)->children, p))->data);
+
+ while (q != p) {
+ q = GTK_TREE_ITEM(g_list_next(g_list_find(GTK_TREE(parent)->children, q))->data);
+ if (GTK_WIDGET_VISIBLE(GTK_WIDGET(q)))
+ return q;
+ }
+
+ return NULL;
+}
+
+wxTreeItemId wxTreeCtrl::GetPrevVisible(const wxTreeItemId& item) const {
+ GtkTreeItem *p = (GtkTreeItem *)item;
+ GtkTree *parent = GTK_TREE(GTK_WIDGET(p)->parent);
+ GtkTreeItem *q;
+
+ if (!GTK_IS_TREE(parent))
+ return NULL;
+
+ if (parent->children == NULL)
+ return NULL;
+
+ q = GTK_TREE_ITEM(g_list_previous(g_list_find(GTK_TREE(parent)->children, p))->data);
+
+ while (q != p) {
+ q = GTK_TREE_ITEM(g_list_previous(g_list_find(GTK_TREE(parent)->children, q))->data);
+ if (GTK_WIDGET_VISIBLE(GTK_WIDGET(q)))
+ return q;
+ }
+
+ return NULL;
+}
+
+wxTreeItemId wxTreeCtrl::AddRoot(const wxString& text, int image,
+ int selectedImage, wxTreeItemData *data) {
+ return p_InsertItem(0, text, image, selectedImage, data);
+}
+
+wxTreeItemId wxTreeCtrl::PrependItem(const wxTreeItemId& parent,
+ const wxString& text, int image, int selectedImage,
+ wxTreeItemData *data) {
+#warning "Need to implement PrependItem"
+ return NULL;
+}
+
+wxTreeItemId wxTreeCtrl::InsertItem(const wxTreeItemId& parent,
+ const wxTreeItemId& idPrevious, const wxString& text,
+ int image, int selectedImage, wxTreeItemData *data) {
+#warning "Need to implement InsertItem"
+ return NULL;
+}
+
+wxTreeItemId wxTreeCtrl::AppendItem(const wxTreeItemId& parent,
+ const wxString& text, int image, int selectedImage,
+ wxTreeItemData *data) {
+ return p_InsertItem(parent, text, image, selectedImage, data);
+}
+
+wxTreeItemId wxTreeCtrl::p_InsertItem(GtkTreeItem *p,
+ const wxString& text, int image, int selectedImage,
+ wxTreeItemData *data) {
+ GtkTreeItem *item;
+
+printf("begin insert\n");
+
+ item = GTK_TREE_ITEM(gtk_tree_item_new());
+
+ GtkHBox *m_box = GTK_HBOX(gtk_hbox_new(FALSE, 0));
+ gtk_container_add (GTK_CONTAINER (item), GTK_WIDGET(m_box));
+
+ gtk_object_set_data(GTK_OBJECT(item), "w_box", m_box);
+
+ const wxBitmap *bmp;
+ const wxImageList *list;
+ if ((list = GetImageList(wxIMAGE_LIST_NORMAL)) != NULL)
+ if ((bmp = list->GetBitmap(image)) != NULL)
+ if (bmp->Ok()) {
+ GdkBitmap *mask = NULL;
+ if (bmp->GetMask())
+ mask = bmp->GetMask()->GetBitmap();
+ GtkPixmap *m_image_widget = GTK_PIXMAP(gtk_pixmap_new(bmp->GetPixmap(), mask));
+ gtk_misc_set_alignment (GTK_MISC (m_image_widget), 0.0, 0.5);
+ gtk_box_pack_start(GTK_BOX(m_box), GTK_WIDGET(m_image_widget), FALSE, FALSE, 0);
+ gtk_object_set_data(GTK_OBJECT(item), "w_image", (void *)m_image_widget);
+ gtk_object_set_data(GTK_OBJECT(item), "image", (void *)image);
+ gtk_widget_show (GTK_WIDGET(m_image_widget));
+ }
+ GtkLabel *m_label_widget = GTK_LABEL(gtk_label_new ((char *)(const char *)text));
+ gtk_misc_set_alignment (GTK_MISC (m_label_widget), 0.5, 0.5);
+ gtk_box_pack_start(GTK_BOX(m_box), GTK_WIDGET(m_label_widget), FALSE, FALSE, 0);
+ gtk_object_set_data(GTK_OBJECT(item), "w_label", m_label_widget);
+ gtk_widget_show (GTK_WIDGET(m_label_widget));
+
+ gtk_widget_show(GTK_WIDGET(m_box));
+
+ gtk_object_set_data(GTK_OBJECT(item), "owner", this);
+ gtk_object_set_data(GTK_OBJECT(item), "data", data);
+ gtk_object_set_data(GTK_OBJECT(item), "parent", p);
+
+ if (p != 0) {
+ if (p->subtree == NULL) {
+ GtkTree *tree = GTK_TREE(gtk_tree_new());
+ gtk_tree_item_set_subtree(GTK_TREE_ITEM(p), GTK_WIDGET(tree));
+ gtk_widget_show(GTK_WIDGET(tree));
+ p->expanded = 1;
+ }
+
+ gtk_container_add(GTK_CONTAINER(p->subtree), GTK_WIDGET(item));