summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYossi Kantor <yossi.kantor@samsung.com>2014-06-25 14:13:41 +0300
committerYossi Kantor <yossi.kantor@samsung.com>2014-08-03 14:50:41 +0300
commit8ad175beb60397299c90aadce8d2dfd4450f1524 (patch)
tree9758285224db0265b19f2cd1fe44943a6599c3dd
parente20f75e51748565c38aaebab49f605f2c91729eb (diff)
Integration of Flipselector Item
-rw-r--r--src/lib/Makefile.am9
-rw-r--r--src/lib/elm_flipselector.c226
-rw-r--r--src/lib/elm_flipselector_item.eo76
-rw-r--r--src/lib/elm_widget_flipselector.h27
4 files changed, 233 insertions, 105 deletions
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 566a59f72..15bd7cd83 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -786,7 +786,9 @@ BUILT_SOURCES = \
786 elm_segment_control_item.eo.c \ 786 elm_segment_control_item.eo.c \
787 elm_segment_control_item.eo.h \ 787 elm_segment_control_item.eo.h \
788 elm_slideshow_item.eo.c \ 788 elm_slideshow_item.eo.c \
789 elm_slideshow_item.eo.h 789 elm_slideshow_item.eo.h \
790 elm_flipselector_item.eo.c \
791 elm_flipselector_item.eo.h
790 792
791elementaryeolianfilesdir = $(datadir)/eolian/include/elementary-@VMAJ@ 793elementaryeolianfilesdir = $(datadir)/eolian/include/elementary-@VMAJ@
792elementaryeolianfiles_DATA = \ 794elementaryeolianfiles_DATA = \
@@ -884,7 +886,8 @@ elementaryeolianfiles_DATA = \
884 elm_dayselector_item.eo \ 886 elm_dayselector_item.eo \
885 elm_hoversel_item.eo \ 887 elm_hoversel_item.eo \
886 elm_segment_control_item.eo \ 888 elm_segment_control_item.eo \
887 elm_slideshow_item.eo 889 elm_slideshow_item.eo \
890 elm_flipselector_item.eo
888 891
889EXTRA_DIST += \ 892EXTRA_DIST += \
890 ${elementaryeolianfiles_DATA} 893 ${elementaryeolianfiles_DATA}
@@ -1041,4 +1044,4 @@ nodist_includesunstable_HEADERS = \
1041 elm_toolbar.eo.legacy.h \ 1044 elm_toolbar.eo.legacy.h \
1042 elm_video.eo.legacy.h \ 1045 elm_video.eo.legacy.h \
1043 elm_web.eo.legacy.h \ 1046 elm_web.eo.legacy.h \
1044 elm_win.eo.legacy.h \ No newline at end of file 1047 elm_win.eo.legacy.h
diff --git a/src/lib/elm_flipselector.c b/src/lib/elm_flipselector.c
index 5427e5d8c..2cafa9a71 100644
--- a/src/lib/elm_flipselector.c
+++ b/src/lib/elm_flipselector.c
@@ -4,6 +4,7 @@
4 4
5#include <Elementary.h> 5#include <Elementary.h>
6#include "elm_priv.h" 6#include "elm_priv.h"
7
7#include "elm_widget_flipselector.h" 8#include "elm_widget_flipselector.h"
8 9
9#define MY_CLASS ELM_FLIPSELECTOR_CLASS 10#define MY_CLASS ELM_FLIPSELECTOR_CLASS
@@ -101,14 +102,19 @@ static void
101_update_view(Evas_Object *obj) 102_update_view(Evas_Object *obj)
102{ 103{
103 const char *label; 104 const char *label;
104 Elm_Flipselector_Item *item; 105 Elm_Widobj_Item *item;
105 106
106 ELM_FLIPSELECTOR_DATA_GET(obj, sd); 107 ELM_FLIPSELECTOR_DATA_GET(obj, sd);
107 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 108 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
108 109
109 label = NULL; 110 label = NULL;
110 item = DATA_GET(sd->current); 111 item = DATA_GET(sd->current);
111 if (item) label = item->label; 112
113 if (item)
114 {
115 ELM_FLIPSELECTOR_ITEM_DATA_GET(item, item_data);
116 label = item_data->label;
117 }
112 118
113 elm_layout_text_set(obj, "elm.top", label ? label : ""); 119 elm_layout_text_set(obj, "elm.top", label ? label : "");
114 elm_layout_text_set(obj, "elm.bottom", label ? label : ""); 120 elm_layout_text_set(obj, "elm.bottom", label ? label : "");
@@ -116,24 +122,23 @@ _update_view(Evas_Object *obj)
116 edje_object_message_signal_process(wd->resize_obj); 122 edje_object_message_signal_process(wd->resize_obj);
117} 123}
118 124
119static void 125EOLIAN static void
120_item_text_set_hook(Elm_Object_Item *it, 126_elm_flipselector_item_elm_widget_item_part_text_set(Eo *eo_item,
121 const char *part, 127 Elm_Flipselector_Item_Data *item,
122 const char *label) 128 const char *part,
129 const char *label)
123{ 130{
124 Eina_List *l; 131 Eina_List *l;
125 Elm_Flipselector_Item *item;
126 132
127 if (!label) return; 133 if (!label) return;
128 134
129 if (part && strcmp(part, "default")) return; 135 if (part && strcmp(part, "default")) return;
130 136
131 item = (Elm_Flipselector_Item *)it;
132 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd); 137 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd);
133 138
134 if (!sd->items) return; 139 if (!sd->items) return;
135 140
136 l = eina_list_data_find_list(sd->items, item); 141 l = eina_list_data_find_list(sd->items, eo_item);
137 if (!l) return; 142 if (!l) return;
138 143
139 eina_stringshare_del(item->label); 144 eina_stringshare_del(item->label);
@@ -149,19 +154,21 @@ _item_text_set_hook(Elm_Object_Item *it,
149 } 154 }
150} 155}
151 156
152static const char * 157EOLIAN static const char *
153_item_text_get_hook(const Elm_Object_Item *it, 158_elm_flipselector_item_elm_widget_item_part_text_get(Eo *item EINA_UNUSED,
154 const char *part) 159 Elm_Flipselector_Item_Data *it,
160 const char *part)
155{ 161{
156 if (part && strcmp(part, "default")) return NULL; 162 if (part && strcmp(part, "default")) return NULL;
157 163
158 return ((Elm_Flipselector_Item *)it)->label; 164 return it->label;
159} 165}
160 166
161static void 167EOLIAN static void
162_item_signal_emit_hook(Elm_Object_Item *it, 168_elm_flipselector_item_elm_widget_item_signal_emit(Eo *eo_item EINA_UNUSED,
163 const char *emission, 169 Elm_Flipselector_Item_Data *it,
164 const char *source) 170 const char *emission,
171 const char *source)
165{ 172{
166 edje_object_signal_emit(VIEW(it), emission, source); 173 edje_object_signal_emit(VIEW(it), emission, source);
167} 174}
@@ -180,7 +187,7 @@ _flipselector_walk(Elm_Flipselector_Data *sd)
180static void 187static void
181_sentinel_eval(Elm_Flipselector_Data *sd) 188_sentinel_eval(Elm_Flipselector_Data *sd)
182{ 189{
183 Elm_Flipselector_Item *it; 190 Elm_Widobj_Item *it;
184 Eina_List *l; 191 Eina_List *l;
185 192
186 if (!sd->items) 193 if (!sd->items)
@@ -204,26 +211,27 @@ static void
204_flipselector_process_deletions(Elm_Flipselector_Data *sd) 211_flipselector_process_deletions(Elm_Flipselector_Data *sd)
205{ 212{
206 Eina_List *l; 213 Eina_List *l;
207 Elm_Flipselector_Item *it; 214 Elm_Widobj_Item *eo_item;
208 Eina_Bool skip = EINA_TRUE; 215 Eina_Bool skip = EINA_TRUE;
209 Eina_Bool sentinel_eval = EINA_FALSE; 216 Eina_Bool sentinel_eval = EINA_FALSE;
210 217
211 sd->walking++; /* avoid nested deletions */ 218 sd->walking++; /* avoid nested deletions */
212 219
213 EINA_LIST_FOREACH(sd->items, l, it) 220 EINA_LIST_FOREACH(sd->items, l, eo_item)
214 { 221 {
215 if (!it->deleted) continue; 222 ELM_FLIPSELECTOR_ITEM_DATA_GET(eo_item, item);
223 if (!item->deleted) continue;
216 224
217 if (sd->current == l) 225 if (sd->current == l)
218 { 226 {
219 if (sd->current == sd->sentinel) sentinel_eval = EINA_TRUE; 227 if (sd->current == sd->sentinel) sentinel_eval = EINA_TRUE;
220 sd->current = eina_list_prev(sd->current); 228 sd->current = eina_list_prev(sd->current);
221 } 229 }
222 sd->items = eina_list_remove(sd->items, it); 230 sd->items = eina_list_remove(sd->items, eo_item);
223 231
224 if (!sd->current) sd->current = sd->items; 232 if (!sd->current) sd->current = sd->items;
225 233
226 elm_widget_item_del(it); 234 eo_do(eo_item, elm_wdg_item_del());
227 skip = EINA_FALSE; 235 skip = EINA_FALSE;
228 236
229 if (eina_list_count(sd->items) <= 1) 237 if (eina_list_count(sd->items) <= 1)
@@ -259,17 +267,18 @@ _flipselector_unwalk(Elm_Flipselector_Data *sd)
259static void 267static void
260_on_item_changed(Elm_Flipselector_Data *sd) 268_on_item_changed(Elm_Flipselector_Data *sd)
261{ 269{
262 Elm_Flipselector_Item *item; 270 Elm_Widobj_Item *eo_item;
263 271
264 item = DATA_GET(sd->current); 272 eo_item = DATA_GET(sd->current);
265 if (!item) return; 273 if (!eo_item) return;
266 if (sd->deleting) return; 274 if (sd->deleting) return;
267 275
276 ELM_FLIPSELECTOR_ITEM_DATA_GET(eo_item, item);
268 if (item->func) 277 if (item->func)
269 item->func((void *)item->base.data, WIDGET(item), item); 278 item->func((void *)item->base->data, WIDGET(item), eo_item);
270 if (!item->deleted) 279 if (!item->deleted)
271 evas_object_smart_callback_call 280 evas_object_smart_callback_call
272 (sd->obj, SIG_SELECTED, item); 281 (sd->obj, SIG_SELECTED, eo_item);
273} 282}
274 283
275static void 284static void
@@ -288,13 +297,12 @@ _send_msg(Elm_Flipselector_Data *sd,
288 _on_item_changed(sd); 297 _on_item_changed(sd);
289} 298}
290 299
291static Eina_Bool 300EOLIAN static Eina_Bool
292_item_del_pre_hook(Elm_Object_Item *it) 301_elm_flipselector_item_elm_widget_item_del_pre(Eo *eo_item, Elm_Flipselector_Item_Data *item)
293{ 302{
294 Elm_Flipselector_Item *item, *item2; 303 Elm_Widobj_Item *eo_item2;
295 Eina_List *l; 304 Eina_List *l;
296 305
297 item = (Elm_Flipselector_Item *)it;
298 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd); 306 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd);
299 307
300 if (sd->walking > 0) 308 if (sd->walking > 0)
@@ -305,9 +313,9 @@ _item_del_pre_hook(Elm_Object_Item *it)
305 313
306 _flipselector_walk(sd); 314 _flipselector_walk(sd);
307 315
308 EINA_LIST_FOREACH(sd->items, l, item2) 316 EINA_LIST_FOREACH(sd->items, l, eo_item2)
309 { 317 {
310 if (item2 == item) 318 if (eo_item2 == eo_item)
311 { 319 {
312 if (sd->current == l) 320 if (sd->current == l)
313 { 321 {
@@ -315,7 +323,8 @@ _item_del_pre_hook(Elm_Object_Item *it)
315 if (!sd->current) sd->current = l->next; 323 if (!sd->current) sd->current = l->next;
316 if (sd->current) 324 if (sd->current)
317 { 325 {
318 item2 = sd->current->data; 326 eo_item2 = sd->current->data;
327 ELM_FLIPSELECTOR_ITEM_DATA_GET(eo_item2, item2);
319 _send_msg(sd, MSG_FLIP_DOWN, (char *)item2->label); 328 _send_msg(sd, MSG_FLIP_DOWN, (char *)item2->label);
320 } 329 }
321 else _send_msg(sd, MSG_FLIP_DOWN, ""); 330 else _send_msg(sd, MSG_FLIP_DOWN, "");
@@ -332,35 +341,39 @@ _item_del_pre_hook(Elm_Object_Item *it)
332 return EINA_TRUE; 341 return EINA_TRUE;
333} 342}
334 343
335static Elm_Flipselector_Item * 344EOLIAN static void
345_elm_flipselector_item_eo_base_constructor(Eo *obj, Elm_Flipselector_Item_Data *it)
346{
347 eo_do_super(obj, ELM_FLIPSELECTOR_ITEM_CLASS, eo_constructor());
348 it->base = eo_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS);
349}
350
351static Elm_Widobj_Item *
336_item_new(Evas_Object *obj, 352_item_new(Evas_Object *obj,
337 const char *label, 353 const char *label,
338 Evas_Smart_Cb func, 354 Evas_Smart_Cb func,
339 const void *data) 355 const void *data)
340{ 356{
341 unsigned int len; 357 unsigned int len;
342 Elm_Flipselector_Item *it; 358 Elm_Widobj_Item *eo_item;
343 359
344 ELM_FLIPSELECTOR_DATA_GET(obj, sd); 360 ELM_FLIPSELECTOR_DATA_GET(obj, sd);
345 361
346 it = elm_widget_item_new(obj, Elm_Flipselector_Item); 362 eo_item = eo_add(ELM_FLIPSELECTOR_ITEM_CLASS, obj);
347 if (!it) return NULL; 363 if (!eo_item) return NULL;
348 364
349 elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook); 365 ELM_FLIPSELECTOR_ITEM_DATA_GET(eo_item, it);
350 elm_widget_item_text_set_hook_set(it, _item_text_set_hook);
351 elm_widget_item_text_get_hook_set(it, _item_text_get_hook);
352 elm_widget_item_signal_emit_hook_set(it, _item_signal_emit_hook);
353 366
354 len = strlen(label); 367 len = strlen(label);
355 if (len > sd->max_len) len = sd->max_len; 368 if (len > sd->max_len) len = sd->max_len;
356 369
357 it->label = eina_stringshare_add_length(label, len); 370 it->label = eina_stringshare_add_length(label, len);
358 it->func = func; 371 it->func = func;
359 it->base.data = data; 372 it->base->data = data;
360 373
361 /* TODO: no view here, but if one desires general contents in the 374 /* TODO: no view here, but if one desires general contents in the
362 * future... */ 375 * future... */
363 return it; 376 return eo_item;
364} 377}
365 378
366EOLIAN static Eina_Bool 379EOLIAN static Eina_Bool
@@ -392,7 +405,7 @@ _elm_flipselector_elm_widget_theme_apply(Eo *obj, Elm_Flipselector_Data *sd)
392static void 405static void
393_flip_up(Elm_Flipselector_Data *sd) 406_flip_up(Elm_Flipselector_Data *sd)
394{ 407{
395 Elm_Flipselector_Item *item; 408 Elm_Widobj_Item *eo_item;
396 409
397 if (!sd->current) return; 410 if (!sd->current) return;
398 411
@@ -406,16 +419,17 @@ _flip_up(Elm_Flipselector_Data *sd)
406 else 419 else
407 sd->current = eina_list_prev(sd->current); 420 sd->current = eina_list_prev(sd->current);
408 421
409 item = DATA_GET(sd->current); 422 eo_item = DATA_GET(sd->current);
410 if (!item) return; 423 if (!eo_item) return;
411 424
425 ELM_FLIPSELECTOR_ITEM_DATA_GET(eo_item, item);
412 _send_msg(sd, MSG_FLIP_UP, (char *)item->label); 426 _send_msg(sd, MSG_FLIP_UP, (char *)item->label);
413} 427}
414 428
415static void 429static void
416_flip_down(Elm_Flipselector_Data *sd) 430_flip_down(Elm_Flipselector_Data *sd)
417{ 431{
418 Elm_Flipselector_Item *item; 432 Elm_Widobj_Item *eo_item;
419 433
420 if (!sd->current) return; 434 if (!sd->current) return;
421 435
@@ -428,9 +442,10 @@ _flip_down(Elm_Flipselector_Data *sd)
428 (sd->obj, SIG_OVERFLOWED, NULL); 442 (sd->obj, SIG_OVERFLOWED, NULL);
429 } 443 }
430 444
431 item = DATA_GET(sd->current); 445 eo_item = DATA_GET(sd->current);
432 if (!item) return; 446 if (!eo_item) return;
433 447
448 ELM_FLIPSELECTOR_ITEM_DATA_GET(eo_item, item);
434 _send_msg(sd, MSG_FLIP_DOWN, (char *)item->label); 449 _send_msg(sd, MSG_FLIP_DOWN, (char *)item->label);
435} 450}
436 451
@@ -582,7 +597,7 @@ _elm_flipselector_evas_object_smart_del(Eo *obj, Elm_Flipselector_Data *sd)
582 if (sd->walking) ERR("flipselector deleted while walking.\n"); 597 if (sd->walking) ERR("flipselector deleted while walking.\n");
583 598
584 while (sd->items) 599 while (sd->items)
585 elm_widget_item_del(DATA_GET(sd->items)); 600 eo_do(DATA_GET(sd->items), elm_wdg_item_del());
586 601
587 ecore_timer_del(sd->spin); 602 ecore_timer_del(sd->spin);
588 603
@@ -631,7 +646,7 @@ _elm_flipselector_flip_prev(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd)
631EOLIAN static Elm_Object_Item * 646EOLIAN static Elm_Object_Item *
632_elm_flipselector_item_append(Eo *obj, Elm_Flipselector_Data *sd, const char *label, Evas_Smart_Cb func, const void *data) 647_elm_flipselector_item_append(Eo *obj, Elm_Flipselector_Data *sd, const char *label, Evas_Smart_Cb func, const void *data)
633{ 648{
634 Elm_Flipselector_Item *item; 649 Elm_Widobj_Item *item;
635 650
636 item = _item_new(obj, label, func, data); 651 item = _item_new(obj, label, func, data);
637 if (!item) return NULL; 652 if (!item) return NULL;
@@ -660,7 +675,7 @@ _elm_flipselector_item_append(Eo *obj, Elm_Flipselector_Data *sd, const char *la
660EOLIAN static Elm_Object_Item * 675EOLIAN static Elm_Object_Item *
661_elm_flipselector_item_prepend(Eo *obj, Elm_Flipselector_Data *sd, const char *label, Evas_Smart_Cb func, void *data) 676_elm_flipselector_item_prepend(Eo *obj, Elm_Flipselector_Data *sd, const char *label, Evas_Smart_Cb func, void *data)
662{ 677{
663 Elm_Flipselector_Item *item; 678 Elm_Widobj_Item *item;
664 679
665 item = _item_new(obj, label, func, data); 680 item = _item_new(obj, label, func, data);
666 if (!item) return NULL; 681 if (!item) return NULL;
@@ -695,15 +710,16 @@ _elm_flipselector_items_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd)
695EOLIAN static Elm_Object_Item* 710EOLIAN static Elm_Object_Item*
696_elm_flipselector_first_item_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd) 711_elm_flipselector_first_item_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd)
697{ 712{
698 Elm_Flipselector_Item *it; 713 Elm_Widobj_Item *eo_item;
699 Eina_List *l; 714 Eina_List *l;
700 715
701 if (!sd->items) return NULL; 716 if (!sd->items) return NULL;
702 717
703 EINA_LIST_FOREACH(sd->items, l, it) 718 EINA_LIST_FOREACH(sd->items, l, eo_item)
704 { 719 {
720 ELM_FLIPSELECTOR_ITEM_DATA_GET(eo_item, it);
705 if (it->deleted) continue; 721 if (it->deleted) continue;
706 return (Elm_Object_Item *)it; 722 return (Elm_Object_Item *)eo_item;
707 } 723 }
708 724
709 return NULL; 725 return NULL;
@@ -712,15 +728,16 @@ _elm_flipselector_first_item_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd)
712EOLIAN static Elm_Object_Item* 728EOLIAN static Elm_Object_Item*
713_elm_flipselector_last_item_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd) 729_elm_flipselector_last_item_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd)
714{ 730{
715 Elm_Flipselector_Item *it; 731 Elm_Widobj_Item *eo_item;
716 Eina_List *l; 732 Eina_List *l;
717 733
718 if (!sd->items) return NULL; 734 if (!sd->items) return NULL;
719 735
720 EINA_LIST_REVERSE_FOREACH(sd->items, l, it) 736 EINA_LIST_REVERSE_FOREACH(sd->items, l, eo_item)
721 { 737 {
722 if (it->deleted) continue; 738 ELM_FLIPSELECTOR_ITEM_DATA_GET(eo_item, item);
723 return (Elm_Object_Item *)it; 739 if (item->deleted) continue;
740 return (Elm_Object_Item *)eo_item;
724 } 741 }
725 return NULL; 742 return NULL;
726} 743}
@@ -731,32 +748,31 @@ _elm_flipselector_selected_item_get(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *
731 return DATA_GET(sd->current); 748 return DATA_GET(sd->current);
732} 749}
733 750
734EAPI void 751EOLIAN static void
735elm_flipselector_item_selected_set(Elm_Object_Item *it, 752_elm_flipselector_item_selected_set(Eo *eo_item,
736 Eina_Bool selected) 753 Elm_Flipselector_Item_Data *item,
754 Eina_Bool selected)
737{ 755{
738 Elm_Flipselector_Item *item, *_item, *cur; 756 Elm_Widobj_Item *_item, *cur;
739 int flipside = MSG_FLIP_UP; 757 int flipside = MSG_FLIP_UP;
740 Eina_List *l; 758 Eina_List *l;
741 759
742 ELM_FLIPSELECTOR_ITEM_CHECK_OR_RETURN(it);
743
744 item = (Elm_Flipselector_Item *)it;
745 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd); 760 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd);
746 761
747 cur = DATA_GET(sd->current); 762 cur = DATA_GET(sd->current);
748 if ((selected) && (cur == item)) return; 763 if ((selected) && (cur == eo_item)) return;
749 764
750 _flipselector_walk(sd); 765 _flipselector_walk(sd);
751 766
752 if ((!selected) && (cur == item)) 767 if ((!selected) && (cur == eo_item))
753 { 768 {
754 EINA_LIST_FOREACH(sd->items, l, _item) 769 EINA_LIST_FOREACH(sd->items, l, _item)
755 { 770 {
756 if (!_item->deleted) 771 ELM_FLIPSELECTOR_ITEM_DATA_GET(_item, _item_data);
772 if (!_item_data->deleted)
757 { 773 {
758 sd->current = l; 774 sd->current = l;
759 _send_msg(sd, MSG_FLIP_UP, (char *)_item->label); 775 _send_msg(sd, MSG_FLIP_UP, (char *)_item_data->label);
760 break; 776 break;
761 } 777 }
762 } 778 }
@@ -768,7 +784,7 @@ elm_flipselector_item_selected_set(Elm_Object_Item *it,
768 { 784 {
769 if (_item == cur) flipside = MSG_FLIP_DOWN; 785 if (_item == cur) flipside = MSG_FLIP_DOWN;
770 786
771 if (_item == item) 787 if (_item == eo_item)
772 { 788 {
773 sd->current = l; 789 sd->current = l;
774 _send_msg(sd, flipside, (char *)item->label); 790 _send_msg(sd, flipside, (char *)item->label);
@@ -779,48 +795,42 @@ elm_flipselector_item_selected_set(Elm_Object_Item *it,
779 _flipselector_unwalk(sd); 795 _flipselector_unwalk(sd);
780} 796}
781 797
782EAPI Eina_Bool 798EOLIAN static Eina_Bool
783elm_flipselector_item_selected_get(const Elm_Object_Item *it) 799_elm_flipselector_item_selected_get(Eo *eo_item,
800 Elm_Flipselector_Item_Data *item)
784{ 801{
785 Elm_Flipselector_Item *item;
786
787 ELM_FLIPSELECTOR_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
788
789 item = (Elm_Flipselector_Item *)it;
790 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd); 802 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd);
791 803
792 return eina_list_data_get(sd->current) == item; 804 return eina_list_data_get(sd->current) == eo_item;
793} 805}
794 806
795EAPI Elm_Object_Item * 807EOLIAN static Elm_Widobj_Item *
796elm_flipselector_item_prev_get(const Elm_Object_Item *it) 808_elm_flipselector_item_prev_get(Eo *eo_item,
809 Elm_Flipselector_Item_Data *item)
797{ 810{
798 Elm_Flipselector_Item *item = (Elm_Flipselector_Item *)it;
799 Eina_List *l; 811 Eina_List *l;
800 812
801 ELM_FLIPSELECTOR_ITEM_CHECK_OR_RETURN(it, NULL);
802 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd); 813 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd);
803 814
804 if ((!sd->items)) return NULL; 815 if ((!sd->items)) return NULL;
805 816
806 l = eina_list_data_find_list(sd->items, it); 817 l = eina_list_data_find_list(sd->items, eo_item);
807 if (l && l->prev) return DATA_GET(l->prev); 818 if (l && l->prev) return DATA_GET(l->prev);
808 819
809 return NULL; 820 return NULL;
810} 821}
811 822
812EAPI Elm_Object_Item * 823EOLIAN static Elm_Widobj_Item *
813elm_flipselector_item_next_get(const Elm_Object_Item *it) 824_elm_flipselector_item_next_get(Eo *eo_item,
825 Elm_Flipselector_Item_Data *item)
814{ 826{
815 Eina_List *l; 827 Eina_List *l;
816 Elm_Flipselector_Item *item = (Elm_Flipselector_Item *)it;
817 828
818 ELM_FLIPSELECTOR_ITEM_CHECK_OR_RETURN(it, NULL);
819 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd); 829 ELM_FLIPSELECTOR_DATA_GET(WIDGET(item), sd);
820 830
821 if ((!sd->items)) return NULL; 831 if ((!sd->items)) return NULL;
822 832
823 l = eina_list_data_find_list(sd->items, it); 833 l = eina_list_data_find_list(sd->items, eo_item);
824 if (l && l->next) return DATA_GET(l->next); 834 if (l && l->next) return DATA_GET(l->next);
825 835
826 return NULL; 836 return NULL;
@@ -856,4 +866,36 @@ _elm_flipselector_class_constructor(Eo_Class *klass)
856 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass); 866 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
857} 867}
858 868
859#include "elm_flipselector.eo.c" 869EAPI void
870elm_flipselector_item_selected_set(Elm_Object_Item *it,
871 Eina_Bool selected)
872{
873 eo_do((Eo*)it, elm_obj_flipselector_item_selected_set(selected));
874}
875
876EAPI Eina_Bool
877elm_flipselector_item_selected_get(const Elm_Object_Item *it)
878{
879 Eina_Bool ret;
880 eo_do((Eo*)it, ret = elm_obj_flipselector_item_selected_get());
881 return ret;
882}
883
884EAPI Elm_Object_Item *
885elm_flipselector_item_prev_get(const Elm_Object_Item *it)
886{
887 Elm_Widobj_Item *ret = NULL;
888 eo_do((Eo*)it, ret = elm_obj_flipselector_item_prev_get());
889 return (Elm_Object_Item *)ret;
890}
891
892EAPI Elm_Object_Item *
893elm_flipselector_item_next_get(const Elm_Object_Item *it)
894{
895 Elm_Widobj_Item *ret = NULL;
896 eo_do((Eo*)it, ret = elm_obj_flipselector_item_next_get());
897 return (Elm_Object_Item *)ret;
898}
899
900#include "elm_flipselector_item.eo.c"
901#include "elm_flipselector.eo.c" \ No newline at end of file
diff --git a/src/lib/elm_flipselector_item.eo b/src/lib/elm_flipselector_item.eo
new file mode 100644
index 000000000..482b6c7d0
--- /dev/null
+++ b/src/lib/elm_flipselector_item.eo
@@ -0,0 +1,76 @@
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 {
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 const;
51 return Elm_Widobj_Item*;
52 }
53 next_get {
54 /*@
55 Get the item after @p item in a flip selector widget's
56 internal list of items.
57
58 @return The item after the @p item, in its parent's list. If there is no next
59 item for @p item or there's an error, @c NULL is returned.
60
61 @see elm_flipselector_item_prev_get()
62
63 @ingroup Flipselector
64 */
65 const;
66 return Elm_Widobj_Item*;
67 }
68 }
69 implements {
70 Eo_Base::constructor;
71 Elm_Widget_Item::del_pre;
72 Elm_Widget_Item::signal_emit;
73 Elm_Widget_Item::part_text::get;
74 Elm_Widget_Item::part_text::set;
75 }
76} \ No newline at end of file
diff --git a/src/lib/elm_widget_flipselector.h b/src/lib/elm_widget_flipselector.h
index ce1469f48..72bed73d5 100644
--- a/src/lib/elm_widget_flipselector.h
+++ b/src/lib/elm_widget_flipselector.h
@@ -3,6 +3,10 @@
3 3
4#include "elm_widget_layout.h" 4#include "elm_widget_layout.h"
5 5
6#include "elm_object_item_migration_temp.h"
7#include "elm_flipselector_item.eo.h"
8
9
6/** 10/**
7 * @addtogroup Widget 11 * @addtogroup Widget
8 * @{ 12 * @{
@@ -35,10 +39,10 @@ struct _Elm_Flipselector_Data
35 Eina_Bool deleting : 1; 39 Eina_Bool deleting : 1;
36}; 40};
37 41
38typedef struct _Elm_Flipselector_Item Elm_Flipselector_Item; 42typedef struct _Elm_Flipselector_Item_Data Elm_Flipselector_Item_Data;
39struct _Elm_Flipselector_Item 43struct _Elm_Flipselector_Item_Data
40{ 44{
41 ELM_WIDGET_ITEM; 45 Elm_Widget_Item_Data *base;
42 46
43 const char *label; 47 const char *label;
44 Evas_Smart_Cb func; 48 Evas_Smart_Cb func;
@@ -66,16 +70,19 @@ struct _Elm_Flipselector_Item
66 return val; \ 70 return val; \
67 } 71 }
68 72
69#define ELM_FLIPSELECTOR_CHECK(obj) \ 73#define ELM_FLIPSELECTOR_ITEM_DATA_GET(o, sd) \
74 Elm_Flipselector_Item_Data * sd = eo_data_scope_get(o, ELM_FLIPSELECTOR_ITEM_CLASS)
75
76#define ELM_FLIPSELECTOR_CHECK(obj) \
70 if (EINA_UNLIKELY(!eo_isa((obj), ELM_FLIPSELECTOR_CLASS))) \ 77 if (EINA_UNLIKELY(!eo_isa((obj), ELM_FLIPSELECTOR_CLASS))) \
71 return 78 return
72 79
73#define ELM_FLIPSELECTOR_ITEM_CHECK(it) \ 80#define ELM_FLIPSELECTOR_ITEM_CHECK(obj) \
74 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, ); \ 81 if (EINA_UNLIKELY(!eo_isa((obj), ELM_FLIPSELECTOR_ITEM_CLASS))) \
75 ELM_FLIPSELECTOR_CHECK(it->base.widget); 82 return
76 83
77#define ELM_FLIPSELECTOR_ITEM_CHECK_OR_RETURN(it, ...) \ 84#define ELM_FLIPSELECTOR_ITEM_CHECK_OR_RETURN(obj, ...) \
78 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \ 85 if (EINA_UNLIKELY(!eo_isa((obj), ELM_FLIPSELECTOR_ITEM_CLASS))) \
79 ELM_FLIPSELECTOR_CHECK(it->base.widget) __VA_ARGS__; 86 return __VA_ARGS__;
80 87
81#endif 88#endif