aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/e-table
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-07-27 22:50:04 +0800
committerChris Lahey <clahey@src.gnome.org>2000-07-27 22:50:04 +0800
commit86b1bd7f21c3024437375e656e75738423e85335 (patch)
treeeb75adac6234d7e3262a5c10ba96b874eb2434f4 /widgets/e-table
parente52cd76bd60056abc4c142065ae0c8d34a169f58 (diff)
downloadgsoc2013-evolution-86b1bd7f21c3024437375e656e75738423e85335.tar
gsoc2013-evolution-86b1bd7f21c3024437375e656e75738423e85335.tar.gz
gsoc2013-evolution-86b1bd7f21c3024437375e656e75738423e85335.tar.bz2
gsoc2013-evolution-86b1bd7f21c3024437375e656e75738423e85335.tar.lz
gsoc2013-evolution-86b1bd7f21c3024437375e656e75738423e85335.tar.xz
gsoc2013-evolution-86b1bd7f21c3024437375e656e75738423e85335.tar.zst
gsoc2013-evolution-86b1bd7f21c3024437375e656e75738423e85335.zip
Grab focus properly.
2000-07-27 Christopher James Lahey <clahey@helixcode.com> * e-table-item.c (eti_cursor_change): Grab focus properly. * e-table-item.c, e-table-click-to-add.c: Fixed ETableClickToAdd to handle carriage return. This still doesn't quite work right. svn path=/trunk/; revision=4384
Diffstat (limited to 'widgets/e-table')
-rw-r--r--widgets/e-table/ChangeLog7
-rw-r--r--widgets/e-table/e-table-click-to-add.c82
-rw-r--r--widgets/e-table/e-table-item.c15
3 files changed, 76 insertions, 28 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index 483babd5ff..df302f38e5 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,5 +1,12 @@
2000-07-27 Christopher James Lahey <clahey@helixcode.com>
+ * e-table-item.c (eti_cursor_change): Grab focus properly.
+
+ * e-table-item.c, e-table-click-to-add.c: Fixed ETableClickToAdd
+ to handle carriage return. This still doesn't quite work right.
+
+2000-07-27 Christopher James Lahey <clahey@helixcode.com>
+
* e-table-click-to-add.c: Clear the selection model when
activating.
diff --git a/widgets/e-table/e-table-click-to-add.c b/widgets/e-table/e-table-click-to-add.c
index 8732e88a51..0a4ba21f81 100644
--- a/widgets/e-table/e-table-click-to-add.c
+++ b/widgets/e-table/e-table-click-to-add.c
@@ -103,6 +103,10 @@ etcta_drop_one (ETableClickToAdd *etcta)
gtk_object_set(GTK_OBJECT(etcta->selection),
"model", NULL,
NULL);
+ if (etcta->row)
+ gnome_canvas_item_set(GNOME_CANVAS_ITEM(etcta->row),
+ "ETableModel", NULL,
+ NULL);
}
static void
@@ -310,7 +314,31 @@ etcta_event (GnomeCanvasItem *item, GdkEvent *e)
gnome_canvas_item_w2i (item, &e->button.x, &e->button.y);
}
break;
-
+
+ case GDK_KEY_PRESS:
+ switch (e->key.keyval) {
+ case GDK_Return:
+ case GDK_KP_Enter:
+ case GDK_ISO_Enter:
+ case GDK_3270_Enter:
+ if (etcta->row) {
+ ETableModel *one;
+ e_table_selection_model_clear(etcta->selection);
+
+ e_table_one_commit(E_TABLE_ONE(etcta->one));
+ etcta_drop_one (etcta);
+
+ one = e_table_one_new(etcta->model);
+ etcta_add_one (etcta, one);
+ gtk_object_unref(GTK_OBJECT(one));
+
+ e_table_item_set_cursor(E_TABLE_ITEM(etcta->row), 0, 0);
+ }
+ break;
+ default:
+ break;
+ }
+
default:
return FALSE;
}
@@ -434,30 +462,30 @@ e_table_click_to_add_get_type (void)
void
e_table_click_to_add_commit (ETableClickToAdd *etcta)
{
- if (etcta->row) {
- e_table_one_commit(E_TABLE_ONE(etcta->one));
- gtk_object_destroy(GTK_OBJECT(etcta->row));
- etcta_drop_one (etcta);
- etcta->row = NULL;
- }
- if (!etcta->text) {
- etcta->text = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta),
- e_text_get_type(),
- "text", etcta->message ? etcta->message : "",
- "anchor", GTK_ANCHOR_NW,
- "width", etcta->width - 4,
- NULL);
- e_canvas_item_move_absolute (etcta->text, 2, 2);
- }
- if (!etcta->rect) {
- etcta->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta),
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) etcta->width - 1,
- "y2", (double) etcta->height - 1,
- "outline_color", "black",
- "fill_color", NULL,
- NULL);
- }
+ if (etcta->row) {
+ e_table_one_commit(E_TABLE_ONE(etcta->one));
+ etcta_drop_one (etcta);
+ gtk_object_destroy(GTK_OBJECT(etcta->row));
+ etcta->row = NULL;
+ }
+ if (!etcta->text) {
+ etcta->text = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta),
+ e_text_get_type(),
+ "text", etcta->message ? etcta->message : "",
+ "anchor", GTK_ANCHOR_NW,
+ "width", etcta->width - 4,
+ NULL);
+ e_canvas_item_move_absolute (etcta->text, 2, 2);
+ }
+ if (!etcta->rect) {
+ etcta->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta),
+ gnome_canvas_rect_get_type(),
+ "x1", (double) 0,
+ "y1", (double) 0,
+ "x2", (double) etcta->width - 1,
+ "y2", (double) etcta->height - 1,
+ "outline_color", "black",
+ "fill_color", NULL,
+ NULL);
+ }
}
diff --git a/widgets/e-table/e-table-item.c b/widgets/e-table/e-table-item.c
index e6305acbba..3a3f46a505 100644
--- a/widgets/e-table/e-table-item.c
+++ b/widgets/e-table/e-table-item.c
@@ -1554,6 +1554,19 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
return_val = FALSE;
}
break;
+
+ case GDK_Return:
+ case GDK_KP_Enter:
+ case GDK_ISO_Enter:
+ case GDK_3270_Enter:
+ if (eti_editing (eti)){
+ ecell_view = eti->cell_views [eti->editing_col];
+ e_cell_event (ecell_view, e, view_to_model_col(eti, eti->editing_col), eti->editing_col, eti->editing_row);
+ }
+ return_val = FALSE;
+ gtk_signal_emit (GTK_OBJECT (eti), eti_signals [KEY_PRESS],
+ model_to_view_row(eti, cursor_row), cursor_col, e, &return_val);
+ break;
default:
if (!eti_editing (eti)){
@@ -1762,8 +1775,8 @@ eti_cursor_change (ETableSelectionModel *selection, int row, int col, ETableItem
}
eti_request_region_show (eti, view_col, view_row, view_col, view_row);
+ e_canvas_item_grab_focus(GNOME_CANVAS_ITEM(eti));
if (e_table_model_is_cell_editable(selection->model, col, view_row)) {
- e_canvas_item_grab_focus(GNOME_CANVAS_ITEM(eti));
e_table_item_enter_edit (eti, view_col, view_row);
}
gtk_signal_emit (GTK_OBJECT (eti), eti_signals [CURSOR_CHANGE],