int cur_fontsize;
int max_height, w_pad, h_pad;
unsigned int count;
- unsigned int insert_index;
- unsigned int del_index;
- unsigned int cur_seg_id;
+ int insert_index;
+ int del_index;
+ int cur_seg_id;
double scale_factor;
unsigned int def_color[4];
unsigned int press_color[4];
Evas_Object *label_wd;
const char *label;
int segment_id;
- int selected_id;
Eina_Bool delete_me : 1;
Eina_Bool sel : 1;
};
#define MAXTOKENS 5
-char **_split(char *string, char *delim);
+char **_split(const char *string, char *delim);
static void _mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info);
static void _mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _signal_segment_selected(void *data);
static Elm_Segment_Item* _item_new(Evas_Object *obj, const char *label, Evas_Object *icon);
static Elm_Segment_Item *_item_find(Evas_Object *obj, unsigned int index);
-static int * _animator_animate_add_cb(Evas_Object *obj);
-static int * _animator_animate_del_cb(Evas_Object *obj);
+static Eina_Bool _animator_animate_add_cb(void *data);
+static Eina_Bool _animator_animate_del_cb(void *data);
static void
_signal_segment_off(void *data)
Widget_Data *wd = elm_widget_data_get(item->obj);
if (!wd) return;
- item->sel = EINA_FALSE;
+// item->sel = EINA_FALSE;
edje_object_signal_emit(item->base, "elm,action,unfocus", "elm");
edje_object_signal_emit(item->base, "elm,state,segment,release", "elm");
if(!item->label_wd && item->label)
return;
}
-static void
-_signal_segment_selected(void *data)
-{
- Elm_Segment_Item *item = (Elm_Segment_Item *) data;
- Elm_Segment_Item *it;
- Eina_List *l;
-
- Widget_Data *wd = elm_widget_data_get(item->obj);
- if (!wd) return;
- item->sel = EINA_TRUE;
- if (item->segment_id == wd->cur_seg_id && item->segment_id) return;
- EINA_LIST_FOREACH(wd->seg_ctrl, l, it)
- {
- if (it->segment_id == wd->cur_seg_id)
- {
- _signal_segment_off (it);
- }
- if (it->segment_id == item->selected_id)
- {
- _signal_segment_off (it);
- }
- it->selected_id = -1;
- }
- edje_object_signal_emit(item->base, "elm,action,focus", "elm");
- if(!item->label_wd)
- edje_object_signal_emit(item->base, "elm,state,text,change", "elm");
- if(item->label_wd)
- elm_label_text_color_set(item->label_wd, wd->sel_color[0], wd->sel_color[1], wd->sel_color[2], wd->sel_color[3]);
- item->selected_id = item->segment_id;
- evas_object_smart_callback_call(item->obj, "changed", (void*)item->selected_id);
-
- return;
-}
static void
_signal_segment_on(void *data)
Widget_Data *wd = elm_widget_data_get(item->obj);
if (!wd) return;
- item->sel = EINA_TRUE;
-
- if (item->segment_id == wd->cur_seg_id && item->segment_id) return;
+// item->sel = EINA_TRUE;
+ if (item->segment_id == wd->cur_seg_id) return;
EINA_LIST_FOREACH(wd->seg_ctrl, l, it)
{
{
_signal_segment_off (it);
}
- if (it->segment_id == item->selected_id)
- {
- _signal_segment_off (it);
- }
- it->selected_id = -1;
}
edje_object_signal_emit(item->base, "elm,action,focus", "elm");
if(!item->label_wd)
{
if(!item->label_wd)
edje_object_signal_emit(item->base, "elm,state,text,change", "elm");
- item->sel = EINA_TRUE;
+// item->sel = EINA_TRUE;
return;
}
_signal_segment_on((void*)item);
}
edje_object_part_swallow(it->base, "elm.swallow.label.content", it->label_wd);
edje_object_signal_emit(it->base, "elm,state,label,visible", "elm");
- if (it->segment_id == wd->cur_seg_id && it->sel)
+ if (it->segment_id == wd->cur_seg_id)
{
elm_label_text_color_set(it->label_wd, wd->sel_color[0], wd->sel_color[1], wd->sel_color[2], wd->sel_color[3]);
}
it->delete_me = EINA_FALSE;
it->segment_id = wd->id;
it->label_wd = NULL;
- it->sel = EINA_FALSE;
- it->selected_id = -1;
+// it->sel = EINA_FALSE;
it->base = edje_object_add(evas_object_evas_get(obj));
_elm_theme_object_set(obj, it->obj, "segment", "base/default", elm_object_style_get(it->obj));
{
edje_object_signal_emit(it->base, "elm,state,label,visible", "elm");
}
- if(it->sel)
- _signal_segment_on((void*)it);
i++;
}
/* split string into tokens, return token array */
char **
-_split(char *string, char *delim)
+_split(const char *string, char *delim)
{
char **tokens = NULL;
char *working = NULL;
if(working == NULL)
return NULL;
- /* to make sure, copy string to a safe place */
+/* to make sure, copy string to a safe place */
strcpy(working, string);
for(idx = 0; idx < MAXTOKENS; idx++)
tokens[idx] = NULL;
token = strtok(working, delim);
idx = 0;
- /* always keep the last entry NULL termindated */
+/* always keep the last entry NULL terminated */
while((idx < (MAXTOKENS - 1)) && (token != NULL)) {
tokens[idx] = malloc(sizeof(char) * strlen(token) + 1);
if(tokens[idx] != NULL) {
}
}
-static int *
-_animator_animate_add_cb(Evas_Object *obj)
+static Eina_Bool
+_animator_animate_add_cb(void *data)
{
int w;
+ Evas_Object *obj = (Evas_Object *)data;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return 0;
{
_state_value_set(obj);
evas_object_geometry_get(wd->ani_it->base, NULL, NULL, &w, NULL);
- return (int*) ECORE_CALLBACK_RENEW;
+ return ECORE_CALLBACK_RENEW;
}
else
{
ecore_animator_del(wd->ani);
wd->ani = NULL;
wd->ani_it = NULL;
- return (int*) ECORE_CALLBACK_CANCEL;
+ return ECORE_CALLBACK_CANCEL;
}
}
-static int *
-_animator_animate_del_cb(Evas_Object *obj)
+static Eina_Bool
+_animator_animate_del_cb(void *data)
{
int w;
+ Evas_Object *obj = (Evas_Object *)data;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return 0;\r
{
_state_value_set(obj);
evas_object_geometry_get(wd->ani_it->base, NULL, NULL, &w, NULL);
- return (int*) ECORE_CALLBACK_RENEW;
+ return ECORE_CALLBACK_RENEW;
}
else
{
wd->ani_it = NULL;
_update_list(obj);
wd->id = eina_list_count(wd->seg_ctrl);
- return (int*) ECORE_CALLBACK_CANCEL;
+ return ECORE_CALLBACK_CANCEL;
}
}
EAPI const char *
elm_segment_control_get_segment_label_at(Evas_Object *obj, unsigned int index)
{
- char *label;
+ const char *label;
label = elm_segment_control_item_label_get( obj, index);
return label;
EINA_LIST_FOREACH(wd->seg_ctrl, l, it)
{
- if(it->selected_id!=-1 && it->segment_id == it->selected_id)
- {
- wd->cur_seg_id = it->selected_id;
- }
- if(it->segment_id == wd->cur_seg_id && it->sel)
+ if(it->segment_id == wd->cur_seg_id)
return it;
}
return NULL;
Elm_Segment_Item *it;
it = elm_segment_control_item_selected_get(obj);
if(!it) return NULL;
- if(it->sel)
- *value = it->segment_id;
- else
- *value = -1;
- return it;
+ *value = it->segment_id;
+ return it;
}
{
if (!it) return NULL;
- return it->obj;
+ return it->base;
}
/**
if(select)
{
if(item->segment_id == wd->cur_seg_id && wd->cur_seg_id) return;
- item->sel = EINA_TRUE;
- _signal_segment_selected(item);
+// item->sel = EINA_TRUE;
+ _signal_segment_on(item);
}
else if(item->segment_id == wd->cur_seg_id)
{
- item->sel = EINA_FALSE;
+// item->sel = EINA_FALSE;
wd->cur_seg_id = -1;
_signal_segment_off(item);
}