aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChunEon Park <hermet@hermet.pe.kr>2012-01-02 10:40:17 +0000
committerChunEon Park <hermet@hermet.pe.kr>2012-01-02 10:40:17 +0000
commit5f1c8f6107c097fba4705397fc465d13f438062f (patch)
treeb47643e84ea439ae45eebe3c7a54439ad979da2b
parentelementary/multibuttonentry - Elm_Multibuttonentry_Item -> Elm_Object_Item (diff)
downloadefl-5f1c8f6107c097fba4705397fc465d13f438062f.tar.gz
elementary/multibuttonentry - deprecated APIs. Now, let's use elm_common APIs.
elm_multibuttonentry_label_set() elm_multibuttonentry_label_get() elm_multibuttonentry_item_label_set() elm_multibuttonentry_item_label_get() SVN revision: 66739
Diffstat (limited to '')
-rw-r--r--legacy/elementary/src/bin/test_multibuttonentry.c2
-rw-r--r--legacy/elementary/src/edje_externals/elm_multibuttonentry.c57
-rw-r--r--legacy/elementary/src/lib/elc_multibuttonentry.c79
-rw-r--r--legacy/elementary/src/lib/elc_multibuttonentry.h47
-rw-r--r--legacy/elementary/src/lib/elm_deprecated.h43
5 files changed, 139 insertions, 89 deletions
diff --git a/legacy/elementary/src/bin/test_multibuttonentry.c b/legacy/elementary/src/bin/test_multibuttonentry.c
index a203d45ac2..be84691908 100644
--- a/legacy/elementary/src/bin/test_multibuttonentry.c
+++ b/legacy/elementary/src/bin/test_multibuttonentry.c
@@ -143,7 +143,7 @@ _add_multibuttonentry(Evas_Object *parent)
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);
diff --git a/legacy/elementary/src/edje_externals/elm_multibuttonentry.c b/legacy/elementary/src/edje_externals/elm_multibuttonentry.c
index 9750765460..723d34d1ee 100644
--- a/legacy/elementary/src/edje_externals/elm_multibuttonentry.c
+++ b/legacy/elementary/src/edje_externals/elm_multibuttonentry.c
@@ -16,7 +16,7 @@ external_multibuttonentry_state_set(void *data __UNUSED__, Evas_Object *obj, con
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);
}
@@ -26,19 +26,19 @@ external_multibuttonentry_param_set(void *data __UNUSED__, Evas_Object *obj, con
{
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'",
@@ -52,19 +52,19 @@ external_multibuttonentry_param_get(void *data __UNUSED__, const Evas_Object *ob
{
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'",
@@ -86,20 +86,19 @@ external_multibuttonentry_params_parse(void *data __UNUSED__, Evas_Object *obj _
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
diff --git a/legacy/elementary/src/lib/elc_multibuttonentry.c b/legacy/elementary/src/lib/elc_multibuttonentry.c
index 39c9608f96..3aed8d13bc 100644
--- a/legacy/elementary/src/lib/elc_multibuttonentry.c
+++ b/legacy/elementary/src/lib/elc_multibuttonentry.c
@@ -112,6 +112,11 @@ static void _set_vis_guidetext(Evas_Object *obj);
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)
@@ -794,6 +799,8 @@ _add_button_item(Evas_Object *obj, const char *str, Multibuttonentry_Pos pos, co
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);
@@ -1305,6 +1312,50 @@ _box_layout_cb(Evas_Object *o, Evas_Object_Box_Data *priv, void *data __UNUSED__
}
}
+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)
{
@@ -1324,6 +1375,8 @@ 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");
@@ -1358,25 +1411,13 @@ elm_multibuttonentry_entry_get(const Evas_Object *obj)
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 *
@@ -1552,19 +1593,13 @@ elm_multibuttonentry_item_del(Elm_Object_Item *it)
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 *
diff --git a/legacy/elementary/src/lib/elc_multibuttonentry.h b/legacy/elementary/src/lib/elc_multibuttonentry.h
index 7c607a72d3..5541d47347 100644
--- a/legacy/elementary/src/lib/elc_multibuttonentry.h
+++ b/legacy/elementary/src/lib/elc_multibuttonentry.h
@@ -17,7 +17,15 @@
* - @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
+ *
*/
/**
@@ -36,23 +44,6 @@ typedef Eina_Bool (*Elm_Multibuttonentry_Item_Filter_callback)
*/
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
@@ -185,7 +176,7 @@ EAPI Elm_Object_Item *elm_multibuttonentry_selected_item_get(const Evas_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
*
*/
@@ -216,24 +207,6 @@ EAPI void elm_multibuttonentry_item_del(Elm_Object_Item *i
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
diff --git a/legacy/elementary/src/lib/elm_deprecated.h b/legacy/elementary/src/lib/elm_deprecated.h
index cbb558ab95..b8ff947e35 100644
--- a/legacy/elementary/src/lib/elm_deprecated.h
+++ b/legacy/elementary/src/lib/elm_deprecated.h
@@ -2544,3 +2544,46 @@ EINA_DEPRECATED EAPI void elm_segment_control_item_label_set(Elm_Ob
* @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);