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
This commit is contained in:
ChunEon Park 2012-01-02 10:40:17 +00:00
parent ab3198151c
commit 5f1c8f6107
5 changed files with 139 additions and 89 deletions

View File

@ -143,7 +143,7 @@ _add_multibuttonentry(Evas_Object *parent)
evas_object_show(scr); evas_object_show(scr);
mbe = elm_multibuttonentry_add(parent); 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"); 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_weight_set(mbe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(mbe, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_align_set(mbe, EVAS_HINT_FILL, EVAS_HINT_FILL);

View File

@ -16,7 +16,7 @@ external_multibuttonentry_state_set(void *data __UNUSED__, Evas_Object *obj, con
else return; else return;
if (p->label) if (p->label)
elm_multibuttonentry_label_set(obj, p->label); elm_object_text_set(obj, p->label);
if (p->guide_text) if (p->guide_text)
elm_multibuttonentry_guide_text_set(obj, 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 (!strcmp(param->name, "label"))
{ {
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
{ {
elm_multibuttonentry_label_set(obj, param->s); elm_object_text_set(obj, param->s);
return EINA_TRUE; return EINA_TRUE;
} }
} }
else if (!strcmp(param->name, "guide text")) else if (!strcmp(param->name, "guide text"))
{ {
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
{ {
elm_multibuttonentry_guide_text_set(obj, param->s); elm_multibuttonentry_guide_text_set(obj, param->s);
return EINA_TRUE; return EINA_TRUE;
} }
} }
ERR("unknown parameter '%s' of type '%s'", 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 (!strcmp(param->name, "label"))
{ {
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
{ {
param->s = elm_multibuttonentry_label_get(obj); param->s = elm_object_text_get(obj);
return EINA_TRUE; return EINA_TRUE;
} }
} }
else if (!strcmp(param->name, "guide text")) else if (!strcmp(param->name, "guide text"))
{ {
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
{ {
param->s = elm_multibuttonentry_guide_text_get(obj); param->s = elm_multibuttonentry_guide_text_get(obj);
return EINA_TRUE; return EINA_TRUE;
} }
} }
ERR("unknown parameter '%s' of type '%s'", 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) EINA_LIST_FOREACH(params, l, param)
{ {
if (!strcmp(param->name, "label")) if (!strcmp(param->name, "label"))
mem->label = eina_stringshare_add(param->s); mem->label = eina_stringshare_add(param->s);
else if (!strcmp(param->name, "guide text")) else if (!strcmp(param->name, "guide text"))
mem->guide_text = eina_stringshare_add(param->s); mem->guide_text = eina_stringshare_add(param->s);
} }
return mem; return mem;
} }
static Evas_Object *external_multibuttonentry_content_get(void *data __UNUSED__, static Evas_Object *external_multibuttonentry_content_get(void *data __UNUSED__, const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
{ {
ERR("so content"); ERR("so content");
return NULL; return NULL;
} }
static void static void

View File

@ -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 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 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 _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 static void
_del_hook(Evas_Object *obj) _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); item = elm_widget_item_new(obj, Elm_Multibuttonentry_Item);
if (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); elm_widget_item_data_set(item, data);
Evas_Coord rw, vw; Evas_Coord rw, vw;
_resize_button(btn, &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 * EAPI Evas_Object *
elm_multibuttonentry_add(Evas_Object *parent) 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_event_hook_set(obj, _event_hook);
elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
elm_widget_signal_emit_hook_set(obj, _signal_emit_hook); 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); wd->base = edje_object_add(e);
_elm_theme_object_set(obj, wd->base, "multibuttonentry", "base", "default"); _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 * EAPI const char *
elm_multibuttonentry_label_get(const Evas_Object *obj) elm_multibuttonentry_label_get(const Evas_Object *obj)
{ {
ELM_CHECK_WIDTYPE(obj, widtype) NULL; return _text_get_hook(obj, 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;
} }
EAPI void EAPI void
elm_multibuttonentry_label_set(Evas_Object *obj, const char *label) elm_multibuttonentry_label_set(Evas_Object *obj, const char *label)
{ {
ELM_CHECK_WIDTYPE(obj, widtype); _text_set_hook(obj, NULL, label);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (label)
_set_label(obj, label);
else
_set_label(obj, "");
} }
EAPI const char * EAPI const char *
@ -1552,19 +1593,13 @@ elm_multibuttonentry_item_del(Elm_Object_Item *it)
EAPI const char * EAPI const char *
elm_multibuttonentry_item_label_get(const Elm_Object_Item *it) elm_multibuttonentry_item_label_get(const Elm_Object_Item *it)
{ {
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL); return _item_text_get_hook(it, NULL);
Elm_Multibuttonentry_Item *item = (Elm_Multibuttonentry_Item *) it;
return edje_object_part_text_get(item->button, "elm.btn.text");
} }
EAPI void EAPI void
elm_multibuttonentry_item_label_set(Elm_Object_Item *it, const char *str) elm_multibuttonentry_item_label_set(Elm_Object_Item *it, const char *str)
{ {
ELM_OBJ_ITEM_CHECK_OR_RETURN(it); _item_text_set_hook(it, NULL, str);
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);
} }
EAPI Elm_Object_Item * EAPI Elm_Object_Item *

View File

@ -17,7 +17,15 @@
* - @c "unfocused" - when multibuttonentry is unfocused. * - @c "unfocused" - when multibuttonentry is unfocused.
* - @c "expanded" - when multibuttonentry is expanded. * - @c "expanded" - when multibuttonentry is expanded.
* - @c "shrank" - when multibuttonentry is shrank. * - @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); 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 * 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 * 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 * @param selected if it's EINA_TRUE, select the item otherwise, unselect the item
* *
*/ */
@ -215,24 +206,6 @@ EAPI void elm_multibuttonentry_item_del(Elm_Object_Item *i
*/ */
EAPI void elm_multibuttonentry_clear(Evas_Object *obj); 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 * Get the previous item in the multibuttonentry
* *

View File

@ -2544,3 +2544,46 @@ EINA_DEPRECATED EAPI void elm_segment_control_item_label_set(Elm_Ob
* @ingroup SegmentControl * @ingroup SegmentControl
*/ */
EINA_DEPRECATED EAPI void elm_segment_control_item_icon_set(Elm_Object_Item *it, Evas_Object *icon); 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);