static Evas_Object *
_tt_item_icon(void *data __UNUSED__,
- Evas_Object *obj,
+ Evas_Object *obj __UNUSED__,
+ Evas_Object *tt,
void *item __UNUSED__)
{
- Evas_Object *ic = elm_icon_add(obj);
+ Evas_Object *ic = elm_icon_add(tt);
char buf[PATH_MAX];
snprintf(buf, sizeof(buf), "%s/images/logo_small.png",
PACKAGE_DATA_DIR);
static Evas_Object *
_tt_item_icon2(void *data __UNUSED__,
- Evas_Object *obj,
+ Evas_Object *obj __UNUSED__,
+ Evas_Object *tt,
void *item __UNUSED__)
{
- Evas_Object *ic = elm_icon_add(obj);
+ Evas_Object *ic = elm_icon_add(tt);
char buf[PATH_MAX];
snprintf(buf, sizeof(buf), "%s/images/logo.png", PACKAGE_DATA_DIR);
elm_icon_file_set(ic, buf, NULL);
static Evas_Object *
_tt_icon(void *data __UNUSED__,
- Evas_Object *obj)
+ Evas_Object *obj __UNUSED__,
+ Evas_Object *tt)
{
- Evas_Object *ic = elm_icon_add(obj);
+ Evas_Object *ic = elm_icon_add(tt);
char buf[PATH_MAX];
snprintf(buf, sizeof(buf), "%s/images/logo_small.png",
PACKAGE_DATA_DIR);
static Evas_Object *
_tt_icon2(void *data __UNUSED__,
- Evas_Object *obj)
+ Evas_Object *obj __UNUSED__,
+ Evas_Object *tt)
{
- Evas_Object *ic = elm_icon_add(obj);
+ Evas_Object *ic = elm_icon_add(tt);
char buf[PATH_MAX];
snprintf(buf, sizeof(buf), "%s/images/icon_00.png", PACKAGE_DATA_DIR);
elm_icon_file_set(ic, buf, NULL);
elm_list_item_tooltip_content_cb_set(li, _tt_item_icon, NULL, NULL);
li = elm_list_item_append(lst, "Big Icon Tooltip", NULL, NULL, NULL, NULL);
elm_list_item_tooltip_content_cb_set(li, _tt_item_icon2, NULL, NULL);
+ elm_list_item_tooltip_size_restrict_disable(li, EINA_TRUE);
evas_object_size_hint_weight_set(lst, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(lst, EVAS_HINT_FILL, EVAS_HINT_FILL);
* Called back when a widget's tooltip is activated and needs content.
* @param data user-data given to elm_object_tooltip_content_cb_set()
* @param obj owner widget.
+ * @param tooltip The tooltip object (affix content to this!)
*/
- typedef Evas_Object *(*Elm_Tooltip_Content_Cb) (void *data, Evas_Object *obj);
+ typedef Evas_Object *(*Elm_Tooltip_Content_Cb) (void *data, Evas_Object *obj, Evas_Object *tooltip);
/**
* Called back when a widget's item tooltip is activated and needs content.
* @param data user-data given to elm_object_tooltip_content_cb_set()
* @param obj owner widget.
+ * @param tooltip The tooltip object (affix content to this!)
* @param item context dependent item. As an example, if tooltip was
* set on Elm_List_Item, then it is of this type.
*/
- typedef Evas_Object *(*Elm_Tooltip_Item_Content_Cb) (void *data, Evas_Object *obj, void *item);
+ typedef Evas_Object *(*Elm_Tooltip_Item_Content_Cb) (void *data, Evas_Object *obj, Evas_Object *tooltip, void *item);
typedef Eina_Bool (*Elm_Event_Cb) (void *data, Evas_Object *obj, Evas_Object *src, Evas_Callback_Type type, void *event_info);
* @ingroup Gengrid
*/
EAPI const char *elm_gengrid_item_tooltip_style_get(const Elm_Gengrid_Item *item) EINA_ARG_NONNULL(1);
-
+ /**
+ * @brief Disable size restrictions on an object's tooltip
+ * @param item The tooltip's anchor object
+ * @param disable If EINA_TRUE, size restrictions are disabled
+ * @return EINA_FALSE on failure, EINA_TRUE on success
+ *
+ * This function allows a tooltip to expand beyond its parant window's canvas.
+ * It will instead be limited only by the size of the display.
+ */
+ EAPI Eina_Bool elm_gengrid_item_tooltip_size_restrict_disable(Elm_Gengrid_Item *item, Eina_Bool disable);
+ /**
+ * @brief Retrieve size restriction state of an object's tooltip
+ * @param item The tooltip's anchor object
+ * @return If EINA_TRUE, size restrictions are disabled
+ *
+ * This function returns whether a tooltip is allowed to expand beyond
+ * its parant window's canvas.
+ * It will instead be limited only by the size of the display.
+ */
+ EAPI Eina_Bool elm_gengrid_item_tooltip_size_restrict_disabled_get(const Elm_Gengrid_Item *item);
/**
* Set the type of mouse pointer/cursor decoration to be shown,
* when the mouse pointer is over the given gengrid widget item
EAPI const char *elm_object_cursor_style_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI void elm_object_cursor_engine_only_set(Evas_Object *obj, Eina_Bool engine_only) EINA_ARG_NONNULL(1);
EAPI Eina_Bool elm_object_cursor_engine_only_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
+ EAPI Eina_Bool elm_tooltip_size_restrict_disable(Evas_Object *obj, Eina_Bool disable); EINA_ARG_NONNULL(1);
+ EAPI Eina_Bool elm_tooltip_size_restrict_disabled_get(const Evas_Object *obj); EINA_ARG_NONNULL(1);
/* cursors */
EAPI int elm_cursor_engine_only_get(void);
*/
EAPI void elm_list_item_tooltip_text_set(Elm_List_Item *item, const char *text) EINA_ARG_NONNULL(1);
+
+ /**
+ * @brief Disable size restrictions on an object's tooltip
+ * @param item The tooltip's anchor object
+ * @param disable If EINA_TRUE, size restrictions are disabled
+ * @return EINA_FALSE on failure, EINA_TRUE on success
+ *
+ * This function allows a tooltip to expand beyond its parant window's canvas.
+ * It will instead be limited only by the size of the display.
+ */
+ EAPI Eina_Bool elm_list_item_tooltip_size_restrict_disable(Elm_List_Item *item, Eina_Bool disable) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Retrieve size restriction state of an object's tooltip
+ * @param obj The tooltip's anchor object
+ * @return If EINA_TRUE, size restrictions are disabled
+ *
+ * This function returns whether a tooltip is allowed to expand beyond
+ * its parant window's canvas.
+ * It will instead be limited only by the size of the display.
+ */
+ EAPI Eina_Bool elm_list_item_tooltip_size_restrict_disabled_get(const Elm_List_Item *item) EINA_ARG_NONNULL(1);
+
/**
* Set the content to be shown in the tooltip item.
*
EAPI void elm_genlist_item_tooltip_unset(Elm_Genlist_Item *item) EINA_ARG_NONNULL(1);
EAPI void elm_genlist_item_tooltip_style_set(Elm_Genlist_Item *item, const char *style) EINA_ARG_NONNULL(1);
EAPI const char *elm_genlist_item_tooltip_style_get(const Elm_Genlist_Item *item) EINA_ARG_NONNULL(1);
+ /**
+ * @brief Disable size restrictions on an object's tooltip
+ * @param item The tooltip's anchor object
+ * @param disable If EINA_TRUE, size restrictions are disabled
+ * @return EINA_FALSE on failure, EINA_TRUE on success
+ *
+ * This function allows a tooltip to expand beyond its parant window's canvas.
+ * It will instead be limited only by the size of the display.
+ */
+ EAPI Eina_Bool elm_genlist_item_tooltip_size_restrict_disable(Elm_Genlist_Item *item, Eina_Bool disable);
+ /**
+ * @brief Retrieve size restriction state of an object's tooltip
+ * @param item The tooltip's anchor object
+ * @return If EINA_TRUE, size restrictions are disabled
+ *
+ * This function returns whether a tooltip is allowed to expand beyond
+ * its parant window's canvas.
+ * It will instead be limited only by the size of the display.
+ */
+ EAPI Eina_Bool elm_genlist_item_tooltip_size_restrict_disabled_get(const Elm_Genlist_Item *item);
EAPI void elm_genlist_item_cursor_set(Elm_Genlist_Item *item, const char *cursor) EINA_ARG_NONNULL(1);
EAPI const char *elm_genlist_item_cursor_get(const Elm_Genlist_Item *item) EINA_ARG_NONNULL(1);
EAPI void elm_genlist_item_cursor_unset(Elm_Genlist_Item *item) EINA_ARG_NONNULL(1);
static Evas_Object *
_elm_gengrid_item_label_create(void *data,
- Evas_Object *obj,
+ Evas_Object *obj __UNUSED__,
+ Evas_Object *tooltip,
void *item __UNUSED__)
{
- Evas_Object *label = elm_label_add(obj);
+ Evas_Object *label = elm_label_add(tooltip);
if (!label)
return NULL;
elm_object_style_set(label, "tooltip");
return item->tooltip.style;
}
+EAPI Eina_Bool
+elm_gengrid_item_tooltip_size_restrict_disable(Elm_Gengrid_Item *item, Eina_Bool disable)
+{
+ ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
+ return elm_widget_item_tooltip_size_restrict_disable(item, disable);
+}
+
+EAPI Eina_Bool
+elm_gengrid_item_tooltip_size_restrict_disabled_get(const Elm_Gengrid_Item *item)
+{
+ ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
+ return elm_widget_item_tooltip_size_restrict_disabled_get(item);
+}
+
EAPI void
elm_gengrid_item_cursor_set(Elm_Gengrid_Item *item,
const char *cursor)
static Evas_Object *
_elm_genlist_item_label_create(void *data,
- Evas_Object *obj,
+ Evas_Object *obj __UNUSED__,
+ Evas_Object *tooltip,
void *item __UNUSED__)
{
- Evas_Object *label = elm_label_add(obj);
+ Evas_Object *label = elm_label_add(tooltip);
if (!label)
return NULL;
elm_object_style_set(label, "tooltip");
return item->tooltip.style;
}
+EAPI Eina_Bool
+elm_genlist_item_tooltip_size_restrict_disable(Elm_Genlist_Item *item, Eina_Bool disable)
+{
+ ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
+ return elm_widget_item_tooltip_size_restrict_disable(item, disable);
+}
+
+EAPI Eina_Bool
+elm_genlist_item_tooltip_size_restrict_disabled_get(const Elm_Genlist_Item *item)
+{
+ ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
+ return elm_widget_item_tooltip_size_restrict_disabled_get(item);
+}
+
/**
* Set the cursor to be shown when mouse is over the genlist item
*
elm_widget_item_tooltip_unset(item);
}
+EAPI Eina_Bool
+elm_list_item_tooltip_size_restrict_disable(Elm_List_Item *item, Eina_Bool disable)
+{
+ ELM_LIST_ITEM_CHECK_DELETED_RETURN(item, EINA_FALSE);
+ return elm_widget_item_tooltip_size_restrict_disable(item, disable);
+}
+
+EAPI Eina_Bool
+elm_list_item_tooltip_size_restrict_disabled_get(const Elm_List_Item *item)
+{
+ ELM_LIST_ITEM_CHECK_DELETED_RETURN(item, EINA_FALSE);
+ return elm_widget_item_tooltip_size_restrict_disabled_get(item);
+}
+
EAPI void
elm_list_item_tooltip_style_set(Elm_List_Item *item, const char *style)
{
static Evas_Object *
_elm_widget_item_tooltip_label_create(void *data,
- Evas_Object *obj,
+ Evas_Object *obj __UNUSED__,
+ Evas_Object *tooltip,
void *item __UNUSED__)
{
- Evas_Object *label = elm_label_add(obj);
+ Evas_Object *label = elm_label_add(tooltip);
if (!label)
return NULL;
elm_object_style_set(label, "tooltip");
static Evas_Object *
_elm_widget_item_tooltip_create(void *data,
- Evas_Object *obj)
+ Evas_Object *obj,
+ Evas_Object *tooltip)
{
Elm_Widget_Item_Tooltip *wit = data;
- return wit->func((void *)wit->data, obj, wit->item);
+ return wit->func((void *)wit->data, obj, tooltip, wit->item);
}
static void
elm_object_tooltip_style_set(item->view, style);
}
+EAPI Eina_Bool
+_elm_widget_item_tooltip_size_restrict_disable(Elm_Widget_Item *item, Eina_Bool disable)
+{
+ ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, EINA_FALSE);
+ return elm_tooltip_size_restrict_disable(item->view, disable);
+}
+
+EAPI Eina_Bool
+_elm_widget_item_tooltip_size_restrict_disabled_get(const Elm_Widget_Item *item)
+{
+ ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, EINA_FALSE);
+ return elm_tooltip_size_restrict_disabled_get(item->view);
+}
+
/**
* @internal
*
EAPI void _elm_widget_item_tooltip_content_cb_set(Elm_Widget_Item *item, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb);
EAPI void _elm_widget_item_tooltip_unset(Elm_Widget_Item *item);
EAPI void _elm_widget_item_tooltip_style_set(Elm_Widget_Item *item, const char *style);
+EAPI Eina_Bool _elm_widget_item_tooltip_size_restrict_disable(Elm_Widget_Item *item, Eina_Bool disable);
+EAPI Eina_Bool _elm_widget_item_tooltip_size_restrict_disabled_get(const Elm_Widget_Item *item);
EAPI const char *_elm_widget_item_tooltip_style_get(const Elm_Widget_Item *item);
EAPI void _elm_widget_item_cursor_set(Elm_Widget_Item *item, const char *cursor);
EAPI const char *_elm_widget_item_cursor_get(const Elm_Widget_Item *item);
*/
#define elm_widget_item_tooltip_style_set(item, style) \
_elm_widget_item_tooltip_style_set((Elm_Widget_Item *)item, style)
+
+#define elm_widget_item_tooltip_size_restrict_disable(item, disable) \
+ _elm_widget_item_tooltip_size_restrict_disable((Elm_Widget_Item *)item, disable)
+
+#define elm_widget_item_tooltip_size_restrict_disabled_get(item) \
+ _elm_widget_item_tooltip_size_restrict_disabled_get((Elm_Widget_Item *)item)
/**
* Convenience function to query item's tooltip style.
* @see _elm_widget_item_tooltip_style_get()
Evas_Smart_Cb del_cb;
const void *data;
const char *style;
- Evas *evas;
+ Evas *evas, *tt_evas;
Evas_Object *eventarea, *owner;
Evas_Object *tooltip, *content;
+ Evas_Object *tt_win;
Ecore_Timer *show_timer;
Ecore_Timer *hide_timer;
Ecore_Job *reconfigure_job;
double hide_timeout; /* from theme */
Eina_Bool visible_lock:1;
Eina_Bool changed_style:1;
+ Eina_Bool free_size : 1;
};
static void _elm_tooltip_reconfigure(Elm_Tooltip *tt);
_elm_tooltip_reconfigure_job_start(tt);
return;
}
- tt->tooltip = edje_object_add(tt->evas);
+ if (tt->free_size)
+ {
+ tt->tt_win = elm_win_add(NULL, "tooltip", ELM_WIN_BASIC);
+ elm_win_transparent_set(tt->tt_win, EINA_TRUE);
+ elm_win_override_set(tt->tt_win, EINA_TRUE);
+ elm_win_borderless_set(tt->tt_win, EINA_TRUE);
+ elm_object_focus_allow_set(tt->tt_win, EINA_FALSE);
+ tt->tt_evas = evas_object_evas_get(tt->tt_win);
+ tt->tooltip = edje_object_add(tt->tt_evas);
+ evas_object_move(tt->tooltip, 0, 0);
+ elm_win_resize_object_add(tt->tt_win, tt->tooltip);
+ evas_object_show(tt->tt_win);
+ }
+ else
+ tt->tooltip = edje_object_add(tt->evas);
if (!tt->tooltip) return;
- evas_object_layer_set(tt->tooltip, ELM_OBJECT_LAYER_TOOLTIP);
+ evas_object_layer_set(tt->tt_win ?: tt->tooltip, ELM_OBJECT_LAYER_TOOLTIP);
evas_object_event_callback_add
(tt->eventarea, EVAS_CALLBACK_MOVE, _elm_tooltip_obj_move_cb, tt);
evas_object_event_callback_del_full
(tt->eventarea, EVAS_CALLBACK_MOUSE_MOVE, _elm_tooltip_obj_mouse_move_cb, tt);
- evas_object_del(tt->tooltip);
+ if (tt->tt_win) evas_object_del(tt->tt_win);
+ else evas_object_del(tt->tooltip);
+
+ tt->tt_win = NULL;
+ tt->tt_evas = NULL;
tt->tooltip = NULL;
}
static void
_elm_tooltip_reconfigure(Elm_Tooltip *tt)
{
- Evas_Coord ox, oy, ow, oh, px, py, tx, ty, tw, th, cw, ch;
+ Evas_Coord ox, oy, ow, oh, px, py, tx, ty, tw, th, cw = 0, ch = 0;
Evas_Coord eminw, eminh, ominw, ominh;
double rel_x, rel_y;
Eina_Bool inside_eventarea;
+#ifdef HAVE_ELEMENTARY_X
+ Ecore_X_Window xwin;
+#endif
_elm_tooltip_reconfigure_job_stop(tt);
{
const char *style = tt->style ? tt->style : "default";
const char *str;
- if (!_elm_theme_object_set
- (tt->owner, tt->tooltip, "tooltip", "base", style))
+ if (!_elm_theme_object_set(tt->owner, tt->tooltip, "tooltip", "base", style))
{
ERR("Could not apply the theme to the tooltip! style=%s", style);
- evas_object_del(tt->tooltip);
+ if (tt->tt_win) evas_object_del(tt->tt_win);
+ else evas_object_del(tt->tooltip);
+
+ tt->tt_win = NULL;
+ tt->tt_evas = NULL;
tt->tooltip = NULL;
return;
}
evas_object_pass_events_set(tt->tooltip, EINA_TRUE);
tt->changed_style = EINA_FALSE;
if (tt->tooltip)
- edje_object_part_swallow
- (tt->tooltip, "elm.swallow.content", tt->content);
+ edje_object_part_swallow(tt->tooltip, "elm.swallow.content",
+ tt->content);
edje_object_signal_emit(tt->tooltip, "elm,action,show", "elm");
}
if (!tt->content)
{
- tt->content = tt->func((void *)tt->data, tt->owner);
+ tt->content = tt->func((void *)tt->data, tt->owner, tt->tt_win ? : tt->owner);
if (!tt->content)
{
WRN("could not create tooltip content!");
- evas_object_del(tt->tooltip);
+ if (tt->tt_win) evas_object_del(tt->tt_win);
+ else evas_object_del(tt->tooltip);
+
+ tt->tt_win = NULL;
+ tt->tt_evas = NULL;
tt->tooltip = NULL;
return;
}
+ evas_object_show(tt->content);
evas_object_layer_set(tt->content, ELM_OBJECT_LAYER_TOOLTIP);
evas_object_pass_events_set(tt->content, EINA_TRUE);
edje_object_part_swallow
(tt->tooltip, "elm.swallow.content", tt->content);
- evas_object_event_callback_add
- (tt->content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ evas_object_event_callback_add(tt->content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_elm_tooltip_content_changed_hints_cb, tt);
- evas_object_event_callback_add
- (tt->content, EVAS_CALLBACK_DEL,
+ evas_object_event_callback_add(tt->content, EVAS_CALLBACK_DEL,
_elm_tooltip_content_del_cb, tt);
}
if (ominw < 1) ominw = 10; /* at least it is noticeable */
if (ominh < 1) ominh = 10; /* at least it is noticeable */
- edje_object_size_min_restricted_calc
- (tt->tooltip, &tw, &th, ominw, ominh);
+ edje_object_size_min_restricted_calc(tt->tooltip, &tw, &th, ominw, ominh);
- evas_output_size_get(tt->evas, &cw, &ch);
+#ifdef HAVE_ELEMENTARY_X
+ if (tt->tt_win)
+ {
+ xwin = elm_win_xwindow_get(elm_object_top_widget_get(tt->owner));
+ if (xwin)
+ {
+ xwin = ecore_x_window_root_get(xwin);
+ ecore_x_randr_screen_current_size_get(xwin, &cw, &ch, NULL, NULL);
+ }
+ }
+ if (!cw)
+#endif
+ evas_output_size_get(tt->tt_evas ?: tt->evas, &cw, &ch);
evas_pointer_canvas_xy_get(tt->evas, &px, &py);
evas_object_geometry_get(tt->eventarea, &ox, &oy, &ow, &oh);
inside_eventarea = ((px >= ox) && (py >= oy) &&
(px <= ox + ow) && (py <= oy + oh));
+#ifdef HAVE_ELEMENTARY_X
+ if (tt->tt_win) ecore_x_pointer_xy_get(xwin, &px, &py);
+#endif
if (inside_eventarea)
{
tx = px;
else if (ty + th >= ch - tt->pad.by) ty = ch - th - tt->pad.by;
}
- evas_object_move(tt->tooltip, tx, ty);
- evas_object_resize(tt->tooltip, tw, th);
+ evas_object_move(tt->tt_win ? : tt->tooltip, tx, ty);
+ evas_object_resize(tt->tt_win ? : tt->tooltip, tw, th);
evas_object_show(tt->tooltip);
if (inside_eventarea)
}
static Evas_Object *
-_elm_tooltip_label_create(void *data, Evas_Object *obj)
+_elm_tooltip_label_create(void *data, Evas_Object *obj __UNUSED__, Evas_Object *tooltip)
{
- Evas_Object *label = elm_label_add(obj);
+ Evas_Object *label = elm_label_add(tooltip);
if (!label)
return NULL;
elm_object_style_set(label, "tooltip");
_elm_config->tooltip_delay = delay;
return EINA_TRUE;
}
+
+/**
+ * @brief Disable size restrictions on an object's tooltip
+ * @param obj The tooltip's anchor object
+ * @param disable If EINA_TRUE, size restrictions are disabled
+ * @return EINA_FALSE on failure, EINA_TRUE on success
+ *
+ * This function allows a tooltip to expand beyond its parant window's canvas.
+ * It will instead be limited only by the size of the display.
+ */
+EAPI Eina_Bool
+elm_tooltip_size_restrict_disable(Evas_Object *obj, Eina_Bool disable)
+{
+ ELM_TOOLTIP_GET_OR_RETURN(tt, obj, EINA_FALSE);
+ return tt->free_size = disable;
+}
+
+/**
+ * @brief Retrieve size restriction state of an object's tooltip
+ * @param obj The tooltip's anchor object
+ * @return If EINA_TRUE, size restrictions are disabled
+ *
+ * This function returns whether a tooltip is allowed to expand beyond
+ * its parant window's canvas.
+ * It will instead be limited only by the size of the display.
+ */
+EAPI Eina_Bool
+elm_tooltip_size_restrict_disabled_get(const Evas_Object *obj)
+{
+ ELM_TOOLTIP_GET_OR_RETURN(tt, obj, EINA_FALSE);
+ return tt->free_size;
+}