From e581631a9ce0803ba629ac67cd8934a6e23753ae Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Thu, 8 Jun 2000 23:16:22 +0000 Subject: New files. A tree model using a GNode structure to store it's info. 2000-06-08 Chris Toshok * e-tree-gnode.c, e-tree-gnode.h: New files. A tree model using a GNode structure to store it's info. * e-tree-model.c, e-tree-model.h: New files. A proxy model sitting between a table model and the real tree model (of which ETreeGNode is an example). * e-cell-tree.c, e-cell-tree.h: New files. A cell renderer capable of wrapping up a subcell and drawing the tree controls for expanding/collapsing trees. * tree-expanded.xpm, tree-unexpanded.xpm: New files. the standard + and - icons. * e-tree-example-1.c: New file, giving a (pretty poor :) example of using ETreeGNode. * Makefile.am: at the tree stuff to the build, and build tree-example-1. * .cvsignore: ignore tree-example-1. svn path=/trunk/; revision=3483 --- widgets/table/e-tree-model.h | 72 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 widgets/table/e-tree-model.h (limited to 'widgets/table/e-tree-model.h') diff --git a/widgets/table/e-tree-model.h b/widgets/table/e-tree-model.h new file mode 100644 index 0000000000..6924f3ea0e --- /dev/null +++ b/widgets/table/e-tree-model.h @@ -0,0 +1,72 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +#ifndef _E_TREE_MODEL_H_ +#define _E_TREE_MODEL_H_ + +#include "e-table-model.h" + +#define E_TREE_MODEL_TYPE (e_tree_model_get_type ()) +#define E_TREE_MODEL(o) (GTK_CHECK_CAST ((o), E_TREE_MODEL_TYPE, ETreeModel)) +#define E_TREE_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_MODEL_TYPE, ETreeModelClass)) +#define E_IS_TREE_MODEL(o) (GTK_CHECK_TYPE ((o), E_TREE_MODEL_TYPE)) +#define E_IS_TREE_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_MODEL_TYPE)) + +typedef gpointer ETreePathItem; +typedef GList ETreePath; + +typedef struct { + ETableModel base; + + ETableModel *source; + + ETreePath *root_node; + + GArray *array; + +} ETreeModel; + +typedef struct { + ETableModelClass parent_class; + + /* + * Virtual methods + */ + ETreePath *(*get_root) (ETreeModel *etm); + + ETreePath *(*get_next) (ETreeModel *etm, ETreePath* node); + ETreePath *(*get_prev) (ETreeModel *etm, ETreePath* node); + + void *(*value_at) (ETreeModel *etm, ETreePath* node, int col); + void (*set_value_at) (ETreeModel *etm, ETreePath* node, int col, const void *val); + gboolean (*is_editable) (ETreeModel *etm, ETreePath* node, int col); + + guint (*get_children) (ETreeModel *etm, ETreePath* node, ETreePath ***paths); + void (*release_paths) (ETreeModel *etm, ETreePath **paths, guint num_paths); + gboolean (*is_expanded) (ETreeModel *etm, ETreePath* node); + void (*set_expanded) (ETreeModel *etm, ETreePath* node, gboolean expanded); + + /* + * Signals + */ + +} ETreeModelClass; + +GtkType e_tree_model_get_type (void); + +ETreeModel *e_tree_model_new (void); + +/* operations on "nodes" in the tree */ +ETreePath * e_tree_model_get_root (ETreeModel *etree); +ETreePath * e_tree_model_node_at_row (ETreeModel *etree, int row); +guint e_tree_model_node_depth (ETreeModel *etree, ETreePath *path); +ETreePath *e_tree_model_node_get_parent (ETreeModel *etree, ETreePath *path); +ETreePath *e_tree_model_node_get_next (ETreeModel *etree, ETreePath *path); +ETreePath *e_tree_model_node_get_prev (ETreeModel *etree, ETreePath *path); +gboolean e_tree_model_node_is_root (ETreeModel *etree, ETreePath *path); + +gboolean e_tree_model_node_is_expandable (ETreeModel *etree, ETreePath *path); +gboolean e_tree_model_node_is_expanded (ETreeModel *etree, ETreePath *path); +guint e_tree_model_node_get_children (ETreeModel *etree, ETreePath *path, ETreePath ***paths); +void e_tree_model_release_paths (ETreeModel *etree, ETreePath **paths, guint num_paths); +guint e_tree_model_node_num_visible_descendents (ETreeModel *etm, ETreePath *node); + +#endif /* _E_TREE_MODEL_H */ -- cgit