evas_object_show(scr);
mbe = elm_multibuttonentry_add(parent);
- elm_multibuttonentry_label_set(mbe, "To: ");
+ elm_object_text_set(mbe, "To: ");
elm_multibuttonentry_guide_text_set(mbe, "Tap to add recipient");
evas_object_size_hint_weight_set(mbe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(mbe, EVAS_HINT_FILL, EVAS_HINT_FILL);
else return;
if (p->label)
- elm_multibuttonentry_label_set(obj, p->label);
+ elm_object_text_set(obj, p->label);
if (p->guide_text)
elm_multibuttonentry_guide_text_set(obj, p->guide_text);
}
{
if (!strcmp(param->name, "label"))
{
- if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
- {
- elm_multibuttonentry_label_set(obj, param->s);
- return EINA_TRUE;
- }
+ if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
+ {
+ elm_object_text_set(obj, param->s);
+ return EINA_TRUE;
+ }
}
else if (!strcmp(param->name, "guide text"))
{
- if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
- {
- elm_multibuttonentry_guide_text_set(obj, param->s);
- return EINA_TRUE;
- }
+ if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
+ {
+ elm_multibuttonentry_guide_text_set(obj, param->s);
+ return EINA_TRUE;
+ }
}
ERR("unknown parameter '%s' of type '%s'",
{
if (!strcmp(param->name, "label"))
{
- if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
- {
- param->s = elm_multibuttonentry_label_get(obj);
- return EINA_TRUE;
- }
+ if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
+ {
+ param->s = elm_object_text_get(obj);
+ return EINA_TRUE;
+ }
}
else if (!strcmp(param->name, "guide text"))
{
- if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
- {
- param->s = elm_multibuttonentry_guide_text_get(obj);
- return EINA_TRUE;
- }
+ if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
+ {
+ param->s = elm_multibuttonentry_guide_text_get(obj);
+ return EINA_TRUE;
+ }
}
ERR("unknown parameter '%s' of type '%s'",
EINA_LIST_FOREACH(params, l, param)
{
- if (!strcmp(param->name, "label"))
- mem->label = eina_stringshare_add(param->s);
- else if (!strcmp(param->name, "guide text"))
- mem->guide_text = eina_stringshare_add(param->s);
+ if (!strcmp(param->name, "label"))
+ mem->label = eina_stringshare_add(param->s);
+ else if (!strcmp(param->name, "guide text"))
+ mem->guide_text = eina_stringshare_add(param->s);
}
return mem;
}
-static Evas_Object *external_multibuttonentry_content_get(void *data __UNUSED__,
- const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
+static Evas_Object *external_multibuttonentry_content_get(void *data __UNUSED__, const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
{
- ERR("so content");
- return NULL;
+ ERR("so content");
+ return NULL;
}
static void
static void _calculate_box_min_size(Evas_Object *box, Evas_Object_Box_Data *priv);
static Evas_Coord _calculate_item_max_height(Evas_Object *box, Evas_Object_Box_Data *priv, int obj_index);
static void _box_layout_cb(Evas_Object *o, Evas_Object_Box_Data *priv, void *data);
+static void _item_text_set_hook(Elm_Object_Item *it,
+ const char *part,
+ const char *label);
+static const char * _item_text_get_hook(const Elm_Object_Item *it,
+ const char *part);
static void
_del_hook(Evas_Object *obj)
item = elm_widget_item_new(obj, Elm_Multibuttonentry_Item);
if (item)
{
+ elm_widget_item_text_set_hook_set(item, _item_text_set_hook);
+ elm_widget_item_text_get_hook_set(item, _item_text_get_hook);
elm_widget_item_data_set(item, data);
Evas_Coord rw, vw;
_resize_button(btn, &rw, &vw);
}
}
+static void
+_item_text_set_hook(Elm_Object_Item *it, const char *part, const char *label)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+
+ Elm_Multibuttonentry_Item *item;
+ if (part && strcmp(part, "default")) return;
+ if (!label) return;
+ item = (Elm_Multibuttonentry_Item *) it;
+ edje_object_part_text_set(item->button, "elm.btn.text", label);
+ _resize_button(item->button, &item->rw, &item->vw);
+}
+
+static const char *
+_item_text_get_hook(const Elm_Object_Item *it, const char *part)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
+ Elm_Multibuttonentry_Item *item;
+ if (part && strcmp(part, "default")) return NULL;
+ item = (Elm_Multibuttonentry_Item *) it;
+ return edje_object_part_text_get(item->button, "elm.btn.text");
+}
+
+static void
+_text_set_hook(Evas_Object *obj, const char *part, const char *label)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ if (part && strcmp(part, "default")) return;
+ if (label) _set_label(obj, label);
+ else _set_label(obj, "");
+}
+
+static const char *
+_text_get_hook(const Evas_Object *obj, const char *part)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd;
+ if (part && strcmp(part, "default")) return NULL;
+ wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ if (wd->label) return edje_object_part_text_get(wd->label, "mbe.label");
+ return NULL;
+}
+
EAPI Evas_Object *
elm_multibuttonentry_add(Evas_Object *parent)
{
elm_widget_event_hook_set(obj, _event_hook);
elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
+ elm_widget_text_set_hook_set(obj, _text_set_hook);
+ elm_widget_text_get_hook_set(obj, _text_get_hook);
wd->base = edje_object_add(e);
_elm_theme_object_set(obj, wd->base, "multibuttonentry", "base", "default");
EAPI const char *
elm_multibuttonentry_label_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd) return NULL;
- if (wd->label) return edje_object_part_text_get(wd->label, "mbe.label");
- return NULL;
+ return _text_get_hook(obj, NULL);
}
EAPI void
elm_multibuttonentry_label_set(Evas_Object *obj, const char *label)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd) return;
- if (label)
- _set_label(obj, label);
- else
- _set_label(obj, "");
+ _text_set_hook(obj, NULL, label);
}
EAPI const char *
EAPI const char *
elm_multibuttonentry_item_label_get(const Elm_Object_Item *it)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
- Elm_Multibuttonentry_Item *item = (Elm_Multibuttonentry_Item *) it;
- return edje_object_part_text_get(item->button, "elm.btn.text");
+ return _item_text_get_hook(it, NULL);
}
EAPI void
elm_multibuttonentry_item_label_set(Elm_Object_Item *it, const char *str)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
- Elm_Multibuttonentry_Item *item = (Elm_Multibuttonentry_Item *) it;
- if (!str) return;
- edje_object_part_text_set(item->button, "elm.btn.text", str);
- _resize_button(item->button, &item->rw, &item->vw);
+ _item_text_set_hook(it, NULL, str);
}
EAPI Elm_Object_Item *
* - @c "unfocused" - when multibuttonentry is unfocused.
* - @c "expanded" - when multibuttonentry is expanded.
* - @c "shrank" - when multibuttonentry is shrank.
- * - @c "shrank,state,changed" - when shrink mode state of multibuttonentry is changed.
+ * - @c "shrank,state,changed" - when shrink mode state of multibuttonentry is
+ * changed.
+ *
+ * Default text parts of the multibuttonentry widget that you can use for are:
+ * @li "default" - A label of the multibuttonentry
+ *
+ * Default text parts of the multibuttonentry items that you can use for are:
+ * @li "default" - A label of the multibuttonentry item
+ *
*/
/**
*/
EAPI Evas_Object *elm_multibuttonentry_add(Evas_Object *parent);
-/**
- * Get the label
- *
- * @param obj The multibuttonentry object
- * @return The label, or NULL if none
- *
- */
-EAPI const char *elm_multibuttonentry_label_get(const Evas_Object *obj);
-
-/**
- * Set the label
- *
- * @param obj The multibuttonentry object
- * @param label The text label string
- *
- */
-EAPI void elm_multibuttonentry_label_set(Evas_Object *obj, const char *label);
/**
* Get the entry of the multibuttonentry object
/**
* Set the selected state of an item
*
- * @param item The it
+ * @param it The item
* @param selected if it's EINA_TRUE, select the item otherwise, unselect the item
*
*/
EAPI void elm_multibuttonentry_clear(Evas_Object *obj);
/**
- * Get the label of a given item
- *
- * @param it The item
- * @return The label of a given item, or NULL if none
- *
- */
-EAPI const char *elm_multibuttonentry_item_label_get(const Elm_Object_Item *it);
-
-/**
- * Set the label of a given item
- *
- * @param it The item
- * @param str The text label string
- *
- */
-EAPI void elm_multibuttonentry_item_label_set(Elm_Object_Item *it, const char *str);
-
-/**
* Get the previous item in the multibuttonentry
*
* @param it The item
* @ingroup SegmentControl
*/
EINA_DEPRECATED EAPI void elm_segment_control_item_icon_set(Elm_Object_Item *it, Evas_Object *icon);
+
+/**
+ * Get the label
+ *
+ * @param obj The multibuttonentry object
+ * @return The label, or NULL if none
+ *
+ * @deprecated Use elm_object_text_get() instead
+ *
+ */
+EINA_DEPRECATED EAPI const char *elm_multibuttonentry_label_get(const Evas_Object *obj);
+
+/**
+ * Set the label
+ *
+ * @param obj The multibuttonentry object
+ * @param label The text label string
+ *
+ * @deprecated Use elm_object_text_set() instead
+ *
+ */
+EINA_DEPRECATED EAPI void elm_multibuttonentry_label_set(Evas_Object *obj, const char *label);
+
+/**
+ * Get the label of a given item
+ *
+ * @param it The item
+ * @return The label of a given item, or NULL if none
+ *
+ * @deprecated Use elm_object_item_text_get() instead
+ *
+ */
+EINA_DEPRECATED EAPI const char *elm_multibuttonentry_item_label_get(const Elm_Object_Item *it);
+
+/**
+ * Set the label of a given item
+ *
+ * @param it The item
+ * @param str The text label string
+ *
+ * @deprecated Use elm_object_item_text_set() instead
+ */
+EINA_DEPRECATED EAPI void elm_multibuttonentry_item_label_set(Elm_Object_Item *it, const char *str);