diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-06-02 10:57:39 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-06-02 10:57:39 +0800 |
commit | f9b79bb0f6f9f372539af46e26c93c1669762c79 (patch) | |
tree | 4c2bec08f2921cbfba3d079034820c17c201579c /widgets | |
parent | df398954171eb8e1acdeb9c890583521821f2984 (diff) | |
download | gsoc2013-evolution-f9b79bb0f6f9f372539af46e26c93c1669762c79.tar gsoc2013-evolution-f9b79bb0f6f9f372539af46e26c93c1669762c79.tar.gz gsoc2013-evolution-f9b79bb0f6f9f372539af46e26c93c1669762c79.tar.bz2 gsoc2013-evolution-f9b79bb0f6f9f372539af46e26c93c1669762c79.tar.lz gsoc2013-evolution-f9b79bb0f6f9f372539af46e26c93c1669762c79.tar.xz gsoc2013-evolution-f9b79bb0f6f9f372539af46e26c93c1669762c79.tar.zst gsoc2013-evolution-f9b79bb0f6f9f372539af46e26c93c1669762c79.zip |
Added a "key_press" signal.
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-item.h,
e-table.c, e-table.h: Added a "key_press" signal.
svn path=/trunk/; revision=3366
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/e-table/ChangeLog | 6 | ||||
-rw-r--r-- | widgets/e-table/e-table-group-container.c | 9 | ||||
-rw-r--r-- | widgets/e-table/e-table-group-leaf.c | 11 | ||||
-rw-r--r-- | widgets/e-table/e-table-group.c | 25 | ||||
-rw-r--r-- | widgets/e-table/e-table-group.h | 5 | ||||
-rw-r--r-- | widgets/e-table/e-table-item.c | 21 | ||||
-rw-r--r-- | widgets/e-table/e-table-item.h | 1 | ||||
-rw-r--r-- | widgets/e-table/e-table.c | 24 | ||||
-rw-r--r-- | widgets/e-table/e-table.h | 1 | ||||
-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 | 21 | ||||
-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 |
17 files changed, 194 insertions, 6 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog index 2ca43c24f2..7fe58859f5 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-item.h, + e-table.c, e-table.h: Added a "key_press" signal. + 2000-06-01 Dan Winship <danw@helixcode.com> * e-cell-text.h: Remove an offending *. diff --git a/widgets/e-table/e-table-group-container.c b/widgets/e-table/e-table-group-container.c index 04ddb011c1..4aa7e2fe8a 100644 --- a/widgets/e-table/e-table-group-container.c +++ b/widgets/e-table/e-table-group-container.c @@ -323,6 +323,13 @@ child_double_click (ETableGroup *etg, int row, e_table_group_double_click (E_TABLE_GROUP (etgc), row); } +static gint +child_key_press (ETableGroup *etg, int row, int col, GdkEvent *event, + ETableGroupContainer *etgc) +{ + return e_table_group_key_press (E_TABLE_GROUP (etgc), row, col, event); +} + static void etgc_add (ETableGroup *etg, gint row) { @@ -378,6 +385,8 @@ etgc_add (ETableGroup *etg, gint row) GTK_SIGNAL_FUNC (child_cursor_change), etgc); gtk_signal_connect (GTK_OBJECT (child), "double_click", GTK_SIGNAL_FUNC (child_double_click), etgc); + gtk_signal_connect (GTK_OBJECT (child), "key_press", + GTK_SIGNAL_FUNC (child_key_press), etgc); child_node->child = child; child_node->key = e_table_model_duplicate_value (etg->model, etgc->ecol->col_idx, val); child_node->count = 1; diff --git a/widgets/e-table/e-table-group-leaf.c b/widgets/e-table/e-table-group-leaf.c index 29273c4f73..dcf9c280c4 100644 --- a/widgets/e-table/e-table-group-leaf.c +++ b/widgets/e-table/e-table-group-leaf.c @@ -104,6 +104,15 @@ etgl_double_click (GtkObject *object, gint row, ETableGroupLeaf *etgl) e_table_group_double_click (E_TABLE_GROUP(etgl), E_TABLE_SUBSET(etgl->subset)->map_table[row]); } +static gint +etgl_key_press (GtkObject *object, gint row, gint col, GdkEvent *event, ETableGroupLeaf *etgl) +{ + if (row < E_TABLE_SUBSET(etgl->subset)->n_map) + return e_table_group_key_press (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) { @@ -142,6 +151,8 @@ etgl_realize (GnomeCanvasItem *item) GTK_SIGNAL_FUNC(etgl_cursor_change), etgl); gtk_signal_connect (GTK_OBJECT(etgl->item), "double_click", GTK_SIGNAL_FUNC(etgl_double_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/e-table/e-table-group.c b/widgets/e-table/e-table-group.c index 2e7f94bb1f..92c274762b 100644 --- a/widgets/e-table/e-table-group.c +++ b/widgets/e-table/e-table-group.c @@ -31,6 +31,7 @@ enum { ROW_SELECTION, CURSOR_CHANGE, DOUBLE_CLICK, + KEY_PRESS, LAST_SIGNAL }; @@ -271,6 +272,21 @@ e_table_group_double_click (ETableGroup *e_table_group, gint row) row); } +gint +e_table_group_key_press (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 [DOUBLE_CLICK], + row, col, event, &return_val); + + return return_val; +} + ETableHeader * e_table_group_get_header (ETableGroup *etg) { @@ -322,6 +338,7 @@ etg_class_init (GtkObjectClass *object_class) klass->row_selection = NULL; klass->cursor_change = NULL; klass->double_click = NULL; + klass->key_press = NULL; klass->add = NULL; klass->add_all = NULL; @@ -362,6 +379,14 @@ etg_class_init (GtkObjectClass *object_class) gtk_marshal_NONE__INT, GTK_TYPE_NONE, 1, GTK_TYPE_INT); + etg_signals [KEY_PRESS] = + gtk_signal_new ("key_press", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (ETableGroupClass, key_press), + e_marshal_INT__INT_INT_POINTER, + GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); + gtk_object_class_add_signals (object_class, etg_signals, LAST_SIGNAL); } diff --git a/widgets/e-table/e-table-group.h b/widgets/e-table/e-table-group.h index 22e2a3dc8e..2260168cd4 100644 --- a/widgets/e-table/e-table-group.h +++ b/widgets/e-table/e-table-group.h @@ -46,6 +46,7 @@ typedef struct { void (*row_selection) (ETableGroup *etg, int row, gboolean selected); void (*cursor_change) (ETableGroup *etg, int row); void (*double_click) (ETableGroup *etg, int row); + gint (*key_press) (ETableGroup *etg, int row, int col, GdkEvent *event); /* Virtual functions. */ void (*add) (ETableGroup *etg, gint row); @@ -106,6 +107,10 @@ void e_table_group_cursor_change (ETableGroup *etg, gint row); void e_table_group_double_click (ETableGroup *etg, gint row); +gint e_table_group_key_press (ETableGroup *etg, + gint row, + gint col, + GdkEvent *event); GtkType e_table_group_get_type (void); diff --git a/widgets/e-table/e-table-item.c b/widgets/e-table/e-table-item.c index 90fcfdb7b1..592e69a4d3 100644 --- a/widgets/e-table/e-table-item.c +++ b/widgets/e-table/e-table-item.c @@ -20,6 +20,7 @@ #include "e-cell.h" #include "e-util/e-canvas.h" #include "e-util/e-canvas-utils.h" +#include "e-util/e-util.h" #define PARENT_OBJECT_TYPE gnome_canvas_item_get_type () @@ -31,6 +32,7 @@ enum { ROW_SELECTION, CURSOR_CHANGE, DOUBLE_CLICK, + KEY_PRESS, LAST_SIGNAL }; @@ -1324,11 +1326,15 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) if (!(e->key.keyval >= 0x20 && e->key.keyval <= 0xff)) return_val = FALSE; + ecol = e_table_header_get_column (eti->header, eti->cursor_col); + ecell_view = eti->cell_views [eti->cursor_col]; + e_cell_event (ecell_view, e, ecol->col_idx, eti->cursor_col, eti->cursor_row); + + } else { + gtk_signal_emit (GTK_OBJECT (eti), eti_signals [KEY_PRESS], + eti->cursor_row, eti->cursor_col, e, &return_val); } - ecol = e_table_header_get_column (eti->header, eti->cursor_col); - ecell_view = eti->cell_views [eti->cursor_col]; - e_cell_event (ecell_view, e, ecol->col_idx, eti->cursor_col, eti->cursor_row); } break; @@ -1388,6 +1394,7 @@ eti_class_init (GtkObjectClass *object_class) eti_class->row_selection = eti_row_selection; eti_class->cursor_change = NULL; eti_class->double_click = NULL; + eti_class->key_press = NULL; gtk_object_add_arg_type ("ETableItem::ETableHeader", GTK_TYPE_OBJECT, GTK_ARG_WRITABLE, ARG_TABLE_HEADER); @@ -1437,6 +1444,14 @@ eti_class_init (GtkObjectClass *object_class) gtk_marshal_NONE__INT, GTK_TYPE_NONE, 1, GTK_TYPE_INT); + eti_signals [KEY_PRESS] = + gtk_signal_new ("key_press", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (ETableItemClass, key_press), + e_marshal_INT__INT_INT_POINTER, + GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); + gtk_object_class_add_signals (object_class, eti_signals, LAST_SIGNAL); } diff --git a/widgets/e-table/e-table-item.h b/widgets/e-table/e-table-item.h index b466824bd7..54defe30e1 100644 --- a/widgets/e-table/e-table-item.h +++ b/widgets/e-table/e-table-item.h @@ -93,6 +93,7 @@ typedef struct { void (*row_selection) (ETableItem *eti, int row, gboolean selected); void (*cursor_change) (ETableItem *eti, int row); void (*double_click) (ETableItem *eti, int row); + gint (*key_press) (ETableItem *eti, int row, int col, GdkEvent *event); } ETableItemClass; GtkType e_table_item_get_type (void); diff --git a/widgets/e-table/e-table.c b/widgets/e-table/e-table.c index bf3aaa71cb..f6ad92e4c2 100644 --- a/widgets/e-table/e-table.c +++ b/widgets/e-table/e-table.c @@ -42,6 +42,7 @@ enum { ROW_SELECTION, CURSOR_CHANGE, DOUBLE_CLICK, + KEY_PRESS, LAST_SIGNAL }; @@ -206,6 +207,16 @@ group_double_click (ETableGroup *etg, int row, ETable *et) row); } +static gint +group_key_press (ETableGroup *etg, int row, int col, GdkEvent *event, ETable *et) +{ + int return_val; + gtk_signal_emit (GTK_OBJECT (et), + et_signals [DOUBLE_CLICK], + row, col, event, &return_val); + return return_val; +} + static gboolean changed_idle (gpointer data) { @@ -231,6 +242,8 @@ changed_idle (gpointer data) GTK_SIGNAL_FUNC (group_cursor_change), et); gtk_signal_connect (GTK_OBJECT (et->group), "double_click", GTK_SIGNAL_FUNC (group_double_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); gtk_object_set (GTK_OBJECT (et->group), @@ -315,6 +328,8 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h GTK_SIGNAL_FUNC(group_cursor_change), e_table); gtk_signal_connect (GTK_OBJECT (e_table->group), "double_click", GTK_SIGNAL_FUNC(group_double_click), e_table); + gtk_signal_connect (GTK_OBJECT (e_table->group), "key_press", + GTK_SIGNAL_FUNC(group_key_press), e_table); e_table->table_model_change_id = gtk_signal_connect ( GTK_OBJECT (model), "model_changed", @@ -729,6 +744,7 @@ e_table_class_init (GtkObjectClass *object_class) klass->row_selection = NULL; klass->cursor_change = NULL; klass->double_click = NULL; + klass->key_press = NULL; et_signals [ROW_SELECTION] = gtk_signal_new ("row_selection", @@ -753,6 +769,14 @@ e_table_class_init (GtkObjectClass *object_class) GTK_SIGNAL_OFFSET (ETableClass, double_click), gtk_marshal_NONE__INT, GTK_TYPE_NONE, 1, GTK_TYPE_INT); + + et_signals [DOUBLE_CLICK] = + gtk_signal_new ("key_press", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (ETableClass, key_press), + e_marshal_INT__INT_INT_POINTER, + GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); gtk_object_class_add_signals (object_class, et_signals, LAST_SIGNAL); diff --git a/widgets/e-table/e-table.h b/widgets/e-table/e-table.h index cba2919669..df396cd529 100644 --- a/widgets/e-table/e-table.h +++ b/widgets/e-table/e-table.h @@ -62,6 +62,7 @@ typedef struct { void (*row_selection) (ETable *et, int row, gboolean selected); void (*cursor_change) (ETable *et, int row); void (*double_click) (ETable *et, int row); + gint (*key_press) (ETable *et, int row, int col, GdkEvent *event); } ETableClass; GtkType e_table_get_type (void); diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c index 04ddb011c1..4aa7e2fe8a 100644 --- a/widgets/table/e-table-group-container.c +++ b/widgets/table/e-table-group-container.c @@ -323,6 +323,13 @@ child_double_click (ETableGroup *etg, int row, e_table_group_double_click (E_TABLE_GROUP (etgc), row); } +static gint +child_key_press (ETableGroup *etg, int row, int col, GdkEvent *event, + ETableGroupContainer *etgc) +{ + return e_table_group_key_press (E_TABLE_GROUP (etgc), row, col, event); +} + static void etgc_add (ETableGroup *etg, gint row) { @@ -378,6 +385,8 @@ etgc_add (ETableGroup *etg, gint row) GTK_SIGNAL_FUNC (child_cursor_change), etgc); gtk_signal_connect (GTK_OBJECT (child), "double_click", GTK_SIGNAL_FUNC (child_double_click), etgc); + gtk_signal_connect (GTK_OBJECT (child), "key_press", + GTK_SIGNAL_FUNC (child_key_press), etgc); child_node->child = child; child_node->key = e_table_model_duplicate_value (etg->model, etgc->ecol->col_idx, val); child_node->count = 1; diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c index 29273c4f73..dcf9c280c4 100644 --- a/widgets/table/e-table-group-leaf.c +++ b/widgets/table/e-table-group-leaf.c @@ -104,6 +104,15 @@ etgl_double_click (GtkObject *object, gint row, ETableGroupLeaf *etgl) e_table_group_double_click (E_TABLE_GROUP(etgl), E_TABLE_SUBSET(etgl->subset)->map_table[row]); } +static gint +etgl_key_press (GtkObject *object, gint row, gint col, GdkEvent *event, ETableGroupLeaf *etgl) +{ + if (row < E_TABLE_SUBSET(etgl->subset)->n_map) + return e_table_group_key_press (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) { @@ -142,6 +151,8 @@ etgl_realize (GnomeCanvasItem *item) GTK_SIGNAL_FUNC(etgl_cursor_change), etgl); gtk_signal_connect (GTK_OBJECT(etgl->item), "double_click", GTK_SIGNAL_FUNC(etgl_double_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 2e7f94bb1f..92c274762b 100644 --- a/widgets/table/e-table-group.c +++ b/widgets/table/e-table-group.c @@ -31,6 +31,7 @@ enum { ROW_SELECTION, CURSOR_CHANGE, DOUBLE_CLICK, + KEY_PRESS, LAST_SIGNAL }; @@ -271,6 +272,21 @@ e_table_group_double_click (ETableGroup *e_table_group, gint row) row); } +gint +e_table_group_key_press (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 [DOUBLE_CLICK], + row, col, event, &return_val); + + return return_val; +} + ETableHeader * e_table_group_get_header (ETableGroup *etg) { @@ -322,6 +338,7 @@ etg_class_init (GtkObjectClass *object_class) klass->row_selection = NULL; klass->cursor_change = NULL; klass->double_click = NULL; + klass->key_press = NULL; klass->add = NULL; klass->add_all = NULL; @@ -362,6 +379,14 @@ etg_class_init (GtkObjectClass *object_class) gtk_marshal_NONE__INT, GTK_TYPE_NONE, 1, GTK_TYPE_INT); + etg_signals [KEY_PRESS] = + gtk_signal_new ("key_press", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (ETableGroupClass, key_press), + e_marshal_INT__INT_INT_POINTER, + GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); + gtk_object_class_add_signals (object_class, etg_signals, LAST_SIGNAL); } diff --git a/widgets/table/e-table-group.h b/widgets/table/e-table-group.h index 22e2a3dc8e..2260168cd4 100644 --- a/widgets/table/e-table-group.h +++ b/widgets/table/e-table-group.h @@ -46,6 +46,7 @@ typedef struct { void (*row_selection) (ETableGroup *etg, int row, gboolean selected); void (*cursor_change) (ETableGroup *etg, int row); void (*double_click) (ETableGroup *etg, int row); + gint (*key_press) (ETableGroup *etg, int row, int col, GdkEvent *event); /* Virtual functions. */ void (*add) (ETableGroup *etg, gint row); @@ -106,6 +107,10 @@ void e_table_group_cursor_change (ETableGroup *etg, gint row); void e_table_group_double_click (ETableGroup *etg, gint row); +gint e_table_group_key_press (ETableGroup *etg, + gint row, + gint col, + GdkEvent *event); GtkType e_table_group_get_type (void); diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index 90fcfdb7b1..592e69a4d3 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -20,6 +20,7 @@ #include "e-cell.h" #include "e-util/e-canvas.h" #include "e-util/e-canvas-utils.h" +#include "e-util/e-util.h" #define PARENT_OBJECT_TYPE gnome_canvas_item_get_type () @@ -31,6 +32,7 @@ enum { ROW_SELECTION, CURSOR_CHANGE, DOUBLE_CLICK, + KEY_PRESS, LAST_SIGNAL }; @@ -1324,11 +1326,15 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) if (!(e->key.keyval >= 0x20 && e->key.keyval <= 0xff)) return_val = FALSE; + ecol = e_table_header_get_column (eti->header, eti->cursor_col); + ecell_view = eti->cell_views [eti->cursor_col]; + e_cell_event (ecell_view, e, ecol->col_idx, eti->cursor_col, eti->cursor_row); + + } else { + gtk_signal_emit (GTK_OBJECT (eti), eti_signals [KEY_PRESS], + eti->cursor_row, eti->cursor_col, e, &return_val); } - ecol = e_table_header_get_column (eti->header, eti->cursor_col); - ecell_view = eti->cell_views [eti->cursor_col]; - e_cell_event (ecell_view, e, ecol->col_idx, eti->cursor_col, eti->cursor_row); } break; @@ -1388,6 +1394,7 @@ eti_class_init (GtkObjectClass *object_class) eti_class->row_selection = eti_row_selection; eti_class->cursor_change = NULL; eti_class->double_click = NULL; + eti_class->key_press = NULL; gtk_object_add_arg_type ("ETableItem::ETableHeader", GTK_TYPE_OBJECT, GTK_ARG_WRITABLE, ARG_TABLE_HEADER); @@ -1437,6 +1444,14 @@ eti_class_init (GtkObjectClass *object_class) gtk_marshal_NONE__INT, GTK_TYPE_NONE, 1, GTK_TYPE_INT); + eti_signals [KEY_PRESS] = + gtk_signal_new ("key_press", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (ETableItemClass, key_press), + e_marshal_INT__INT_INT_POINTER, + GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); + gtk_object_class_add_signals (object_class, eti_signals, LAST_SIGNAL); } diff --git a/widgets/table/e-table-item.h b/widgets/table/e-table-item.h index b466824bd7..54defe30e1 100644 --- a/widgets/table/e-table-item.h +++ b/widgets/table/e-table-item.h @@ -93,6 +93,7 @@ typedef struct { void (*row_selection) (ETableItem *eti, int row, gboolean selected); void (*cursor_change) (ETableItem *eti, int row); void (*double_click) (ETableItem *eti, int row); + gint (*key_press) (ETableItem *eti, int row, int col, GdkEvent *event); } ETableItemClass; GtkType e_table_item_get_type (void); diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index bf3aaa71cb..f6ad92e4c2 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -42,6 +42,7 @@ enum { ROW_SELECTION, CURSOR_CHANGE, DOUBLE_CLICK, + KEY_PRESS, LAST_SIGNAL }; @@ -206,6 +207,16 @@ group_double_click (ETableGroup *etg, int row, ETable *et) row); } +static gint +group_key_press (ETableGroup *etg, int row, int col, GdkEvent *event, ETable *et) +{ + int return_val; + gtk_signal_emit (GTK_OBJECT (et), + et_signals [DOUBLE_CLICK], + row, col, event, &return_val); + return return_val; +} + static gboolean changed_idle (gpointer data) { @@ -231,6 +242,8 @@ changed_idle (gpointer data) GTK_SIGNAL_FUNC (group_cursor_change), et); gtk_signal_connect (GTK_OBJECT (et->group), "double_click", GTK_SIGNAL_FUNC (group_double_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); gtk_object_set (GTK_OBJECT (et->group), @@ -315,6 +328,8 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h GTK_SIGNAL_FUNC(group_cursor_change), e_table); gtk_signal_connect (GTK_OBJECT (e_table->group), "double_click", GTK_SIGNAL_FUNC(group_double_click), e_table); + gtk_signal_connect (GTK_OBJECT (e_table->group), "key_press", + GTK_SIGNAL_FUNC(group_key_press), e_table); e_table->table_model_change_id = gtk_signal_connect ( GTK_OBJECT (model), "model_changed", @@ -729,6 +744,7 @@ e_table_class_init (GtkObjectClass *object_class) klass->row_selection = NULL; klass->cursor_change = NULL; klass->double_click = NULL; + klass->key_press = NULL; et_signals [ROW_SELECTION] = gtk_signal_new ("row_selection", @@ -753,6 +769,14 @@ e_table_class_init (GtkObjectClass *object_class) GTK_SIGNAL_OFFSET (ETableClass, double_click), gtk_marshal_NONE__INT, GTK_TYPE_NONE, 1, GTK_TYPE_INT); + + et_signals [DOUBLE_CLICK] = + gtk_signal_new ("key_press", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (ETableClass, key_press), + e_marshal_INT__INT_INT_POINTER, + GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER); gtk_object_class_add_signals (object_class, et_signals, LAST_SIGNAL); diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h index cba2919669..df396cd529 100644 --- a/widgets/table/e-table.h +++ b/widgets/table/e-table.h @@ -62,6 +62,7 @@ typedef struct { void (*row_selection) (ETable *et, int row, gboolean selected); void (*cursor_change) (ETable *et, int row); void (*double_click) (ETable *et, int row); + gint (*key_press) (ETable *et, int row, int col, GdkEvent *event); } ETableClass; GtkType e_table_get_type (void); |