diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-06-06 13:50:12 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-06-06 13:50:12 +0800 |
commit | 06978bc7368680efabec6a2cde14c74ca5201d04 (patch) | |
tree | 9b01fb6ea232dbb144e7ae5687a004c98bf1272b /widgets/table/e-table-item.c | |
parent | ce74cc7bb1d1a3f27d93dfa2842a9f13e461714f (diff) | |
download | gsoc2013-evolution-06978bc7368680efabec6a2cde14c74ca5201d04.tar.gz gsoc2013-evolution-06978bc7368680efabec6a2cde14c74ca5201d04.tar.zst gsoc2013-evolution-06978bc7368680efabec6a2cde14c74ca5201d04.zip |
Added a right click signal.
2000-06-06 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 right click signal.
* e-table-sorted-variable.c: Fixed a buffer overrun.
svn path=/trunk/; revision=3437
Diffstat (limited to 'widgets/table/e-table-item.c')
-rw-r--r-- | widgets/table/e-table-item.c | 75 |
1 files changed, 50 insertions, 25 deletions
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index 8d96543eed..e494e5ed2b 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -32,6 +32,7 @@ enum { ROW_SELECTION, CURSOR_CHANGE, DOUBLE_CLICK, + RIGHT_CLICK, KEY_PRESS, LAST_SIGNAL }; @@ -1187,33 +1188,48 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) double x1, y1; int col, row; - if (e->button.button == 5 || - e->button.button == 4) - return FALSE; - - gnome_canvas_item_w2i (item, &e->button.x, &e->button.y); - - if (!find_cell (eti, e->button.x, e->button.y, &col, &row, &x1, &y1)) - return TRUE; - - if (eti->cursor_row == row && eti->cursor_col == col){ + switch (e->button.button) { + case 1: /* Fall through. */ + case 2: + gnome_canvas_item_w2i (item, &e->button.x, &e->button.y); - ecol = e_table_header_get_column (eti->header, col); - ecell_view = eti->cell_views [col]; - - /* - * Adjust the event positions - */ - e->button.x = x1; - e->button.y = y1; - e_cell_event (ecell_view, e, ecol->col_idx, col, row); - } else { - /* - * Focus the cell, and select the row - */ - e_table_item_leave_edit (eti); - e_table_item_focus (eti, col, row); + if (!find_cell (eti, e->button.x, e->button.y, &col, &row, &x1, &y1)) + return TRUE; + + if (eti->cursor_row == row && eti->cursor_col == col){ + + ecol = e_table_header_get_column (eti->header, col); + ecell_view = eti->cell_views [col]; + + /* + * Adjust the event positions + */ + e->button.x = x1; + e->button.y = y1; + + e_cell_event (ecell_view, e, ecol->col_idx, col, row); + } else { + /* + * Focus the cell, and select the row + */ + e_table_item_leave_edit (eti); + e_table_item_focus (eti, col, row); + } + break; + case 3: + gnome_canvas_item_w2i (item, &e->button.x, &e->button.y); + if (!find_cell (eti, e->button.x, e->button.y, &col, &row, &x1, &y1)) + return TRUE; + + gtk_signal_emit (GTK_OBJECT (eti), eti_signals [RIGHT_CLICK], + row, col, e, &return_val); + break; + case 4: + case 5: + return FALSE; + break; + } break; } @@ -1387,6 +1403,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->right_click = NULL; eti_class->key_press = NULL; gtk_object_add_arg_type ("ETableItem::ETableHeader", GTK_TYPE_OBJECT, @@ -1437,6 +1454,14 @@ eti_class_init (GtkObjectClass *object_class) gtk_marshal_NONE__INT, GTK_TYPE_NONE, 1, GTK_TYPE_INT); + eti_signals [RIGHT_CLICK] = + gtk_signal_new ("right_click", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (ETableItemClass, right_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, |