From 13679221973a960628aa73dfa289b591e0de27e1 Mon Sep 17 00:00:00 2001 From: Iain Holmes Date: Sun, 17 Sep 2000 17:18:04 +0000 Subject: Better calculations for tooltip positions svn path=/trunk/; revision=5477 --- widgets/table/e-cell-text.c | 13 +++++++------ widgets/table/e-cell-tree.c | 8 +++++++- widgets/table/e-table-item.c | 5 ++--- 3 files changed, 16 insertions(+), 10 deletions(-) (limited to 'widgets/table') diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c index e07c44d1d8..8f31b7adf4 100644 --- a/widgets/table/e-cell-text.c +++ b/widgets/table/e-cell-text.c @@ -1451,14 +1451,15 @@ ect_show_tooltip (ECellView *ecell_view, break; } + gnome_canvas_item_move (tooltip_text, 3.0, 1.0); gnome_canvas_item_set (rect, - "x2", (double) tooltip_width, - "y2", (double) tooltip->row_height, + "x2", (double) tooltip_width + 6, + "y2", (double) tooltip->row_height + 1, NULL); - gtk_widget_set_usize (tooltip->window, tooltip_width, - tooltip->row_height); + gtk_widget_set_usize (tooltip->window, tooltip_width + 6, + tooltip->row_height + 1); gnome_canvas_set_scroll_region (GNOME_CANVAS (canvas), 0.0, 0.0, - (double) tooltip_width, + (double) tooltip_width + 6, (double) tooltip_height); gtk_widget_show (canvas); gtk_widget_realize (tooltip->window); @@ -1466,7 +1467,7 @@ ect_show_tooltip (ECellView *ecell_view, GTK_SIGNAL_FUNC (tooltip_event), tooltip); gtk_widget_popup (tooltip->window, pixel_origin.x + tooltip->x, - pixel_origin.y + tooltip->y); + pixel_origin.y + tooltip->y + 1); unref_lines (&cell); unbuild_current_cell (&cell); diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c index 6d8ff72cca..706551d7ad 100644 --- a/widgets/table/e-cell-tree.c +++ b/widgets/table/e-cell-tree.c @@ -421,10 +421,16 @@ ect_show_tooltip (ECellView *ecell_view, int model_col, int view_col, int row, ETreeModel *tree_model = e_cell_tree_get_tree_model (ecell_view->e_table_model, row); ETreePath *node = e_cell_tree_get_node (tree_model, row); int offset = offset_of_node (tree_model, node); - + GdkPixbuf *node_image; + + node_image = e_tree_model_icon_of_node (tree_model, node); + if (node_image) + offset += gdk_pixbuf_get_width (node_image); + /* if the tooltip happened in the subcell, then handle it */ if (tooltip->cx > offset) { + tooltip->x += offset; e_cell_show_tooltip (tree_view->subcell_view, model_col, view_col, row, tooltip); } } diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index ecb5d8a59b..87d79ea9c5 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -1434,12 +1434,11 @@ _do_tooltip (ETableItem *eti) eti->tooltip->x = x; for (i = 0; i < eti->tooltip->row; i++) - y += ETI_ROW_HEIGHT (eti, i); + y += (ETI_ROW_HEIGHT (eti, i) + 1); eti->tooltip->y = y; - eti->tooltip->eti = GNOME_CANVAS_ITEM(eti); + eti->tooltip->eti = GNOME_CANVAS_ITEM (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, -- cgit v1.2.3