Elementary Toggle: Don't use deprecated functions

If we need to add functions born deprecated because it will
make other developers life easier, ok. But using these
deprecated functions inside our project isn't nice.


SVN revision: 64363
This commit is contained in:
Bruno Dilly 2011-10-24 23:41:11 +00:00
parent 408cf02a9e
commit a63bf2c1c4
3 changed files with 18 additions and 29 deletions

View File

@ -35,7 +35,8 @@ test_toggle(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
elm_object_text_set(tg, "Icon sized to toggle");
elm_check_icon_set(tg, ic);
elm_check_state_set(tg, 1);
elm_check_states_labels_set(tg, "Yes", "No");
elm_object_text_part_set(tg, "on", "Yes");
elm_object_text_part_set(tg, "off", "No");
elm_box_pack_end(bx, tg);
evas_object_show(tg);
evas_object_show(ic);
@ -70,8 +71,8 @@ test_toggle(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
tg = elm_check_add(win);
elm_object_style_set(tg, "toggle");
elm_object_text_set(tg, "Label Only");
elm_check_states_labels_set(tg, "Big long fun times label",
"Small long happy fun label");
elm_object_text_part_set(tg, "on", "Big long fun times label");
elm_object_text_part_set(tg, "off", "Small long happy fun label");
elm_box_pack_end(bx, tg);
evas_object_show(tg);

View File

@ -26,17 +26,10 @@ external_toggle_state_set(void *data __UNUSED__, Evas_Object *obj, const void *f
if (p->icon)
elm_check_icon_set(obj, p->icon);
if ((p->on) && (p->off))
elm_check_states_labels_set(obj, p->on, p->off);
else if ((p->on) || (p->off))
{
const char *on, *off;
elm_check_states_labels_get(obj, &on, &off);
if (p->on)
elm_check_states_labels_set(obj, p->on, off);
else
elm_check_states_labels_set(obj, on, p->off);
}
if (p->on)
elm_object_text_part_set(obj, "on", p->on);
if (p->off)
elm_object_text_part_set(obj, "off", p->off);
if (p->state_exists)
elm_check_state_set(obj, p->state);
@ -67,9 +60,7 @@ external_toggle_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_Ex
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
{
const char *on, *off;
elm_check_states_labels_get(obj, &on, &off);
elm_check_states_labels_set(obj, param->s, off);
elm_object_text_part_set(obj, "on", param->s);
return EINA_TRUE;
}
}
@ -77,9 +68,7 @@ external_toggle_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_Ex
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
{
const char *on, *off;
elm_check_states_labels_get(obj, &on, &off);
elm_check_states_labels_set(obj, on, param->s);
elm_object_text_part_set(obj, "off", param->s);
return EINA_TRUE;
}
}
@ -118,9 +107,7 @@ external_toggle_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_Ex
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
{
const char *on, *off;
elm_check_states_labels_get(obj, &on, &off);
param->s = on;
param->s = elm_object_text_part_get(obj, "on");
return EINA_TRUE;
}
}
@ -128,9 +115,7 @@ external_toggle_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_Ex
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
{
const char *on, *off;
elm_check_states_labels_get(obj, &on, &off);
param->s = off;
param->s = elm_object_text_part_get(obj, "off");
return EINA_TRUE;
}
}

View File

@ -8,7 +8,8 @@ elm_toggle_add(Evas_Object *parent)
obj = elm_check_add(parent);
elm_object_style_set(obj, "toggle");
elm_check_states_labels_set(obj, E_("ON"), E_("OFF"));
elm_object_text_part_set(obj, "on", E_("ON"));
elm_object_text_part_set(obj, "off", E_("OFF"));
return obj;
}
@ -45,13 +46,15 @@ elm_toggle_icon_unset(Evas_Object *obj)
EAPI void
elm_toggle_states_labels_set(Evas_Object *obj, const char *onlabel, const char *offlabel)
{
elm_check_states_labels_set(obj, onlabel, offlabel);
elm_object_text_part_set(obj, "on", onlabel);
elm_object_text_part_set(obj, "off", offlabel);
}
EAPI void
elm_toggle_states_labels_get(const Evas_Object *obj, const char **onlabel, const char **offlabel)
{
elm_check_states_labels_get(obj, onlabel, offlabel);
if (onlabel) *onlabel = elm_object_text_part_get(obj, "on");
if (offlabel) *offlabel = elm_object_text_part_get(obj, "off");
}
EAPI void