aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
authorBruce Tao <bruce.tao@sun.com>2004-05-10 18:13:57 +0800
committerYuedong Du <york@src.gnome.org>2004-05-10 18:13:57 +0800
commit91b30fc6b8968c7ba6633bd8dc3a3315e5fe4095 (patch)
treecc62921e181c4653dba8340acda3742d96bffca8 /widgets/table
parent3be3d1a2e424d25e61de0326b6b4c5ba0ae75bba (diff)
downloadgsoc2013-evolution-91b30fc6b8968c7ba6633bd8dc3a3315e5fe4095.tar.gz
gsoc2013-evolution-91b30fc6b8968c7ba6633bd8dc3a3315e5fe4095.tar.zst
gsoc2013-evolution-91b30fc6b8968c7ba6633bd8dc3a3315e5fe4095.zip
Fixes #51626
2004-04-22 Bruce Tao <bruce.tao@sun.com> Fixes #51626 * e-table-click-to-add.c: (etcta_event): Add an entry for focus_in event, do the same thing as button_press event. * e-table-item.c: (eti_event): Mask the Ctrl+Tab processing routine. * e-table.c: (table_canvas_focus_event_cb), (canvas_vbox_event), (click_to_add_event), (e_table_setup_table): Enable you to navigate between click_to_add and the existing tasks by pressing Ctrl+Tab. However, if there is no existing task, you can still jump out of click_to_add by this way. svn path=/trunk/; revision=25831
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/e-table-click-to-add.c4
-rw-r--r--widgets/table/e-table-item.c4
-rw-r--r--widgets/table/e-table.c69
3 files changed, 73 insertions, 4 deletions
diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c
index df395ebaf7..8fb151bc24 100644
--- a/widgets/table/e-table-click-to-add.c
+++ b/widgets/table/e-table-click-to-add.c
@@ -348,6 +348,10 @@ etcta_event (GnomeCanvasItem *item, GdkEvent *e)
ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (item);
switch (e->type){
+ case GDK_FOCUS_CHANGE:
+ if (!e->focus_change.in)
+ return TRUE;
+
case GDK_BUTTON_PRESS:
if (etcta->text) {
gtk_object_destroy(etcta->text);
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 6e3ef8ddf1..89e11e896a 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -2693,6 +2693,10 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
case GDK_Tab:
case GDK_KP_Tab:
case GDK_ISO_Left_Tab:
+ if ((e->key.state & GDK_CONTROL_MASK) != 0) {
+ return_val = FALSE;
+ break;
+ }
if (eti->cursor_mode == E_CURSOR_SPREADSHEET) {
if ((e->key.state & GDK_SHIFT_MASK) != 0){
/* shift tab */
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index 1fd9bcb3d7..9c218ad974 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -1117,8 +1117,62 @@ table_canvas_focus_event_cb (GtkWidget *widget, GdkEventFocus *event, gpointer d
etable = E_TABLE (data);
- if (!canvas->focused_item && etable->group)
- focus_first_etable_item (etable->group);
+ if (e_table_model_row_count(etable->model) < 1
+ && (etable->click_to_add)
+ && !(E_TABLE_CLICK_TO_ADD(etable->click_to_add)->row)) {
+ gnome_canvas_item_grab_focus (etable->canvas_vbox);
+ gnome_canvas_item_grab_focus (etable->click_to_add);
+ } else if (!canvas->focused_item && etable->group) {
+ focus_first_etable_item (etable->group);
+ }
+
+ return TRUE;
+}
+
+static gboolean
+canvas_vbox_event (ECanvasVbox *vbox, GdkEventKey *key, ETable *etable)
+{
+ GnomeCanvas *canvas;
+
+ canvas = GNOME_CANVAS (etable->table_canvas);
+ switch (key->keyval) {
+ case GDK_Tab:
+ case GDK_KP_Tab:
+ case GDK_ISO_Left_Tab:
+ if ((key->state & GDK_CONTROL_MASK) && etable->click_to_add) {
+ gnome_canvas_item_grab_focus (etable->click_to_add);
+ break;
+ }
+ default:
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static gboolean
+click_to_add_event (ETableClickToAdd *etcta, GdkEventKey *key, ETable *etable)
+{
+ GnomeCanvas *canvas;
+
+ canvas = GNOME_CANVAS (etable->table_canvas);
+ switch (key->keyval) {
+ case GDK_Tab:
+ case GDK_KP_Tab:
+ case GDK_ISO_Left_Tab:
+ if (key->state & GDK_CONTROL_MASK) {
+ if (etable->group) {
+ if (e_table_model_row_count(etable->model) > 0)
+ focus_first_etable_item (etable->group);
+ else
+ gtk_widget_child_focus (
+ gtk_widget_get_toplevel(GTK_WIDGET(etable->table_canvas)), GTK_DIR_TAB_FORWARD);
+ break;
+ }
+ }
+ default:
+ return FALSE;
+ }
return TRUE;
}
@@ -1190,6 +1244,10 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h
"spacing", 10.0,
NULL);
+ g_signal_connect (
+ G_OBJECT (e_table->canvas_vbox), "event",
+ G_CALLBACK (canvas_vbox_event), e_table);
+
et_build_groups(e_table);
if (e_table->use_click_to_add) {
@@ -1211,8 +1269,11 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h
e_table->click_to_add);
g_signal_connect (
- G_OBJECT (e_table->click_to_add), "cursor_change",
- G_CALLBACK (click_to_add_cursor_change), e_table);
+ G_OBJECT (e_table->click_to_add), "event",
+ G_CALLBACK (click_to_add_event), e_table);
+ g_signal_connect (
+ G_OBJECT (e_table->click_to_add), "cursor_change",
+ G_CALLBACK (click_to_add_cursor_change), e_table);
}
}