summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYossi Kantor <yossi.kantor@samsung.com>2014-06-25 14:13:41 +0300
committerDaniel Zaoui <daniel.zaoui@samsung.com>2014-09-17 15:08:41 +0300
commite6e014e20c71629c44c44c3fb5d99aab8844e856 (patch)
tree6eeb3598b9428cec59ce4c354f4c6ce079f0df28
parent07f1a677b51e475b681a17b8b1b04791f84fecec (diff)
Porting to Eo: Elm Flipselector Item
-rw-r--r--src/lib/Makefile.am11
-rw-r--r--src/lib/elm_flipselector.c205
-rw-r--r--src/lib/elm_flipselector_common.h53
-rw-r--r--src/lib/elm_flipselector_item.eo74
-rw-r--r--src/lib/elm_widget_flipselector.h21
5 files changed, 214 insertions, 150 deletions
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index b22072d43..49a76ac06 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -855,7 +855,9 @@ BUILT_SOURCES = \
855 elm_segment_control_item.eo.c \ 855 elm_segment_control_item.eo.c \
856 elm_segment_control_item.eo.h \ 856 elm_segment_control_item.eo.h \
857 elm_slideshow_item.eo.c \ 857 elm_slideshow_item.eo.c \
858 elm_slideshow_item.eo.h 858 elm_slideshow_item.eo.h \
859 elm_flipselector_item.eo.c \
860 elm_flipselector_item.eo.h
859 861
860elementaryeolianfilesdir = $(datadir)/eolian/include/elementary-@VMAJ@ 862elementaryeolianfilesdir = $(datadir)/eolian/include/elementary-@VMAJ@
861elementaryeolianfiles_DATA = \ 863elementaryeolianfiles_DATA = \
@@ -955,7 +957,8 @@ elementaryeolianfiles_DATA = \
955 elm_dayselector_item.eo \ 957 elm_dayselector_item.eo \
956 elm_hoversel_item.eo \ 958 elm_hoversel_item.eo \
957 elm_segment_control_item.eo \ 959 elm_segment_control_item.eo \
958 elm_slideshow_item.eo 960 elm_slideshow_item.eo \
961 elm_flipselector_item.eo
959 962
960EXTRA_DIST += ${elementaryeolianfiles_DATA} 963EXTRA_DIST += ${elementaryeolianfiles_DATA}
961 964
@@ -1056,6 +1059,7 @@ nodist_includesunstable_HEADERS = \
1056 elm_dayselector_item.eo.h \ 1059 elm_dayselector_item.eo.h \
1057 elm_hoversel_item.eo.h \ 1060 elm_hoversel_item.eo.h \
1058 elm_segment_control_item.eo.h \ 1061 elm_segment_control_item.eo.h \
1062 elm_flipselector_item.eo.h \
1059 elm_slideshow_item.eo.h \ 1063 elm_slideshow_item.eo.h \
1060 elm_layout.eo.legacy.h \ 1064 elm_layout.eo.legacy.h \
1061 elm_frame.eo.legacy.h \ 1065 elm_frame.eo.legacy.h \
@@ -1125,7 +1129,8 @@ nodist_includesunstable_HEADERS = \
1125 elm_dayselector_item.eo.legacy.h \ 1129 elm_dayselector_item.eo.legacy.h \
1126 elm_hoversel_item.eo.legacy.h \ 1130 elm_hoversel_item.eo.legacy.h \
1127 elm_segment_control_item.eo.legacy.h \ 1131 elm_segment_control_item.eo.legacy.h \
1128 elm_slideshow_item.eo.legacy.h 1132 elm_slideshow_item.eo.legacy.h \
1133 elm_flipselector_item.eo.legacy.h
1129 1134
1130if HAVE_CXX11 1135if HAVE_CXX11
1131 1136
diff --git a/src/lib/elm_flipselector.c b/src/lib/elm_flipselector.c
index b7b826e46..e1b8f8371 100644
--- a/src/lib/elm_flipselector.c
+++ b/src/lib/elm_flipselector.c
@@ -2,6 +2,7 @@
2# include "elementary_config.h" 2# include "elementary_config.h"
3#endif 3#endif
4 4
5#define ELM_WIDGET_ITEM_PROTECTED
5#include <Elementary.h> 6#include <Elementary.h>
6#include "elm_priv.h" 7#include "elm_priv.h"
7#include "elm_widget_flipselector.h" 8#include "elm_widget_flipselector.h"
@@ -110,13 +111,14 @@ static void
110_update_view(Evas_Object *obj) 111_update_view(Evas_Object *obj)
111{ 112{
112 const char *label; 113 const char *label;
113 Elm_Flipselector_Item *item; 114 Elm_Object_Item *eo_item;
114 115
115 ELM_FLIPSELECTOR_DATA_GET(obj, sd); 116 ELM_FLIPSELECTOR_DATA_GET(obj, sd);
116 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 117 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
117 118
118 label = NULL; 119 label = NULL;
119 item = DATA_GET(sd->current); 120 eo_item = DATA_GET(sd->current);
121 ELM_FLIPSELECTOR_ITEM_DATA_GET(eo_item, item);
120 if (item) label = item->label; 122 if (item) label = item->label;
121 123
122 elm_layout_text_set(obj, "elm.top", label ? label : ""); 124 elm_layout_text_set(obj, "elm.top", label ? label : "");
@@ -125,24 +127,23 @@ _update_view(Evas_Object *obj)
125 edje_object_message_signal_process(wd->resize_obj); 127 edje_object_message_signal_process(wd->resize_obj);
126} 128}
127 129
128static void 130EOLIAN static void
129_item_text_set_hook(Elm_Object_Item *it, 131_elm_flipselector_item_elm_widget_item_part_text_set(Eo *eo_item,
130 const char *part, 132 Elm_Flipselector_Item_Data *item,
131 const char *label) 133 const char *part,
134 const char *label)
132{ 135{
133 Eina_List *l; 136 Eina_List *l;
134 Elm_Flipselector_Item *item;
135 137
136 if (!label) return; 138 if (!label) return;
137 139
138 if (part && strcmp(part, "default")) return; 140 if (part && strcmp(part, "default")) return;
139 141
140 item = (Elm_Flipselector_Item *)it;
141 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd); 142 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd);
142 143
143 if (!sd->items) return; 144 if (!sd->items) return;
144 145
145 l = eina_list_data_find_list(sd->items, item); 146 l = eina_list_data_find_list(sd->items, eo_item);
146 if (!l) return; 147 if (!l) return;
147 148
148 eina_stringshare_del(item->label); 149 eina_stringshare_del(item->label);
@@ -158,19 +159,21 @@ _item_text_set_hook(Elm_Object_Item *it,
158 } 159 }
159} 160}
160 161
161static const char * 162EOLIAN static const char *
162_item_text_get_hook(const Elm_Object_Item *it, 163_elm_flipselector_item_elm_widget_item_part_text_get(Eo *eo_it EINA_UNUSED,
163 const char *part) 164 Elm_Flipselector_Item_Data *it,
165 const char *part)
164{ 166{
165 if (part && strcmp(part, "default")) return NULL; 167 if (part && strcmp(part, "default")) return NULL;
166 168
167 return ((Elm_Flipselector_Item *)it)->label; 169 return it->label;
168} 170}
169 171
170static void 172EOLIAN static void
171_item_signal_emit_hook(Elm_Object_Item *it, 173_elm_flipselector_item_elm_widget_item_signal_emit(Eo *eo_it EINA_UNUSED,
172 const char *emission, 174 Elm_Flipselector_Item_Data *it,
173 const char *source) 175 const char *emission,
176 const char *source)
174{ 177{
175 edje_object_signal_emit(VIEW(it), emission, source); 178 edje_object_signal_emit(VIEW(it), emission, source);
176} 179}
@@ -189,7 +192,7 @@ _flipselector_walk(Elm_Flipselector_Data *sd)
189static void 192static void
190_sentinel_eval(Elm_Flipselector_Data *sd) 193_sentinel_eval(Elm_Flipselector_Data *sd)
191{ 194{
192 Elm_Flipselector_Item *it; 195 Elm_Object_Item *it;
193 Eina_List *l; 196 Eina_List *l;
194 197
195 if (!sd->items) 198 if (!sd->items)
@@ -202,7 +205,7 @@ _sentinel_eval(Elm_Flipselector_Data *sd)
202 205
203 EINA_LIST_FOREACH(sd->items, l, it) 206 EINA_LIST_FOREACH(sd->items, l, it)
204 { 207 {
205 if (strlen(elm_object_item_text_get((Elm_Object_Item *)it)) > 208 if (strlen(elm_object_item_text_get(it)) >
206 strlen(elm_object_item_text_get(DATA_GET(sd->sentinel)))) 209 strlen(elm_object_item_text_get(DATA_GET(sd->sentinel))))
207 sd->sentinel = l; 210 sd->sentinel = l;
208 } 211 }
@@ -213,26 +216,27 @@ static void
213_flipselector_process_deletions(Elm_Flipselector_Data *sd) 216_flipselector_process_deletions(Elm_Flipselector_Data *sd)
214{ 217{
215 Eina_List *l; 218 Eina_List *l;
216 Elm_Flipselector_Item *it; 219 Elm_Object_Item *eo_item;
217 Eina_Bool skip = EINA_TRUE; 220 Eina_Bool skip = EINA_TRUE;
218 Eina_Bool sentinel_eval = EINA_FALSE; 221 Eina_Bool sentinel_eval = EINA_FALSE;
219 222
220 sd->walking++; /* avoid nested deletions */ 223 sd->walking++; /* avoid nested deletions */
221 224
222 EINA_LIST_FOREACH(sd->items, l, it) 225 EINA_LIST_FOREACH(sd->items, l, eo_item)
223 { 226 {
224 if (!it->deleted) continue; 227 ELM_FLIPSELECTOR_ITEM_DATA_GET(eo_item, item);
228 if (!item->deleted) continue;
225 229
226 if (sd->current == l) 230 if (sd->current == l)
227 { 231 {
228 if (sd->current == sd->sentinel) sentinel_eval = EINA_TRUE; 232 if (sd->current == sd->sentinel) sentinel_eval = EINA_TRUE;
229 sd->current = eina_list_prev(sd->current); 233 sd->current = eina_list_prev(sd->current);
230 } 234 }
231 sd->items = eina_list_remove(sd->items, it); 235 sd->items = eina_list_remove(sd->items, eo_item);
232 236
233 if (!sd->current) sd->current = sd->items; 237 if (!sd->current) sd->current = sd->items;
234 238
235 elm_widget_item_del(it); 239 eo_do((Eo *)eo_item, elm_wdg_item_del());
236 skip = EINA_FALSE; 240 skip = EINA_FALSE;
237 241
238 if (eina_list_count(sd->items) <= 1) 242 if (eina_list_count(sd->items) <= 1)
@@ -268,17 +272,18 @@ _flipselector_unwalk(Elm_Flipselector_Data *sd)
268static void 272static void
269_on_item_changed(Elm_Flipselector_Data *sd) 273_on_item_changed(Elm_Flipselector_Data *sd)
270{ 274{
271 Elm_Flipselector_Item *item; 275 Elm_Object_Item *eo_item;
272 276
273 item = DATA_GET(sd->current); 277 eo_item = DATA_GET(sd->current);
278 ELM_FLIPSELECTOR_ITEM_DATA_GET(eo_item, item);
274 if (!item) return; 279 if (!item) return;
275 if (sd->deleting) return; 280 if (sd->deleting) return;
276 281
277 if (item->func) 282 if (item->func)
278 item->func((void *)item->base.data, WIDGET(item), item); 283 item->func((void *)item->base->data, WIDGET(item), eo_item);
279 if (!item->deleted) 284 if (!item->deleted)
280 evas_object_smart_callback_call 285 evas_object_smart_callback_call
281 (sd->obj, SIG_SELECTED, item); 286 (sd->obj, SIG_SELECTED, eo_item);
282} 287}
283 288
284static void 289static void
@@ -297,13 +302,12 @@ _send_msg(Elm_Flipselector_Data *sd,
297 _on_item_changed(sd); 302 _on_item_changed(sd);
298} 303}
299 304
300static Eina_Bool 305EOLIAN static Eina_Bool
301_item_del_pre_hook(Elm_Object_Item *it) 306_elm_flipselector_item_elm_widget_item_del_pre(Eo *eo_item, Elm_Flipselector_Item_Data *item)
302{ 307{
303 Elm_Flipselector_Item *item, *item2; 308 Elm_Object_Item *eo_item2;
304 Eina_List *l; 309 Eina_List *l;
305 310
306 item = (Elm_Flipselector_Item *)it;
307 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd); 311 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd);
308 312
309 if (sd->walking > 0) 313 if (sd->walking > 0)
@@ -314,9 +318,9 @@ _item_del_pre_hook(Elm_Object_Item *it)
314 318
315 _flipselector_walk(sd); 319 _flipselector_walk(sd);
316 320
317 EINA_LIST_FOREACH(sd->items, l, item2) 321 EINA_LIST_FOREACH(sd->items, l, eo_item2)
318 { 322 {
319 if (item2 == item) 323 if ((Eo *)eo_item2 == eo_item)
320 { 324 {
321 if (sd->current == l) 325 if (sd->current == l)
322 { 326 {
@@ -324,7 +328,8 @@ _item_del_pre_hook(Elm_Object_Item *it)
324 if (!sd->current) sd->current = l->next; 328 if (!sd->current) sd->current = l->next;
325 if (sd->current) 329 if (sd->current)
326 { 330 {
327 item2 = sd->current->data; 331 eo_item2 = sd->current->data;
332 ELM_FLIPSELECTOR_ITEM_DATA_GET(eo_item2, item2);
328 _send_msg(sd, MSG_FLIP_DOWN, (char *)item2->label); 333 _send_msg(sd, MSG_FLIP_DOWN, (char *)item2->label);
329 } 334 }
330 else _send_msg(sd, MSG_FLIP_DOWN, ""); 335 else _send_msg(sd, MSG_FLIP_DOWN, "");
@@ -341,35 +346,39 @@ _item_del_pre_hook(Elm_Object_Item *it)
341 return EINA_TRUE; 346 return EINA_TRUE;
342} 347}
343 348
344static Elm_Flipselector_Item * 349EOLIAN static void
350_elm_flipselector_item_eo_base_constructor(Eo *obj, Elm_Flipselector_Item_Data *it)
351{
352 eo_do_super(obj, ELM_FLIPSELECTOR_ITEM_CLASS, eo_constructor());
353 it->base = eo_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS);
354}
355
356static Elm_Object_Item *
345_item_new(Evas_Object *obj, 357_item_new(Evas_Object *obj,
346 const char *label, 358 const char *label,
347 Evas_Smart_Cb func, 359 Evas_Smart_Cb func,
348 const void *data) 360 const void *data)
349{ 361{
350 unsigned int len; 362 unsigned int len;
351 Elm_Flipselector_Item *it; 363 Eo *eo_item;
352 364
353 ELM_FLIPSELECTOR_DATA_GET(obj, sd); 365 ELM_FLIPSELECTOR_DATA_GET(obj, sd);
354 366
355 it = elm_widget_item_new(obj, Elm_Flipselector_Item); 367 eo_item = eo_add(ELM_FLIPSELECTOR_ITEM_CLASS, obj);
356 if (!it) return NULL; 368 if (!eo_item) return NULL;
357 369
358 elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook); 370 ELM_FLIPSELECTOR_ITEM_DATA_GET(eo_item, it);
359 elm_widget_item_text_set_hook_set(it, _item_text_set_hook);
360 elm_widget_item_text_get_hook_set(it, _item_text_get_hook);
361 elm_widget_item_signal_emit_hook_set(it, _item_signal_emit_hook);
362 371
363 len = strlen(label); 372 len = strlen(label);
364 if (len > sd->max_len) len = sd->max_len; 373 if (len > sd->max_len) len = sd->max_len;
365 374
366 it->label = eina_stringshare_add_length(label, len); 375 it->label = eina_stringshare_add_length(label, len);
367 it->func = func; 376 it->func = func;
368 it->base.data = data; 377 it->base->data = data;
369 378
370 /* TODO: no view here, but if one desires general contents in the 379 /* TODO: no view here, but if one desires general contents in the
371 * future... */ 380 * future... */
372 return it; 381 return (Elm_Object_Item *)eo_item;
373} 382}
374 383
375EOLIAN static Eina_Bool 384EOLIAN static Eina_Bool
@@ -401,7 +410,7 @@ _elm_flipselector_elm_widget_theme_apply(Eo *obj, Elm_Flipselector_Data *sd)
401static void 410static void
402_flip_up(Elm_Flipselector_Data *sd) 411_flip_up(Elm_Flipselector_Data *sd)
403{ 412{
404 Elm_Flipselector_Item *item; 413 Elm_Object_Item *eo_item;
405 414
406 if (!sd->current) return; 415 if (!sd->current) return;
407 416
@@ -415,7 +424,8 @@ _flip_up(Elm_Flipselector_Data *sd)
415 else 424 else
416 sd->current = eina_list_prev(sd->current); 425 sd->current = eina_list_prev(sd->current);
417 426
418 item = DATA_GET(sd->current); 427 eo_item = DATA_GET(sd->current);
428 ELM_FLIPSELECTOR_ITEM_DATA_GET(eo_item, item);
419 if (!item) return; 429 if (!item) return;
420 430
421 _send_msg(sd, MSG_FLIP_UP, (char *)item->label); 431 _send_msg(sd, MSG_FLIP_UP, (char *)item->label);
@@ -424,7 +434,7 @@ _flip_up(Elm_Flipselector_Data *sd)
424static void 434static void
425_flip_down(Elm_Flipselector_Data *sd) 435_flip_down(Elm_Flipselector_Data *sd)
426{ 436{
427 Elm_Flipselector_Item *item; 437 Elm_Object_Item *eo_item;
428 438
429 if (!sd->current) return; 439 if (!sd->current) return;
430 440
@@ -437,7 +447,8 @@ _flip_down(Elm_Flipselector_Data *sd)
437 (sd->obj, SIG_OVERFLOWED, NULL); 447 (sd->obj, SIG_OVERFLOWED, NULL);
438 } 448 }
439 449
440 item = DATA_GET(sd->current); 450 eo_item = DATA_GET(sd->current);
451 ELM_FLIPSELECTOR_ITEM_DATA_GET(eo_item, item);
441 if (!item) return; 452 if (!item) return;
442 453
443 _send_msg(sd, MSG_FLIP_DOWN, (char *)item->label); 454 _send_msg(sd, MSG_FLIP_DOWN, (char *)item->label);
@@ -591,7 +602,7 @@ _elm_flipselector_evas_object_smart_del(Eo *obj, Elm_Flipselector_Data *sd)
591 if (sd->walking) ERR("flipselector deleted while walking.\n"); 602 if (sd->walking) ERR("flipselector deleted while walking.\n");
592 603
593 while (sd->items) 604 while (sd->items)
594 elm_widget_item_del(DATA_GET(sd->items)); 605 eo_do(DATA_GET(sd->items), elm_wdg_item_del());
595 606
596 ecore_timer_del(sd->spin); 607 ecore_timer_del(sd->spin);
597 608
@@ -641,7 +652,7 @@ _elm_flipselector_flip_prev(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd)
641EOLIAN static Elm_Object_Item * 652EOLIAN static Elm_Object_Item *
642_elm_flipselector_item_append(Eo *obj, Elm_Flipselector_Data *sd, const char *label, Evas_Smart_Cb func, const void *data) 653_elm_flipselector_item_append(Eo *obj, Elm_Flipselector_Data *sd, const char *label, Evas_Smart_Cb func, const void *data)
643{ 654{
644 Elm_Flipselector_Item *item; 655 Elm_Object_Item *item;
645 656
646 item = _item_new(obj, label, func, data); 657 item = _item_new(obj, label, func, data);
647 if (!item) return NULL; 658 if (!item) return NULL;
@@ -654,7 +665,7 @@ _elm_flipselector_item_append(Eo *obj, Elm_Flipselector_Data *sd, const char *la
654 } 665 }
655 666
656 if (!sd->sentinel || 667 if (!sd->sentinel ||
657 (strlen(elm_object_item_text_get((Elm_Object_Item *)item)) > 668 (strlen(elm_object_item_text_get(item)) >
658 strlen(elm_object_item_text_get(DATA_GET(sd->sentinel))))) 669 strlen(elm_object_item_text_get(DATA_GET(sd->sentinel)))))
659 { 670 {
660 sd->sentinel = eina_list_last(sd->items); 671 sd->sentinel = eina_list_last(sd->items);
@@ -664,13 +675,13 @@ _elm_flipselector_item_append(Eo *obj, Elm_Flipselector_Data *sd, const char *la
664 if (eina_list_count(sd->items) > 1) 675 if (eina_list_count(sd->items) > 1)
665 elm_layout_signal_emit(obj, "elm,state,button,visible", "elm"); 676 elm_layout_signal_emit(obj, "elm,state,button,visible", "elm");
666 677
667 return (Elm_Object_Item *)item; 678 return item;
668} 679}
669 680
670EOLIAN static Elm_Object_Item * 681EOLIAN static Elm_Object_Item *
671_elm_flipselector_item_prepend(Eo *obj, Elm_Flipselector_Data *sd, const char *label, Evas_Smart_Cb func, void *data) 682_elm_flipselector_item_prepend(Eo *obj, Elm_Flipselector_Data *sd, const char *label, Evas_Smart_Cb func, void *data)
672{ 683{
673 Elm_Flipselector_Item *item; 684 Elm_Object_Item *item;
674 685
675 item = _item_new(obj, label, func, data); 686 item = _item_new(obj, label, func, data);
676 if (!item) return NULL; 687 if (!item) return NULL;
@@ -683,7 +694,7 @@ _elm_flipselector_item_prepend(Eo *obj, Elm_Flipselector_Data *sd, const char *l
683 } 694 }
684 695
685 if (!sd->sentinel || 696 if (!sd->sentinel ||
686 (strlen(elm_object_item_text_get((Elm_Object_Item *)item)) > 697 (strlen(elm_object_item_text_get(item)) >
687 strlen(elm_object_item_text_get(DATA_GET(sd->sentinel))))) 698 strlen(elm_object_item_text_get(DATA_GET(sd->sentinel)))))
688 { 699 {
689 sd->sentinel = sd->items; 700 sd->sentinel = sd->items;
@@ -693,7 +704,7 @@ _elm_flipselector_item_prepend(Eo *obj, Elm_Flipselector_Data *sd, const char *l
693 if (eina_list_count(sd->items) >= 2) 704 if (eina_list_count(sd->items) >= 2)
694 elm_layout_signal_emit(obj, "elm,state,button,visible", "elm"); 705 elm_layout_signal_emit(obj, "elm,state,button,visible", "elm");
695 706
696 return (Elm_Object_Item *)item; 707 return item;
697} 708}
698 709
699EOLIAN static const Eina_List* 710EOLIAN static const Eina_List*
@@ -705,15 +716,16 @@ _elm_flipselector_items_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd)
705EOLIAN static Elm_Object_Item* 716EOLIAN static Elm_Object_Item*
706_elm_flipselector_first_item_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd) 717_elm_flipselector_first_item_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd)
707{ 718{
708 Elm_Flipselector_Item *it; 719 Elm_Object_Item *eo_item;
709 Eina_List *l; 720 Eina_List *l;
710 721
711 if (!sd->items) return NULL; 722 if (!sd->items) return NULL;
712 723
713 EINA_LIST_FOREACH(sd->items, l, it) 724 EINA_LIST_FOREACH(sd->items, l, eo_item)
714 { 725 {
726 ELM_FLIPSELECTOR_ITEM_DATA_GET(eo_item, it);
715 if (it->deleted) continue; 727 if (it->deleted) continue;
716 return (Elm_Object_Item *)it; 728 return eo_item;
717 } 729 }
718 730
719 return NULL; 731 return NULL;
@@ -722,15 +734,16 @@ _elm_flipselector_first_item_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd)
722EOLIAN static Elm_Object_Item* 734EOLIAN static Elm_Object_Item*
723_elm_flipselector_last_item_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd) 735_elm_flipselector_last_item_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd)
724{ 736{
725 Elm_Flipselector_Item *it; 737 Elm_Object_Item *eo_item;
726 Eina_List *l; 738 Eina_List *l;
727 739
728 if (!sd->items) return NULL; 740 if (!sd->items) return NULL;
729 741
730 EINA_LIST_REVERSE_FOREACH(sd->items, l, it) 742 EINA_LIST_REVERSE_FOREACH(sd->items, l, eo_item)
731 { 743 {
732 if (it->deleted) continue; 744 ELM_FLIPSELECTOR_ITEM_DATA_GET(eo_item, item);
733 return (Elm_Object_Item *)it; 745 if (item->deleted) continue;
746 return eo_item;
734 } 747 }
735 return NULL; 748 return NULL;
736} 749}
@@ -745,24 +758,30 @@ EAPI void
745elm_flipselector_item_selected_set(Elm_Object_Item *it, 758elm_flipselector_item_selected_set(Elm_Object_Item *it,
746 Eina_Bool selected) 759 Eina_Bool selected)
747{ 760{
748 Elm_Flipselector_Item *item, *_item, *cur; 761 eo_do((Eo*)it, elm_obj_flipselector_item_selected_set(selected));
762}
763
764EOLIAN static void
765_elm_flipselector_item_selected_set(Eo *eo_item,
766 Elm_Flipselector_Item_Data *item,
767 Eina_Bool selected)
768{
769 Elm_Object_Item *_eo_item, *eo_cur;
749 int flipside = MSG_FLIP_UP; 770 int flipside = MSG_FLIP_UP;
750 Eina_List *l; 771 Eina_List *l;
751 772
752 ELM_FLIPSELECTOR_ITEM_CHECK_OR_RETURN(it);
753
754 item = (Elm_Flipselector_Item *)it;
755 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd); 773 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd);
756 774
757 cur = DATA_GET(sd->current); 775 eo_cur = DATA_GET(sd->current);
758 if ((selected) && (cur == item)) return; 776 if ((selected) && ((Eo *)eo_cur == eo_item)) return;
759 777
760 _flipselector_walk(sd); 778 _flipselector_walk(sd);
761 779
762 if ((!selected) && (cur == item)) 780 if ((!selected) && ((Eo *)eo_cur == eo_item))
763 { 781 {
764 EINA_LIST_FOREACH(sd->items, l, _item) 782 EINA_LIST_FOREACH(sd->items, l, _eo_item)
765 { 783 {
784 ELM_FLIPSELECTOR_ITEM_DATA_GET(_eo_item, _item);
766 if (!_item->deleted) 785 if (!_item->deleted)
767 { 786 {
768 sd->current = l; 787 sd->current = l;
@@ -774,14 +793,15 @@ elm_flipselector_item_selected_set(Elm_Object_Item *it,
774 return; 793 return;
775 } 794 }
776 795
777 EINA_LIST_FOREACH(sd->items, l, _item) 796 EINA_LIST_FOREACH(sd->items, l, _eo_item)
778 { 797 {
779 if (_item == cur) flipside = MSG_FLIP_DOWN; 798 if (_eo_item == eo_cur) flipside = MSG_FLIP_DOWN;
780 799
781 if (_item == item) 800 if ((Eo *)_eo_item == eo_item)
782 { 801 {
802 ELM_FLIPSELECTOR_ITEM_DATA_GET(_eo_item, _item);
783 sd->current = l; 803 sd->current = l;
784 _send_msg(sd, flipside, (char *)item->label); 804 _send_msg(sd, flipside, (char *)_item->label);
785 break; 805 break;
786 } 806 }
787 } 807 }
@@ -792,28 +812,35 @@ elm_flipselector_item_selected_set(Elm_Object_Item *it,
792EAPI Eina_Bool 812EAPI Eina_Bool
793elm_flipselector_item_selected_get(const Elm_Object_Item *it) 813elm_flipselector_item_selected_get(const Elm_Object_Item *it)
794{ 814{
795 Elm_Flipselector_Item *item; 815 return eo_do((Eo *)it, elm_obj_flipselector_item_selected_get());
796 816}
797 ELM_FLIPSELECTOR_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
798 817
799 item = (Elm_Flipselector_Item *)it; 818EOLIAN static Eina_Bool
819_elm_flipselector_item_selected_get(Eo *eo_item,
820 Elm_Flipselector_Item_Data *item)
821{
800 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd); 822 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd);
801 823
802 return eina_list_data_get(sd->current) == item; 824 return eina_list_data_get(sd->current) == eo_item;
803} 825}
804 826
805EAPI Elm_Object_Item * 827EAPI Elm_Object_Item *
806elm_flipselector_item_prev_get(const Elm_Object_Item *it) 828elm_flipselector_item_prev_get(const Elm_Object_Item *it)
807{ 829{
808 Elm_Flipselector_Item *item = (Elm_Flipselector_Item *)it; 830 return (Elm_Object_Item *)eo_do((Eo *)it, elm_obj_flipselector_item_prev_get());
831}
832
833EOLIAN static Elm_Object_Item *
834_elm_flipselector_item_prev_get(Eo *eo_item,
835 Elm_Flipselector_Item_Data *item)
836{
809 Eina_List *l; 837 Eina_List *l;
810 838
811 ELM_FLIPSELECTOR_ITEM_CHECK_OR_RETURN(it, NULL);
812 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd); 839 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd);
813 840
814 if ((!sd->items)) return NULL; 841 if ((!sd->items)) return NULL;
815 842
816 l = eina_list_data_find_list(sd->items, it); 843 l = eina_list_data_find_list(sd->items, eo_item);
817 if (l && l->prev) return DATA_GET(l->prev); 844 if (l && l->prev) return DATA_GET(l->prev);
818 845
819 return NULL; 846 return NULL;
@@ -822,15 +849,20 @@ elm_flipselector_item_prev_get(const Elm_Object_Item *it)
822EAPI Elm_Object_Item * 849EAPI Elm_Object_Item *
823elm_flipselector_item_next_get(const Elm_Object_Item *it) 850elm_flipselector_item_next_get(const Elm_Object_Item *it)
824{ 851{
852 return (Elm_Object_Item *)eo_do((Eo *)it, elm_obj_flipselector_item_next_get());
853}
854
855EOLIAN static Elm_Object_Item *
856_elm_flipselector_item_next_get(Eo *eo_item,
857 Elm_Flipselector_Item_Data *item)
858{
825 Eina_List *l; 859 Eina_List *l;
826 Elm_Flipselector_Item *item = (Elm_Flipselector_Item *)it;
827 860
828 ELM_FLIPSELECTOR_ITEM_CHECK_OR_RETURN(it, NULL);
829 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd); 861 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd);
830 862
831 if ((!sd->items)) return NULL; 863 if ((!sd->items)) return NULL;
832 864
833 l = eina_list_data_find_list(sd->items, it); 865 l = eina_list_data_find_list(sd->items, eo_item);
834 if (l && l->next) return DATA_GET(l->next); 866 if (l && l->next) return DATA_GET(l->next);
835 867
836 return NULL; 868 return NULL;
@@ -877,4 +909,5 @@ _elm_flipselector_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA
877 return &atspi_actions[0]; 909 return &atspi_actions[0];
878} 910}
879 911
912#include "elm_flipselector_item.eo.c"
880#include "elm_flipselector.eo.c" 913#include "elm_flipselector.eo.c"
diff --git a/src/lib/elm_flipselector_common.h b/src/lib/elm_flipselector_common.h
index ef058f5b9..bb277d819 100644
--- a/src/lib/elm_flipselector_common.h
+++ b/src/lib/elm_flipselector_common.h
@@ -1,61 +1,8 @@
1/**
2 * Set whether a given flip selector widget's item should be the
3 * currently selected one.
4 *
5 * @param it The flip selector item
6 * @param selected @c EINA_TRUE to select it, @c EINA_FALSE to unselect.
7 *
8 * This sets whether @p item is or not the selected (thus, under
9 * display) one. If @p item is different than the one under display,
10 * the latter will be unselected. If the @p item is set to be
11 * unselected, on the other hand, the @b first item in the widget's
12 * internal members list will be the new selected one.
13 *
14 * @see elm_flipselector_item_selected_get()
15 *
16 * @ingroup Flipselector
17 */
18EAPI void elm_flipselector_item_selected_set(Elm_Object_Item *it, Eina_Bool selected); 1EAPI void elm_flipselector_item_selected_set(Elm_Object_Item *it, Eina_Bool selected);
19 2
20/**
21 * Get whether a given flip selector widget's item is the currently
22 * selected one.
23 *
24 * @param it The flip selector item
25 * @return @c EINA_TRUE, if it's selected, @c EINA_FALSE otherwise
26 * (or on errors).
27 *
28 * @see elm_flipselector_item_selected_set()
29 *
30 * @ingroup Flipselector
31 */
32EAPI Eina_Bool elm_flipselector_item_selected_get(const Elm_Object_Item *it); 3EAPI Eina_Bool elm_flipselector_item_selected_get(const Elm_Object_Item *it);
33 4
34/**
35 * Get the item before @p item in a flip selector widget's internal list of
36 * items.
37 *
38 * @param it The item to fetch previous from
39 * @return The item before the @p item, in its parent's list. If there is no
40 * previous item for @p item or there's an error, @c NULL is returned.
41 *
42 * @see elm_flipselector_item_next_get()
43 *
44 * @ingroup Flipselector
45 */
46EAPI Elm_Object_Item *elm_flipselector_item_prev_get(const Elm_Object_Item *it); 5EAPI Elm_Object_Item *elm_flipselector_item_prev_get(const Elm_Object_Item *it);
47 6
48/**
49 * Get the item after @p item in a flip selector widget's
50 * internal list of items.
51 *
52 * @param it The item to fetch next from
53 * @return The item after the @p item, in its parent's list. If there is no next
54 * item for @p item or there's an error, @c NULL is returned.
55 *
56 * @see elm_flipselector_item_prev_get()
57 *
58 * @ingroup Flipselector
59 */
60EAPI Elm_Object_Item *elm_flipselector_item_next_get(const Elm_Object_Item *it); 7EAPI Elm_Object_Item *elm_flipselector_item_next_get(const Elm_Object_Item *it);
61 8
diff --git a/src/lib/elm_flipselector_item.eo b/src/lib/elm_flipselector_item.eo
new file mode 100644
index 000000000..0cee16ab0
--- /dev/null
+++ b/src/lib/elm_flipselector_item.eo
@@ -0,0 +1,74 @@
1class Elm_Flipselector_Item(Elm_Widget_Item)
2{
3 legacy_prefix: null;
4 eo_prefix: elm_obj_flipselector_item;
5 properties {
6 selected {
7 get {
8 /*@
9 Get whether a given flip selector widget's item is the currently
10 selected one.
11
12 @see elm_flipselector_item_selected_set()
13 @ingroup Flipselector
14 */
15 }
16 set {
17 /*@
18 Set whether a given flip selector widget's item should be the
19 currently selected one.
20
21 This sets whether @p item is or not the selected (thus, under
22 display) one. If @p item is different than the one under display,
23 the latter will be unselected. If the @p item is set to be
24 unselected, on the other hand, the @b first item in the widget's
25 internal members list will be the new selected one.
26
27 @see elm_flipselector_item_selected_get()
28
29 @ingroup Flipselector
30 */
31 }
32 values {
33 Eina_Bool selected; /*@ EINA_TRUE if selected EINA_FALSE otherwise */
34 }
35 }
36 }
37 methods {
38 prev_get @const {
39 /*@
40 Get the item before @p item in a flip selector widget's internal list of
41 items.
42
43 @return The item before the @p item, in its parent's list. If there is no
44 previous item for @p item or there's an error, @c NULL is returned.
45
46 @see elm_flipselector_item_next_get()
47
48 @ingroup Flipselector
49 */
50 return: Elm_Object_Item *;
51 }
52 next_get @const {
53 /*@
54 Get the item after @p item in a flip selector widget's
55 internal list of items.
56
57 @return The item after the @p item, in its parent's list. If there is no next
58 item for @p item or there's an error, @c NULL is returned.
59
60 @see elm_flipselector_item_prev_get()
61
62 @ingroup Flipselector
63 */
64 return: Elm_Object_Item *;
65 }
66 }
67 implements {
68 Eo.Base.constructor;
69 Elm_Widget_Item.del_pre;
70 Elm_Widget_Item.signal_emit;
71 Elm_Widget_Item.part_text.get;
72 Elm_Widget_Item.part_text.set;
73 }
74}
diff --git a/src/lib/elm_widget_flipselector.h b/src/lib/elm_widget_flipselector.h
index b96188e3a..0670cee14 100644
--- a/src/lib/elm_widget_flipselector.h
+++ b/src/lib/elm_widget_flipselector.h
@@ -8,6 +8,8 @@
8 * FINAL. CALL elm_widget_api_check(ELM_INTERNAL_API_VERSION) TO CHECK 8 * FINAL. CALL elm_widget_api_check(ELM_INTERNAL_API_VERSION) TO CHECK
9 * IT AT RUNTIME. 9 * IT AT RUNTIME.
10 */ 10 */
11#include "elm_object_item_migration_temp.h"
12#include "elm_flipselector_item.eo.h"
11 13
12/** 14/**
13 * @addtogroup Widget 15 * @addtogroup Widget
@@ -41,10 +43,10 @@ struct _Elm_Flipselector_Data
41 Eina_Bool deleting : 1; 43 Eina_Bool deleting : 1;
42}; 44};
43 45
44typedef struct _Elm_Flipselector_Item Elm_Flipselector_Item; 46typedef struct _Elm_Flipselector_Item_Data Elm_Flipselector_Item_Data;
45struct _Elm_Flipselector_Item 47struct _Elm_Flipselector_Item_Data
46{ 48{
47 ELM_WIDGET_ITEM; 49 Elm_Widget_Item_Data *base;
48 50
49 const char *label; 51 const char *label;
50 Evas_Smart_Cb func; 52 Evas_Smart_Cb func;
@@ -72,16 +74,19 @@ struct _Elm_Flipselector_Item
72 return val; \ 74 return val; \
73 } 75 }
74 76
75#define ELM_FLIPSELECTOR_CHECK(obj) \ 77#define ELM_FLIPSELECTOR_ITEM_DATA_GET(o, sd) \
78 Elm_Flipselector_Item_Data * sd = eo_data_scope_get((Eo *)o, ELM_FLIPSELECTOR_ITEM_CLASS)
79
80#define ELM_FLIPSELECTOR_CHECK(obj) \
76 if (EINA_UNLIKELY(!eo_isa((obj), ELM_FLIPSELECTOR_CLASS))) \ 81 if (EINA_UNLIKELY(!eo_isa((obj), ELM_FLIPSELECTOR_CLASS))) \
77 return 82 return
78 83
79#define ELM_FLIPSELECTOR_ITEM_CHECK(it) \ 84#define ELM_FLIPSELECTOR_ITEM_CHECK(it) \
80 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item_Data *)it, ); \ 85 if (EINA_UNLIKELY(!eo_isa(((Eo *)it->base->eo_obj), ELM_FLIPSELECTOR_ITEM_CLASS))) \
81 ELM_FLIPSELECTOR_CHECK(it->base.widget); 86 return
82 87
83#define ELM_FLIPSELECTOR_ITEM_CHECK_OR_RETURN(it, ...) \ 88#define ELM_FLIPSELECTOR_ITEM_CHECK_OR_RETURN(it, ...) \
84 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item_Data *)it, __VA_ARGS__); \ 89 if (EINA_UNLIKELY(!eo_isa(((Eo *)it->base->eo_obj), ELM_FLIPSELECTOR_ITEM_CLASS))) \
85 ELM_FLIPSELECTOR_CHECK(it->base.widget) __VA_ARGS__; 90 return __VA_ARGS__;
86 91
87#endif 92#endif