forked from enlightenment/efl
Elm tooltip: Added checks if the object passed is an elm object.
SVN revision: 62919
This commit is contained in:
parent
b80a338147
commit
e36e207812
|
@ -2397,6 +2397,23 @@ elm_widget_theme_object_set(Evas_Object *obj,
|
|||
return _elm_theme_object_set(obj, edj, wname, welement, wstyle);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_widget_is_check(const Evas_Object *obj)
|
||||
{
|
||||
static int abort_on_warn = -1;
|
||||
if (elm_widget_is(obj))
|
||||
return EINA_TRUE;
|
||||
|
||||
ERR("Passing Object: %p.", obj);
|
||||
if (abort_on_warn == -1)
|
||||
{
|
||||
if (getenv("ELM_ERROR_ABORT")) abort_on_warn = 1;
|
||||
else abort_on_warn = 0;
|
||||
}
|
||||
if (abort_on_warn == 1) abort();
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_widget_type_check(const Evas_Object *obj,
|
||||
const char *type)
|
||||
|
|
|
@ -400,6 +400,7 @@ EAPI int elm_widget_drag_child_locked_y_get(const Evas_Object *obj)
|
|||
EAPI Eina_Bool elm_widget_theme_object_set(Evas_Object *obj, Evas_Object *edj, const char *wname, const char *welement, const char *wstyle);
|
||||
EAPI void elm_widget_type_register(const char **ptr);
|
||||
EAPI void elm_widget_type_unregister(const char **ptr);
|
||||
EAPI Eina_Bool elm_widget_is_check(const Evas_Object *obj);
|
||||
EAPI Eina_Bool elm_widget_type_check(const Evas_Object *obj, const char *type);
|
||||
EAPI Eina_List *elm_widget_stringlist_get(const char *str);
|
||||
EAPI void elm_widget_stringlist_free(Eina_List *list);
|
||||
|
@ -671,6 +672,9 @@ EAPI void elm_widget_tree_dot_dump(const Evas_Object *top, FILE *out
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
#define ELM_CHECK_WID_IS(obj) \
|
||||
if (!elm_widget_is_check(obj)) return
|
||||
|
||||
#define ELM_CHECK_WIDTYPE(obj, widtype) \
|
||||
if (!elm_widget_type_check((obj), (widtype))) return
|
||||
|
||||
|
|
|
@ -717,6 +717,7 @@ elm_object_sub_tooltip_content_cb_set(Evas_Object *eventarea, Evas_Object *owner
|
|||
EAPI void
|
||||
elm_object_tooltip_show(Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WID_IS(obj);
|
||||
ELM_TOOLTIP_GET_OR_RETURN(tt, obj);
|
||||
tt->visible_lock = EINA_TRUE;
|
||||
_elm_tooltip_show(tt);
|
||||
|
@ -734,6 +735,7 @@ elm_object_tooltip_show(Evas_Object *obj)
|
|||
EAPI void
|
||||
elm_object_tooltip_hide(Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WID_IS(obj);
|
||||
ELM_TOOLTIP_GET_OR_RETURN(tt, obj);
|
||||
tt->visible_lock = EINA_FALSE;
|
||||
_elm_tooltip_hide_anim_start(tt);
|
||||
|
@ -754,6 +756,7 @@ elm_object_tooltip_hide(Evas_Object *obj)
|
|||
EAPI void
|
||||
elm_object_tooltip_text_set(Evas_Object *obj, const char *text)
|
||||
{
|
||||
ELM_CHECK_WID_IS(obj);
|
||||
EINA_SAFETY_ON_NULL_RETURN(obj);
|
||||
EINA_SAFETY_ON_NULL_RETURN(text);
|
||||
|
||||
|
@ -785,6 +788,7 @@ elm_object_tooltip_text_set(Evas_Object *obj, const char *text)
|
|||
EAPI void
|
||||
elm_object_tooltip_content_cb_set(Evas_Object *obj, Elm_Tooltip_Content_Cb func, const void *data, Evas_Smart_Cb del_cb)
|
||||
{
|
||||
ELM_CHECK_WID_IS(obj);
|
||||
elm_object_sub_tooltip_content_cb_set(obj, obj, func, data, del_cb);
|
||||
}
|
||||
|
||||
|
@ -804,6 +808,7 @@ elm_object_tooltip_content_cb_set(Evas_Object *obj, Elm_Tooltip_Content_Cb func,
|
|||
EAPI void
|
||||
elm_object_tooltip_unset(Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WID_IS(obj);
|
||||
ELM_TOOLTIP_GET_OR_RETURN(tt, obj);
|
||||
_elm_tooltip_unset(tt);
|
||||
}
|
||||
|
@ -821,6 +826,7 @@ elm_object_tooltip_unset(Evas_Object *obj)
|
|||
EAPI void
|
||||
elm_object_tooltip_style_set(Evas_Object *obj, const char *style)
|
||||
{
|
||||
ELM_CHECK_WID_IS(obj);
|
||||
ELM_TOOLTIP_GET_OR_RETURN(tt, obj);
|
||||
if (!eina_stringshare_replace(&tt->style, style)) return;
|
||||
elm_tooltip_theme(tt);
|
||||
|
@ -836,6 +842,7 @@ elm_object_tooltip_style_set(Evas_Object *obj, const char *style)
|
|||
EAPI const char *
|
||||
elm_object_tooltip_style_get(const Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WID_IS(obj);
|
||||
ELM_TOOLTIP_GET_OR_RETURN(tt, obj, NULL);
|
||||
return tt->style ? tt->style : "default";
|
||||
}
|
||||
|
@ -883,6 +890,7 @@ elm_tooltip_delay_set(double delay)
|
|||
EAPI Eina_Bool
|
||||
elm_tooltip_size_restrict_disable(Evas_Object *obj, Eina_Bool disable)
|
||||
{
|
||||
ELM_CHECK_WID_IS(obj);
|
||||
ELM_TOOLTIP_GET_OR_RETURN(tt, obj, EINA_FALSE);
|
||||
return tt->free_size = disable;
|
||||
}
|
||||
|
@ -899,6 +907,7 @@ elm_tooltip_size_restrict_disable(Evas_Object *obj, Eina_Bool disable)
|
|||
EAPI Eina_Bool
|
||||
elm_tooltip_size_restrict_disabled_get(const Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WID_IS(obj);
|
||||
ELM_TOOLTIP_GET_OR_RETURN(tt, obj, EINA_FALSE);
|
||||
return tt->free_size;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue