aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-item.c
diff options
context:
space:
mode:
authorIain Holmes <iain@helixcode.com>2000-09-16 05:42:38 +0800
committerIain Holmes <iain@src.gnome.org>2000-09-16 05:42:38 +0800
commit6e4ae07fbfce5845d48e8ba1992f64376a885ac4 (patch)
treecdf00c9707a7de41e34f4b3ba48ea695224ca0eb /widgets/table/e-table-item.c
parentce3c18afd96cc9fb91fca4dfabc440206aa2f99e (diff)
downloadgsoc2013-evolution-6e4ae07fbfce5845d48e8ba1992f64376a885ac4.tar
gsoc2013-evolution-6e4ae07fbfce5845d48e8ba1992f64376a885ac4.tar.gz
gsoc2013-evolution-6e4ae07fbfce5845d48e8ba1992f64376a885ac4.tar.bz2
gsoc2013-evolution-6e4ae07fbfce5845d48e8ba1992f64376a885ac4.tar.lz
gsoc2013-evolution-6e4ae07fbfce5845d48e8ba1992f64376a885ac4.tar.xz
gsoc2013-evolution-6e4ae07fbfce5845d48e8ba1992f64376a885ac4.tar.zst
gsoc2013-evolution-6e4ae07fbfce5845d48e8ba1992f64376a885ac4.zip
If the cursor is inside the subcell, call the show_tooltip on it.
2000-09-15 Iain Holmes <iain@helixcode.com> * e-cell-tree.c (ect_show_tooltip): If the cursor is inside the subcell, call the show_tooltip on it. * e-table-header-item.c (draw_button): Draw the arrow first, then take it's size into account when calculating how to draw the text. Use ellipsis if the text it too long. 2000-09-15 Iain Holmes <iain@helixcode.com> * e-table-header-item.c (draw_button): Fix a crash by passing the canvas widget to gtk_paint_box. Reported by Radek. 2000-09-14 Iain Holmes <iain@helixcode.com> * e-table-header-item.c (set_cursor): The column isn't resizable if it is the last, or if all other columns after it are not resizable. * e-cell-text.c (ect_max_width): Correctly calculate the width of the line of text. Unbuild the current cell and unref the lines as well. (build_current_cell): Initialize cell->style to 0; 2000-09-14 Iain Holmes <iain@helixcode.com> * e-table-item.c: Start timers for the tooltip to appear, on motion events. * e-cell.[ch]: Add a new show_tooltip method. * e-cell-text.c (ect_show_tooltip): Show the tooltip. svn path=/trunk/; revision=5466
Diffstat (limited to 'widgets/table/e-table-item.c')
-rw-r--r--widgets/table/e-table-item.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 186587838c..b1fdfc66d3 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -881,6 +881,10 @@ eti_destroy (GtkObject *object)
g_free (eti->height_cache);
+ if (eti->tooltip->window)
+ gtk_widget_destroy (eti->tooltip->window);
+ g_free (eti->tooltip);
+
if (GTK_OBJECT_CLASS (eti_parent_class)->destroy)
(*GTK_OBJECT_CLASS (eti_parent_class)->destroy) (object);
}
@@ -1010,6 +1014,8 @@ eti_init (GnomeCanvasItem *item)
eti->needs_redraw = 0;
eti->needs_compute_height = 0;
+ eti->tooltip = g_new0 (ETableTooltip, 1);
+
e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM (eti), eti_reflow);
}
@@ -1414,6 +1420,34 @@ eti_cursor_move_down (ETableItem *eti)
eti_cursor_move (eti, model_to_view_row(eti, cursor_row) + 1, model_to_view_col(eti, cursor_col));
}
+static int
+_do_tooltip (ETableItem *eti)
+{
+ ECellView *ecell_view;
+ int x = 0, y = 0;
+ int i;
+
+ ecell_view = eti->cell_views[eti->tooltip->col];
+
+ for (i = 0; i < eti->tooltip->col; i++)
+ x += eti->header->columns[i]->width;
+ eti->tooltip->x = x;
+
+ for (i = 0; i < eti->tooltip->row; i++)
+ y += ETI_ROW_HEIGHT (eti, i);
+ eti->tooltip->y = y;
+ eti->tooltip->eti = eti;
+ eti->tooltip->row_height = ETI_ROW_HEIGHT (eti, i);
+
+ g_print ("Tooltip at %d,%d\n", x, y);
+ e_cell_show_tooltip (ecell_view,
+ view_to_model_col (eti, eti->tooltip->col),
+ eti->tooltip->col,
+ eti->tooltip->row,
+ eti->tooltip);
+ return FALSE;
+}
+
/* FIXME: cursor */
static int
eti_event (GnomeCanvasItem *item, GdkEvent *e)
@@ -1428,6 +1462,14 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
int col, row;
gint cursor_row, cursor_col;
+ if (eti->tooltip->timer) {
+ gtk_timeout_remove (eti->tooltip->timer);
+ eti->tooltip->timer = 0;
+ }
+ if (eti->tooltip->window) {
+ gtk_widget_destroy (eti->tooltip->window);
+ eti->tooltip->window = NULL;
+ }
e_canvas_item_grab_focus(GNOME_CANVAS_ITEM(eti));
switch (e->button.button) {
@@ -1495,6 +1537,14 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
int col, row;
gint cursor_row, cursor_col;
+ if (eti->tooltip->timer) {
+ gtk_timeout_remove (eti->tooltip->timer);
+ eti->tooltip->timer = 0;
+ }
+ if (eti->tooltip->window) {
+ gtk_widget_destroy (eti->tooltip->window);
+ eti->tooltip->window = NULL;
+ }
switch (e->button.button) {
case 1: /* Fall through. */
case 2:
@@ -1563,6 +1613,14 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
"cursor_col", &cursor_col,
NULL);
+ if (eti->tooltip->timer > 0)
+ gtk_timeout_remove (eti->tooltip->timer);
+ eti->tooltip->col = col;
+ eti->tooltip->row = row;
+ eti->tooltip->cx = e->motion.x;
+ eti->tooltip->cy = e->motion.y;
+ eti->tooltip->timer = gtk_timeout_add (1000, _do_tooltip, eti);
+
if (cursor_row == view_to_model_row(eti, row) && cursor_col == view_to_model_col(eti, col)){
ecell_view = eti->cell_views [col];
@@ -1711,6 +1769,12 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
break;
}
+ case GDK_LEAVE_NOTIFY:
+ case GDK_ENTER_NOTIFY:
+ if (eti->tooltip->timer > 0)
+ gtk_timeout_remove (eti->tooltip->timer);
+ break;
+
default:
return_val = FALSE;
}