]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/treegtk.cpp
native implementation of wxDirDialog for wxCocoa (patch 1403780)
[wxWidgets.git] / src / gtk / treegtk.cpp
index 6d8fa194e161bc0d7feb275b0b1e99208529feeb..9c6809f2920878b5e7a63aaf47b0fe1fedfc879c 100644 (file)
@@ -9,10 +9,6 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
-#pragma implementation "treectrl.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
@@ -25,7 +21,7 @@
 #endif
 
 #include "wx/gtk/treectrl.h"
-#include <wx/textctrl.h>
+#include "wx/textctrl.h"
 #include "wx/log.h"
 
 #include <gtk/gtk.h>
@@ -75,10 +71,8 @@ static void gtk_treeitem_select_callback(GtkWidget *widget, wxTreeItemId *treeit
   owner->SendSelChanged(GTK_TREE_ITEM(widget));
 }
 
-#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxTreeCtrl, wxControl)
 
-#endif
 
 void wxTreeCtrl::Init() {
   m_imageListNormal = NULL;
@@ -228,7 +222,7 @@ void wxTreeCtrl::SetItemText(const wxTreeItemId& item, const wxString& text) {
     return;
 
   GtkLabel *l = GTK_LABEL(gtk_object_get_data(GTK_OBJECT((GtkTreeItem *)item), "w_label"));
-  gtk_label_set(l, text);
+  gtk_label_set_text(l, text);
 }
 
 void wxTreeCtrl::SetItemImage(const wxTreeItemId& item, int image) {
@@ -317,7 +311,7 @@ wxTreeItemId wxTreeCtrl::GetSelection() const {
   return p;
 }
 
-wxTreeItemId wxTreeCtrl::GetParent(const wxTreeItemId& item) const {
+wxTreeItemId wxTreeCtrl::GetItemParent(const wxTreeItemId& item) const {
   if (item.IsOk())
     return (GtkTreeItem *)gtk_object_get_data(GTK_OBJECT((GtkTreeItem *)item), "parent");
 
@@ -498,7 +492,7 @@ printf("begin insert\n");
   const wxBitmap *bmp;
   const wxImageList *list;
   if ((list = GetImageList(wxIMAGE_LIST_NORMAL)) != NULL)
-    if ((bmp = list->GetBitmap(image)) != NULL)
+    if ((bmp = list->GetBitmapPtr(image)) != NULL)
       if (bmp->Ok()) {
         GdkBitmap *mask = NULL;
         if (bmp->GetMask())
@@ -540,16 +534,14 @@ printf("m_tree = %p\n", m_tree);
 
   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 );
+  g_signal_connect (item, "select",
+                    G_CALLBACK (gtk_treeitem_select_callback), this);
+  g_signal_connect (item, "deselect",
+                    G_CALLBACK (gtk_treeitem_select_callback), this);
+  g_signal_connect (item, "expand",
+                    G_CALLBACK (gtk_treeitem_expand_callback), this);
+  g_signal_connect (item, "collapse",
+                    G_CALLBACK (gtk_treeitem_collapse_callback), this);
 
   return item;
 }
@@ -673,7 +665,7 @@ void wxTreeCtrl::EndEditLabel(const wxTreeItemId& item, bool discardChanges) {
 #warning "Need to implement EndEditLabel"
 /*
   GtkLabel *m_label = (GtkLabel *)gtk_object_get_data(GTK_OBJECT((GtkTreeItem *)m_editItem), "w_label");
-  gtk_label_set(m_label, m_textCtrl->GetValue());
+  gtk_label_set_text(m_label, m_textCtrl->GetValue());
 
   gtk_object_remove_data(GTK_OBJECT((GtkTreeItem *)m_editItem), "w_edit");
 
@@ -722,8 +714,8 @@ long wxTreeCtrl::GetChild(long item) const {
   GtkTreeItem *next = NULL;
 
   p = findGtkTreeItem(item);
-  GList *list = gtk_container_children(GTK_CONTAINER(p));
-  next = GTK_TREE_ITEM(list->data);;
+  GList *list = gtk_container_get_children(GTK_CONTAINER(p));
+  next = GTK_TREE_ITEM(list->data);
 
   if (next != NULL)
     return (long)gtk_object_get_data(GTK_OBJECT(next), "id");
@@ -734,8 +726,8 @@ long wxTreeCtrl::GetChild(long item) const {
 long wxTreeCtrl::GetFirstVisibleItem(void) const {
   GtkTreeItem *next = NULL;
 
-  GList *list = gtk_container_children(GTK_CONTAINER(m_anchor));
-  next = GTK_TREE_ITEM(list->data);;
+  GList *list = gtk_container_get_children(GTK_CONTAINER(m_anchor));
+  next = GTK_TREE_ITEM(list->data);
 //  gtk_container_foreach(GTK_CONTAINER(m_anchor), gtk_treectrl_next_visible_callback, &next);
 
   if (next != NULL)
@@ -749,8 +741,8 @@ long wxTreeCtrl::GetNextVisibleItem(long item) const {
   GtkTreeItem *next = NULL;
 
   p = findGtkTreeItem(item);
-  GList *list = gtk_container_children(GTK_CONTAINER(p));
-  next = GTK_TREE_ITEM(list->data);;
+  GList *list = gtk_container_get_children(GTK_CONTAINER(p));
+  next = GTK_TREE_ITEM(list->data);
 //  gtk_container_foreach(GTK_CONTAINER(p), gtk_treectrl_next_visible_callback, &next);
 
   if (next != NULL)
@@ -862,16 +854,14 @@ long wxTreeCtrl::InsertItem(long parent, wxTreeItem& info, long insertAfter) {
 
   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 );
+  g_signal_connect (item, "select",
+                    G_CALLBACK (gtk_treeitem_select_callback), this);
+  g_signal_connect (item, "deselect",
+                    G_CALLBACK (gtk_treeitem_select_callback), this);
+  g_signal_connect (item, "expand",
+                    G_CALLBACK (gtk_treeitem_expand_callback), this);
+  g_signal_connect (item, "collapse",
+                    G_CALLBACK (gtk_treeitem_collapse_callback), this);
 
   return info.m_itemId;
 }