Tooltip
This feature is supported in mobile applications only.
The tooltip component is a smart object that shows a content in a frame when mouse hovers a parent object. It provides tips or information about the parent object.
A tooltip component is not a UI component as such, so it does not emit signals. There are no registered callbacks for it.
For more information, see the Tooltips API.
Figure: Tooltip component
Adding a Tooltip
The tooltip component cannot be created with the elm_tooltip_add() function. This component is already contained in a parent component when it is created. You can only activate or disable it.
Activating the Tooltip
To activate the tooltip on a parent object:
- Set a tooltip text to the parent object:
Evas_Object *parent = elm_button_add(obj); elm_object_text_set(parent, "Parent"); evas_object_show(parent); elm_object_tooltip_text_set(parent, "The tooltip text";
You can also set a content to the parent object.
{ elm_object_tooltip_content_cb_set(parent, tooltip_content_cb, data, tooltip_content_del_cb); } Evas_Object* tooltip_content_cb(void*data, Evas_Object *obj, Evas_Object *tooltip) { // Create the tooltip content } void tooltip_content_del_cb(void *data, Evas_Object *obj, void *event_info) { // Destroy the tooltip content }
When passing content to the tooltip, the tooltip_content_cb function is called each time the tooltip is shown. The role of this function is to create the content to set in the tooltip. It returns a pointer to an Evas_Object.
-
When the tooltip disappears, the tooltip_content_del_cb function is called. This function is in charge of deleting the previously allocated Evas_Object.
Once set, the tooltip can be manually hidden or shown.
elm_object_tooltip_hide(parent); elm_object_tooltip_show(parent);
-
Remove the tooltip from the parent object when it is not needed.
elm_object_tooltip_unset(parent);
Note When content is set into the tooltip object, unsetting it calls the callback provided as del_cb to notify that the tooltip cannot be used any longer.
Configuring the Tooltip
The window mode allows the tooltip to expand beyond its parent window canvas. It is limited only by the size of the display.
elm_object_tooltip_window_mode_set(parent, EINA_TRUE); elm_object_tooltip_window_mode_get(parent);
Using the Tooltip Styles
The following styles are available for the tooltip:
- default
- transparent
To set the transparent style:
elm_object_tooltip_style_set(parent, "transparent");
To get the current style, use the elm_object_tooltip_style_get() function:
char *style = elm_object_tooltip_style_get(parent);
Note |
---|
Except as noted, this content is licensed under LGPLv2.1+. |