ph4 = elm_photo_add(win);
tb_it = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1);
- elm_toolbar_item_disabled_set(tb_it, EINA_TRUE);
+ elm_object_item_disabled_set(tb_it, EINA_TRUE);
elm_toolbar_item_priority_set(tb_it, 100);
tb_it = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1);
ph4 = elm_photo_add(win);
item = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1);
- elm_toolbar_item_disabled_set(item, EINA_TRUE);
+ elm_object_item_disabled_set(item, EINA_TRUE);
elm_toolbar_item_priority_set(item, -100);
item = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1);
ph4 = elm_photo_add(win);
tb_it = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1);
- elm_toolbar_item_disabled_set(tb_it, EINA_TRUE);
+ elm_object_item_disabled_set(tb_it, EINA_TRUE);
elm_toolbar_item_priority_set(tb_it, 0);
tb_it = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1);
ph4 = elm_photo_add(win);
tb_it = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1);
- elm_toolbar_item_disabled_set(tb_it, EINA_TRUE);
+ elm_object_item_disabled_set(tb_it, EINA_TRUE);
elm_toolbar_item_priority_set(tb_it, 100);
tb_it = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1);
ph4 = elm_photo_add(win);
tb_it = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1);
- elm_toolbar_item_disabled_set(tb_it, EINA_TRUE);
+ elm_object_item_disabled_set(tb_it, EINA_TRUE);
elm_toolbar_item_priority_set(tb_it, 100);
snprintf(buf, sizeof(buf), "%s/images/icon_04.pngj", elm_app_data_dir_get());
ph4 = elm_photo_add(win);
tb_it = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1);
- elm_toolbar_item_disabled_set(tb_it, EINA_TRUE);
+ elm_object_item_disabled_set(tb_it, EINA_TRUE);
elm_toolbar_item_priority_set(tb_it, 100);
tb_it = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1);
tb_it = elm_toolbar_item_append(tb, "mail-send", "Create and send email",
_item_3_pressed, bt);
- elm_toolbar_item_disabled_set(tb_it, EINA_TRUE);
+ elm_object_item_disabled_set(tb_it, EINA_TRUE);
elm_toolbar_homogeneous_set(tb, EINA_FALSE);
if (title)
strncpy(buf, title, sizeof(buf) - 1);
- elm_toolbar_item_label_set(td->tab, buf);
+ elm_object_item_text_set(td->tab, buf);
}
static void
* - @c "default"
* - @c "transparent" - no background or shadow, just show the content
*
+ * Default text parts of the toolbar items that you can use for are:
+ * @li "default" - label of the toolbar item
+ *
* List of examples:
* @li @ref toolbar_example_01
* @li @ref toolbar_example_02
*
* This returns the toolbar object itself that an item belongs to.
*
+ * @deprecated use elm_object_item_object_get() instead.
* @ingroup Toolbar
*/
- EAPI Evas_Object *elm_toolbar_item_toolbar_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI Evas_Object *elm_toolbar_item_toolbar_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
/**
* Set the priority of a toolbar item.
*
* @see elm_toolbar_item_label_set() for more details.
* @see elm_toolbar_item_append()
*
+ * @deprecated use elm_object_item_text_get() instead.
* @ingroup Toolbar
*/
- EAPI const char *elm_toolbar_item_label_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI const char *elm_toolbar_item_label_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
/**
* Set the label of item.
*
* @see elm_toolbar_item_label_get()
* @see elm_toolbar_item_append()
*
+ * @deprecated use elm_object_item_text_set() instead
* @ingroup Toolbar
*/
- EAPI void elm_toolbar_item_label_set(Elm_Object_Item *it, const char *label) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI void elm_toolbar_item_label_set(Elm_Object_Item *it, const char *label) EINA_ARG_NONNULL(1);
/**
* Return the data associated with a given toolbar widget item.
*
*
* @see elm_toolbar_item_data_set()
*
+ * @deprecated use elm_object_item_data_get() instead.
* @ingroup Toolbar
*/
- EAPI void *elm_toolbar_item_data_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI void *elm_toolbar_item_data_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
/**
* Set the data associated with a given toolbar widget item.
*
* @warning The old data pointer won't be touched by this function, so
* the user had better to free that old data himself/herself.
*
+ * @deprecated use elm_object_item_data_set() instead.
* @ingroup Toolbar
*/
- EAPI void elm_toolbar_item_data_set(Elm_Object_Item *it, const void *data) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI void elm_toolbar_item_data_set(Elm_Object_Item *it, const void *data) EINA_ARG_NONNULL(1);
/**
* Returns a pointer to a toolbar item by its label.
*
*
* @see elm_toolbar_item_disabled_set() for more details.
*
+ * @deprecated use elm_object_item_disabled_get() instead.
* @ingroup Toolbar
*/
- EAPI Eina_Bool elm_toolbar_item_disabled_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI Eina_Bool elm_toolbar_item_disabled_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
/**
* Sets the disabled/enabled state of a toolbar item.
* disabled state (@c EINA_TRUE for disabled, @c EINA_FALSE for
* enabled).
*
+ * @deprecated use elm_object_item_disabled_set() instead.
* @ingroup Toolbar
*/
- EAPI void elm_toolbar_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI void elm_toolbar_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled) EINA_ARG_NONNULL(1);
/**
* Set or unset item as a separator.
static void _item_show(Elm_Toolbar_Item *it);
static void _item_select(Elm_Toolbar_Item *it);
static void _item_unselect(Elm_Toolbar_Item *it);
-static void _item_disable(Elm_Toolbar_Item *it, Eina_Bool disabled);
static void _del_pre_hook(Evas_Object *obj);
static void _del_hook(Evas_Object *obj);
static void _mirrored_set(Evas_Object *obj, Eina_Bool mirrored);
{NULL, NULL}
};
+static void
+_item_disable_set_hook(Elm_Object_Item *it)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+
+ Widget_Data *wd;
+ Elm_Toolbar_Item *toolbar_it = (Elm_Toolbar_Item *) it;
+
+ wd = elm_widget_data_get(WIDGET(toolbar_it));
+ if (!wd) return;
+
+ if (elm_widget_item_disabled_get(toolbar_it))
+ {
+ edje_object_signal_emit(VIEW(toolbar_it), "elm,state,disabled", "elm");
+ elm_widget_signal_emit(toolbar_it->icon, "elm,state,disabled", "elm");
+ }
+ else
+ {
+ edje_object_signal_emit(VIEW(toolbar_it), "elm,state,enabled", "elm");
+ elm_widget_signal_emit(toolbar_it->icon, "elm,state,enabled", "elm");
+ }
+ _resize(WIDGET(toolbar_it), NULL, NULL, NULL);
+}
static Eina_Bool
_item_icon_set(Evas_Object *icon_obj, const char *type, const char *icon)
}
static void
-_item_disable(Elm_Toolbar_Item *it, Eina_Bool disabled)
-{
- Widget_Data *wd = elm_widget_data_get(WIDGET(it));
-
- if (!wd) return;
- if (elm_widget_item_disabled_get(it) == disabled) return;
- elm_object_item_disabled_set((Elm_Object_Item *) it, disabled);
- if (disabled)
- {
- edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
- elm_widget_signal_emit(it->icon, "elm,state,disabled", "elm");
- }
- else
- {
- edje_object_signal_emit(VIEW(it), "elm,state,enabled", "elm");
- elm_widget_signal_emit(it->icon, "elm,state,enabled", "elm");
- }
-}
-
-static void
_item_del(Elm_Toolbar_Item *it)
{
Elm_Toolbar_Item_State *it_state;
}
static void
+_item_text_set_hook(Elm_Object_Item *it,
+ const char *part,
+ const char *label)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+ if (part && strcmp(part, "default")) return;
+ _item_label_set(((Elm_Toolbar_Item *) it), label, "elm,state,label_set");
+}
+
+static const char *
+_item_text_get_hook(const Elm_Object_Item *it, const char *part)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
+ if (part && strcmp(part, "default")) return NULL;
+ return ((Elm_Toolbar_Item *) it)->label;
+}
+
+static void
_translate_hook(Evas_Object *obj)
{
evas_object_smart_callback_call(obj, "language,changed", NULL);
evas_object_del(icon_obj);
return NULL;
}
+
+ elm_widget_item_disable_set_hook_set(it, _item_disable_set_hook);
+ elm_widget_item_text_set_hook_set(it, _item_text_set_hook);
+ elm_widget_item_text_get_hook_set(it, _item_text_get_hook);
+
it->label = eina_stringshare_add(label);
it->prio.visible = 1;
it->prio.priority = 0;
EAPI const char *
elm_toolbar_item_label_get(const Elm_Object_Item *it)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
- return ((Elm_Toolbar_Item *) it)->label;
+ return _item_text_get_hook(it, NULL);
}
EAPI void
elm_toolbar_item_label_set(Elm_Object_Item *it, const char *label)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
- _item_label_set(((Elm_Toolbar_Item *) it), label, "elm,state,label_set");
+ _item_text_set_hook(it, NULL, label);
}
EAPI void *
elm_toolbar_item_data_get(const Elm_Object_Item *it)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
return elm_object_item_data_get(it);
}
EAPI void
elm_toolbar_item_data_set(Elm_Object_Item *it, const void *data)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
elm_object_item_data_set(it, (void *) data);
}
EAPI Eina_Bool
elm_toolbar_item_disabled_get(const Elm_Object_Item *it)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
- return ((Elm_Widget_Item *) it)->disabled;
+ return elm_object_item_disabled_get(it);
}
EAPI void
elm_toolbar_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
- Elm_Toolbar_Item *item = (Elm_Toolbar_Item *) it;
- _item_disable(item, disabled);
- _resize(WIDGET(item), NULL, NULL, NULL);
+ elm_object_item_disabled_set(it, disabled);
}
EAPI void