1 #include <Elementary.h>
5 * @defgroup Tooltips Tooltips
7 * The Tooltip is an (internal, for now) smart object used to show a
8 * content in a frame on mouse hover of objects(or widgets), with
9 * tips/information about them.
12 static const char _tooltip_key[] = "_elm_tooltip";
14 #define ELM_TOOLTIP_GET_OR_RETURN(tt, obj, ...) \
20 CRITICAL("Null pointer: " #obj); \
23 tt = evas_object_data_get((obj), _tooltip_key); \
26 ERR("Object does not have tooltip: " #obj); \
34 Elm_Tooltip_Content_Cb func;
39 Evas_Object *eventarea, *owner;
40 Evas_Object *tooltip, *content;
42 Ecore_Timer *show_timer;
43 Ecore_Timer *hide_timer;
44 Ecore_Job *reconfigure_job;
46 Evas_Coord x, y, bx, by;
51 double hide_timeout; /* from theme */
52 Eina_Bool visible_lock:1;
53 Eina_Bool changed_style:1;
54 Eina_Bool free_size : 1;
57 static void _elm_tooltip_reconfigure(Elm_Tooltip *tt);
58 static void _elm_tooltip_reconfigure_job_start(Elm_Tooltip *tt);
59 static void _elm_tooltip_reconfigure_job_stop(Elm_Tooltip *tt);
60 static void _elm_tooltip_hide_anim_start(Elm_Tooltip *tt);
61 static void _elm_tooltip_hide_anim_stop(Elm_Tooltip *tt);
62 static void _elm_tooltip_show_timer_stop(Elm_Tooltip *tt);
63 static void _elm_tooltip_hide(Elm_Tooltip *tt);
64 static void _elm_tooltip_data_clean(Elm_Tooltip *tt);
67 _elm_tooltip_content_changed_hints_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
69 _elm_tooltip_reconfigure_job_start(data);
73 _elm_tooltip_content_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
75 Elm_Tooltip *tt = data;
77 tt->visible_lock = EINA_FALSE;
78 _elm_tooltip_hide(tt);
82 _elm_tooltip_obj_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
84 Elm_Tooltip *tt = data;
85 _elm_tooltip_reconfigure_job_start(tt);
89 _elm_tooltip_obj_resize_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
91 Elm_Tooltip *tt = data;
92 _elm_tooltip_reconfigure_job_start(tt);
96 _elm_tooltip_obj_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
98 Elm_Tooltip *tt = data;
99 _elm_tooltip_reconfigure_job_start(tt);
103 _elm_tooltip_show(Elm_Tooltip *tt)
105 _elm_tooltip_show_timer_stop(tt);
106 _elm_tooltip_hide_anim_stop(tt);
110 _elm_tooltip_reconfigure_job_start(tt);
115 tt->tt_win = elm_win_add(NULL, "tooltip", ELM_WIN_BASIC);
116 elm_win_borderless_set(tt->tt_win, EINA_TRUE);
117 elm_win_override_set(tt->tt_win, EINA_TRUE);
118 tt->tt_evas = evas_object_evas_get(tt->tt_win);
119 tt->tooltip = edje_object_add(tt->tt_evas);
120 evas_object_pass_events_set(tt->tooltip, EINA_TRUE);
121 evas_object_move(tt->tooltip, 0, 0);
122 elm_win_resize_object_add(tt->tt_win, tt->tooltip);
123 #ifdef HAVE_ELEMENTARY_X
124 ecore_x_window_shape_input_rectangle_set(elm_win_xwindow_get(tt->tt_win), 0, 0, 0, 0);
126 evas_object_show(tt->tt_win);
129 tt->tooltip = edje_object_add(tt->evas);
130 if (!tt->tooltip) return;
132 evas_object_layer_set(tt->tt_win ?: tt->tooltip, ELM_OBJECT_LAYER_TOOLTIP);
134 evas_object_event_callback_add
135 (tt->eventarea, EVAS_CALLBACK_MOVE, _elm_tooltip_obj_move_cb, tt);
136 evas_object_event_callback_add
137 (tt->eventarea, EVAS_CALLBACK_RESIZE, _elm_tooltip_obj_resize_cb, tt);
138 evas_object_event_callback_add
139 (tt->eventarea, EVAS_CALLBACK_MOUSE_MOVE, _elm_tooltip_obj_mouse_move_cb, tt);
141 evas_object_pass_events_set(tt->tooltip, EINA_TRUE);
142 tt->changed_style = EINA_TRUE;
143 _elm_tooltip_reconfigure_job_start(tt);
147 _elm_tooltip_content_del(Elm_Tooltip *tt)
149 if (!tt->content) return;
151 evas_object_event_callback_del_full
152 (tt->content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
153 _elm_tooltip_content_changed_hints_cb, tt);
154 evas_object_event_callback_del_full
155 (tt->content, EVAS_CALLBACK_DEL,
156 _elm_tooltip_content_del_cb, tt);
157 evas_object_hide(tt->content);
158 evas_object_del(tt->content);
164 _elm_tooltip_hide(Elm_Tooltip *tt)
166 _elm_tooltip_show_timer_stop(tt);
167 _elm_tooltip_hide_anim_stop(tt);
168 _elm_tooltip_reconfigure_job_stop(tt);
170 if (!tt->tooltip) return;
171 if (tt->visible_lock) return;
173 _elm_tooltip_content_del(tt);
175 evas_object_event_callback_del_full
176 (tt->eventarea, EVAS_CALLBACK_MOVE, _elm_tooltip_obj_move_cb, tt);
177 evas_object_event_callback_del_full
178 (tt->eventarea, EVAS_CALLBACK_RESIZE, _elm_tooltip_obj_resize_cb, tt);
179 evas_object_event_callback_del_full
180 (tt->eventarea, EVAS_CALLBACK_MOUSE_MOVE, _elm_tooltip_obj_mouse_move_cb, tt);
182 if (tt->tt_win) evas_object_del(tt->tt_win);
183 else evas_object_del(tt->tooltip);
191 _elm_tooltip_reconfigure_job(void *data)
193 Elm_Tooltip *tt = data;
194 tt->reconfigure_job = NULL;
195 _elm_tooltip_reconfigure(data);
199 _elm_tooltip_reconfigure_job_stop(Elm_Tooltip *tt)
201 if (!tt->reconfigure_job) return;
202 ecore_job_del(tt->reconfigure_job);
203 tt->reconfigure_job = NULL;
207 _elm_tooltip_reconfigure_job_start(Elm_Tooltip *tt)
209 if (tt->reconfigure_job) ecore_job_del(tt->reconfigure_job);
210 tt->reconfigure_job = ecore_job_add
211 (_elm_tooltip_reconfigure_job, tt);
215 _elm_tooltip_hide_anim_cb(void *data)
217 Elm_Tooltip *tt = data;
218 tt->hide_timer = NULL;
219 _elm_tooltip_hide(tt);
224 _elm_tooltip_hide_anim_start(Elm_Tooltip *tt)
227 if (tt->hide_timer) return;
228 /* hide slightly faster when in window mode to look less stupid */
229 if ((tt->hide_timeout > 0) && tt->tt_win) extra = 0.1;
230 edje_object_signal_emit(tt->tooltip, "elm,action,hide", "elm");
231 tt->hide_timer = ecore_timer_add
232 (tt->hide_timeout - extra, _elm_tooltip_hide_anim_cb, tt);
236 _elm_tooltip_hide_anim_stop(Elm_Tooltip *tt)
238 if (!tt->hide_timer) return;
240 edje_object_signal_emit(tt->tooltip, "elm,action,show", "elm");
241 ecore_timer_del(tt->hide_timer);
242 tt->hide_timer = NULL;
246 _elm_tooltip_reconfigure(Elm_Tooltip *tt)
248 Evas_Coord ox, oy, ow, oh, px, py, tx, ty, tw, th, cw = 0, ch = 0;
249 Evas_Coord eminw, eminh, ominw, ominh;
251 Eina_Bool inside_eventarea;
252 #ifdef HAVE_ELEMENTARY_X
253 Ecore_X_Window xwin = 0;
256 _elm_tooltip_reconfigure_job_stop(tt);
258 if (tt->hide_timer) return;
259 if (!tt->tooltip) return;
260 if (tt->changed_style)
262 const char *style = tt->style ? tt->style : "default";
264 if (!_elm_theme_object_set(tt->owner, tt->tooltip, "tooltip", "base", style))
266 ERR("Could not apply the theme to the tooltip! style=%s", style);
267 if (tt->tt_win) evas_object_del(tt->tt_win);
268 else evas_object_del(tt->tooltip);
282 tt->hide_timeout = 0.0;
284 { /* FIXME: hardcoded here is bad */
285 if (!strcmp(style, "transparent"))
286 elm_win_transparent_set(tt->tt_win, EINA_TRUE);
288 elm_win_transparent_set(tt->tt_win, EINA_FALSE);
291 str = edje_object_data_get(tt->tooltip, "pad_x");
292 if (str) tt->pad.x = atoi(str);
293 str = edje_object_data_get(tt->tooltip, "pad_y");
294 if (str) tt->pad.y = atoi(str);
296 str = edje_object_data_get(tt->tooltip, "pad_border_x");
297 if (str) tt->pad.bx = atoi(str);
298 str = edje_object_data_get(tt->tooltip, "pad_border_y");
299 if (str) tt->pad.by = atoi(str);
301 str = edje_object_data_get(tt->tooltip, "hide_timeout");
304 tt->hide_timeout = atof(str);
305 if (tt->hide_timeout < 0.0) tt->hide_timeout = 0.0;
308 evas_object_pass_events_set(tt->tooltip, EINA_TRUE);
309 tt->changed_style = EINA_FALSE;
311 edje_object_part_swallow(tt->tooltip, "elm.swallow.content",
314 edje_object_signal_emit(tt->tooltip, "elm,action,show", "elm");
319 tt->content = tt->func((void *)tt->data, tt->owner, tt->tt_win ? : tt->owner);
322 WRN("could not create tooltip content!");
323 if (tt->tt_win) evas_object_del(tt->tt_win);
324 else evas_object_del(tt->tooltip);
331 evas_object_show(tt->content);
332 evas_object_layer_set(tt->content, ELM_OBJECT_LAYER_TOOLTIP);
333 evas_object_pass_events_set(tt->content, EINA_TRUE);
334 edje_object_part_swallow
335 (tt->tooltip, "elm.swallow.content", tt->content);
336 evas_object_event_callback_add(tt->content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
337 _elm_tooltip_content_changed_hints_cb, tt);
338 evas_object_event_callback_add(tt->content, EVAS_CALLBACK_DEL,
339 _elm_tooltip_content_del_cb, tt);
343 evas_object_size_hint_min_get(tt->content, &ominw, &ominh);
344 edje_object_size_min_get(tt->tooltip, &eminw, &eminh);
346 if (ominw < eminw) ominw = eminw;
347 if (ominh < eminh) ominh = eminh;
349 if (ominw < 1) ominw = 10; /* at least it is noticeable */
350 if (ominh < 1) ominh = 10; /* at least it is noticeable */
352 edje_object_size_min_restricted_calc(tt->tooltip, &tw, &th, ominw, ominh);
354 #ifdef HAVE_ELEMENTARY_X
357 xwin = elm_win_xwindow_get(elm_object_top_widget_get(tt->owner));
360 xwin = ecore_x_window_root_get(xwin);
361 ecore_x_randr_screen_current_size_get(xwin, &cw, &ch, NULL, NULL);
366 evas_output_size_get(tt->tt_evas ?: tt->evas, &cw, &ch);
368 evas_object_geometry_get(tt->eventarea, &ox, &oy, &ow, &oh);
373 #ifdef HAVE_ELEMENTARY_X
374 ecore_x_pointer_xy_get(xwin, &px, &py);
376 elm_win_screen_position_get(elm_object_top_widget_get(tt->owner), &x, &y);
382 evas_pointer_canvas_xy_get(tt->evas, &px, &py);
384 inside_eventarea = ((px >= ox) && (py >= oy) &&
385 (px <= ox + ow) && (py <= oy + oh));
386 if (inside_eventarea)
391 if (tx + tw + tt->pad.x < cw) tx += tt->pad.x;
392 if (ty + th + tt->pad.y < ch) ty += tt->pad.y;
396 tx = ox + (ow / 2) - (tw / 2);
397 if (ch < (th + oy + oh)) ty = oy - th;
401 if (tt->pad.bx * 2 + tw < cw)
403 if (tx < tt->pad.bx) tx = tt->pad.bx;
404 else if (tx + tw >= cw - tt->pad.bx) tx = cw - tw - tt->pad.bx;
407 if (tt->pad.by * 2 + th < ch)
409 if (ty < tt->pad.by) ty = tt->pad.by;
410 else if (ty + th >= ch - tt->pad.by) ty = ch - th - tt->pad.by;
415 if (abs(tx - tw) < (tx + tw) - cw)
420 if (abs(ty - th) < (ty + th) - ch)
423 evas_object_move(tt->tt_win ? : tt->tooltip, tx, ty);
424 evas_object_resize(tt->tt_win ? : tt->tooltip, tw, th);
425 evas_object_show(tt->tooltip);
427 if (inside_eventarea)
429 rel_x = (px - tx) / (double)tw;
430 rel_y = (py - ty) / (double)th;
434 rel_x = (ox + (ow / 2) - tx) / (double)tw;
435 rel_y = (oy + (oh / 2) - ty) / (double)th;
438 #define FDIF(a, b) (fabs((a) - (b)) > 0.0001)
439 if ((FDIF(rel_x, tt->rel_pos.x)) || (FDIF(rel_y, tt->rel_pos.y)))
441 Edje_Message_Float_Set *msg;
443 msg = alloca(sizeof(Edje_Message_Float_Set) + sizeof(double));
447 tt->rel_pos.x = rel_x;
448 tt->rel_pos.y = rel_y;
450 edje_object_message_send(tt->tooltip, EDJE_MESSAGE_FLOAT_SET, 1, msg);
456 _elm_tooltip_show_timer_stop(Elm_Tooltip *tt)
458 if (!tt->show_timer) return;
459 ecore_timer_del(tt->show_timer);
460 tt->show_timer = NULL;
464 _elm_tooltip_timer_show_cb(void *data)
466 Elm_Tooltip *tt = data;
467 tt->show_timer = NULL;
468 _elm_tooltip_show(tt);
469 return ECORE_CALLBACK_CANCEL;
473 _elm_tooltip_obj_mouse_in_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
475 Elm_Tooltip *tt = data;
477 _elm_tooltip_hide_anim_stop(tt);
479 if ((tt->show_timer) || (tt->tooltip)) return;
481 tt->show_timer = ecore_timer_add
482 (_elm_config->tooltip_delay, _elm_tooltip_timer_show_cb, tt);
486 _elm_tooltip_obj_mouse_out_cb(Elm_Tooltip *tt, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Event_Mouse_Out *event __UNUSED__)
488 if (tt->visible_lock) return;
492 _elm_tooltip_show_timer_stop(tt);
495 _elm_tooltip_hide_anim_start(tt);
498 static void _elm_tooltip_obj_free_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__);
501 _elm_tooltip_unset(Elm_Tooltip *tt)
503 tt->visible_lock = EINA_FALSE;
504 _elm_tooltip_hide(tt);
505 _elm_tooltip_data_clean(tt);
509 evas_object_event_callback_del_full
510 (tt->eventarea, EVAS_CALLBACK_MOUSE_IN,
511 _elm_tooltip_obj_mouse_in_cb, tt);
512 evas_object_event_callback_del_full
513 (tt->eventarea, EVAS_CALLBACK_MOUSE_OUT,
514 (Evas_Object_Event_Cb)_elm_tooltip_obj_mouse_out_cb, tt);
515 evas_object_event_callback_del_full
516 (tt->eventarea, EVAS_CALLBACK_FREE, _elm_tooltip_obj_free_cb, tt);
518 evas_object_data_del(tt->eventarea, _tooltip_key);
522 evas_object_event_callback_del_full
523 (tt->owner, EVAS_CALLBACK_FREE, _elm_tooltip_obj_free_cb, tt);
524 elm_widget_tooltip_del(tt->owner, tt);
527 eina_stringshare_del(tt->style);
532 _elm_tooltip_obj_free_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
534 Elm_Tooltip *tt = data;
535 if (tt->eventarea == obj) tt->eventarea = NULL;
536 if (tt->owner == obj) tt->owner = NULL;
537 _elm_tooltip_unset(tt);
541 _elm_tooltip_label_create(void *data, Evas_Object *obj __UNUSED__, Evas_Object *tooltip)
543 Evas_Object *label = elm_label_add(tooltip);
546 elm_object_style_set(label, "tooltip");
547 elm_object_text_set(label, data);
552 _elm_tooltip_label_del_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
554 eina_stringshare_del(data);
558 _elm_tooltip_data_clean(Elm_Tooltip *tt)
560 if (tt->del_cb) tt->del_cb((void *)tt->data, tt->owner, NULL);
562 _elm_tooltip_content_del(tt);
569 * Notify tooltip should recalculate its theme.
573 elm_tooltip_theme(Elm_Tooltip *tt)
575 if (!tt->tooltip) return;
576 tt->changed_style = EINA_TRUE;
577 _elm_tooltip_reconfigure_job_start(tt);
582 * Set the content to be shown in the tooltip object for specific event area.
584 * Setup the tooltip to object. The object @a eventarea can have only
585 * one tooltip, so any previous tooltip data is removed. @p func(with
586 * @p data) will be called every time that need show the tooltip and
587 * it should return a valid Evas_Object. This object is then managed
588 * fully by tooltip system and is deleted when the tooltip is gone.
590 * This is an internal function that is used by objects with sub-items
591 * that want to provide different tooltips for each of them. The @a
592 * owner object should be an elm_widget and will be used to track
593 * theme changes and to feed @a func and @a del_cb. The @a eventarea
594 * may be any object and is the one that should be used later on with
595 * elm_object_tooltip apis, such as elm_object_tooltip_hide(),
596 * elm_object_tooltip_show() or elm_object_tooltip_unset().
598 * @param eventarea the object being attached a tooltip.
599 * @param owner the elm_widget that owns this object, will be used to
600 * track theme changes and to be used in @a func or @a del_cb.
601 * @param func the function used to create the tooltip contents. The
602 * @a Evas_Object parameters will receive @a owner as value.
603 * @param data what to provide to @a func as callback data/context.
604 * @param del_cb called when data is not needed anymore, either when
605 * another callback replaces @func, the tooltip is unset with
606 * elm_object_tooltip_unset() or the owner object @a obj
607 * dies. This callback receives as the first parameter the
608 * given @a data, and @c event_info is NULL.
614 elm_object_sub_tooltip_content_cb_set(Evas_Object *eventarea, Evas_Object *owner, Elm_Tooltip_Content_Cb func, const void *data, Evas_Smart_Cb del_cb)
616 Elm_Tooltip *tt = NULL;
617 Eina_Bool just_created;
619 EINA_SAFETY_ON_NULL_GOTO(owner, error);
620 EINA_SAFETY_ON_NULL_GOTO(eventarea, error);
624 elm_object_tooltip_unset(eventarea);
628 tt = evas_object_data_get(eventarea, _tooltip_key);
631 if (tt->owner != owner)
633 if (tt->owner != eventarea)
634 evas_object_event_callback_del_full
635 (tt->owner, EVAS_CALLBACK_FREE, _elm_tooltip_obj_free_cb, tt);
637 elm_widget_tooltip_del(tt->owner, tt);
639 if (owner != eventarea)
640 evas_object_event_callback_add
641 (owner, EVAS_CALLBACK_FREE, _elm_tooltip_obj_free_cb, tt);
643 elm_widget_tooltip_add(tt->owner, tt);
646 if ((tt->func == func) && (tt->data == data) &&
647 (tt->del_cb == del_cb))
649 _elm_tooltip_data_clean(tt);
650 just_created = EINA_FALSE;
654 tt = ELM_NEW(Elm_Tooltip);
658 tt->eventarea = eventarea;
659 tt->evas = evas_object_evas_get(eventarea);
660 evas_object_data_set(eventarea, _tooltip_key, tt);
662 just_created = EINA_TRUE;
664 evas_object_event_callback_add(eventarea, EVAS_CALLBACK_MOUSE_IN,
665 _elm_tooltip_obj_mouse_in_cb, tt);
666 evas_object_event_callback_add(eventarea, EVAS_CALLBACK_MOUSE_OUT,
667 (Evas_Object_Event_Cb)_elm_tooltip_obj_mouse_out_cb, tt);
668 evas_object_event_callback_add(eventarea, EVAS_CALLBACK_FREE,
669 _elm_tooltip_obj_free_cb, tt);
671 if (owner != eventarea)
672 evas_object_event_callback_add
673 (owner, EVAS_CALLBACK_FREE, _elm_tooltip_obj_free_cb, tt);
675 elm_widget_tooltip_add(tt->owner, tt);
682 if (!just_created) _elm_tooltip_reconfigure_job_start(tt);
686 if (del_cb) del_cb((void *)data, owner, NULL);
690 * Force show tooltip of object
692 * @param obj Target object
694 * Force show the tooltip and disable hide on mouse_out.
695 * If another content is set as tooltip, the visible tooltip will hididen and
696 * showed again with new content.
697 * This can force show more than one tooltip at a time.
702 elm_object_tooltip_show(Evas_Object *obj)
704 ELM_TOOLTIP_GET_OR_RETURN(tt, obj);
705 tt->visible_lock = EINA_TRUE;
706 _elm_tooltip_show(tt);
710 * Force hide tooltip of object
712 * @param obj Target object
714 * Force hide the tooltip and (re)enable future mouse interations.
719 elm_object_tooltip_hide(Evas_Object *obj)
721 ELM_TOOLTIP_GET_OR_RETURN(tt, obj);
722 tt->visible_lock = EINA_FALSE;
723 _elm_tooltip_hide_anim_start(tt);
727 * Set the text to be shown in the tooltip object
729 * @param obj Target object
730 * @param text The text to set in the content
732 * Setup the text as tooltip to object. The object can have only one tooltip,
733 * so any previous tooltip data is removed.
734 * This method call internaly the elm_tooltip_content_cb_set().
739 elm_object_tooltip_text_set(Evas_Object *obj, const char *text)
741 EINA_SAFETY_ON_NULL_RETURN(obj);
742 EINA_SAFETY_ON_NULL_RETURN(text);
744 text = eina_stringshare_add(text);
745 elm_object_tooltip_content_cb_set
746 (obj, _elm_tooltip_label_create, text, _elm_tooltip_label_del_cb);
750 * Set the content to be shown in the tooltip object
752 * Setup the tooltip to object. The object can have only one tooltip,
753 * so any previous tooltip data is removed. @p func(with @p data) will
754 * be called every time that need show the tooltip and it should
755 * return a valid Evas_Object. This object is then managed fully by
756 * tooltip system and is deleted when the tooltip is gone.
758 * @param obj the object being attached a tooltip.
759 * @param func the function used to create the tooltip contents.
760 * @param data what to provide to @a func as callback data/context.
761 * @param del_cb called when data is not needed anymore, either when
762 * another callback replaces @func, the tooltip is unset with
763 * elm_object_tooltip_unset() or the owner object @a obj
764 * dies. This callback receives as the first parameter the
765 * given @a data, and @c event_info is NULL.
770 elm_object_tooltip_content_cb_set(Evas_Object *obj, Elm_Tooltip_Content_Cb func, const void *data, Evas_Smart_Cb del_cb)
772 elm_object_sub_tooltip_content_cb_set(obj, obj, func, data, del_cb);
776 * Unset tooltip from object
778 * @param obj Target object
780 * Remove tooltip from object. The callback provided as del_cb to
781 * elm_object_tooltip_content_cb_set() will be called to notify it is
784 * @see elm_object_tooltip_content_cb_set()
789 elm_object_tooltip_unset(Evas_Object *obj)
791 ELM_TOOLTIP_GET_OR_RETURN(tt, obj);
792 _elm_tooltip_unset(tt);
796 * Sets a different style for this object tooltip.
798 * @note before you set a style you should define a tooltip with
799 * elm_object_tooltip_content_cb_set() or
800 * elm_object_tooltip_text_set().
802 * @param obj an object with tooltip already set.
803 * @param style the theme style to use (default, transparent, ...)
806 elm_object_tooltip_style_set(Evas_Object *obj, const char *style)
808 ELM_TOOLTIP_GET_OR_RETURN(tt, obj);
809 if (!eina_stringshare_replace(&tt->style, style)) return;
810 elm_tooltip_theme(tt);
814 * Get the style for this object tooltip.
816 * @param obj an object with tooltip already set.
817 * @return style the theme style in use, defaults to "default". If the
818 * object does not have a tooltip set, then NULL is returned.
821 elm_object_tooltip_style_get(const Evas_Object *obj)
823 ELM_TOOLTIP_GET_OR_RETURN(tt, obj, NULL);
824 return tt->style ? tt->style : "default";
828 * Get the configured tooltip delay
830 * This gets the globally configured tooltip delay in seconds
832 * @return The tooltip delay
836 elm_tooltip_delay_get(void)
838 return _elm_config->tooltip_delay;
842 * Set the configured tooltip delay
844 * This sets the globally configured delay to tooltip
846 * @param delay The delay to show the tooltip
847 * @return EINA_TRUE if value is valid and setted
851 elm_tooltip_delay_set(double delay)
853 if (delay < 0.0) return EINA_FALSE;
854 _elm_config->tooltip_delay = delay;
859 * @brief Disable size restrictions on an object's tooltip
860 * @param obj The tooltip's anchor object
861 * @param disable If EINA_TRUE, size restrictions are disabled
862 * @return EINA_FALSE on failure, EINA_TRUE on success
864 * This function allows a tooltip to expand beyond its parant window's canvas.
865 * It will instead be limited only by the size of the display.
868 elm_tooltip_size_restrict_disable(Evas_Object *obj, Eina_Bool disable)
870 ELM_TOOLTIP_GET_OR_RETURN(tt, obj, EINA_FALSE);
871 return tt->free_size = disable;
875 * @brief Retrieve size restriction state of an object's tooltip
876 * @param obj The tooltip's anchor object
877 * @return If EINA_TRUE, size restrictions are disabled
879 * This function returns whether a tooltip is allowed to expand beyond
880 * its parant window's canvas.
881 * It will instead be limited only by the size of the display.
884 elm_tooltip_size_restrict_disabled_get(const Evas_Object *obj)
886 ELM_TOOLTIP_GET_OR_RETURN(tt, obj, EINA_FALSE);
887 return tt->free_size;