aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/e-table/e-tree-gnode.c
diff options
context:
space:
mode:
authorChris Toshok <toshok@helixcode.com>2000-06-11 12:20:56 +0800
committerChris Toshok <toshok@src.gnome.org>2000-06-11 12:20:56 +0800
commitaac3f2c8b69f579e04314b21a13d752afe4bd317 (patch)
treedec49e04bac8721e060f07003aa90bcb76d30479 /widgets/e-table/e-tree-gnode.c
parent835ec00d01e23256143229d8e2c99f68afae1e6c (diff)
downloadgsoc2013-evolution-aac3f2c8b69f579e04314b21a13d752afe4bd317.tar
gsoc2013-evolution-aac3f2c8b69f579e04314b21a13d752afe4bd317.tar.gz
gsoc2013-evolution-aac3f2c8b69f579e04314b21a13d752afe4bd317.tar.bz2
gsoc2013-evolution-aac3f2c8b69f579e04314b21a13d752afe4bd317.tar.lz
gsoc2013-evolution-aac3f2c8b69f579e04314b21a13d752afe4bd317.tar.xz
gsoc2013-evolution-aac3f2c8b69f579e04314b21a13d752afe4bd317.tar.zst
gsoc2013-evolution-aac3f2c8b69f579e04314b21a13d752afe4bd317.zip
change things so we focus the cell and select the row, and also dispatch
2000-06-10 Chris Toshok <toshok@helixcode.com> * e-table-item.c (eti_event): change things so we focus the cell and select the row, and also dispatch the event to that row/cell. This fixes the problem with the tree where you had to click twice to activate the tree controls. * Makefile.am (libetable_a_SOURCES): remove e-tree-gnode.* and add e-tree-simple.* (icons): add tree-expanded.xpm and tree-unexpanded.xpm * e-cell-tree.c (ect_enter_edit): defer to subcell's view. (ect_leave_edit): defer to subcell's view. (visible_depth_of_node): visual depth, taking into account that the root node of the model might not be displayed. (offset_of_node): return the offset used to shift the subcell over. (ect_draw): don't draw vertical lines if we're the leftmode node (a visual root node). also, don't shift x2 by the subcell offset, so we get ellipses like we're supposed to. (ect_event): remove GDK_BUTTON_RELEASE from the list of events that we care about. * e-tree-example-1.c: lots of changes, a more dynamic UI so we can test tree model api stuff. * e-tree-gnode.c, e-tree-gnode.c: removed files, since their guts have been rolled into e-tree-model.c * e-tree-model.c, e-tree-model.h: substantially changed. too much to really describe here. this should really be considered the first revision of these files :) * e-tree-simple.c, e-tree-simple.h: analogous to e-table-simple, a subclass that allows the use of function pointers. svn path=/trunk/; revision=3519
Diffstat (limited to 'widgets/e-table/e-tree-gnode.c')
-rw-r--r--widgets/e-table/e-tree-gnode.c210
1 files changed, 0 insertions, 210 deletions
diff --git a/widgets/e-table/e-tree-gnode.c b/widgets/e-table/e-tree-gnode.c
deleted file mode 100644
index ce53751b56..0000000000
--- a/widgets/e-table/e-tree-gnode.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-gnode.c: a Tree Model that reflects a GNode structure visually.
- *
- * Author:
- * Chris Toshok (toshok@helixcode.com)
- *
- * (C) 2000 Helix Code, Inc.
- */
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include "e-util/e-util.h"
-#include "e-tree-gnode.h"
-
-#define PARENT_TYPE E_TREE_MODEL_TYPE
-
-static ETreePath *
-gnode_get_root (ETreeModel *etm)
-{
- ETreeGNode *etg = E_TREE_GNODE (etm);
- ETreePath *path = NULL;
-
- path = g_list_append(path, etg->root);
-
- return path;
-}
-
-static ETreePath *
-gnode_get_prev (ETreeModel *etm, ETreePath *node)
-{
- ETreePath *prev_path;
-
- GNode *gnode;
- GNode *prev_sibling;
-
- g_return_val_if_fail (node && node->data, NULL);
-
- gnode = (GNode*)node->data;
- prev_sibling = g_node_prev_sibling(gnode);
-
- if (!prev_sibling)
- return NULL;
-
- prev_path = g_list_copy (node->next);
- prev_path = g_list_prepend (prev_path, prev_sibling);
- return prev_path;
-}
-
-static ETreePath *
-gnode_get_next (ETreeModel *etm, ETreePath *node)
-{
- ETreePath *next_path;
- GNode *gnode;
- GNode *next_sibling;
-
- g_return_val_if_fail (node && node->data, NULL);
-
- gnode = (GNode*)node->data;
- next_sibling = g_node_next_sibling(gnode);
-
- if (!next_sibling)
- return NULL;
-
- next_path = g_list_copy (node->next);
- next_path = g_list_prepend (next_path, next_sibling);
- return next_path;
-}
-
-static void *
-gnode_value_at (ETreeModel *etm, ETreePath *node, int col)
-{
- ETreeGNode *etg = E_TREE_GNODE (etm);
- GNode *gnode;
-
- g_return_val_if_fail (node && node->data, NULL);
-
- gnode = (GNode*)node->data;
-
- return etg->value_at (etm, gnode, col, etg->data);
-}
-
-static void
-gnode_set_value_at (ETreeModel *etm, ETreePath *node, int col, const void *val)
-{
- ETreeGNode *etg = E_TREE_GNODE (etm);
- GNode *gnode;
-
- g_return_if_fail (node && node->data);
-
- gnode = (GNode*)node->data;
-
- /* XXX */
-}
-
-static gboolean
-gnode_is_editable (ETreeModel *etm, ETreePath *node, int col)
-{
- ETreeGNode *etg = E_TREE_GNODE (etm);
- GNode *gnode;
-
- g_return_val_if_fail (node && node->data, FALSE);
-
- gnode = (GNode*)node->data;
-
- /* XXX */
- return FALSE;
-}
-
-static guint
-gnode_get_children (ETreeModel *etm, ETreePath *node, ETreePath ***paths)
-{
- ETreeGNode *etg = E_TREE_GNODE (etm);
- GNode *gnode;
- guint n_children;
-
- g_return_val_if_fail (node && node->data, 0);
-
- gnode = (GNode*)node->data;
-
- n_children = g_node_n_children (gnode);
-
- if (paths)
- {
- int i;
- (*paths) = g_malloc (sizeof (ETreePath*) * n_children);
- for (i = 0; i < n_children; i ++) {
- (*paths)[i] = g_list_copy (node);
- (*paths)[i] = g_list_prepend ((*paths)[i], g_node_nth_child (gnode, i));
- }
- }
-
- return n_children;
-}
-
-static void
-gnode_release_paths (ETreeModel *etm, ETreePath **paths, guint num_paths)
-{
- guint i;
- g_return_if_fail (paths);
-
- for (i = 0; i < num_paths; i ++)
- g_list_free (paths[i]);
- g_free (paths);
-}
-
-static gboolean
-gnode_is_expanded (ETreeModel *etm, ETreePath *node)
-{
- ETreeGNode *etg = E_TREE_GNODE (etm);
- GNode *gnode;
-
- g_return_val_if_fail (node && node->data, FALSE);
-
- gnode = (GNode*)node->data;
-
- return (gboolean)gnode->data;
-}
-
-static void
-gnode_set_expanded (ETreeModel *etm, ETreePath *node, gboolean expanded)
-{
- ETreeGNode *etg = E_TREE_GNODE (etm);
- GNode *gnode;
- int num_descendents;
-
- g_return_if_fail (node && node->data);
-
- gnode = (GNode*)node->data;
-
- /* XXX */
- gnode->data = (gpointer)expanded;
-
- e_table_model_changed (E_TABLE_MODEL(etm));
-}
-
-static void
-e_tree_gnode_class_init (GtkObjectClass *object_class)
-{
- ETreeModelClass *model_class = (ETreeModelClass *) object_class;
-
- model_class->get_root = gnode_get_root;
- model_class->get_next = gnode_get_next;
- model_class->get_prev = gnode_get_prev;
- model_class->value_at = gnode_value_at;
- model_class->set_value_at = gnode_set_value_at;
- model_class->is_editable = gnode_is_editable;
- model_class->get_children = gnode_get_children;
- model_class->release_paths = gnode_release_paths;
- model_class->is_expanded = gnode_is_expanded;
- model_class->set_expanded = gnode_set_expanded;
-}
-
-E_MAKE_TYPE(e_tree_gnode, "ETreeGNode", ETreeGNode, e_tree_gnode_class_init, NULL, PARENT_TYPE)
-
-ETreeModel *
-e_tree_gnode_new (GNode *root_node,
- ETreeGNodeValueAtFn value_at,
- void *data)
-{
- ETreeGNode *etg;
-
- etg = gtk_type_new (e_tree_gnode_get_type ());
-
- etg->root = root_node;
-
- etg->value_at = value_at;
- etg->data = data;
-
- return (ETreeModel*)etg;
-}