forked from enlightenment/efl
+elm_toolbar_item_icon_memfile_set
we should probably move towards an elm_object(_item)_icon_set api soon... SVN revision: 63645
This commit is contained in:
parent
c575d2d4c6
commit
a73fd7e3f4
|
@ -13690,6 +13690,24 @@ extern "C" {
|
|||
*/
|
||||
EAPI const char *elm_toolbar_item_icon_get(const Elm_Toolbar_Item *item) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Set the icon associated with @p item to an image in a binary buffer.
|
||||
*
|
||||
* @param item The toolbar item.
|
||||
* @param img The binary data that will be used as an image
|
||||
* @param size The size of binary data @p img
|
||||
* @param format Optional format of @p img to pass to the image loader
|
||||
* @param key Optional key of @p img to pass to the image loader (eg. if @p img is an edje file)
|
||||
*
|
||||
* @return (@c EINA_TRUE = success, @c EINA_FALSE = error)
|
||||
*
|
||||
* @note The icon image set by this function can be changed by
|
||||
* elm_toolbar_item_icon_set().
|
||||
*
|
||||
* @ingroup Toolbar
|
||||
*/
|
||||
EAPI Eina_Bool elm_toolbar_item_icon_memfile_set(Elm_Toolbar_Item *item, const void *img, size_t size, const char *format, const char *key) EINA_ARG_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Delete them item from the toolbar.
|
||||
*
|
||||
|
|
|
@ -1392,6 +1392,49 @@ elm_toolbar_item_icon_set(Elm_Toolbar_Item *item, const char *icon)
|
|||
}
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_toolbar_item_icon_memfile_set(Elm_Toolbar_Item *item, const void *img, size_t size, const char *format, const char *key)
|
||||
{
|
||||
Evas_Object *icon_obj;
|
||||
Widget_Data *wd;
|
||||
Evas_Object *obj = item->base.widget;
|
||||
Eina_Bool ret;
|
||||
|
||||
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
|
||||
wd = elm_widget_data_get(obj);
|
||||
if (!wd) return EINA_FALSE;
|
||||
|
||||
if (img && size)
|
||||
{
|
||||
icon_obj = _els_smart_icon_add(evas_object_evas_get(obj));
|
||||
evas_object_repeat_events_set(icon_obj, EINA_TRUE);
|
||||
ret = _els_smart_icon_memfile_set(icon_obj, img, size, format, key);
|
||||
if (!ret)
|
||||
{
|
||||
evas_object_del(icon_obj);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
_elm_toolbar_item_icon_obj_set(obj, item, icon_obj, NULL, wd->icon_size,
|
||||
"elm,state,icon_set");
|
||||
}
|
||||
else
|
||||
_elm_toolbar_item_icon_obj_set(obj, item, NULL, NULL, 0, "elm,state,icon_set");
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
elm_toolbar_item_icon_object_get(Elm_Toolbar_Item *item)
|
||||
{
|
||||
Widget_Data *wd;
|
||||
Evas_Object *obj = item->base.widget;
|
||||
|
||||
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
|
||||
wd = elm_widget_data_get(obj);
|
||||
if (!wd) return NULL;
|
||||
|
||||
return item->icon;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_toolbar_item_del(Elm_Toolbar_Item *item)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue