typedef struct _Widget_Data Widget_Data;
+enum{
+ DEFAULT = 0,
+ HIGHLIGHTED,
+ FOCUSED,
+ DISABLED,
+};
struct _Widget_Data
{
Evas_Object *btn, *icon;
double ar_threshold;
double ar_interval;
Ecore_Timer *timer;
- const char *clickedlabel;
- const char *focusedlabel;
- const char *disabledlabel;
- const char *defaultlabel;
- int highlightedstate;
- int focusedstate;
- int disabledstate;
- int defaultstate;
+ const char *statelabel[4];
+ int statetype[4];
};
static const char *widtype = NULL;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (wd->label) eina_stringshare_del(wd->label);
- if (wd->defaultlabel) eina_stringshare_del(wd->defaultlabel);
- if (wd->clickedlabel) eina_stringshare_del(wd->clickedlabel);
- if (wd->focusedlabel) eina_stringshare_del(wd->focusedlabel);
- if (wd->disabledlabel) eina_stringshare_del(wd->disabledlabel);
+ if (wd->statelabel[DEFAULT]) eina_stringshare_del(wd->statelabel[DEFAULT]);
+ if (wd->statelabel[HIGHLIGHTED]) eina_stringshare_del(wd->statelabel[HIGHLIGHTED]);
+ if (wd->statelabel[FOCUSED]) eina_stringshare_del(wd->statelabel[FOCUSED]);
+ if (wd->statelabel[DISABLED]) eina_stringshare_del(wd->statelabel[DISABLED]);
free(wd);
}
if (!wd) return;
if (elm_widget_focus_get(obj))
{
- if(wd->focusedstate)
+ if(wd->statelabel[FOCUSED])
{
- _set_label(obj, wd->focusedlabel);
+ _set_label(obj, wd->statelabel[FOCUSED]);
}
edje_object_signal_emit(wd->btn, "elm,action,focus", "elm");
evas_object_focus_set(wd->btn, 1);
}
else
{
- if(wd->defaultlabel)
- _set_label(obj, wd->defaultlabel);
+ if(wd->statelabel[DEFAULT])
+ _set_label(obj, wd->statelabel[DEFAULT]);
else
_set_label(obj, wd->label);
edje_object_signal_emit(wd->btn, "elm,action,unfocus", "elm");
if (!wd) return;
if (elm_widget_disabled_get(obj))
{
- if(wd->disabledstate )
+ if(wd->statelabel[DISABLED] )
{
- _set_label(obj, wd->disabledlabel);
+ _set_label(obj, wd->statelabel[DISABLED]);
}
edje_object_signal_emit(wd->btn, "elm,state,disabled", "elm");
}
else
{
- if(wd->defaultlabel)
- _set_label(obj, wd->defaultlabel);
+ if(wd->statelabel[DEFAULT])
+ _set_label(obj, wd->statelabel[DEFAULT]);
else
_set_label(obj, wd->label);
edje_object_signal_emit(wd->btn, "elm,state,enabled", "elm");
{
Widget_Data *wd = elm_widget_data_get(data);
if (!wd) return;
- if(wd->highlightedstate)
+
+ if(wd->statelabel[HIGHLIGHTED])
{
- _set_label(data, wd->clickedlabel);
+ _set_label(data, wd->statelabel[HIGHLIGHTED]);
}
if (wd->autorepeat && !wd->repeating)
{
{
Widget_Data *wd = elm_widget_data_get(data);
if (!wd) return;
- if(wd->defaultlabel)
- _set_label(data, wd->defaultlabel);
+ if(wd->statelabel[DEFAULT])
+ _set_label(data, wd->statelabel[DEFAULT]);
else
_set_label(data, wd->label);
return;
{
Widget_Data *wd = elm_widget_data_get(data);
if (!wd) return;
- if(wd->defaultlabel)
- _set_label(data, wd->defaultlabel);
+ if(wd->statelabel[DEFAULT])
+ _set_label(data, wd->statelabel[DEFAULT]);
else
_set_label(data, wd->label);
evas_object_smart_callback_call(data, "unpressed", NULL);
wd->btn = edje_object_add(e);
_elm_theme_object_set(obj, wd->btn, "button", "base", "default");
- wd->defaultstate = 0;
- wd->highlightedstate = 0;
- wd->focusedstate = 0;
- wd->disabledstate = 0;
+ wd->statetype[DEFAULT] = 0;
+ wd->statetype[HIGHLIGHTED] = 0;
+ wd->statetype[FOCUSED] = 0;
+ wd->statetype[DISABLED] = 0;
edje_object_signal_callback_add(wd->btn, "elm,action,click", "",
_signal_clicked, obj);
edje_object_signal_callback_add(wd->btn, "elm,action,press", "",
if(state == UIControlStateDefault)
{
- wd->defaultstate = UIControlStateDefault;
- if (wd->defaultlabel) eina_stringshare_del(wd->defaultlabel);
- wd->defaultlabel = eina_stringshare_add(label);
+ wd->statetype[DEFAULT] = UIControlStateDefault;
+ eina_stringshare_replace(&wd->statelabel[DEFAULT], label);
+ return;
}
if(state == UIControlStateHighlighted)
{
- wd->highlightedstate = UIControlStateHighlighted;
- if (wd->clickedlabel) eina_stringshare_del(wd->clickedlabel);
- wd->clickedlabel = eina_stringshare_add(label);
+ wd->statetype[HIGHLIGHTED] = UIControlStateHighlighted;
+ eina_stringshare_replace(&wd->statelabel[HIGHLIGHTED], label);
return;
}
if(state == UIControlStateFocused)
{
- wd->focusedstate = UIControlStateFocused;
- if (wd->focusedlabel) eina_stringshare_del(wd->focusedlabel);
- wd->focusedlabel = eina_stringshare_add(label);
+ wd->statetype[FOCUSED] = UIControlStateFocused;
+ eina_stringshare_replace(&wd->statelabel[FOCUSED], label);
return;
}
if(state == UIControlStateDisabled)
{
- wd->disabledstate = UIControlStateDisabled;
- if (wd->disabledlabel) eina_stringshare_del(wd->disabledlabel);
- wd->disabledlabel = eina_stringshare_add(label);
+ wd->statetype[DISABLED] = UIControlStateDisabled;
+ eina_stringshare_replace(&wd->statelabel[DISABLED], label);
return;
}
}
if (!wd) return NULL;
if(state == UIControlStateDefault)
- return wd->defaultlabel;
+ return wd->statelabel[DEFAULT];
else if(state == UIControlStateHighlighted)
- return wd->highlightedstate;
+ return wd->statelabel[HIGHLIGHTED];
else if(state == UIControlStateFocused)
- return wd->focusedlabel;
+ return wd->statelabel[FOCUSED];
else if(state == UIControlStateDisabled)
- return wd->disabledlabel;
+ return wd->statelabel[DISABLED];
else
return NULL;
}
edje_object_part_swallow(it->base, "elm.swallow.content", it->icon);
edje_object_signal_emit(it->base, "elm,state,icon,visible", "elm");
- if(wd->cur_seg_id == i)
+ if(wd->cur_seg_id == it->segment_id)
{
edje_object_signal_emit(it->base, "elm,state,segment,on", "elm");
edje_object_signal_emit(it->base, "elm,state,text,change", "elm");
wd->ani = NULL;
wd->ani_it = NULL;
_update_list(obj);
+ wd->id = eina_list_count(wd->seg_ctrl);
return ECORE_CALLBACK_CANCEL;
}
}
return;
wd->seg_ctrl = eina_list_append(wd->seg_ctrl, it);
+ wd->id = eina_list_count(wd->seg_ctrl);
_update_list(obj);
edje_object_signal_callback_add(it->base, "elm,action,segment,click", "elm", _signal_segment_on, it);
- ++wd->id;
+// ++wd->id;
+ wd->insert_index = 0;
+ wd->del_index = 0;
_refresh_segment_ids(obj);
- if(animate && it->segment_id)
+ if(animate && it->segment_id && wd->ani_it == NULL)
{
- if(wd->ani_it == NULL)
- {
evas_object_resize(it->base, 1, wd->height);
wd->ani_it = it;
wd->ani = ecore_animator_add( _animator_animate_add_cb, obj );
- }
- else
- {
- wd->queue = eina_list_append(wd->queue, it);
- }
}
else
_state_value_set(obj);
}
edje_object_signal_callback_add(it->base, "elm,action,segment,click", "elm", _signal_segment_on, it);
wd->insert_index = index;
- ++wd->id;
+// ++wd->id;
+ wd->id = eina_list_count(wd->seg_ctrl);
_refresh_segment_ids(obj);
_update_list(obj);
- if(animate && it->segment_id)
+ if(animate && it->segment_id && wd->ani_it == NULL)
{
- if(wd->ani_it == NULL)
- {
wd->ani_it = it;
evas_object_resize(it->base, 1, wd->height);
wd->ani = ecore_animator_add( _animator_animate_add_cb, obj );
- }
- else
- {
- wd->queue = eina_list_append(wd->queue, it);
- }
}
else
_state_value_set(obj);
return;
wd->del_index = it->segment_id;
- if(animate && it->segment_id)
+ if(animate && it->segment_id && wd->ani_it == NULL)
{
- if(wd->ani_it == NULL)
- {
it->delete_me = EINA_TRUE;
wd->ani_it = it;
wd->ani = ecore_animator_add( _animator_animate_del_cb, obj );
- }
- else
- {
- wd->queue = eina_list_append(wd->queue, it);
- }
}
else
{
_state_value_set(obj);
_update_list(obj);
}
- --wd->id;
+// --wd->id;
+ wd->id = eina_list_count(wd->seg_ctrl);
return;
}
return;
wd->del_index = index;
- --wd->id;
+
if(animate && it->segment_id)
{
if(wd->ani_it == NULL)
_item_free(obj, it);
_refresh_segment_ids(obj);
_state_value_set(obj);
+ _update_list(obj);
}
- _update_list(obj);
+// --wd->id;
+ wd->id = eina_list_count(wd->seg_ctrl);
return;
}