diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-08-25 05:13:17 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-08-25 05:13:17 +0800 |
commit | 5e1949f93523c93bd8a1384e2c71a12e0717219d (patch) | |
tree | 7731a10fafe498700b4d95841cef912aa16d8762 /widgets/table | |
parent | 3877d4077d333964b165d45e3e400a2b5ea1296f (diff) | |
download | gsoc2013-evolution-5e1949f93523c93bd8a1384e2c71a12e0717219d.tar.gz gsoc2013-evolution-5e1949f93523c93bd8a1384e2c71a12e0717219d.tar.zst gsoc2013-evolution-5e1949f93523c93bd8a1384e2c71a12e0717219d.zip |
Added a click signal which gets sent if the user hits the left or middle
2000-08-24 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-item.h,
e-table.c, e-table.h: Added a click signal which gets sent if the
user hits the left or middle mouse button on a cell.
svn path=/trunk/; revision=5020
Diffstat (limited to 'widgets/table')
-rw-r--r-- | widgets/table/e-table-group-container.c | 9 | ||||
-rw-r--r-- | widgets/table/e-table-group-leaf.c | 11 | ||||
-rw-r--r-- | widgets/table/e-table-group.c | 25 | ||||
-rw-r--r-- | widgets/table/e-table-group.h | 5 | ||||
-rw-r--r-- | widgets/table/e-table-item.c | 13 | ||||
-rw-r--r-- | widgets/table/e-table-item.h | 1 | ||||
-rw-r--r-- | widgets/table/e-table.c | 24 | ||||
-rw-r--r-- | widgets/table/e-table.h | 1 |
8 files changed, 89 insertions, 0 deletions
diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c index 3a68bc044b..7118ffae0b 100644 --- a/widgets/table/e-table-group-container.c +++ b/widgets/table/e-table-group-container.c @@ -341,6 +341,13 @@ child_right_click (ETableGroup *etg, int row, int col, GdkEvent *event, } static gint +child_click (ETableGroup *etg, int row, int col, GdkEvent *event, + ETableGroupContainer *etgc) +{ + return e_table_group_click (E_TABLE_GROUP (etgc), row, col, event); +} + +static gint child_key_press (ETableGroup *etg, int row, int col, GdkEvent *event, ETableGroupContainer *etgc) { @@ -401,6 +408,8 @@ etgc_add (ETableGroup *etg, gint row) GTK_SIGNAL_FUNC (child_double_click), etgc); gtk_signal_connect (GTK_OBJECT (child), "right_click", GTK_SIGNAL_FUNC (child_right_click), etgc); + gtk_signal_connect (GTK_OBJECT (child), "click", + GTK_SIGNAL_FUNC (child_click), etgc); gtk_signal_connect (GTK_OBJECT (child), "key_press", GTK_SIGNAL_FUNC (child_key_press), etgc); child_node->child = child; diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c index c4792eb87e..d083d44f21 100644 --- a/widgets/table/e-table-group-leaf.c +++ b/widgets/table/e-table-group-leaf.c @@ -115,6 +115,15 @@ etgl_right_click (GtkObject *object, gint row, gint col, GdkEvent *event, ETable return 0; } +static gint +etgl_click (GtkObject *object, gint row, gint col, GdkEvent *event, ETableGroupLeaf *etgl) +{ + if (row < E_TABLE_SUBSET(etgl->subset)->n_map) + return e_table_group_click (E_TABLE_GROUP(etgl), E_TABLE_SUBSET(etgl->subset)->map_table[row], col, event); + else + return 0; +} + static void etgl_reflow (GnomeCanvasItem *item, gint flags) { @@ -154,6 +163,8 @@ etgl_realize (GnomeCanvasItem *item) GTK_SIGNAL_FUNC(etgl_double_click), etgl); gtk_signal_connect (GTK_OBJECT(etgl->item), "right_click", GTK_SIGNAL_FUNC(etgl_right_click), etgl); + gtk_signal_connect (GTK_OBJECT(etgl->item), "click", + GTK_SIGNAL_FUNC(etgl_click), etgl); gtk_signal_connect (GTK_OBJECT(etgl->item), "key_press", GTK_SIGNAL_FUNC(etgl_key_press), etgl); e_canvas_item_request_reflow(item); diff --git a/widgets/table/e-table-group.c b/widgets/table/e-table-group.c index fbd9026096..213a94969f 100644 --- a/widgets/table/e-table-group.c +++ b/widgets/table/e-table-group.c @@ -28,6 +28,7 @@ enum { CURSOR_CHANGE, DOUBLE_CLICK, RIGHT_CLICK, + CLICK, KEY_PRESS, LAST_SIGNAL }; @@ -298,6 +299,21 @@ e_table_group_right_click (ETableGroup *e_table_group, gint row, gint col, GdkEv } gint +e_table_group_click (ETableGroup *e_table_group, gint row, gint col, GdkEvent *event) +{ + gint return_val = 0; + + g_return_val_if_fail (e_table_group != NULL, 0); + g_return_val_if_fail (E_IS_TABLE_GROUP (e_table_group), 0); + + gtk_signal_emit (GTK_OBJECT (e_table_group), + etg_signals [CLICK], + row, col, event, &return_val); + + return return_val; +} + +gint e_table_group_key_press (ETableGroup *e_table_group, gint row, gint col, GdkEvent *event) { gint return_val = 0; @@ -363,6 +379,7 @@ etg_class_init (GtkObjectClass *object_class) klass->cursor_change = NULL; klass->double_click = NULL; klass->right_click = NULL; + klass->click = NULL; klass->key_press = NULL; klass->add = NULL; @@ -406,6 +423,14 @@ etg_class_init (GtkObjectClass *object_class) e_marshal_INT__INT_INT_POINTER, GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); + etg_signals [CLICK] = + gtk_signal_new ("click", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (ETableGroupClass, click), + e_marshal_INT__INT_INT_POINTER, + GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); + etg_signals [KEY_PRESS] = gtk_signal_new ("key_press", GTK_RUN_LAST, diff --git a/widgets/table/e-table-group.h b/widgets/table/e-table-group.h index a3afe7f5e1..9a67a7b9d3 100644 --- a/widgets/table/e-table-group.h +++ b/widgets/table/e-table-group.h @@ -48,6 +48,7 @@ typedef struct { void (*cursor_change) (ETableGroup *etg, int row); void (*double_click) (ETableGroup *etg, int row); gint (*right_click) (ETableGroup *etg, int row, int col, GdkEvent *event); + gint (*click) (ETableGroup *etg, int row, int col, GdkEvent *event); gint (*key_press) (ETableGroup *etg, int row, int col, GdkEvent *event); /* Virtual functions. */ @@ -121,6 +122,10 @@ gint e_table_group_right_click (ETableGroup *etg, gint row, gint col, GdkEvent *event); +gint e_table_group_click (ETableGroup *etg, + gint row, + gint col, + GdkEvent *event); gint e_table_group_key_press (ETableGroup *etg, gint row, gint col, diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index afa1bb8f96..fdc5f1b36b 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -33,6 +33,7 @@ enum { CURSOR_CHANGE, DOUBLE_CLICK, RIGHT_CLICK, + CLICK, KEY_PRESS, LAST_SIGNAL }; @@ -1440,6 +1441,9 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) e_cell_event (ecell_view, e, view_to_model_col(eti, col), col, row); } + + gtk_signal_emit (GTK_OBJECT (eti), eti_signals [RIGHT_CLICK], + row, col, e, &return_val); break; case 3: gnome_canvas_item_w2i (item, &e->button.x, &e->button.y); @@ -1709,6 +1713,7 @@ eti_class_init (GtkObjectClass *object_class) eti_class->cursor_change = NULL; eti_class->double_click = NULL; eti_class->right_click = NULL; + eti_class->click = NULL; eti_class->key_press = NULL; gtk_object_add_arg_type ("ETableItem::ETableHeader", GTK_TYPE_OBJECT, @@ -1759,6 +1764,14 @@ eti_class_init (GtkObjectClass *object_class) e_marshal_INT__INT_INT_POINTER, GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); + eti_signals [CLICK] = + gtk_signal_new ("click", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (ETableItemClass, click), + e_marshal_INT__INT_INT_POINTER, + GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); + eti_signals [KEY_PRESS] = gtk_signal_new ("key_press", GTK_RUN_LAST, diff --git a/widgets/table/e-table-item.h b/widgets/table/e-table-item.h index 2d81bca758..82171f851f 100644 --- a/widgets/table/e-table-item.h +++ b/widgets/table/e-table-item.h @@ -99,6 +99,7 @@ typedef struct { void (*cursor_change) (ETableItem *eti, int row); void (*double_click) (ETableItem *eti, int row); gint (*right_click) (ETableItem *eti, int row, int col, GdkEvent *event); + gint (*click) (ETableItem *eti, int row, int col, GdkEvent *event); gint (*key_press) (ETableItem *eti, int row, int col, GdkEvent *event); } ETableItemClass; diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 8dd8721711..1cf9e81e9a 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -43,6 +43,7 @@ enum { CURSOR_CHANGE, DOUBLE_CLICK, RIGHT_CLICK, + CLICK, KEY_PRESS, TABLE_DRAG_BEGIN, @@ -317,6 +318,16 @@ group_right_click (ETableGroup *etg, int row, int col, GdkEvent *event, ETable * } static gint +group_click (ETableGroup *etg, int row, int col, GdkEvent *event, ETable *et) +{ + int return_val; + gtk_signal_emit (GTK_OBJECT (et), + et_signals [CLICK], + row, col, event, &return_val); + return return_val; +} + +static gint group_key_press (ETableGroup *etg, int row, int col, GdkEvent *event, ETable *et) { int return_val; @@ -353,6 +364,8 @@ changed_idle (gpointer data) GTK_SIGNAL_FUNC (group_double_click), et); gtk_signal_connect (GTK_OBJECT (et->group), "right_click", GTK_SIGNAL_FUNC (group_right_click), et); + gtk_signal_connect (GTK_OBJECT (et->group), "click", + GTK_SIGNAL_FUNC (group_click), et); gtk_signal_connect (GTK_OBJECT (et->group), "key_press", GTK_SIGNAL_FUNC (group_key_press), et); e_table_fill_table (et, et->model); @@ -491,6 +504,8 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h GTK_SIGNAL_FUNC(group_double_click), e_table); gtk_signal_connect (GTK_OBJECT (e_table->group), "right_click", GTK_SIGNAL_FUNC(group_right_click), e_table); + gtk_signal_connect (GTK_OBJECT (e_table->group), "click", + GTK_SIGNAL_FUNC(group_click), e_table); gtk_signal_connect (GTK_OBJECT (e_table->group), "key_press", GTK_SIGNAL_FUNC(group_key_press), e_table); @@ -1584,6 +1599,7 @@ e_table_class_init (GtkObjectClass *object_class) klass->cursor_change = NULL; klass->double_click = NULL; klass->right_click = NULL; + klass->click = NULL; klass->key_press = NULL; klass->table_drag_begin = NULL; @@ -1620,6 +1636,14 @@ e_table_class_init (GtkObjectClass *object_class) e_marshal_INT__INT_INT_POINTER, GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); + et_signals [CLICK] = + gtk_signal_new ("click", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (ETableClass, click), + e_marshal_INT__INT_INT_POINTER, + GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); + et_signals [KEY_PRESS] = gtk_signal_new ("key_press", GTK_RUN_LAST, diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h index 19dcbfecc8..f42ca51069 100644 --- a/widgets/table/e-table.h +++ b/widgets/table/e-table.h @@ -97,6 +97,7 @@ typedef struct { void (*cursor_change) (ETable *et, int row); void (*double_click) (ETable *et, int row); gint (*right_click) (ETable *et, int row, int col, GdkEvent *event); + gint (*click) (ETable *et, int row, int col, GdkEvent *event); gint (*key_press) (ETable *et, int row, int col, GdkEvent *event); void (*set_scroll_adjustments) (ETable *table, |