aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/e-table
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-06-02 08:18:00 +0800
committerChris Lahey <clahey@src.gnome.org>2000-06-02 08:18:00 +0800
commit0a898d1c96145bcc37fef5dad685f8c47bd98189 (patch)
tree8c31740349faf59f9fe4d6736171798bc350f036 /widgets/e-table
parentf4eed74cbc66265957f938f13f1baa15e76c421e (diff)
downloadgsoc2013-evolution-0a898d1c96145bcc37fef5dad685f8c47bd98189.tar
gsoc2013-evolution-0a898d1c96145bcc37fef5dad685f8c47bd98189.tar.gz
gsoc2013-evolution-0a898d1c96145bcc37fef5dad685f8c47bd98189.tar.bz2
gsoc2013-evolution-0a898d1c96145bcc37fef5dad685f8c47bd98189.tar.lz
gsoc2013-evolution-0a898d1c96145bcc37fef5dad685f8c47bd98189.tar.xz
gsoc2013-evolution-0a898d1c96145bcc37fef5dad685f8c47bd98189.tar.zst
gsoc2013-evolution-0a898d1c96145bcc37fef5dad685f8c47bd98189.zip
Added e_table_get_selected_view_row.
2000-06-01 Christopher James Lahey <clahey@helixcode.com> * e-table-group-container.c, e-table-group-leaf.c, e-table-group.c, e-table-group.h, e-table-item.c, e-table.c, e-table.h: Added e_table_get_selected_view_row. svn path=/trunk/; revision=3351
Diffstat (limited to 'widgets/e-table')
-rw-r--r--widgets/e-table/ChangeLog6
-rw-r--r--widgets/e-table/e-table-group-container.c17
-rw-r--r--widgets/e-table/e-table-group-leaf.c12
-rw-r--r--widgets/e-table/e-table-group.c21
-rw-r--r--widgets/e-table/e-table-group.h2
-rw-r--r--widgets/e-table/e-table-item.c6
-rw-r--r--widgets/e-table/e-table.c6
-rw-r--r--widgets/e-table/e-table.h2
8 files changed, 68 insertions, 4 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index f711f5c832..431d77976f 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,3 +1,9 @@
+2000-06-01 Christopher James Lahey <clahey@helixcode.com>
+
+ * e-table-group-container.c, e-table-group-leaf.c,
+ e-table-group.c, e-table-group.h, e-table-item.c, e-table.c,
+ e-table.h: Added e_table_get_selected_view_row.
+
2000-05-30 Christopher James Lahey <clahey@helixcode.com>
* e-cell-text.c, e-cell-text.h: Added bold column's to ECellText.
diff --git a/widgets/e-table/e-table-group-container.c b/widgets/e-table/e-table-group-container.c
index 900edb023f..04ddb011c1 100644
--- a/widgets/e-table/e-table-group-container.c
+++ b/widgets/e-table/e-table-group-container.c
@@ -469,6 +469,22 @@ etgc_select_row (ETableGroup *etg, gint row)
}
}
+static int
+etgc_get_selected_view_row (ETableGroup *etg)
+{
+ ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
+ GList *list;
+ int count = 0;
+ for (list = etgc->children; list; list = g_list_next(list)) {
+ ETableGroup *group = ((ETableGroupContainerChildNode *)list->data)->child;
+ int row = e_table_group_get_selected_view_row(group);
+ if (row != -1)
+ return count + row;
+ count += e_table_group_row_count(group);
+ }
+ return -1;
+}
+
static void
etgc_set_focus (ETableGroup *etg, EFocus direction, gint view_col)
{
@@ -633,6 +649,7 @@ etgc_class_init (GtkObjectClass *object_class)
e_group_class->row_count = etgc_row_count;
e_group_class->set_focus = etgc_set_focus;
e_group_class->select_row = etgc_select_row;
+ e_group_class->get_selected_view_row = etgc_get_selected_view_row;
e_group_class->unfocus = etgc_unfocus;
e_group_class->get_focus_column = etgc_get_focus_column;
diff --git a/widgets/e-table/e-table-group-leaf.c b/widgets/e-table/e-table-group-leaf.c
index 50241f9990..29273c4f73 100644
--- a/widgets/e-table/e-table-group-leaf.c
+++ b/widgets/e-table/e-table-group-leaf.c
@@ -198,6 +198,17 @@ etgl_select_row (ETableGroup *etg, gint row)
e_table_item_focus(etgl->item, 0, row);
}
+static int
+etgl_get_selected_view_row (ETableGroup *etg)
+{
+ ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
+ int row;
+ gtk_object_get(GTK_OBJECT(etgl->item),
+ "cursor_row", &row,
+ NULL);
+ return row;
+}
+
static void
etgl_unfocus (ETableGroup *etg)
{
@@ -321,6 +332,7 @@ etgl_class_init (GtkObjectClass *object_class)
e_group_class->set_focus = etgl_set_focus;
e_group_class->select_row = etgl_select_row;
e_group_class->unfocus = etgl_unfocus;
+ e_group_class->get_selected_view_row = etgl_get_selected_view_row;
e_group_class->get_focus_column = etgl_get_focus_column;
gtk_object_add_arg_type ("ETableGroupLeaf::drawgrid", GTK_TYPE_BOOL,
diff --git a/widgets/e-table/e-table-group.c b/widgets/e-table/e-table-group.c
index 4258640a97..2e7f94bb1f 100644
--- a/widgets/e-table/e-table-group.c
+++ b/widgets/e-table/e-table-group.c
@@ -180,6 +180,18 @@ e_table_group_select_row (ETableGroup *etg,
ETG_CLASS (etg)->select_row (etg, row);
}
+int
+e_table_group_get_selected_view_row (ETableGroup *etg)
+{
+ g_return_val_if_fail (etg != NULL, -1);
+ g_return_val_if_fail (E_IS_TABLE_GROUP (etg), -1);
+
+ if (ETG_CLASS (etg)->get_selected_view_row)
+ return ETG_CLASS (etg)->get_selected_view_row (etg);
+ else
+ return -1;
+}
+
void
e_table_group_unfocus (ETableGroup *etg)
{
@@ -314,11 +326,12 @@ etg_class_init (GtkObjectClass *object_class)
klass->add = NULL;
klass->add_all = NULL;
klass->remove = NULL;
- klass->get_count = NULL;
- klass->row_count = NULL;
- klass->increment = NULL;
- klass->set_focus = NULL;
+ klass->get_count = NULL;
+ klass->row_count = NULL;
+ klass->increment = NULL;
+ klass->set_focus = NULL;
klass->select_row = NULL;
+ klass->get_selected_view_row = NULL;
klass->unfocus = NULL;
klass->get_focus = etg_get_focus;
klass->get_ecol = NULL;
diff --git a/widgets/e-table/e-table-group.h b/widgets/e-table/e-table-group.h
index 3389cee984..22e2a3dc8e 100644
--- a/widgets/e-table/e-table-group.h
+++ b/widgets/e-table/e-table-group.h
@@ -56,6 +56,7 @@ typedef struct {
void (*increment) (ETableGroup *etg, gint position, gint amount);
void (*set_focus) (ETableGroup *etg, EFocus direction, gint view_col);
void (*select_row) (ETableGroup *etg, gint row);
+ int (*get_selected_view_row) (ETableGroup *etg);
void (*unfocus) (ETableGroup *etg);
gboolean (*get_focus) (ETableGroup *etg);
gint (*get_focus_column) (ETableGroup *etg);
@@ -78,6 +79,7 @@ void e_table_group_set_focus (ETableGroup *etg,
gint view_col);
void e_table_group_select_row (ETableGroup *etg,
gint row);
+int e_table_group_get_selected_view_row (ETableGroup *etg);
void e_table_group_unfocus (ETableGroup *etg);
gboolean e_table_group_get_focus (ETableGroup *etg);
gint e_table_group_get_focus_column (ETableGroup *etg);
diff --git a/widgets/e-table/e-table-item.c b/widgets/e-table/e-table-item.c
index 42a91ee2c3..1a10363fcc 100644
--- a/widgets/e-table/e-table-item.c
+++ b/widgets/e-table/e-table-item.c
@@ -45,6 +45,7 @@ enum {
ARG_CURSOR_MODE,
ARG_LENGTH_THRESHOLD,
ARG_HAS_CURSOR,
+ ARG_CURSOR_ROW,
ARG_MINIMUM_WIDTH,
ARG_WIDTH,
@@ -793,6 +794,9 @@ eti_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
case ARG_HAS_CURSOR:
GTK_VALUE_BOOL (*arg) = (eti->cursor_row != -1);
break;
+ case ARG_CURSOR_ROW:
+ GTK_VALUE_INT (*arg) = eti->cursor_row;
+ break;
default:
arg->type = GTK_TYPE_INVALID;
}
@@ -1406,6 +1410,8 @@ eti_class_init (GtkObjectClass *object_class)
GTK_ARG_READABLE, ARG_HEIGHT);
gtk_object_add_arg_type ("ETableItem::has_cursor", GTK_TYPE_BOOL,
GTK_ARG_READWRITE, ARG_HAS_CURSOR);
+ gtk_object_add_arg_type ("ETableItem::has_cursor", GTK_TYPE_INT,
+ GTK_ARG_READABLE, ARG_CURSOR_ROW);
eti_signals [ROW_SELECTION] =
gtk_signal_new ("row_selection",
diff --git a/widgets/e-table/e-table.c b/widgets/e-table/e-table.c
index 25095db72d..bf3aaa71cb 100644
--- a/widgets/e-table/e-table.c
+++ b/widgets/e-table/e-table.c
@@ -645,6 +645,12 @@ e_table_select_row (ETable *e_table, int row)
e_table_group_select_row(e_table->group, row);
}
+int
+e_table_get_selected_view_row (ETable *e_table)
+{
+ return e_table_group_get_selected_view_row(e_table->group);
+}
+
static void
et_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
{
diff --git a/widgets/e-table/e-table.h b/widgets/e-table/e-table.h
index 52ba005dc2..cba2919669 100644
--- a/widgets/e-table/e-table.h
+++ b/widgets/e-table/e-table.h
@@ -84,6 +84,8 @@ void e_table_save_specification (ETable *e_table, gchar *filename);
void e_table_select_row (ETable *e_table,
int row);
+/* -1 means no selection. */
+int e_table_get_selected_view_row (ETable *e_table);
END_GNOME_DECLS