diff options
author | Srinivasa Ragavan <sragavan@novell.com> | 2005-11-23 16:19:00 +0800 |
---|---|---|
committer | Srinivasa Ragavan <sragavan@src.gnome.org> | 2005-11-23 16:19:00 +0800 |
commit | a722e3281e5404a902eefe0f20005f59b5b2d813 (patch) | |
tree | c589fa71f218ee0c0e17f86bf066f2866ca1ee41 /calendar/gui/e-day-view.c | |
parent | 80f4fd336fed8066ba8db8dd398c5023b0ff4ff7 (diff) | |
download | gsoc2013-evolution-a722e3281e5404a902eefe0f20005f59b5b2d813.tar.gz gsoc2013-evolution-a722e3281e5404a902eefe0f20005f59b5b2d813.tar.zst gsoc2013-evolution-a722e3281e5404a902eefe0f20005f59b5b2d813.zip |
Added a function to get tooltip tooltip widget
2005-11-23 Srinivasa Ragavan <sragavan@novell.com>
* gui/e-calendar-view.c (tooltip_grab), (get_label),
(e_calendar_view_get_tooltips): Added a function to get tooltip
tooltip widget
* gui/e-calendar-view.h:
* gui/e-day-view.c (e_day_view_add_event),
(e_day_view_reshape_long_event), (e_day_view_reshape_day_event),
(e_day_view_on_text_item_event): Added tooltip for day/work week
view.
* gui/e-week-view.c (e_week_view_add_event), (tooltip_event_cb),
(e_week_view_reshape_event_span), (e_week_view_on_text_item_event):
Added tooltip for week/month view.
* gui/e-week-view.h:
* gui/misc.c (get_position_in_array), (calculate_time): Added a
function for converting time to string.
* gui/misc.h:
svn path=/trunk/; revision=30648
Diffstat (limited to 'calendar/gui/e-day-view.c')
-rw-r--r-- | calendar/gui/e-day-view.c | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index a7092f8f91..1c655ad7f2 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -4224,6 +4224,9 @@ e_day_view_add_event (ECalComponent *comp, } event.start = start; + event.tooltip = NULL; + event.color = NULL; + event.timeout = -1; event.end = end; event.canvas_item = NULL; event.comp_data->instance_start = start; @@ -4465,6 +4468,7 @@ e_day_view_reshape_long_event (EDayView *day_view, NULL); g_signal_connect (event->canvas_item, "event", G_CALLBACK (e_day_view_on_text_item_event), day_view); + g_object_set_data ((GObject *)event->canvas_item, "event", (gpointer)event); g_signal_emit_by_name (G_OBJECT(day_view), "event_added", event); @@ -4646,6 +4650,7 @@ e_day_view_reshape_day_event (EDayView *day_view, NULL); g_signal_connect (event->canvas_item, "event", G_CALLBACK (e_day_view_on_text_item_event), day_view); + g_object_set_data ((GObject *)event->canvas_item, "event", (gpointer)event); g_signal_emit_by_name (G_OBJECT(day_view), "event_added", event); @@ -5765,7 +5770,6 @@ cancel_editing (EDayView *day_view) e_day_view_stop_editing_event (day_view); } - static gboolean e_day_view_on_text_item_event (GnomeCanvasItem *item, GdkEvent *event, @@ -5825,10 +5829,50 @@ e_day_view_on_text_item_event (GnomeCanvasItem *item, e_day_view_on_editing_stopped (day_view, item); return FALSE; + case GDK_ENTER_NOTIFY: + { + EDayViewEvent *pevent = (EDayViewEvent *)g_object_get_data ((GObject *)item, "event"); + + pevent->x = ((GdkEventCrossing *)event)->x_root; + pevent->y = ((GdkEventCrossing *)event)->y_root; + pevent->tooltip = NULL; + pevent->timeout = g_timeout_add (500, (GSourceFunc)e_calendar_view_get_tooltips, pevent); + + return TRUE; + } + case GDK_LEAVE_NOTIFY: + { + EDayViewEvent *pevent = (EDayViewEvent *)g_object_get_data ((GObject *)item, "event"); + + if (pevent && pevent->tooltip) { + gtk_widget_destroy (pevent->tooltip); + pevent->tooltip = NULL; + } + + if (pevent && pevent->timeout != -1) { + g_source_remove (pevent->timeout); + pevent->timeout = -1; + } + + return TRUE; + } + case GDK_MOTION_NOTIFY: + { + EDayViewEvent *pevent = (EDayViewEvent *)g_object_get_data ((GObject *)item, "event"); + + pevent->x = ((GdkEventMotion *)event)->x_root; + pevent->y = ((GdkEventMotion *)event)->y_root; + + if (pevent->tooltip) { + gtk_window_move ((GtkWindow *)pevent->tooltip, ((int)((GdkEventMotion *)event)->x_root)+16, ((int)((GdkEventMotion *)event)->y_root) +16); + } + + return TRUE; + } default: break; } - + return FALSE; } |