diff options
author | Christopher James Lahey <clahey@ximian.com> | 2001-04-16 00:20:02 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-04-16 00:20:02 +0800 |
commit | 9e995f6b8e6839f9b5ac9e61067fdb8864c93eed (patch) | |
tree | 29d09465a7de6324a46bd74428db1632f33d7a4e | |
parent | fbe64c2aee924f646e01c096e40094585615c086 (diff) | |
download | gsoc2013-evolution-9e995f6b8e6839f9b5ac9e61067fdb8864c93eed.tar gsoc2013-evolution-9e995f6b8e6839f9b5ac9e61067fdb8864c93eed.tar.gz gsoc2013-evolution-9e995f6b8e6839f9b5ac9e61067fdb8864c93eed.tar.bz2 gsoc2013-evolution-9e995f6b8e6839f9b5ac9e61067fdb8864c93eed.tar.lz gsoc2013-evolution-9e995f6b8e6839f9b5ac9e61067fdb8864c93eed.tar.xz gsoc2013-evolution-9e995f6b8e6839f9b5ac9e61067fdb8864c93eed.tar.zst gsoc2013-evolution-9e995f6b8e6839f9b5ac9e61067fdb8864c93eed.zip |
Use e_canvas_hide_tooltip and e_canvas_popup_tooltip.
2001-04-15 Christopher James Lahey <clahey@ximian.com>
* e-cell-text.c (tooltip_event): Use e_canvas_hide_tooltip and
e_canvas_popup_tooltip.
* e-table-item.c: Cleaned this up. Removed some #if 0 and
replaced others with #ifdefs.
* e-table-tooltip.h: Removed some unnecessary fields.
svn path=/trunk/; revision=9326
-rw-r--r-- | widgets/table/e-cell-text.c | 32 | ||||
-rw-r--r-- | widgets/table/e-table-item.c | 53 | ||||
-rw-r--r-- | widgets/table/e-table-tooltip.h | 2 |
3 files changed, 19 insertions, 68 deletions
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c index 6a3fc87122..db881f764b 100644 --- a/widgets/table/e-cell-text.c +++ b/widgets/table/e-cell-text.c @@ -1103,18 +1103,12 @@ tooltip_event (GtkWidget *window, switch (event->type) { case GDK_LEAVE_NOTIFY: - if (tooltip->window) { - gtk_widget_destroy (tooltip->window); - tooltip->window = NULL; - } + e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(tooltip->eti)->canvas)); break; case GDK_BUTTON_PRESS: case GDK_BUTTON_RELEASE: if (event->type == GDK_BUTTON_RELEASE) { - if (tooltip->window) { - gtk_widget_destroy (tooltip->window); - tooltip->window = NULL; - } + e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(tooltip->eti)->canvas)); } event->button.x = tooltip->cx; @@ -1123,10 +1117,7 @@ tooltip_event (GtkWidget *window, event, &ret_val); break; case GDK_KEY_PRESS: - if (tooltip->window){ - gtk_widget_destroy (tooltip->window); - tooltip->window = NULL; - } + e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(tooltip->eti)->canvas)); gtk_signal_emit_by_name (GTK_OBJECT (tooltip->eti), "event", event, &ret_val); break; @@ -1164,6 +1155,7 @@ ect_show_tooltip (ECellView *ecell_view, GnomeCanvasItem *rect; double text_height; ECellText *ect = E_CELL_TEXT(ecell_view->ecell); + GtkWidget *window; tooltip->timer = 0; @@ -1201,11 +1193,11 @@ ect_show_tooltip (ECellView *ecell_view, pixel_origin.x -= (int) gtk_layout_get_hadjustment (GTK_LAYOUT (text_view->canvas))->value; pixel_origin.y -= (int) gtk_layout_get_vadjustment (GTK_LAYOUT (text_view->canvas))->value; - tooltip->window = gtk_window_new (GTK_WINDOW_POPUP); - gtk_container_set_border_width (GTK_CONTAINER (tooltip->window), 1); + window = gtk_window_new (GTK_WINDOW_POPUP); + gtk_container_set_border_width (GTK_CONTAINER (window), 1); canvas = e_canvas_new (); - gtk_container_add (GTK_CONTAINER (tooltip->window), canvas); + gtk_container_add (GTK_CONTAINER (window), canvas); max_width = 0.0; for (lines = cell.breaks->lines, i = 0; i < cell.breaks->num_lines; @@ -1265,18 +1257,18 @@ ect_show_tooltip (ECellView *ecell_view, "x2", (double) tooltip_width + 6, "y2", (double) tooltip->row_height + 1, NULL); - gtk_widget_set_usize (tooltip->window, tooltip_width + 6, + gtk_widget_set_usize (window, tooltip_width + 6, tooltip->row_height + 1); gnome_canvas_set_scroll_region (GNOME_CANVAS (canvas), 0.0, 0.0, (double) tooltip_width + 6, (double) tooltip_height); gtk_widget_show (canvas); - gtk_widget_realize (tooltip->window); - gtk_signal_connect (GTK_OBJECT (tooltip->window), "event", + gtk_widget_realize (window); + gtk_signal_connect (GTK_OBJECT (window), "event", GTK_SIGNAL_FUNC (tooltip_event), tooltip); - gtk_widget_popup (tooltip->window, pixel_origin.x + tooltip->x, - pixel_origin.y + tooltip->y - 1); + e_canvas_popup_tooltip (E_CANVAS(text_view->canvas), window, pixel_origin.x + tooltip->x, + pixel_origin.y + tooltip->y - 1); unref_lines (&cell); unbuild_current_cell (&cell); diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index 929911cba3..98cb7788e5 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -32,6 +32,8 @@ #define FOCUSED_BORDER 2 +/* #define DO_TOOLTIPS 1 */ + #define d(x) /* FIXME: Do an analysis of which cell functions are needed before @@ -961,8 +963,7 @@ eti_destroy (GtkObject *object) eti->height_cache = NULL; eti->height_cache_idle_count = 0; - if (eti->tooltip->window) - gtk_widget_destroy (eti->tooltip->window); + e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(eti)->canvas)); if (eti->tooltip->timer) { gtk_timeout_remove (eti->tooltip->timer); eti->tooltip->timer = 0; @@ -1108,7 +1109,6 @@ eti_init (GnomeCanvasItem *item) eti->tooltip = g_new0 (ETableTooltip, 1); eti->tooltip->timer = 0; - eti->tooltip->window = NULL; eti->tooltip->eti = GNOME_CANVAS_ITEM (eti); eti->grabbed_col = -1; @@ -1122,25 +1122,6 @@ eti_init (GnomeCanvasItem *item) static const char gray50_bits[] = { 0x02, 0x01, }; -#ifdef DO_TOOLTIPS -static gint -eti_visibility_notify(GtkWidget *widget, - GdkEventVisibility *event, - ETableItem *eti) -{ - if (eti->tooltip->visibility_count > 0) { - if (eti->tooltip->window) { - gtk_widget_destroy (eti->tooltip->window); - eti->tooltip->window = NULL; - } - } - - eti->tooltip->visibility_count ++; - - return FALSE; -} -#endif - static void eti_realize (GnomeCanvasItem *item) { @@ -1171,12 +1152,6 @@ eti_realize (GnomeCanvasItem *item) gdk_gc_set_stipple (eti->focus_gc, eti->stipple); gdk_gc_set_fill (eti->focus_gc, GDK_OPAQUE_STIPPLED); -#ifdef DO_TOOLTIPS - gtk_widget_add_events(gtk_widget_get_toplevel(GTK_WIDGET(item->canvas)), GDK_VISIBILITY_NOTIFY_MASK); - - gtk_signal_connect(GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(item->canvas))), "visibility_notify_event", - GTK_SIGNAL_FUNC(eti_visibility_notify), eti); -#endif if (eti->cell_views == NULL) eti_attach_cell_views (eti); @@ -1571,10 +1546,7 @@ _do_tooltip (ETableItem *eti) int i; int height_extra = eti->horizontal_draw_grid ? 1 : 0; - if (eti->tooltip->window) { - gtk_widget_destroy (eti->tooltip->window); - eti->tooltip->window = NULL; - } + e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(eti)->canvas)); if (eti_editing (eti)) return FALSE; @@ -1590,8 +1562,6 @@ _do_tooltip (ETableItem *eti) eti->tooltip->y = y; eti->tooltip->row_height = ETI_ROW_HEIGHT (eti, i); - eti->tooltip->visibility_count = 0; - e_cell_show_tooltip (ecell_view, view_to_model_col (eti, eti->tooltip->col), eti->tooltip->col, @@ -1724,10 +1694,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) 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_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(eti)->canvas)); switch (e->button.button) { case 1: /* Fall through. */ case 2: @@ -1811,10 +1778,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) "cursor_col", &cursor_col, NULL); - if (eti->tooltip->window) { - gtk_widget_destroy (eti->tooltip->window); - eti->tooltip->window = NULL; - } + e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(eti)->canvas)); #ifdef DO_TOOLTIPS if (eti->tooltip->timer > 0) @@ -1850,10 +1814,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) "cursor_col", &cursor_col, NULL); - if (eti->tooltip->window) { - gtk_widget_destroy (eti->tooltip->window); - eti->tooltip->window = NULL; - } + e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(eti)->canvas)); if (cursor_col == -1) return FALSE; diff --git a/widgets/table/e-table-tooltip.h b/widgets/table/e-table-tooltip.h index e9c8921933..617a0e3b55 100644 --- a/widgets/table/e-table-tooltip.h +++ b/widgets/table/e-table-tooltip.h @@ -7,13 +7,11 @@ BEGIN_GNOME_DECLS typedef struct { - GtkWidget *window; gint timer; int col, row; int row_height; int x, y; int cx, cy; - int visibility_count; GnomeCanvasItem *eti; } ETableTooltip; |