#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
+#define ELM_WIDGET_ITEM_PROTECTED
#include <Elementary.h>
#include "elm_priv.h"
EOLIAN static Eina_Bool
_elm_segment_control_elm_widget_translate(Eo *obj EINA_UNUSED, Elm_Segment_Control_Data *sd)
{
- Elm_Segment_Item *it;
+ Elm_Object_Item *it;
Eina_List *l;
EINA_LIST_FOREACH(sd->items, l, it)
- elm_widget_item_translate(it);
+ eo_do((Eo *)it, elm_wdg_item_translate());
eo_do_super(obj, MY_CLASS, elm_obj_widget_translate());
}
static void
-_item_free(Elm_Segment_Item *it)
+_item_free(Elm_Segment_Control_Item_Data *it)
{
ELM_SEGMENT_CONTROL_DATA_GET(WIDGET(it), sd);
if (sd->selected_item == it) sd->selected_item = NULL;
- if (sd->items) sd->items = eina_list_remove(sd->items, it);
+ if (sd->items) sd->items = eina_list_remove(sd->items, EO_OBJ(it));
evas_object_del(it->icon);
eina_stringshare_del(it->label);
Eina_List *l;
Eina_Bool rtl;
int item_count;
- Elm_Segment_Item *it;
+ Elm_Object_Item *eo_item;
int bx, by, bw, bh, pos;
ELM_WIDGET_DATA_GET_OR_RETURN(sd->obj, wd);
if (rtl) pos = bx + bw - sd->item_width;
else pos = bx;
- EINA_LIST_FOREACH(sd->items, l, it)
+ EINA_LIST_FOREACH(sd->items, l, eo_item)
{
+ ELM_SEGMENT_ITEM_DATA_GET(eo_item, it);
evas_object_move(VIEW(it), pos, by);
evas_object_resize(VIEW(it), sd->item_width, bh);
if (rtl) pos -= sd->item_width;
}
static void
-_swallow_item_objects(Elm_Segment_Item *it)
+_swallow_item_objects(Elm_Segment_Control_Item_Data *it)
{
if (!it) return;
Eina_List *l;
Eina_Bool rtl;
int item_count;
- Elm_Segment_Item *it;
+ Elm_Object_Item *eo_it;
_position_items(sd);
if (item_count == 1)
{
- it = eina_list_nth(sd->items, 0);
+ eo_it = eina_list_nth(sd->items, 0);
+ ELM_SEGMENT_ITEM_DATA_GET(eo_it, it);
+
it->seg_index = 0;
//Set the segment type
}
rtl = elm_widget_mirrored_get(sd->obj);
- EINA_LIST_FOREACH(sd->items, l, it)
+ EINA_LIST_FOREACH(sd->items, l, eo_it)
{
+ ELM_SEGMENT_ITEM_DATA_GET(eo_it, it);
it->seg_index = idx;
//Set the segment type
{
Eina_List *l;
Eina_Bool rtl;
- Elm_Segment_Item *it;
+ Elm_Object_Item *eo_item;
Eina_Bool int_ret = EINA_FALSE;
eo_do_super(obj, MY_CLASS, int_ret = elm_obj_widget_theme_apply());
rtl = elm_widget_mirrored_get(obj);
- EINA_LIST_FOREACH(sd->items, l, it)
+ EINA_LIST_FOREACH(sd->items, l, eo_item)
{
+ ELM_SEGMENT_ITEM_DATA_GET(eo_item, it);
elm_widget_theme_object_set
(obj, VIEW(it), "segment_control", "item",
elm_widget_style_get(obj));
static void *
_elm_list_data_get(const Eina_List *list)
{
- Elm_Segment_Item *it = eina_list_data_get(list);
+ Elm_Object_Item *eo_item = eina_list_data_get(list);
- if (it) return NULL;
+ if (eo_item) return NULL;
+ ELM_SEGMENT_ITEM_DATA_GET(eo_item, it);
edje_object_signal_emit(VIEW(it), "elm,state,segment,selected", "elm");
return VIEW(it);
#endif
static void
-_segment_off(Elm_Segment_Item *it)
+_segment_off(Elm_Segment_Control_Item_Data *it)
{
ELM_SEGMENT_CONTROL_DATA_GET(WIDGET(it), sd);
}
static void
-_segment_on(Elm_Segment_Item *it)
+_segment_on(Elm_Segment_Control_Item_Data *it)
{
ELM_SEGMENT_CONTROL_DATA_GET(WIDGET(it), sd);
edje_object_signal_emit(VIEW(it), "elm,state,segment,selected", "elm");
sd->selected_item = it;
- evas_object_smart_callback_call(sd->obj, SIG_CHANGED, it);
+ evas_object_smart_callback_call(sd->obj, SIG_CHANGED, EO_OBJ(it));
}
static void
Evas_Object *obj EINA_UNUSED,
void *event_info)
{
- Elm_Segment_Item *it = data;
+ Elm_Segment_Control_Item_Data *it = data;
Evas_Event_Mouse_Up *ev = event_info;
Evas_Coord x, y, w, h;
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
- Elm_Segment_Item *it = data;
+ Elm_Segment_Control_Item_Data *it = data;
Evas_Event_Mouse_Down *ev = event_info;
ELM_SEGMENT_CONTROL_DATA_GET(WIDGET(it), sd);
edje_object_signal_emit(VIEW(it), "elm,state,segment,pressed", "elm");
}
-static Elm_Segment_Item *
+static Elm_Segment_Control_Item_Data *
_item_find(const Evas_Object *obj,
int idx)
{
- Elm_Segment_Item *it;
+ Elm_Object_Item *eo_it;
ELM_SEGMENT_CONTROL_DATA_GET(obj, sd);
- it = eina_list_nth(sd->items, idx);
+ eo_it = eina_list_nth(sd->items, idx);
+ ELM_SEGMENT_ITEM_DATA_GET(eo_it, it);
return it;
}
-static void
-_item_text_set_hook(Elm_Object_Item *it,
- const char *part,
- const char *label)
+EOLIAN static void
+_elm_segment_control_item_elm_widget_item_part_text_set(Eo *eo_item EINA_UNUSED,
+ Elm_Segment_Control_Item_Data *item,
+ const char *part,
+ const char *label)
{
- Elm_Segment_Item *item;
char buf[1024];
- item = (Elm_Segment_Item *)it;
if ((!part) || (!strcmp(part, "default")) ||
(!strcmp(part, "elm.text")))
edje_object_part_text_escaped_set(VIEW(item), part, label);
}
-static const char *
-_item_text_get_hook(const Elm_Object_Item *it,
- const char *part)
+EOLIAN static const char *
+_elm_segment_control_item_elm_widget_item_part_text_get(Eo *eo_item EINA_UNUSED,
+ Elm_Segment_Control_Item_Data *it,
+ const char *part)
{
char buf[1024];
return edje_object_part_text_get(VIEW(it), buf);
}
-static void
-_item_content_set_hook(Elm_Object_Item *it,
- const char *part,
- Evas_Object *content)
+EOLIAN static void
+_elm_segment_control_item_elm_widget_item_part_content_set(Eo *eo_item EINA_UNUSED,
+ Elm_Segment_Control_Item_Data *item,
+ const char *part,
+ Evas_Object *content)
{
- Elm_Segment_Item *item;
char buf[1024];
- item = (Elm_Segment_Item *)it;
if (!part || !strcmp("icon", part))
{
{
if (content)
{
- edje_object_part_swallow(VIEW(it), part, content);
+ edje_object_part_swallow(VIEW(item), part, content);
snprintf(buf, sizeof(buf), "elm,state,%s,visible", part);
edje_object_signal_emit(VIEW(item), buf, "elm");
}
}
}
-static Evas_Object *
-_item_content_get_hook(const Elm_Object_Item *it,
- const char *part)
+EOLIAN static Evas_Object *
+_elm_segment_control_item_elm_widget_item_part_content_get(Eo *eo_item EINA_UNUSED,
+ Elm_Segment_Control_Item_Data *item,
+ const char *part)
{
- Elm_Segment_Item *item;
- item = (Elm_Segment_Item *)it;
-
if (part && !strcmp(part, "icon"))
return item->icon;
else
}
static Eina_Bool
-_item_del_pre_hook(Elm_Object_Item *it)
+_elm_segment_control_item_elm_widget_item_del_pre(Eo *eo_item EINA_UNUSED, Elm_Segment_Control_Item_Data *item)
{
- Elm_Segment_Item *item = (Elm_Segment_Item *)it;
- ELM_SEGMENT_CONTROL_DATA_GET(WIDGET(it), sd);
+ ELM_SEGMENT_CONTROL_DATA_GET(WIDGET(item), sd);
_item_free(item);
_update_list(sd);
_access_info_cb(void *data, Evas_Object *obj EINA_UNUSED)
{
const char *txt = NULL;
- Elm_Segment_Item *it = (Elm_Segment_Item *)data;
+ Elm_Segment_Control_Item_Data *it = (Elm_Segment_Control_Item_Data *)data;
ELM_SEGMENT_CONTROL_ITEM_CHECK_OR_RETURN(it, NULL);
if (!txt) txt = it->label;
static char *
_access_state_cb(void *data, Evas_Object *obj EINA_UNUSED)
{
- Elm_Segment_Item *it = (Elm_Segment_Item *)data;
+ Elm_Segment_Control_Item_Data *it = (Elm_Segment_Control_Item_Data *)data;
ELM_SEGMENT_CONTROL_ITEM_CHECK_OR_RETURN(it, NULL);
ELM_SEGMENT_CONTROL_DATA_GET(WIDGET(it), sd);
ELM_WIDGET_DATA_GET_OR_RETURN(WIDGET(it), wd, NULL);
return strdup(E_("State: Unselected"));
}
-static void
-_access_widget_item_register(Elm_Segment_Item *it)
+static Evas_Object*
+_elm_segment_control_item_elm_widget_item_access_register(Eo *eo_it EINA_UNUSED,
+ Elm_Segment_Control_Item_Data *it)
{
Elm_Access_Info *ai;
+ Evas_Object *ret;
- _elm_access_widget_item_register((Elm_Widget_Item_Data *)it);
+ eo_do_super(eo_it, ELM_SEGMENT_CONTROL_ITEM_CLASS, ret = elm_wdg_item_access_register());
- ai = _elm_access_info_get(it->base.access_obj);
+ ai = _elm_access_info_get(it->base->access_obj);
_elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("Segment Control Item"));
_elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, it);
_elm_access_callback_set(ai, ELM_ACCESS_STATE, _access_state_cb, it);
+
+ return ret;
}
-static Elm_Segment_Item *
+static Elm_Object_Item *
_item_new(Evas_Object *obj,
Evas_Object *icon,
const char *label)
{
- Elm_Segment_Item *it;
-
- it = elm_widget_item_new(obj, Elm_Segment_Item);
- if (!it) return NULL;
+ Eo *eo_item;
- elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
- elm_widget_item_text_set_hook_set(it, _item_text_set_hook);
- elm_widget_item_text_get_hook_set(it, _item_text_get_hook);
- elm_widget_item_content_set_hook_set(it, _item_content_set_hook);
- elm_widget_item_content_get_hook_set(it, _item_content_get_hook);
+ eo_item = eo_add(ELM_SEGMENT_CONTROL_ITEM_CLASS, obj);
+ if (!eo_item) return NULL;
- VIEW(it) = edje_object_add(evas_object_evas_get(obj));
- edje_object_scale_set(VIEW(it),elm_widget_scale_get(WIDGET(it)) *
- elm_config_scale_get());
- evas_object_smart_member_add(VIEW(it), obj);
-
- elm_widget_sub_object_add(obj, VIEW(it));
- elm_widget_theme_object_set
- (obj, VIEW(it), "segment_control", "item", elm_object_style_get(obj));
- edje_object_mirrored_set(VIEW(it), elm_widget_mirrored_get(WIDGET(it)));
+ ELM_SEGMENT_ITEM_DATA_GET(eo_item, it);
if (label) eina_stringshare_replace(&it->label, label);
if (it->label)
// ACCESS
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
- _access_widget_item_register(it);
+ eo_do(eo_item, elm_wdg_item_access_register());
- return it;
+ return (Elm_Object_Item *)eo_item;
+}
+
+EOLIAN static void
+_elm_segment_control_item_eo_base_constructor(Eo *obj, Elm_Segment_Control_Item_Data *it)
+{
+ eo_do_super(obj, ELM_SEGMENT_CONTROL_ITEM_CLASS, eo_constructor());
+ it->base = eo_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS);
+
+ Evas_Object *parent;
+ eo_do (obj, parent = eo_parent_get());
+
+ VIEW(it) = edje_object_add(evas_object_evas_get(parent));
+ edje_object_scale_set(VIEW(it),elm_widget_scale_get(WIDGET(it)) *
+ elm_config_scale_get());
+ evas_object_smart_member_add(VIEW(it), parent);
+
+ elm_widget_sub_object_add(parent, VIEW(it));
+ elm_widget_theme_object_set
+ (parent, VIEW(it), "segment_control", "item", elm_object_style_get(parent));
+ edje_object_mirrored_set(VIEW(it), elm_widget_mirrored_get(WIDGET(it)));
}
EOLIAN static void
EOLIAN static void
_elm_segment_control_evas_object_smart_del(Eo *obj, Elm_Segment_Control_Data *sd)
{
- Elm_Segment_Item *it;
+ Elm_Object_Item *eo_it;
- EINA_LIST_FREE(sd->items, it)
+ EINA_LIST_FREE(sd->items, eo_it)
{
+ ELM_SEGMENT_ITEM_DATA_GET(eo_it, it);
_item_free(it);
- elm_widget_item_free(it);
+ eo_del((Eo *)eo_it);
}
eo_do_super(obj, MY_CLASS, evas_obj_smart_del());
{
Eina_List *items = NULL;
Eina_List *l;
- Elm_Segment_Item *it;
+ Elm_Object_Item *eo_item;
ELM_SEGMENT_CONTROL_CHECK(obj) EINA_FALSE;
- EINA_LIST_FOREACH(sd->items, l, it)
- items = eina_list_append(items, it->base.access_obj);
+ EINA_LIST_FOREACH(sd->items, l, eo_item)
+ {
+ ELM_SEGMENT_ITEM_DATA_GET(eo_item, it);
+ items = eina_list_append(items, it->base->access_obj);
+ }
return elm_widget_focus_list_next_get
(obj, items, eina_list_data_get, dir, next);
_access_obj_process(Elm_Segment_Control_Data *sd, Eina_Bool is_access)
{
Eina_List *l;
- Elm_Segment_Item *it;
+ Eo *eo_item;
- EINA_LIST_FOREACH(sd->items, l, it)
+ EINA_LIST_FOREACH(sd->items, l, eo_item)
{
- if (is_access) _access_widget_item_register(it);
+ if (is_access) eo_do(eo_item, elm_wdg_item_access_register());
else
- _elm_access_widget_item_unregister((Elm_Widget_Item_Data *)it);
+ eo_do(eo_item, elm_wdg_item_access_unregister());
}
}
EOLIAN static Elm_Object_Item*
_elm_segment_control_item_add(Eo *obj, Elm_Segment_Control_Data *sd, Evas_Object *icon, const char *label)
{
- Elm_Segment_Item *it;
-
+ Elm_Object_Item *eo_item;
- it = _item_new(obj, icon, label);
- if (!it) return NULL;
+ eo_item = _item_new(obj, icon, label);
+ if (!eo_item) return NULL;
- sd->items = eina_list_append(sd->items, it);
+ sd->items = eina_list_append(sd->items, eo_item);
_update_list(sd);
- return (Elm_Object_Item *)it;
+ return (Elm_Object_Item *)eo_item;
}
EOLIAN static Elm_Object_Item*
_elm_segment_control_item_insert_at(Eo *obj, Elm_Segment_Control_Data *sd, Evas_Object *icon, const char *label, int idx)
{
- Elm_Segment_Item *it, *it_rel;
+ Elm_Object_Item *eo_item;
+ Elm_Segment_Control_Item_Data *it_rel;
if (idx < 0) idx = 0;
- it = _item_new(obj, icon, label);
- if (!it) return NULL;
+ eo_item = _item_new(obj, icon, label);
+ if (!eo_item) return NULL;
it_rel = _item_find(obj, idx);
- if (it_rel) sd->items = eina_list_prepend_relative(sd->items, it, it_rel);
- else sd->items = eina_list_append(sd->items, it);
+ if (it_rel) sd->items = eina_list_prepend_relative(sd->items, eo_item, EO_OBJ(it_rel));
+ else sd->items = eina_list_append(sd->items, eo_item);
_update_list(sd);
- return (Elm_Object_Item *)it;
+ return (Elm_Object_Item *)eo_item;
}
EOLIAN static void
_elm_segment_control_item_del_at(Eo *obj, Elm_Segment_Control_Data *_pd EINA_UNUSED, int idx)
{
- Elm_Segment_Item *it;
+ Elm_Segment_Control_Item_Data *it;
it = _item_find(obj, idx);
if (!it) return;
- elm_widget_item_del((Elm_Object_Item *)it);
+ eo_do((Eo *)EO_OBJ(it), elm_wdg_item_del());
}
EOLIAN static const char*
_elm_segment_control_item_label_get(Eo *obj, Elm_Segment_Control_Data *_pd EINA_UNUSED, int idx)
{
- Elm_Segment_Item *it;
+ Elm_Segment_Control_Item_Data *it;
it = _item_find(obj, idx);
if (it) return it->label;
EOLIAN static Evas_Object*
_elm_segment_control_item_icon_get(Eo *obj, Elm_Segment_Control_Data *_pd EINA_UNUSED, int idx)
{
- Elm_Segment_Item *it = _item_find(obj, idx);
+ Elm_Segment_Control_Item_Data *it = _item_find(obj, idx);
if (it) return it->icon;
return NULL;
}
EAPI Evas_Object *
elm_segment_control_item_object_get(const Elm_Object_Item *it)
{
- ELM_SEGMENT_CONTROL_ITEM_CHECK_OR_RETURN(it, NULL);
+ return eo_do((Eo*)it, elm_obj_segment_control_item_object_get());
+}
+EOLIAN static Evas_Object *
+_elm_segment_control_item_object_get(Eo *eo_it EINA_UNUSED, Elm_Segment_Control_Item_Data *it)
+{
return VIEW(it);
}
EOLIAN static Elm_Object_Item*
_elm_segment_control_item_selected_get(Eo *obj EINA_UNUSED, Elm_Segment_Control_Data *sd)
{
- return (Elm_Object_Item *)sd->selected_item;
+ return (Elm_Object_Item *)EO_OBJ(sd->selected_item);
}
EAPI void
elm_segment_control_item_selected_set(Elm_Object_Item *it,
Eina_Bool selected)
{
- Elm_Segment_Item *item = (Elm_Segment_Item *)it;
+ eo_do((Eo*)it, elm_obj_segment_control_item_selected_set(selected));
+}
- ELM_SEGMENT_CONTROL_ITEM_CHECK_OR_RETURN(it);
- ELM_SEGMENT_CONTROL_DATA_GET(WIDGET(it), sd);
+EOLIAN static void
+_elm_segment_control_item_selected_set(Eo *eo_item EINA_UNUSED,
+ Elm_Segment_Control_Item_Data *item,
+ Eina_Bool selected)
+{
+ ELM_SEGMENT_CONTROL_ITEM_CHECK_OR_RETURN(item);
+ ELM_SEGMENT_CONTROL_DATA_GET(WIDGET(item), sd);
if (item == sd->selected_item)
{
EOLIAN static Elm_Object_Item*
_elm_segment_control_item_get(Eo *obj, Elm_Segment_Control_Data *_pd EINA_UNUSED, int idx)
{
- return (Elm_Object_Item *)_item_find(obj, idx);
+ Elm_Segment_Control_Item_Data *it = _item_find(obj, idx);
+ return (Elm_Object_Item *)EO_OBJ(it);
}
-EAPI int
-elm_segment_control_item_index_get(const Elm_Object_Item *it)
+EOLIAN static int
+_elm_segment_control_item_index_get(Eo *eo_it EINA_UNUSED, Elm_Segment_Control_Item_Data *it)
{
ELM_SEGMENT_CONTROL_ITEM_CHECK_OR_RETURN(it, -1);
- return ((Elm_Segment_Item *)it)->seg_index;
+ return it->seg_index;
}
EOLIAN static void
_elm_segment_control_smart_focus_next_enable = EINA_TRUE;
}
+#include "elm_segment_control_item.eo.c"
#include "elm_segment_control.eo.c"