forked from AuroraMiddleware/gtk
Move GtkTreeModel from object to interface.
2000-10-16 <jrb@redhat.com> * gtk/gtktreemodel.h (struct _GtkTreeModelIface): Move GtkTreeModel from object to interface.
This commit is contained in:
parent
50ce7224fd
commit
457a5f9335
@ -1,3 +1,8 @@
|
||||
2000-10-16 <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreemodel.h (struct _GtkTreeModelIface): Move
|
||||
GtkTreeModel from object to interface.
|
||||
|
||||
2000-10-16 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktreeviewcolumn.c: #include gtklabel.h, fixing
|
||||
|
@ -1,3 +1,8 @@
|
||||
2000-10-16 <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreemodel.h (struct _GtkTreeModelIface): Move
|
||||
GtkTreeModel from object to interface.
|
||||
|
||||
2000-10-16 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktreeviewcolumn.c: #include gtklabel.h, fixing
|
||||
|
@ -1,3 +1,8 @@
|
||||
2000-10-16 <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreemodel.h (struct _GtkTreeModelIface): Move
|
||||
GtkTreeModel from object to interface.
|
||||
|
||||
2000-10-16 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktreeviewcolumn.c: #include gtklabel.h, fixing
|
||||
|
@ -1,3 +1,8 @@
|
||||
2000-10-16 <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreemodel.h (struct _GtkTreeModelIface): Move
|
||||
GtkTreeModel from object to interface.
|
||||
|
||||
2000-10-16 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktreeviewcolumn.c: #include gtklabel.h, fixing
|
||||
|
@ -1,3 +1,8 @@
|
||||
2000-10-16 <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreemodel.h (struct _GtkTreeModelIface): Move
|
||||
GtkTreeModel from object to interface.
|
||||
|
||||
2000-10-16 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktreeviewcolumn.c: #include gtklabel.h, fixing
|
||||
|
@ -1,3 +1,8 @@
|
||||
2000-10-16 <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreemodel.h (struct _GtkTreeModelIface): Move
|
||||
GtkTreeModel from object to interface.
|
||||
|
||||
2000-10-16 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktreeviewcolumn.c: #include gtklabel.h, fixing
|
||||
|
@ -1,3 +1,8 @@
|
||||
2000-10-16 <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreemodel.h (struct _GtkTreeModelIface): Move
|
||||
GtkTreeModel from object to interface.
|
||||
|
||||
2000-10-16 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktreeviewcolumn.c: #include gtklabel.h, fixing
|
||||
|
@ -21,11 +21,23 @@
|
||||
#include "gtktreemodel.h"
|
||||
#include "gtkliststore.h"
|
||||
#include "gtktreedatalist.h"
|
||||
#include "gtksignal.h"
|
||||
|
||||
#define G_SLIST(x) ((GSList *) x)
|
||||
|
||||
enum {
|
||||
NODE_CHANGED,
|
||||
NODE_INSERTED,
|
||||
NODE_CHILD_TOGGLED,
|
||||
NODE_DELETED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint list_store_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static void gtk_list_store_init (GtkListStore *list_store);
|
||||
static void gtk_list_store_class_init (GtkListStoreClass *class);
|
||||
static void gtk_list_store_tree_model_init (GtkTreeModelIface *iface);
|
||||
static gint gtk_list_store_get_n_columns (GtkTreeModel *tree_model);
|
||||
static GtkTreeNode gtk_list_store_get_node (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path);
|
||||
@ -50,9 +62,6 @@ static GtkTreeNode gtk_list_store_node_parent (GtkTreeModel *tree_mo
|
||||
GtkTreeNode node);
|
||||
|
||||
|
||||
static GtkTreeModelClass *parent_class = NULL;
|
||||
|
||||
|
||||
GtkType
|
||||
gtk_list_store_get_type (void)
|
||||
{
|
||||
@ -73,7 +82,17 @@ gtk_list_store_get_type (void)
|
||||
(GInstanceInitFunc) gtk_list_store_init,
|
||||
};
|
||||
|
||||
list_store_type = g_type_register_static (GTK_TYPE_TREE_MODEL, "GtkListStore", &list_store_info);
|
||||
static const GInterfaceInfo tree_model_info =
|
||||
{
|
||||
(GInterfaceInitFunc) gtk_list_store_tree_model_init,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
list_store_type = g_type_register_static (GTK_TYPE_OBJECT, "GtkListStore", &list_store_info);
|
||||
g_type_add_interface_static (list_store_type,
|
||||
GTK_TYPE_TREE_MODEL,
|
||||
&tree_model_info);
|
||||
}
|
||||
|
||||
return list_store_type;
|
||||
@ -83,23 +102,62 @@ static void
|
||||
gtk_list_store_class_init (GtkListStoreClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkTreeModelClass *tree_model_class;
|
||||
|
||||
object_class = (GtkObjectClass*) class;
|
||||
tree_model_class = (GtkTreeModelClass *) class;
|
||||
|
||||
parent_class = gtk_type_class (gtk_tree_model_get_type ());
|
||||
list_store_signals[NODE_CHANGED] =
|
||||
gtk_signal_new ("node_changed",
|
||||
GTK_RUN_FIRST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkListStoreClass, node_changed),
|
||||
gtk_marshal_NONE__POINTER_POINTER,
|
||||
GTK_TYPE_NONE, 2,
|
||||
GTK_TYPE_POINTER,
|
||||
GTK_TYPE_POINTER);
|
||||
list_store_signals[NODE_INSERTED] =
|
||||
gtk_signal_new ("node_inserted",
|
||||
GTK_RUN_FIRST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkListStoreClass, node_inserted),
|
||||
gtk_marshal_NONE__POINTER_POINTER,
|
||||
GTK_TYPE_NONE, 2,
|
||||
GTK_TYPE_POINTER,
|
||||
GTK_TYPE_POINTER);
|
||||
list_store_signals[NODE_CHILD_TOGGLED] =
|
||||
gtk_signal_new ("node_child_toggled",
|
||||
GTK_RUN_FIRST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkListStoreClass, node_child_toggled),
|
||||
gtk_marshal_NONE__POINTER_POINTER,
|
||||
GTK_TYPE_NONE, 2,
|
||||
GTK_TYPE_POINTER,
|
||||
GTK_TYPE_POINTER);
|
||||
list_store_signals[NODE_DELETED] =
|
||||
gtk_signal_new ("node_deleted",
|
||||
GTK_RUN_FIRST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkListStoreClass, node_deleted),
|
||||
gtk_marshal_NONE__POINTER,
|
||||
GTK_TYPE_NONE, 1,
|
||||
GTK_TYPE_POINTER);
|
||||
|
||||
tree_model_class->get_n_columns = gtk_list_store_get_n_columns;
|
||||
tree_model_class->get_node = gtk_list_store_get_node;
|
||||
tree_model_class->get_path = gtk_list_store_get_path;
|
||||
tree_model_class->node_get_value = gtk_list_store_node_get_value;
|
||||
tree_model_class->node_next = gtk_list_store_node_next;
|
||||
tree_model_class->node_children = gtk_list_store_node_children;
|
||||
tree_model_class->node_has_child = gtk_list_store_node_has_child;
|
||||
tree_model_class->node_n_children = gtk_list_store_node_n_children;
|
||||
tree_model_class->node_nth_child = gtk_list_store_node_nth_child;
|
||||
tree_model_class->node_parent = gtk_list_store_node_parent;
|
||||
|
||||
gtk_object_class_add_signals (object_class, list_store_signals, LAST_SIGNAL);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_list_store_tree_model_init (GtkTreeModelIface *iface)
|
||||
{
|
||||
iface->get_n_columns = gtk_list_store_get_n_columns;
|
||||
iface->get_node = gtk_list_store_get_node;
|
||||
iface->get_path = gtk_list_store_get_path;
|
||||
iface->node_get_value = gtk_list_store_node_get_value;
|
||||
iface->node_next = gtk_list_store_node_next;
|
||||
iface->node_children = gtk_list_store_node_children;
|
||||
iface->node_has_child = gtk_list_store_node_has_child;
|
||||
iface->node_n_children = gtk_list_store_node_n_children;
|
||||
iface->node_nth_child = gtk_list_store_node_nth_child;
|
||||
iface->node_parent = gtk_list_store_node_parent;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -37,7 +37,7 @@ typedef struct _GtkListStoreClass GtkListStoreClass;
|
||||
|
||||
struct _GtkListStore
|
||||
{
|
||||
GtkTreeModel parent;
|
||||
GtkObject parent;
|
||||
|
||||
/*< private >*/
|
||||
GtkTreeNode root;
|
||||
@ -47,7 +47,21 @@ struct _GtkListStore
|
||||
|
||||
struct _GtkListStoreClass
|
||||
{
|
||||
GtkTreeModelClass parent_class;
|
||||
GtkObjectClass parent_class;
|
||||
|
||||
/* signals */
|
||||
/* Will be moved into the GtkTreeModelIface eventually */
|
||||
void (* node_changed) (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeNode node);
|
||||
void (* node_inserted) (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeNode node);
|
||||
void (* node_child_toggled) (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeNode node);
|
||||
void (* node_deleted) (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path);
|
||||
};
|
||||
|
||||
GtkType gtk_list_store_get_type (void);
|
||||
|
@ -21,6 +21,11 @@
|
||||
#include "gtkmarshal.h"
|
||||
#include "gtksignal.h"
|
||||
enum {
|
||||
NODE_CHANGED,
|
||||
NODE_INSERTED,
|
||||
NODE_CHILD_TOGGLED,
|
||||
NODE_DELETED,
|
||||
|
||||
GET_N_COLUMNS,
|
||||
GET_NODE,
|
||||
GET_PATH,
|
||||
@ -37,6 +42,7 @@ enum {
|
||||
|
||||
static void gtk_model_simple_init (GtkModelSimple *model_simple);
|
||||
static void gtk_model_simple_class_init (GtkModelSimpleClass *class);
|
||||
static void gtk_model_simple_tree_model_init (GtkTreeModelIface *iface);
|
||||
static gint gtk_real_model_simple_get_n_columns (GtkTreeModel *tree_model);
|
||||
static GtkTreeNode gtk_real_model_simple_get_node (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path);
|
||||
@ -62,7 +68,6 @@ static GtkTreeNode gtk_real_model_simple_node_parent (GtkTreeModel *
|
||||
|
||||
|
||||
|
||||
static GtkTreeModelClass *parent_class = NULL;
|
||||
static guint model_simple_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
|
||||
@ -86,7 +91,17 @@ gtk_model_simple_get_type (void)
|
||||
(GInstanceInitFunc) gtk_model_simple_init
|
||||
};
|
||||
|
||||
static const GInterfaceInfo tree_model_info =
|
||||
{
|
||||
(GInterfaceInitFunc) gtk_model_simple_tree_model_init,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
model_simple_type = g_type_register_static (GTK_TYPE_TREE_MODEL, "GtkModelSimple", &model_simple_info);
|
||||
g_type_add_interface_static (model_simple_type,
|
||||
GTK_TYPE_TREE_MODEL,
|
||||
&tree_model_info);
|
||||
}
|
||||
|
||||
return model_simple_type;
|
||||
@ -98,75 +113,48 @@ gtk_model_simple_new (void)
|
||||
return GTK_OBJECT (gtk_type_new (GTK_TYPE_MODEL_SIMPLE));
|
||||
}
|
||||
|
||||
|
||||
typedef gint (*GtkSignal_INT__NONE) (GtkObject * object,
|
||||
gpointer user_data);
|
||||
void
|
||||
gtk_marshal_INT__NONE (GtkObject * object,
|
||||
GtkSignalFunc func, gpointer func_data, GtkArg * args)
|
||||
{
|
||||
GtkSignal_INT__NONE rfunc;
|
||||
gint *return_val;
|
||||
return_val = GTK_RETLOC_INT (args[0]);
|
||||
rfunc = (GtkSignal_INT__NONE) func;
|
||||
*return_val = (*rfunc) (object, func_data);
|
||||
}
|
||||
|
||||
typedef gpointer (*GtkSignal_POINTER__NONE) (GtkObject * object,
|
||||
gpointer user_data);
|
||||
void
|
||||
gtk_marshal_POINTER__NONE (GtkObject * object,
|
||||
GtkSignalFunc func, gpointer func_data, GtkArg * args)
|
||||
{
|
||||
GtkSignal_POINTER__NONE rfunc;
|
||||
gpointer *return_val;
|
||||
return_val = GTK_RETLOC_POINTER (args[0]);
|
||||
rfunc = (GtkSignal_POINTER__NONE) func;
|
||||
*return_val = (*rfunc) (object, func_data);
|
||||
}
|
||||
|
||||
typedef gpointer (*GtkSignal_POINTER__POINTER) (GtkObject * object,
|
||||
gpointer arg1,
|
||||
gpointer user_data);
|
||||
void
|
||||
gtk_marshal_POINTER__POINTER (GtkObject * object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data, GtkArg * args)
|
||||
{
|
||||
GtkSignal_POINTER__POINTER rfunc;
|
||||
gpointer *return_val;
|
||||
return_val = GTK_RETLOC_POINTER (args[1]);
|
||||
rfunc = (GtkSignal_POINTER__POINTER) func;
|
||||
*return_val = (*rfunc) (object, GTK_VALUE_POINTER (args[0]), func_data);
|
||||
}
|
||||
|
||||
typedef gpointer (*GtkSignal_POINTER__POINTER_INT) (GtkObject * object,
|
||||
gpointer arg1,
|
||||
gint arg2,
|
||||
gpointer user_data);
|
||||
void
|
||||
gtk_marshal_POINTER__POINTER_INT (GtkObject * object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data, GtkArg * args)
|
||||
{
|
||||
GtkSignal_POINTER__POINTER_INT rfunc;
|
||||
gpointer *return_val;
|
||||
return_val = GTK_RETLOC_POINTER (args[2]);
|
||||
rfunc = (GtkSignal_POINTER__POINTER_INT) func;
|
||||
*return_val = (*rfunc) (object, GTK_VALUE_POINTER (args[0]), GTK_VALUE_INT (args[1]), func_data);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_model_simple_class_init (GtkModelSimpleClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
|
||||
GtkTreeModelClass *tree_model_class;
|
||||
|
||||
object_class = (GtkObjectClass*) class;
|
||||
tree_model_class = (GtkTreeModelClass*) class;
|
||||
parent_class = g_type_class_peek_parent (class);
|
||||
|
||||
model_simple_signals[NODE_CHANGED] =
|
||||
gtk_signal_new ("node_changed",
|
||||
GTK_RUN_FIRST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkModelSimpleClass, node_changed),
|
||||
gtk_marshal_NONE__POINTER_POINTER,
|
||||
GTK_TYPE_NONE, 2,
|
||||
GTK_TYPE_POINTER,
|
||||
GTK_TYPE_POINTER);
|
||||
model_simple_signals[NODE_INSERTED] =
|
||||
gtk_signal_new ("node_inserted",
|
||||
GTK_RUN_FIRST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkModelSimpleClass, node_inserted),
|
||||
gtk_marshal_NONE__POINTER_POINTER,
|
||||
GTK_TYPE_NONE, 2,
|
||||
GTK_TYPE_POINTER,
|
||||
GTK_TYPE_POINTER);
|
||||
model_simple_signals[NODE_CHILD_TOGGLED] =
|
||||
gtk_signal_new ("node_child_toggled",
|
||||
GTK_RUN_FIRST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkModelSimpleClass, node_child_toggled),
|
||||
gtk_marshal_NONE__POINTER_POINTER,
|
||||
GTK_TYPE_NONE, 2,
|
||||
GTK_TYPE_POINTER,
|
||||
GTK_TYPE_POINTER);
|
||||
model_simple_signals[NODE_DELETED] =
|
||||
gtk_signal_new ("node_deleted",
|
||||
GTK_RUN_FIRST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkModelSimpleClass, node_deleted),
|
||||
gtk_marshal_NONE__POINTER,
|
||||
GTK_TYPE_NONE, 1,
|
||||
GTK_TYPE_POINTER);
|
||||
|
||||
model_simple_signals[GET_N_COLUMNS] =
|
||||
gtk_signal_new ("get_n_columns",
|
||||
@ -251,21 +239,24 @@ gtk_model_simple_class_init (GtkModelSimpleClass *class)
|
||||
GTK_TYPE_POINTER, 1,
|
||||
GTK_TYPE_POINTER);
|
||||
|
||||
|
||||
tree_model_class->get_n_columns = gtk_real_model_simple_get_n_columns;
|
||||
tree_model_class->get_node = gtk_real_model_simple_get_node;
|
||||
tree_model_class->get_path = gtk_real_model_simple_get_path;
|
||||
tree_model_class->node_get_value = gtk_real_model_simple_node_get_value;
|
||||
tree_model_class->node_next = gtk_real_model_simple_node_next;
|
||||
tree_model_class->node_children = gtk_real_model_simple_node_children;
|
||||
tree_model_class->node_has_child = gtk_real_model_simple_node_has_child;
|
||||
tree_model_class->node_n_children = gtk_real_model_simple_node_n_children;
|
||||
tree_model_class->node_nth_child = gtk_real_model_simple_node_nth_child;
|
||||
tree_model_class->node_parent = gtk_real_model_simple_node_parent;
|
||||
|
||||
gtk_object_class_add_signals (object_class, model_simple_signals, LAST_SIGNAL);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_model_simple_tree_model_init (GtkTreeModelIface *iface)
|
||||
{
|
||||
iface->get_n_columns = gtk_real_model_simple_get_n_columns;
|
||||
iface->get_node = gtk_real_model_simple_get_node;
|
||||
iface->get_path = gtk_real_model_simple_get_path;
|
||||
iface->node_get_value = gtk_real_model_simple_node_get_value;
|
||||
iface->node_next = gtk_real_model_simple_node_next;
|
||||
iface->node_children = gtk_real_model_simple_node_children;
|
||||
iface->node_has_child = gtk_real_model_simple_node_has_child;
|
||||
iface->node_n_children = gtk_real_model_simple_node_n_children;
|
||||
iface->node_nth_child = gtk_real_model_simple_node_nth_child;
|
||||
iface->node_parent = gtk_real_model_simple_node_parent;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_model_simple_init (GtkModelSimple *model_simple)
|
||||
|
@ -29,8 +29,8 @@ extern "C" {
|
||||
#define GTK_TYPE_MODEL_SIMPLE (gtk_model_simple_get_type ())
|
||||
#define GTK_MODEL_SIMPLE(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_MODEL_SIMPLE, GtkModelSimple))
|
||||
#define GTK_MODEL_SIMPLE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_MODEL_SIMPLE, GtkModelSimpleClass))
|
||||
#define GTK_IS_MODEL_SIMPLE(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_MODEL_SIMPLE))
|
||||
#define GTK_IS_MODEL_SIMPLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), GTK_TYPE_MODEL_SIMPLE))
|
||||
#define GTK_IS_MODEL_SIMPLE(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_MODEL_SIMPLE))
|
||||
#define GTK_IS_MODEL_SIMPLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), GTK_TYPE_MODEL_SIMPLE))
|
||||
|
||||
|
||||
typedef struct _GtkModelSimple GtkModelSimple;
|
||||
@ -38,12 +38,26 @@ typedef struct _GtkModelSimpleClass GtkModelSimpleClass;
|
||||
|
||||
struct _GtkModelSimple
|
||||
{
|
||||
GtkTreeModel parent;
|
||||
GtkObject parent;
|
||||
};
|
||||
|
||||
struct _GtkModelSimpleClass
|
||||
{
|
||||
GtkTreeModelClass parent_class;
|
||||
GtkObjectClass parent_class;
|
||||
|
||||
/* signals */
|
||||
/* Will be moved into the GtkTreeModelIface eventually */
|
||||
void (* node_changed) (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeNode node);
|
||||
void (* node_inserted) (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeNode node);
|
||||
void (* node_child_toggled) (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeNode node);
|
||||
void (* node_deleted) (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path);
|
||||
};
|
||||
|
||||
|
||||
|
@ -21,15 +21,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "gtktreemodel.h"
|
||||
#include "gtksignal.h"
|
||||
|
||||
enum {
|
||||
NODE_CHANGED,
|
||||
NODE_INSERTED,
|
||||
NODE_CHILD_TOGGLED,
|
||||
NODE_DELETED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
struct _GtkTreePath
|
||||
{
|
||||
@ -37,13 +28,6 @@ struct _GtkTreePath
|
||||
gint *indices;
|
||||
};
|
||||
|
||||
static void gtk_tree_model_init (GtkTreeModel *tree_model);
|
||||
static void gtk_tree_model_class_init (GtkTreeModelClass *klass);
|
||||
|
||||
static GtkObjectClass *parent_class = NULL;
|
||||
static guint tree_model_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
|
||||
GtkType
|
||||
gtk_tree_model_get_type (void)
|
||||
{
|
||||
@ -53,87 +37,17 @@ gtk_tree_model_get_type (void)
|
||||
{
|
||||
static const GTypeInfo tree_model_info =
|
||||
{
|
||||
sizeof (GtkTreeModelClass),
|
||||
sizeof (GtkTreeModelIface), /* class_size */
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
(GClassInitFunc) gtk_tree_model_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GtkTreeModel),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) gtk_tree_model_init
|
||||
};
|
||||
|
||||
tree_model_type = g_type_register_static (GTK_TYPE_OBJECT, "GtkTreeModel", &tree_model_info);
|
||||
tree_model_type = g_type_register_static (G_TYPE_INTERFACE, "GtkTreeModel", &tree_model_info);
|
||||
}
|
||||
|
||||
return tree_model_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_class_init (GtkTreeModelClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
|
||||
object_class = (GtkObjectClass*) class;
|
||||
|
||||
parent_class = g_type_class_peek_parent (class);
|
||||
|
||||
tree_model_signals[NODE_CHANGED] =
|
||||
gtk_signal_new ("node_changed",
|
||||
GTK_RUN_FIRST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkTreeModelClass, node_changed),
|
||||
gtk_marshal_NONE__POINTER_POINTER,
|
||||
GTK_TYPE_NONE, 2,
|
||||
GTK_TYPE_POINTER,
|
||||
GTK_TYPE_POINTER);
|
||||
tree_model_signals[NODE_INSERTED] =
|
||||
gtk_signal_new ("node_inserted",
|
||||
GTK_RUN_FIRST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkTreeModelClass, node_inserted),
|
||||
gtk_marshal_NONE__POINTER_POINTER,
|
||||
GTK_TYPE_NONE, 2,
|
||||
GTK_TYPE_POINTER,
|
||||
GTK_TYPE_POINTER);
|
||||
tree_model_signals[NODE_CHILD_TOGGLED] =
|
||||
gtk_signal_new ("node_child_toggled",
|
||||
GTK_RUN_FIRST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkTreeModelClass, node_child_toggled),
|
||||
gtk_marshal_NONE__POINTER_POINTER,
|
||||
GTK_TYPE_NONE, 2,
|
||||
GTK_TYPE_POINTER,
|
||||
GTK_TYPE_POINTER);
|
||||
tree_model_signals[NODE_DELETED] =
|
||||
gtk_signal_new ("node_deleted",
|
||||
GTK_RUN_FIRST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkTreeModelClass, node_deleted),
|
||||
gtk_marshal_NONE__POINTER,
|
||||
GTK_TYPE_NONE, 1,
|
||||
GTK_TYPE_POINTER);
|
||||
|
||||
|
||||
gtk_object_class_add_signals (object_class, tree_model_signals, LAST_SIGNAL);
|
||||
|
||||
|
||||
class->get_node = NULL;
|
||||
class->node_next = NULL;
|
||||
class->node_children = NULL;
|
||||
class->node_n_children = NULL;
|
||||
class->node_nth_child = NULL;
|
||||
class->node_parent = NULL;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_tree_model_init (GtkTreeModel *tree_model)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/* GtkTreePath Operations */
|
||||
GtkTreePath *
|
||||
gtk_tree_path_new (void)
|
||||
@ -339,8 +253,8 @@ gtk_tree_path_down (GtkTreePath *path)
|
||||
gint
|
||||
gtk_tree_model_get_n_columns (GtkTreeModel *tree_model)
|
||||
{
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_GET_CLASS (tree_model)->get_n_columns != NULL, 0);
|
||||
return (* GTK_TREE_MODEL_GET_CLASS (tree_model)->get_n_columns) (tree_model);
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->get_n_columns != NULL, 0);
|
||||
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->get_n_columns) (tree_model);
|
||||
}
|
||||
|
||||
/* Node options */
|
||||
@ -348,16 +262,16 @@ GtkTreeNode
|
||||
gtk_tree_model_get_node (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path)
|
||||
{
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_GET_CLASS (tree_model)->get_node != NULL, NULL);
|
||||
return (* GTK_TREE_MODEL_GET_CLASS (tree_model)->get_node) (tree_model, path);
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->get_node != NULL, NULL);
|
||||
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->get_node) (tree_model, path);
|
||||
}
|
||||
|
||||
GtkTreePath *
|
||||
gtk_tree_model_get_path (GtkTreeModel *tree_model,
|
||||
GtkTreeNode node)
|
||||
{
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_GET_CLASS (tree_model)->get_path != NULL, NULL);
|
||||
return (* GTK_TREE_MODEL_GET_CLASS (tree_model)->get_path) (tree_model, node);
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->get_path != NULL, NULL);
|
||||
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->get_path) (tree_model, node);
|
||||
}
|
||||
|
||||
void
|
||||
@ -366,40 +280,40 @@ gtk_tree_model_node_get_value (GtkTreeModel *tree_model,
|
||||
gint column,
|
||||
GValue *value)
|
||||
{
|
||||
g_return_if_fail (GTK_TREE_MODEL_GET_CLASS (tree_model)->node_get_value != NULL);
|
||||
(* GTK_TREE_MODEL_GET_CLASS (tree_model)->node_get_value) (tree_model, node, column, value);
|
||||
g_return_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->node_get_value != NULL);
|
||||
(* GTK_TREE_MODEL_GET_IFACE (tree_model)->node_get_value) (tree_model, node, column, value);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_tree_model_node_next (GtkTreeModel *tree_model,
|
||||
GtkTreeNode *node)
|
||||
{
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_GET_CLASS (tree_model)->node_next != NULL, FALSE);
|
||||
return (* GTK_TREE_MODEL_GET_CLASS (tree_model)->node_next) (tree_model, node);
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->node_next != NULL, FALSE);
|
||||
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->node_next) (tree_model, node);
|
||||
}
|
||||
|
||||
GtkTreeNode
|
||||
gtk_tree_model_node_children (GtkTreeModel *tree_model,
|
||||
GtkTreeNode node)
|
||||
{
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_GET_CLASS (tree_model)->node_children != NULL, NULL);
|
||||
return (* GTK_TREE_MODEL_GET_CLASS (tree_model)->node_children) (tree_model, node);
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->node_children != NULL, NULL);
|
||||
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->node_children) (tree_model, node);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_tree_model_node_has_child (GtkTreeModel *tree_model,
|
||||
GtkTreeNode node)
|
||||
{
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_GET_CLASS (tree_model)->node_has_child != NULL, FALSE);
|
||||
return (* GTK_TREE_MODEL_GET_CLASS (tree_model)->node_has_child) (tree_model, node);
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->node_has_child != NULL, FALSE);
|
||||
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->node_has_child) (tree_model, node);
|
||||
}
|
||||
|
||||
gint
|
||||
gtk_tree_model_node_n_children (GtkTreeModel *tree_model,
|
||||
GtkTreeNode node)
|
||||
{
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_GET_CLASS (tree_model)->node_n_children != NULL, -1);
|
||||
return (* GTK_TREE_MODEL_GET_CLASS (tree_model)->node_n_children) (tree_model, node);
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->node_n_children != NULL, -1);
|
||||
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->node_n_children) (tree_model, node);
|
||||
}
|
||||
|
||||
GtkTreeNode
|
||||
@ -407,15 +321,15 @@ gtk_tree_model_node_nth_child (GtkTreeModel *tree_model,
|
||||
GtkTreeNode node,
|
||||
gint n)
|
||||
{
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_GET_CLASS (tree_model)->node_nth_child != NULL, NULL);
|
||||
return (* GTK_TREE_MODEL_GET_CLASS (tree_model)->node_nth_child) (tree_model, node, n);
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->node_nth_child != NULL, NULL);
|
||||
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->node_nth_child) (tree_model, node, n);
|
||||
}
|
||||
|
||||
GtkTreeNode
|
||||
gtk_tree_model_node_parent (GtkTreeModel *tree_model,
|
||||
GtkTreeNode node)
|
||||
{
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_GET_CLASS (tree_model)->node_parent != NULL, NULL);
|
||||
return (* GTK_TREE_MODEL_GET_CLASS (tree_model)->node_parent) (tree_model, node);
|
||||
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->node_parent != NULL, NULL);
|
||||
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->node_parent) (tree_model, node);
|
||||
}
|
||||
|
||||
|
@ -27,27 +27,25 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GTK_TYPE_TREE_MODEL (gtk_tree_model_get_type ())
|
||||
#define GTK_TREE_MODEL(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_TREE_MODEL, GtkTreeModel))
|
||||
#define GTK_TREE_MODEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_TREE_MODEL, GtkTreeModelClass))
|
||||
#define GTK_IS_TREE_MODEL(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_TREE_MODEL))
|
||||
#define GTK_IS_TREE_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), GTK_TYPE_TREE_MODEL))
|
||||
#define GTK_TREE_MODEL_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_TREE_MODEL, GtkTreeModelClass))
|
||||
#define GTK_TREE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_MODEL, GtkTreeModel))
|
||||
#define GTK_IS_TREE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_MODEL))
|
||||
#define GTK_TREE_MODEL_GET_IFACE(obj) ((GtkTreeModelIface *)g_type_interface_peek (((GTypeInstance *)GTK_TREE_MODEL (obj))->g_class, GTK_TYPE_TREE_MODEL))
|
||||
|
||||
|
||||
typedef gpointer GtkTreeNode;
|
||||
typedef struct _GtkTreePath GtkTreePath;
|
||||
typedef struct _GtkTreeModel GtkTreeModel;
|
||||
typedef struct _GtkTreeModelClass GtkTreeModelClass;
|
||||
typedef struct _GtkTreeModel GtkTreeModel; /* Dummy typedef */
|
||||
typedef struct _GtkTreeModelIface GtkTreeModelIface;
|
||||
|
||||
struct _GtkTreeModel
|
||||
struct _GtkTreeModelIface
|
||||
{
|
||||
GtkObject parent;
|
||||
};
|
||||
GTypeInterface g_iface;
|
||||
|
||||
struct _GtkTreeModelClass
|
||||
{
|
||||
GtkObjectClass parent_class;
|
||||
|
||||
/* signals */
|
||||
/* Signals */
|
||||
/* Currently unimplemented as interfaces do not support signals yet, so
|
||||
* objects implementing this interface need this. Later, it will be moved
|
||||
* back here.
|
||||
*/
|
||||
void (* node_changed) (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeNode node);
|
||||
@ -87,7 +85,7 @@ struct _GtkTreeModelClass
|
||||
|
||||
|
||||
/* Basic tree_model operations */
|
||||
GtkType gtk_tree_model_get_type (void);
|
||||
GtkType gtk_tree_model_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* GtkTreePath Operations */
|
||||
GtkTreePath *gtk_tree_path_new (void);
|
||||
|
@ -25,8 +25,19 @@
|
||||
|
||||
#define G_NODE(node) ((GNode *)node)
|
||||
|
||||
static void gtk_tree_store_init (GtkTreeStore *TreeStore);
|
||||
static void gtk_tree_store_class_init (GtkTreeStoreClass *klass);
|
||||
enum {
|
||||
NODE_CHANGED,
|
||||
NODE_INSERTED,
|
||||
NODE_CHILD_TOGGLED,
|
||||
NODE_DELETED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint tree_store_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static void gtk_tree_store_init (GtkTreeStore *tree_store);
|
||||
static void gtk_tree_store_class_init (GtkTreeStoreClass *tree_store_class);
|
||||
static void gtk_tree_store_tree_model_init (GtkTreeModelIface *iface);
|
||||
static gint gtk_tree_store_get_n_columns (GtkTreeModel *tree_model);
|
||||
static GtkTreeNode gtk_tree_store_get_node (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path);
|
||||
@ -51,8 +62,6 @@ static GtkTreeNode gtk_tree_store_node_parent (GtkTreeModel *tree_mo
|
||||
GtkTreeNode node);
|
||||
|
||||
|
||||
static GtkTreeModelClass *parent_class = NULL;
|
||||
|
||||
|
||||
GtkType
|
||||
gtk_tree_store_get_type (void)
|
||||
@ -74,33 +83,81 @@ gtk_tree_store_get_type (void)
|
||||
(GInstanceInitFunc) gtk_tree_store_init
|
||||
};
|
||||
|
||||
static const GInterfaceInfo tree_model_info =
|
||||
{
|
||||
(GInterfaceInitFunc) gtk_tree_store_tree_model_init,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
tree_store_type = g_type_register_static (GTK_TYPE_TREE_MODEL, "GtkTreeStore", &tree_store_info);
|
||||
g_type_add_interface_static (tree_store_type,
|
||||
GTK_TYPE_TREE_MODEL,
|
||||
&tree_model_info);
|
||||
}
|
||||
|
||||
return tree_store_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_store_class_init (GtkTreeStoreClass *klass)
|
||||
gtk_tree_store_class_init (GtkTreeStoreClass *tree_store_class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkTreeModelClass *tree_model_class;
|
||||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
tree_model_class = (GtkTreeModelClass *) klass;
|
||||
object_class = (GtkObjectClass *) tree_store_class;
|
||||
|
||||
parent_class = gtk_type_class (gtk_tree_model_get_type ());
|
||||
tree_store_signals[NODE_CHANGED] =
|
||||
gtk_signal_new ("node_changed",
|
||||
GTK_RUN_FIRST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkTreeStoreClass, node_changed),
|
||||
gtk_marshal_NONE__POINTER_POINTER,
|
||||
GTK_TYPE_NONE, 2,
|
||||
GTK_TYPE_POINTER,
|
||||
GTK_TYPE_POINTER);
|
||||
tree_store_signals[NODE_INSERTED] =
|
||||
gtk_signal_new ("node_inserted",
|
||||
GTK_RUN_FIRST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkTreeStoreClass, node_inserted),
|
||||
gtk_marshal_NONE__POINTER_POINTER,
|
||||
GTK_TYPE_NONE, 2,
|
||||
GTK_TYPE_POINTER,
|
||||
GTK_TYPE_POINTER);
|
||||
tree_store_signals[NODE_CHILD_TOGGLED] =
|
||||
gtk_signal_new ("node_child_toggled",
|
||||
GTK_RUN_FIRST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkTreeStoreClass, node_child_toggled),
|
||||
gtk_marshal_NONE__POINTER_POINTER,
|
||||
GTK_TYPE_NONE, 2,
|
||||
GTK_TYPE_POINTER,
|
||||
GTK_TYPE_POINTER);
|
||||
tree_store_signals[NODE_DELETED] =
|
||||
gtk_signal_new ("node_deleted",
|
||||
GTK_RUN_FIRST,
|
||||
GTK_CLASS_TYPE (object_class),
|
||||
GTK_SIGNAL_OFFSET (GtkTreeStoreClass, node_deleted),
|
||||
gtk_marshal_NONE__POINTER,
|
||||
GTK_TYPE_NONE, 1,
|
||||
GTK_TYPE_POINTER);
|
||||
|
||||
tree_model_class->get_n_columns = gtk_tree_store_get_n_columns;
|
||||
tree_model_class->get_node = gtk_tree_store_get_node;
|
||||
tree_model_class->get_path = gtk_tree_store_get_path;
|
||||
tree_model_class->node_get_value = gtk_tree_store_node_get_value;
|
||||
tree_model_class->node_next = gtk_tree_store_node_next;
|
||||
tree_model_class->node_children = gtk_tree_store_node_children;
|
||||
tree_model_class->node_has_child = gtk_tree_store_node_has_child;
|
||||
tree_model_class->node_n_children = gtk_tree_store_node_n_children;
|
||||
tree_model_class->node_nth_child = gtk_tree_store_node_nth_child;
|
||||
tree_model_class->node_parent = gtk_tree_store_node_parent;
|
||||
gtk_object_class_add_signals (object_class, tree_store_signals, LAST_SIGNAL);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_store_tree_model_init (GtkTreeModelIface *iface)
|
||||
{
|
||||
iface->get_n_columns = gtk_tree_store_get_n_columns;
|
||||
iface->get_node = gtk_tree_store_get_node;
|
||||
iface->get_path = gtk_tree_store_get_path;
|
||||
iface->node_get_value = gtk_tree_store_node_get_value;
|
||||
iface->node_next = gtk_tree_store_node_next;
|
||||
iface->node_children = gtk_tree_store_node_children;
|
||||
iface->node_has_child = gtk_tree_store_node_has_child;
|
||||
iface->node_n_children = gtk_tree_store_node_n_children;
|
||||
iface->node_nth_child = gtk_tree_store_node_nth_child;
|
||||
iface->node_parent = gtk_tree_store_node_parent;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -37,7 +37,7 @@ typedef struct _GtkTreeStoreClass GtkTreeStoreClass;
|
||||
|
||||
struct _GtkTreeStore
|
||||
{
|
||||
GtkTreeModel parent;
|
||||
GtkObject parent;
|
||||
GtkTreeNode root;
|
||||
gint n_columns;
|
||||
GType *column_headers;
|
||||
@ -45,7 +45,21 @@ struct _GtkTreeStore
|
||||
|
||||
struct _GtkTreeStoreClass
|
||||
{
|
||||
GtkTreeModelClass parent_class;
|
||||
GtkObjectClass parent_class;
|
||||
|
||||
/* signals */
|
||||
/* Will be moved into the GtkTreeModelIface eventually */
|
||||
void (* node_changed) (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeNode node);
|
||||
void (* node_inserted) (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeNode node);
|
||||
void (* node_child_toggled) (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeNode node);
|
||||
void (* node_deleted) (GtkTreeModel *tree_model,
|
||||
GtkTreePath *path);
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user