summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2014-09-28 08:15:07 +0300
committerDaniel Zaoui <daniel.zaoui@samsung.com>2014-11-12 12:03:55 +0200
commitf3670e50f969429acef82d608d5786e3689fe2c9 (patch)
treec7706f7c67f1ed1a8d8b4677788dd3ea2ba4e5f3
parentf90288a6d605328474afdf6df9bba9998b5c90ca (diff)
downloadelementary-f3670e50f969429acef82d608d5786e3689fe2c9.tar.gz
Elm Multibuttonentry Item: Migrate to Eo
-rw-r--r--src/lib/Makefile.am6
-rw-r--r--src/lib/elc_multibuttonentry.c259
-rw-r--r--src/lib/elc_multibuttonentry_legacy.h34
-rw-r--r--src/lib/elm_multibuttonentry_item.eo55
-rw-r--r--src/lib/elm_widget_multibuttonentry.h20
5 files changed, 224 insertions, 150 deletions
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index d6d4825e4..e625b7e78 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -613,7 +613,8 @@ elm_slideshow_item.eo \
elm_flipselector_item.eo \
elm_menu_item.eo \
elm_ctxpopup_item.eo \
-elm_index_item.eo
+elm_index_item.eo \
+elm_multibuttonentry_item.eo
elm_eolian_c = $(elm_eolian_files:%.eo=%.eo.c)
elm_eolian_h = $(elm_eolian_files:%.eo=%.eo.h)
@@ -734,7 +735,8 @@ elementaryeolianfiles_DATA = \
elm_flipselector_item.eo \
elm_menu_item.eo \
elm_ctxpopup_item.eo \
- elm_index_item.eo
+ elm_index_item.eo \
+ elm_multibuttonentry_item.eo
EXTRA_DIST += ${elementaryeolianfiles_DATA}
diff --git a/src/lib/elc_multibuttonentry.c b/src/lib/elc_multibuttonentry.c
index 0204133a2..2c6fc36a0 100644
--- a/src/lib/elc_multibuttonentry.c
+++ b/src/lib/elc_multibuttonentry.c
@@ -3,6 +3,7 @@
#endif
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
+#define ELM_WIDGET_ITEM_PROTECTED
#include <Elementary.h>
#include "elm_priv.h"
@@ -44,11 +45,11 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
EOLIAN static Eina_Bool
_elm_multibuttonentry_elm_widget_translate(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd)
{
- Elm_Multibuttonentry_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());
@@ -68,14 +69,15 @@ EOLIAN static Eina_Bool
_elm_multibuttonentry_elm_widget_theme_apply(Eo *obj, Elm_Multibuttonentry_Data *sd)
{
Eina_List *l;
- Elm_Multibuttonentry_Item *item;
+ Elm_Object_Item *eo_item;
Eina_Bool int_ret = EINA_FALSE;
eo_do_super(obj, MY_CLASS, int_ret = elm_obj_widget_theme_apply());
if (!int_ret) return EINA_FALSE;
- EINA_LIST_FOREACH(sd->items, l, item)
+ EINA_LIST_FOREACH(sd->items, l, eo_item)
{
+ ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
if (item->button)
elm_widget_theme_object_set
(obj, item->button, "multibuttonentry", "btn",
@@ -133,7 +135,7 @@ _shrink_mode_set(Evas_Object *obj,
{
int count;
Eina_List *l;
- Elm_Multibuttonentry_Item *item;
+ Elm_Object_Item *eo_item;
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(obj, sd);
@@ -155,8 +157,9 @@ _shrink_mode_set(Evas_Object *obj,
elm_box_padding_get(sd->box, &box_inner_item_width_padding, NULL);
// unpack all items and entry
elm_box_unpack_all(sd->box);
- EINA_LIST_FOREACH(sd->items, l, item)
+ EINA_LIST_FOREACH(sd->items, l, eo_item)
{
+ ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
evas_object_hide(item->button);
item->visible = EINA_FALSE;
}
@@ -171,14 +174,15 @@ _shrink_mode_set(Evas_Object *obj,
w -= box_inner_item_width_padding;
}
- item = NULL;
+ eo_item = NULL;
count = eina_list_count(sd->items);
- EINA_LIST_FOREACH(sd->items, l, item)
+ EINA_LIST_FOREACH(sd->items, l, eo_item)
{
Evas_Coord w_label_count = 0, h = 0;
char *buf;
+ ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
elm_box_pack_end(sd->box, item->button);
evas_object_show(item->button);
item->visible = EINA_TRUE;
@@ -234,8 +238,9 @@ _shrink_mode_set(Evas_Object *obj,
{
// unpack all items and entry
elm_box_unpack_all(sd->box);
- EINA_LIST_FOREACH(sd->items, l, item)
+ EINA_LIST_FOREACH(sd->items, l, eo_item)
{
+ ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
evas_object_hide(item->button);
item->visible = EINA_FALSE;
}
@@ -246,9 +251,10 @@ _shrink_mode_set(Evas_Object *obj,
if (sd->label) elm_box_pack_end(sd->box, sd->label);
// pack remain btns
- item = NULL;
- EINA_LIST_FOREACH(sd->items, l, item)
+ eo_item = NULL;
+ EINA_LIST_FOREACH(sd->items, l, eo_item)
{
+ ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
elm_box_pack_end(sd->box, item->button);
evas_object_show(item->button);
item->visible = EINA_TRUE;
@@ -330,26 +336,27 @@ end:
}
static void
-_button_item_del(Elm_Multibuttonentry_Item *item)
+_button_item_del(Elm_Multibuttonentry_Item_Data *item)
{
Eina_List *l;
- Elm_Multibuttonentry_Item *it;
+ Elm_Object_Item *eo_it;
Evas_Object *obj = WIDGET(item);
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(obj, sd);
- EINA_LIST_FOREACH(sd->items, l, it)
+ EINA_LIST_FOREACH(sd->items, l, eo_it)
{
+ ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_it, it);
if (it == item)
{
- sd->items = eina_list_remove(sd->items, it);
+ sd->items = eina_list_remove(sd->items, eo_it);
elm_box_unpack(sd->box, it->button);
- evas_object_smart_callback_call(obj, SIG_ITEM_DELETED, it);
+ evas_object_smart_callback_call(obj, SIG_ITEM_DELETED, eo_it);
evas_object_del(it->button);
- if (sd->selected_it == (Elm_Object_Item *)it)
+ if (sd->selected_it == it)
sd->selected_it = NULL;
break;
}
@@ -366,11 +373,11 @@ static void
_current_button_state_change(Evas_Object *obj,
Multibuttonentry_Button_State state)
{
- Elm_Multibuttonentry_Item *item;
+ Elm_Multibuttonentry_Item_Data *item;
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(obj, sd);
- item = (Elm_Multibuttonentry_Item *)sd->selected_it;
+ item = sd->selected_it;
if (!item || !item->button) return;
@@ -378,7 +385,7 @@ _current_button_state_change(Evas_Object *obj,
{
case MULTIBUTTONENTRY_BUTTON_STATE_SELECTED:
edje_object_signal_emit(item->button, "elm,state,focused", "elm");
- evas_object_smart_callback_call(obj, SIG_ITEM_SELECTED, item);
+ evas_object_smart_callback_call(obj, SIG_ITEM_SELECTED, EO_OBJ(item));
break;
case MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT:
default:
@@ -393,7 +400,7 @@ _current_button_change(Evas_Object *obj,
Evas_Object *btn)
{
Eina_List *l;
- Elm_Multibuttonentry_Item *item;
+ Elm_Object_Item *eo_item;
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(obj, sd);
@@ -401,11 +408,12 @@ _current_button_change(Evas_Object *obj,
_current_button_state_change(obj, MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT);
// change the current
- EINA_LIST_FOREACH(sd->items, l, item)
+ EINA_LIST_FOREACH(sd->items, l, eo_item)
{
+ ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
if (item->button == btn)
{
- sd->selected_it = (Elm_Object_Item *)item;
+ sd->selected_it = item;
break;
}
}
@@ -465,7 +473,7 @@ _button_clicked_cb(void *data,
const char *emission EINA_UNUSED,
const char *source EINA_UNUSED)
{
- Elm_Multibuttonentry_Item *item = NULL;
+ Elm_Multibuttonentry_Item_Data *item = NULL;
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(data, sd);
@@ -475,9 +483,9 @@ _button_clicked_cb(void *data,
if (sd->selected_it)
{
- if ((item = (Elm_Multibuttonentry_Item *)sd->selected_it) != NULL)
+ if ((item = sd->selected_it) != NULL)
{
- evas_object_smart_callback_call(data, SIG_ITEM_CLICKED, item);
+ evas_object_smart_callback_call(data, SIG_ITEM_CLICKED, EO_OBJ(item));
_button_select(data, item->button);
}
}
@@ -490,15 +498,16 @@ _button_deleted_cb(void *data,
const char *source EINA_UNUSED)
{
Eina_List *l;
- Elm_Multibuttonentry_Item *item = NULL;
+ Elm_Object_Item *eo_item = NULL;
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(data, sd);
// change the current
- EINA_LIST_FOREACH(sd->items, l, item)
+ EINA_LIST_FOREACH(sd->items, l, eo_item)
{
+ ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
if (item->button == obj)
{
- elm_widget_item_del(item);
+ eo_do((Eo *)eo_item, elm_wdg_item_del());
break;
}
}
@@ -536,22 +545,21 @@ _button_resize(Evas_Object *obj,
if (vieww) *vieww = vw;
}
-static void
-_item_signal_emit_hook(Elm_Object_Item *it,
- const char *emission,
- const char *source)
+EOLIAN static void
+_elm_multibuttonentry_item_elm_widget_item_signal_emit(Eo *eo_item EINA_UNUSED,
+ Elm_Multibuttonentry_Item_Data *item,
+ const char *emission,
+ const char *source)
{
- Elm_Multibuttonentry_Item *item = (Elm_Multibuttonentry_Item *)it;
-
edje_object_signal_emit(item->button, emission, source);
}
-static void
-_item_text_set_hook(Elm_Object_Item *it,
- const char *part,
- const char *label)
+EOLIAN static void
+_elm_multibuttonentry_item_elm_widget_item_part_text_set(Eo *eo_item EINA_UNUSED,
+ Elm_Multibuttonentry_Item_Data *item,
+ const char *part,
+ const char *label)
{
- Elm_Multibuttonentry_Item *item;
const char *dest_part = NULL;
if (!part || !strcmp(part, "elm.text"))
@@ -559,16 +567,15 @@ _item_text_set_hook(Elm_Object_Item *it,
else
dest_part = part;
- item = (Elm_Multibuttonentry_Item *)it;
edje_object_part_text_escaped_set(item->button, dest_part, label);
- _button_resize(item->base.widget, item->button, &item->rw, &item->vw);
+ _button_resize(item->base->widget, item->button, &item->rw, &item->vw);
}
-static const char *
-_item_text_get_hook(const Elm_Object_Item *it,
- const char *part)
+EOLIAN static const char *
+_elm_multibuttonentry_item_elm_widget_item_part_text_get(Eo *eo_item EINA_UNUSED,
+ Elm_Multibuttonentry_Item_Data *item,
+ const char *part)
{
- Elm_Multibuttonentry_Item *item;
const char *src_part = NULL;
if (!part || !strcmp(part, "elm.text"))
@@ -576,14 +583,14 @@ _item_text_get_hook(const Elm_Object_Item *it,
else
src_part = part;
- item = (Elm_Multibuttonentry_Item *)it;
return edje_object_part_text_get(item->button, src_part);
}
-static Eina_Bool
-_item_del_pre_hook(Elm_Object_Item *it)
+EOLIAN static Eina_Bool
+_elm_multibuttonentry_item_elm_widget_item_del_pre(Eo *eo_it EINA_UNUSED,
+ Elm_Multibuttonentry_Item_Data *it EINA_UNUSED)
{
- _button_item_del((Elm_Multibuttonentry_Item *)it);
+ _button_item_del(it);
return EINA_TRUE;
}
@@ -613,9 +620,10 @@ _access_multibuttonentry_label_register(Evas_Object *obj, Eina_Bool is_access)
static void
_access_multibuttonentry_item_register(Evas_Object *obj,
- Elm_Multibuttonentry_Item *item,
+ Elm_Object_Item *eo_item,
Eina_Bool is_access)
{
+ ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
if (is_access)
{
Evas_Object *ao;
@@ -634,11 +642,18 @@ _access_multibuttonentry_item_register(Evas_Object *obj,
evas_object_propagate_events_set(item->button, !is_access);
}
+EOLIAN static void
+_elm_multibuttonentry_item_eo_base_constructor(Eo *eo_item, Elm_Multibuttonentry_Item_Data *item)
+{
+ eo_do_super(eo_item, ELM_MULTIBUTTONENTRY_ITEM_CLASS, eo_constructor());
+ item->base = eo_data_scope_get(eo_item, ELM_WIDGET_ITEM_CLASS);
+}
+
static Elm_Object_Item *
_button_item_add(Elm_Multibuttonentry_Data *sd,
const char *str,
Multibuttonentry_Pos pos,
- const void *ref,
+ Elm_Object_Item *eo_reference,
Evas_Smart_Cb func,
void *data)
{
@@ -646,10 +661,12 @@ _button_item_add(Elm_Multibuttonentry_Data *sd,
Evas_Object *btn;
Evas_Coord rw, vw;
char *str_utf8 = NULL;
- Elm_Multibuttonentry_Item *item;
+ Eo *eo_item;
Evas_Coord width = -1, height = -1;
Elm_Multibuttonentry_Item_Filter *item_filter;
- Elm_Multibuttonentry_Item *reference = (Elm_Multibuttonentry_Item *)ref;
+ Elm_Multibuttonentry_Item_Data *reference = eo_reference?
+ eo_data_scope_get((Eo *)eo_reference, ELM_MULTIBUTTONENTRY_ITEM_CLASS):
+ NULL;
Evas_Object *obj;
obj = sd->parent;
@@ -684,15 +701,11 @@ _button_item_add(Elm_Multibuttonentry_Data *sd,
evas_object_show(btn);
// append item list
- item = elm_widget_item_new(obj, Elm_Multibuttonentry_Item);
- if (!item) return NULL;
+ eo_item = eo_add(ELM_MULTIBUTTONENTRY_ITEM_CLASS, obj, elm_wdg_item_data_set(data));
+ if (!eo_item) return NULL;
- elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook);
- 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_signal_emit_hook_set(item, _item_signal_emit_hook);
+ ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
- elm_widget_item_data_set(item, data);
_button_resize(obj, btn, &rw, &vw);
item->button = btn;
@@ -715,7 +728,7 @@ _button_item_add(Elm_Multibuttonentry_Data *sd,
_elm_access_say(text);
eina_strbuf_free(buf);
- _access_multibuttonentry_item_register(obj, item, EINA_TRUE);
+ _access_multibuttonentry_item_register(obj, (Elm_Object_Item *)eo_item, EINA_TRUE);
}
if (func)
@@ -726,7 +739,7 @@ _button_item_add(Elm_Multibuttonentry_Data *sd,
switch (pos)
{
case MULTIBUTTONENTRY_POS_START:
- sd->items = eina_list_prepend(sd->items, item);
+ sd->items = eina_list_prepend(sd->items, eo_item);
if (sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK)
{
elm_widget_sub_object_add(obj, btn);
@@ -744,7 +757,7 @@ _button_item_add(Elm_Multibuttonentry_Data *sd,
break;
case MULTIBUTTONENTRY_POS_END:
- sd->items = eina_list_append(sd->items, item);
+ sd->items = eina_list_append(sd->items, eo_item);
if (sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK)
{
elm_widget_sub_object_add(obj, btn);
@@ -764,10 +777,10 @@ _button_item_add(Elm_Multibuttonentry_Data *sd,
break;
case MULTIBUTTONENTRY_POS_BEFORE:
- if (reference)
- sd->items = eina_list_prepend_relative(sd->items, item, reference);
+ if (eo_reference)
+ sd->items = eina_list_prepend_relative(sd->items, eo_item, eo_reference);
else
- sd->items = eina_list_append(sd->items, item);
+ sd->items = eina_list_append(sd->items, eo_item);
if (sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK)
{
elm_widget_sub_object_add(obj, btn);
@@ -776,7 +789,7 @@ _button_item_add(Elm_Multibuttonentry_Data *sd,
}
else
{
- if (reference)
+ if (eo_reference)
elm_box_pack_before(sd->box, btn, reference->button);
else
{
@@ -793,10 +806,10 @@ _button_item_add(Elm_Multibuttonentry_Data *sd,
break;
case MULTIBUTTONENTRY_POS_AFTER:
- if (reference)
- sd->items = eina_list_append_relative(sd->items, item, reference);
+ if (eo_reference)
+ sd->items = eina_list_append_relative(sd->items, eo_item, eo_reference);
else
- sd->items = eina_list_append(sd->items, item);
+ sd->items = eina_list_append(sd->items, eo_item);
if (sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK)
{
elm_widget_sub_object_add(obj, btn);
@@ -804,7 +817,7 @@ _button_item_add(Elm_Multibuttonentry_Data *sd,
}
else
{
- if (reference)
+ if (eo_reference)
elm_box_pack_after(sd->box, btn, reference->button);
else
{
@@ -823,11 +836,11 @@ _button_item_add(Elm_Multibuttonentry_Data *sd,
default:
break;
}
- evas_object_smart_callback_call(obj, SIG_ITEM_ADDED, item);
+ evas_object_smart_callback_call(obj, SIG_ITEM_ADDED, eo_item);
free(str_utf8);
- return (Elm_Object_Item *)item;
+ return (Elm_Object_Item *)eo_item;
}
//FIXME: having an empty event handling function and reacting on Evas
@@ -939,12 +952,12 @@ _entry_focus_in_cb(void *data,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
- Elm_Multibuttonentry_Item *item = NULL;
+ Elm_Multibuttonentry_Item_Data *item = NULL;
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(data, sd);
if (sd->selected_it)
{
- item = (Elm_Multibuttonentry_Item *)sd->selected_it;
+ item = sd->selected_it;
elm_object_focus_set(sd->entry, EINA_FALSE);
evas_object_focus_set(item->button, EINA_TRUE);
}
@@ -980,7 +993,6 @@ _layout_key_down_cb(void *data,
Evas_Object *obj EINA_UNUSED,
void *event_info)
{
- Elm_Multibuttonentry_Item *item = NULL;
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(data, sd);
Evas_Event_Key_Up *ev = (Evas_Event_Key_Up *)event_info;
@@ -992,10 +1004,10 @@ _layout_key_down_cb(void *data,
((strcmp(ev->key, "BackSpace") == 0) ||
(strcmp(ev->key, "Delete") == 0)))
{
- item = (Elm_Multibuttonentry_Item *)sd->selected_it;
+ Elm_Multibuttonentry_Item_Data *item = sd->selected_it;
if (item && sd->editable)
{
- elm_widget_item_del(item);
+ eo_do((Eo *)EO_OBJ(item), elm_wdg_item_del());
elm_object_focus_set(sd->entry, EINA_TRUE);
}
}
@@ -1003,9 +1015,12 @@ _layout_key_down_cb(void *data,
(strcmp(ev->key, "BackSpace") == 0)) ||
(strcmp(ev->key, "Delete") == 0)))
{
- item = eina_list_data_get(eina_list_last(sd->items));
- if (item)
- _button_select(sd->parent, item->button);
+ Elm_Object_Item *eo_item = eina_list_data_get(eina_list_last(sd->items));
+ if (eo_item)
+ {
+ ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
+ _button_select(sd->parent, item->button);
+ }
}
}
else
@@ -1430,7 +1445,7 @@ _access_info_cb(void *data EINA_UNUSED, Evas_Object *obj)
char *ret;
Eina_Strbuf *buf;
Eina_List *l = NULL;
- Elm_Multibuttonentry_Item *it;
+ Elm_Object_Item *eo_item;
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
@@ -1445,8 +1460,9 @@ _access_info_cb(void *data EINA_UNUSED, Evas_Object *obj)
if (sd->label_str) eina_strbuf_append(buf, sd->label_str);
int invisible_its = 0;
- EINA_LIST_FOREACH (sd->items, l, it)
+ EINA_LIST_FOREACH (sd->items, l, eo_item)
{
+ ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, it);
if (it->visible)
eina_strbuf_append_printf(buf, ", %s",
edje_object_part_text_get(it->button, "elm.btn.text"));
@@ -1495,12 +1511,13 @@ _elm_multibuttonentry_evas_object_smart_add(Eo *obj, Elm_Multibuttonentry_Data *
EOLIAN static void
_elm_multibuttonentry_evas_object_smart_del(Eo *obj, Elm_Multibuttonentry_Data *sd)
{
- Elm_Multibuttonentry_Item *item;
+ Elm_Object_Item *eo_item;
- EINA_LIST_FREE(sd->items, item)
+ EINA_LIST_FREE(sd->items, eo_item)
{
+ ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
evas_object_del(item->button);
- free(item);
+ eo_del((Eo *)eo_item);
}
sd->items = NULL;
@@ -1537,7 +1554,7 @@ _elm_multibuttonentry_elm_widget_focus_next(Eo *obj, Elm_Multibuttonentry_Data *
Eina_List *items = NULL;
Eina_List *l = NULL;
- Elm_Multibuttonentry_Item *it;
+ Elm_Object_Item *eo_item;
Evas_Object *ao;
Evas_Object *po;
@@ -1555,8 +1572,9 @@ _elm_multibuttonentry_elm_widget_focus_next(Eo *obj, Elm_Multibuttonentry_Data *
items = eina_list_append(items, ao);
}
- EINA_LIST_FOREACH (sd->items, l, it)
+ EINA_LIST_FOREACH (sd->items, l, eo_item)
{
+ ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, it);
po = (Evas_Object *)edje_object_part_object_get
(it->button, "elm.btn.text");
ao = evas_object_data_get(po, "_part_access_obj");
@@ -1584,7 +1602,7 @@ static void
_access_obj_process(Evas_Object *obj, Eina_Bool is_access)
{
Eina_List *l;
- Elm_Multibuttonentry_Item *it;
+ Elm_Object_Item *it;
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(obj, sd);
@@ -1724,17 +1742,21 @@ _elm_multibuttonentry_last_item_get(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Da
EOLIAN static Elm_Object_Item*
_elm_multibuttonentry_selected_item_get(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd)
{
- return sd->selected_it;
+ return EO_OBJ(sd->selected_it);
}
EAPI void
elm_multibuttonentry_item_selected_set(Elm_Object_Item *it,
Eina_Bool selected)
{
- Elm_Multibuttonentry_Item *item = (Elm_Multibuttonentry_Item *)it;
-
- ELM_MULTIBUTTONENTRY_ITEM_CHECK_OR_RETURN(it);
+ eo_do((Eo *)it, elm_obj_multibuttonentry_item_selected_set(selected));
+}
+EOLIAN static void
+_elm_multibuttonentry_item_selected_set(Eo *eo_item EINA_UNUSED,
+ Elm_Multibuttonentry_Item_Data *item,
+ Eina_Bool selected)
+{
if (selected) _button_select(WIDGET(item), item->button);
else _button_select(WIDGET(item), NULL);
}
@@ -1742,8 +1764,15 @@ elm_multibuttonentry_item_selected_set(Elm_Object_Item *it,
EAPI Eina_Bool
elm_multibuttonentry_item_selected_get(const Elm_Object_Item *it)
{
+ return eo_do((Eo *)it, elm_obj_multibuttonentry_item_selected_get());
+}
+
+EOLIAN static Eina_Bool
+_elm_multibuttonentry_item_selected_get(Eo *eo_item,
+ Elm_Multibuttonentry_Item_Data *item EINA_UNUSED)
+{
//TODO : To be implemented.
- if (!it) return EINA_FALSE;
+ if (!eo_item) return EINA_FALSE;
return EINA_TRUE;
}
@@ -1751,15 +1780,16 @@ elm_multibuttonentry_item_selected_get(const Elm_Object_Item *it)
EOLIAN static void
_elm_multibuttonentry_clear(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd)
{
- Elm_Multibuttonentry_Item *item;
+ Elm_Object_Item *eo_item;
if (sd->items)
{
- EINA_LIST_FREE(sd->items, item)
+ EINA_LIST_FREE(sd->items, eo_item)
{
+ ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(eo_item, item);
elm_box_unpack(sd->box, item->button);
evas_object_del(item->button);
- free(item);
+ eo_del((Eo *)eo_item);
}
sd->items = NULL;
}
@@ -1770,15 +1800,21 @@ _elm_multibuttonentry_clear(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd)
EAPI Elm_Object_Item *
elm_multibuttonentry_item_prev_get(const Elm_Object_Item *it)
{
+ return (Elm_Object_Item *)eo_do((Eo *)it, elm_obj_multibuttonentry_item_prev_get());
+}
+
+EOLIAN static Elm_Object_Item *
+_elm_multibuttonentry_item_prev_get(Eo *eo_it,
+ Elm_Multibuttonentry_Item_Data *it)
+{
Eina_List *l;
- Elm_Multibuttonentry_Item *item;
+ Elm_Object_Item *eo_item;
- ELM_MULTIBUTTONENTRY_ITEM_CHECK_OR_RETURN(it, NULL);
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN_VAL(WIDGET(it), sd, NULL);
- EINA_LIST_FOREACH(sd->items, l, item)
+ EINA_LIST_FOREACH(sd->items, l, eo_item)
{
- if (item == (Elm_Multibuttonentry_Item *)it)
+ if (eo_item == (Elm_Object_Item *)eo_it)
{
l = eina_list_prev(l);
if (!l) return NULL;
@@ -1791,15 +1827,21 @@ elm_multibuttonentry_item_prev_get(const Elm_Object_Item *it)
EAPI Elm_Object_Item *
elm_multibuttonentry_item_next_get(const Elm_Object_Item *it)
{
+ return (Elm_Object_Item *)eo_do((Eo *)it, elm_obj_multibuttonentry_item_next_get());
+}
+
+EOLIAN static Elm_Object_Item *
+_elm_multibuttonentry_item_next_get(Eo *eo_it,
+ Elm_Multibuttonentry_Item_Data *it)
+{
Eina_List *l;
- Elm_Multibuttonentry_Item *item;
+ Elm_Object_Item *eo_item;
- ELM_MULTIBUTTONENTRY_ITEM_CHECK_OR_RETURN(it, NULL);
ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN_VAL(WIDGET(it), sd, NULL);
- EINA_LIST_FOREACH(sd->items, l, item)
+ EINA_LIST_FOREACH(sd->items, l, eo_item)
{
- if (item == (Elm_Multibuttonentry_Item *)it)
+ if (eo_item == (Elm_Object_Item *)eo_it)
{
l = eina_list_next(l);
if (!l) return NULL;
@@ -1812,14 +1854,14 @@ elm_multibuttonentry_item_next_get(const Elm_Object_Item *it)
EINA_DEPRECATED EAPI void *
elm_multibuttonentry_item_data_get(const Elm_Object_Item *it)
{
- return elm_widget_item_data_get(it);
+ return eo_do((Eo *)it, elm_wdg_item_data_get());
}
EINA_DEPRECATED EAPI void
elm_multibuttonentry_item_data_set(Elm_Object_Item *it,
void *data)
{
- return elm_widget_item_data_set(it, data);
+ eo_do((Eo *)it, elm_wdg_item_data_set(data));
}
EOLIAN static void
@@ -1900,4 +1942,5 @@ _elm_multibuttonentry_class_constructor(Eo_Class *klass)
_elm_multibuttonentry_smart_focus_next_enable = EINA_TRUE;
}
+#include "elm_multibuttonentry_item.eo.c"
#include "elm_multibuttonentry.eo.c"
diff --git a/src/lib/elc_multibuttonentry_legacy.h b/src/lib/elc_multibuttonentry_legacy.h
index b1739be99..ec936b701 100644
--- a/src/lib/elc_multibuttonentry_legacy.h
+++ b/src/lib/elc_multibuttonentry_legacy.h
@@ -9,44 +9,12 @@
*/
EAPI Evas_Object *elm_multibuttonentry_add(Evas_Object *parent);
-/**
- * Set the selected state of an item
- *
- * @param it The item
- * @param selected if it's @c EINA_TRUE, select the item otherwise, unselect the item
- *
- * @ingroup Multibuttonentry
- */
EAPI void elm_multibuttonentry_item_selected_set(Elm_Object_Item *it, Eina_Bool selected);
-/**
- * Get the selected state of an item
- *
- * @param it The item
- * @return @c EINA_TRUE if the item is selected, @c EINA_FALSE otherwise.
- *
- * @ingroup Multibuttonentry
- */
EAPI Eina_Bool elm_multibuttonentry_item_selected_get(const Elm_Object_Item *it);
-/**
- * Get the previous item in the multibuttonentry
- *
- * @param it The item
- * @return The item before the item @p it
- *
- * @ingroup Multibuttonentry
- */
EAPI Elm_Object_Item *elm_multibuttonentry_item_prev_get(const Elm_Object_Item *it);
-/**
- * Get the next item in the multibuttonentry
- *
- * @param it The item
- * @return The item after the item @p it
- *
- * @ingroup Multibuttonentry
- */
EAPI Elm_Object_Item *elm_multibuttonentry_item_next_get(const Elm_Object_Item *it);
-#include "elm_multibuttonentry.eo.legacy.h" \ No newline at end of file
+#include "elm_multibuttonentry.eo.legacy.h"
diff --git a/src/lib/elm_multibuttonentry_item.eo b/src/lib/elm_multibuttonentry_item.eo
new file mode 100644
index 000000000..a4e2df1e0
--- /dev/null
+++ b/src/lib/elm_multibuttonentry_item.eo
@@ -0,0 +1,55 @@
+class Elm_Multibuttonentry_Item(Elm_Widget_Item)
+{
+ legacy_prefix: null;
+ eo_prefix: elm_obj_multibuttonentry_item;
+ properties {
+ selected {
+ get {
+ /*@
+ Get the selected state of an item
+
+ @ingroup Multibuttonentry
+ */
+ }
+ set {
+ /*@
+ Set the selected state of an item
+
+ @ingroup Multibuttonentry
+ */
+ }
+ values {
+ Eina_Bool selected; /*@ EINA_TRUE if selected EINA_FALSE otherwise */
+ }
+ }
+ }
+ methods {
+ prev_get @const {
+ /*@
+ Get the previous item in the multibuttonentry
+
+ @return The item before the item @p it
+
+ @ingroup Multibuttonentry
+ */
+ return: Elm_Object_Item *;
+ }
+ next_get @const {
+ /*@
+ Get the next item in the multibuttonentry
+
+ @return The item after the item @p it
+
+ @ingroup Multibuttonentry
+ */
+ return: Elm_Object_Item *;
+ }
+ }
+ implements {
+ Eo.Base.constructor;
+ Elm_Widget_Item.del_pre;
+ Elm_Widget_Item.signal_emit;
+ Elm_Widget_Item.part_text.get;
+ Elm_Widget_Item.part_text.set;
+ }
+}
diff --git a/src/lib/elm_widget_multibuttonentry.h b/src/lib/elm_widget_multibuttonentry.h
index 6a9b8d9b1..2216e0313 100644
--- a/src/lib/elm_widget_multibuttonentry.h
+++ b/src/lib/elm_widget_multibuttonentry.h
@@ -2,6 +2,9 @@
#define ELM_WIDGET_MULTIBUTTONENTRY_H
#include "elm_widget_layout.h"
+#include "elm_object_item_migration_temp.h"
+
+#include "elm_multibuttonentry_item.eo.h"
/* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR
* CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT
@@ -53,11 +56,11 @@ typedef enum _Multibuttonentry_View_State
MULTIBUTTONENTRY_VIEW_SHRINK
} Multibuttonentry_View_State;
-typedef struct _Multibuttonentry_Item Elm_Multibuttonentry_Item;
+typedef struct _Multibuttonentry_Item Elm_Multibuttonentry_Item_Data;
struct _Multibuttonentry_Item
{
- ELM_WIDGET_ITEM;
+ Elm_Widget_Item_Data *base;
Evas_Object *button;
Evas_Coord vw, rw; // vw: visual width, real width
@@ -86,7 +89,7 @@ struct _Elm_Multibuttonentry_Data
Eina_List *items;
Eina_List *filter_list;
- Elm_Object_Item *selected_it; /* selected item */
+ Elm_Multibuttonentry_Item_Data *selected_it; /* selected item */
Elm_Multibuttonentry_Format_Cb format_func;
const void *format_func_data;
@@ -129,16 +132,19 @@ struct _Elm_Multibuttonentry_Data
return val; \
}
+#define ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(o, sd) \
+ Elm_Multibuttonentry_Item_Data *sd = eo_data_scope_get((Eo *)o, ELM_MULTIBUTTONENTRY_ITEM_CLASS)
+
#define ELM_MULTIBUTTONENTRY_CHECK(obj) \
if (EINA_UNLIKELY(!eo_isa((obj), ELM_MULTIBUTTONENTRY_CLASS))) \
return
#define ELM_MULTIBUTTONENTRY_ITEM_CHECK(it) \
- ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item_Data *)it, ); \
- ELM_MULTIBUTTONENTRY_CHECK(it->base.widget);
+ if (EINA_UNLIKELY(!eo_isa((it->base->eo_obj), ELM_MULTIBUTTONENTRY_ITEM_CLASS))) \
+ return
#define ELM_MULTIBUTTONENTRY_ITEM_CHECK_OR_RETURN(it, ...) \
- ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item_Data *)it, __VA_ARGS__); \
- ELM_MULTIBUTTONENTRY_CHECK(it->base.widget) __VA_ARGS__;
+ if (EINA_UNLIKELY(!eo_isa((it->base->eo_obj), ELM_MULTIBUTTONENTRY_ITEM_CLASS))) \
+ return __VA_ARGS__;
#endif