summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYossi Kantor <yossi.kantor@samsung.com>2014-06-16 14:48:30 +0300
committerDaniel Zaoui <daniel.zaoui@samsung.com>2014-09-17 15:08:41 +0300
commit58e69ee199a11545c994a6b395a199b70b927398 (patch)
treec48b42915277e082e9bab1a86c2f2d1b1c9b0fb6
parent4009776dca66f12aad987090924ca29959613af5 (diff)
Porting to Eo: Elm Hoversel Item
-rw-r--r--src/lib/Makefile.am11
-rw-r--r--src/lib/elc_hoversel.c153
-rw-r--r--src/lib/elc_hoversel_legacy.h34
-rw-r--r--src/lib/elm_hoversel_item.eo45
-rw-r--r--src/lib/elm_widget_hoversel.h26
5 files changed, 161 insertions, 108 deletions
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index cf31c9b55..06e8f2ea8 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -849,7 +849,9 @@ BUILT_SOURCES = \
849 elm_color_item.eo.c \ 849 elm_color_item.eo.c \
850 elm_color_item.eo.h \ 850 elm_color_item.eo.h \
851 elm_dayselector_item.eo.c \ 851 elm_dayselector_item.eo.c \
852 elm_dayselector_item.eo.h 852 elm_dayselector_item.eo.h \
853 elm_hoversel_item.eo.c \
854 elm_hoversel_item.eo.h
853 855
854elementaryeolianfilesdir = $(datadir)/eolian/include/elementary-@VMAJ@ 856elementaryeolianfilesdir = $(datadir)/eolian/include/elementary-@VMAJ@
855elementaryeolianfiles_DATA = \ 857elementaryeolianfiles_DATA = \
@@ -946,7 +948,8 @@ elementaryeolianfiles_DATA = \
946 elm_win.eo \ 948 elm_win.eo \
947 elm_widget_item.eo \ 949 elm_widget_item.eo \
948 elm_color_item.eo \ 950 elm_color_item.eo \
949 elm_dayselector_item.eo 951 elm_dayselector_item.eo \
952 elm_hoversel_item.eo
950 953
951EXTRA_DIST += ${elementaryeolianfiles_DATA} 954EXTRA_DIST += ${elementaryeolianfiles_DATA}
952 955
@@ -1045,6 +1048,7 @@ nodist_includesunstable_HEADERS = \
1045 elm_widget_item.eo.h \ 1048 elm_widget_item.eo.h \
1046 elm_color_item.eo.h \ 1049 elm_color_item.eo.h \
1047 elm_dayselector_item.eo.h \ 1050 elm_dayselector_item.eo.h \
1051 elm_hoversel_item.eo.h \
1048 elm_layout.eo.legacy.h \ 1052 elm_layout.eo.legacy.h \
1049 elm_frame.eo.legacy.h \ 1053 elm_frame.eo.legacy.h \
1050 elm_hover.eo.legacy.h \ 1054 elm_hover.eo.legacy.h \
@@ -1110,7 +1114,8 @@ nodist_includesunstable_HEADERS = \
1110 elm_win.eo.legacy.h \ 1114 elm_win.eo.legacy.h \
1111 elm_widget_item.eo.legacy.h \ 1115 elm_widget_item.eo.legacy.h \
1112 elm_color_item.eo.legacy.h \ 1116 elm_color_item.eo.legacy.h \
1113 elm_dayselector_item.eo.legacy.h 1117 elm_dayselector_item.eo.legacy.h \
1118 elm_hoversel_item.eo.legacy.h
1114 1119
1115if HAVE_CXX11 1120if HAVE_CXX11
1116 1121
diff --git a/src/lib/elc_hoversel.c b/src/lib/elc_hoversel.c
index be6bbe342..974d4737e 100644
--- a/src/lib/elc_hoversel.c
+++ b/src/lib/elc_hoversel.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_hoversel.h" 8#include "elm_widget_hoversel.h"
@@ -48,11 +49,11 @@ static const Elm_Action key_actions[] = {
48EOLIAN static Eina_Bool 49EOLIAN static Eina_Bool
49_elm_hoversel_elm_widget_translate(Eo *obj EINA_UNUSED, Elm_Hoversel_Data *sd) 50_elm_hoversel_elm_widget_translate(Eo *obj EINA_UNUSED, Elm_Hoversel_Data *sd)
50{ 51{
51 Elm_Hoversel_Item *it; 52 Eo *it;
52 Eina_List *l; 53 Eina_List *l;
53 54
54 EINA_LIST_FOREACH(sd->items, l, it) 55 EINA_LIST_FOREACH(sd->items, l, it)
55 elm_widget_item_translate(it); 56 eo_do(it, elm_wdg_item_translate());
56 57
57 eo_do_super(obj, MY_CLASS, elm_obj_widget_translate()); 58 eo_do_super(obj, MY_CLASS, elm_obj_widget_translate());
58 59
@@ -107,11 +108,11 @@ _on_item_clicked(void *data,
107 Evas_Object *obj EINA_UNUSED, 108 Evas_Object *obj EINA_UNUSED,
108 void *event_info EINA_UNUSED) 109 void *event_info EINA_UNUSED)
109{ 110{
110 Elm_Hoversel_Item *item = data; 111 Elm_Hoversel_Item_Data *item = data;
111 Evas_Object *obj2 = WIDGET(item); 112 Evas_Object *obj2 = WIDGET(item);
112 113
113 if (item->func) item->func((void *)item->base.data, obj2, item); 114 if (item->func) item->func((void *)item->base->data, obj2, EO_OBJ(item));
114 evas_object_smart_callback_call(obj2, SIG_SELECTED, item); 115 evas_object_smart_callback_call(obj2, SIG_SELECTED, EO_OBJ(item));
115 elm_hoversel_hover_end(obj2); 116 elm_hoversel_hover_end(obj2);
116} 117}
117 118
@@ -120,9 +121,9 @@ _item_focused_cb(void *data,
120 Evas_Object *obj EINA_UNUSED, 121 Evas_Object *obj EINA_UNUSED,
121 void *event_info EINA_UNUSED) 122 void *event_info EINA_UNUSED)
122{ 123{
123 Elm_Object_Item *it = data; 124 Elm_Hoversel_Item_Data *it = data;
124 125
125 evas_object_smart_callback_call(WIDGET(it), SIG_ITEM_FOCUSED, it); 126 evas_object_smart_callback_call(WIDGET(it), SIG_ITEM_FOCUSED, EO_OBJ(it));
126} 127}
127 128
128static void 129static void
@@ -130,15 +131,15 @@ _item_unfocused_cb(void *data,
130 Evas_Object *obj EINA_UNUSED, 131 Evas_Object *obj EINA_UNUSED,
131 void *event_info EINA_UNUSED) 132 void *event_info EINA_UNUSED)
132{ 133{
133 Elm_Object_Item *it = data; 134 Elm_Hoversel_Item_Data *it = data;
134 135
135 evas_object_smart_callback_call(WIDGET(it), SIG_ITEM_UNFOCUSED, it); 136 evas_object_smart_callback_call(WIDGET(it), SIG_ITEM_UNFOCUSED, EO_OBJ(it));
136} 137}
137 138
138static void 139static void
139_activate(Evas_Object *obj) 140_activate(Evas_Object *obj)
140{ 141{
141 Elm_Hoversel_Item *item; 142 Elm_Object_Item *eo_item;
142 Evas_Object *bt, *bx, *ic; 143 Evas_Object *bt, *bx, *ic;
143 const Eina_List *l; 144 const Eina_List *l;
144 char buf[4096]; 145 char buf[4096];
@@ -184,8 +185,9 @@ _activate(Evas_Object *obj)
184 snprintf(buf, sizeof(buf), "hoversel_vertical_entry/%s", 185 snprintf(buf, sizeof(buf), "hoversel_vertical_entry/%s",
185 elm_widget_style_get(obj)); 186 elm_widget_style_get(obj));
186 187
187 EINA_LIST_FOREACH(sd->items, l, item) 188 EINA_LIST_FOREACH(sd->items, l, eo_item)
188 { 189 {
190 ELM_HOVERSEL_ITEM_DATA_GET(eo_item, item);
189 VIEW(item) = bt = elm_button_add(bx); 191 VIEW(item) = bt = elm_button_add(bx);
190 elm_widget_mirrored_automatic_set(bt, EINA_FALSE); 192 elm_widget_mirrored_automatic_set(bt, EINA_FALSE);
191 elm_widget_mirrored_set(bt, elm_widget_mirrored_get(obj)); 193 elm_widget_mirrored_set(bt, elm_widget_mirrored_get(obj));
@@ -241,43 +243,45 @@ _on_parent_del(void *data,
241} 243}
242 244
243static const char * 245static const char *
244_item_text_get_hook(const Elm_Object_Item *it, 246_elm_hoversel_item_elm_widget_item_part_text_get(Eo *eo_it EINA_UNUSED,
245 const char *part) 247 Elm_Hoversel_Item_Data *it,
248 const char *part)
246{ 249{
247 if (part && strcmp(part, "default")) return NULL; 250 if (part && strcmp(part, "default")) return NULL;
248 return ((Elm_Hoversel_Item *)it)->label; 251 return it->label;
249} 252}
250 253
251static void 254EOLIAN static void
252_item_signal_emit_hook(Elm_Object_Item *it, 255_elm_hoversel_item_elm_widget_item_signal_emit(Eo *eo_it EINA_UNUSED,
253 const char *emission, 256 Elm_Hoversel_Item_Data *it,
254 const char *source) 257 const char *emission,
258 const char *source)
255{ 259{
256 elm_object_signal_emit(VIEW(it), emission, source); 260 elm_object_signal_emit(VIEW(it), emission, source);
257} 261}
258 262
259static void 263EOLIAN static void
260_item_style_set_hook(Elm_Object_Item *it, 264_elm_hoversel_item_elm_widget_item_style_set(Eo *eo_it EINA_UNUSED,
261 const char *style) 265 Elm_Hoversel_Item_Data *it,
266 const char *style)
262{ 267{
263 elm_object_style_set(VIEW(it), style); 268 elm_object_style_set(VIEW(it), style);
264} 269}
265 270
266static const char * 271EOLIAN static const char *
267_item_style_get_hook(Elm_Object_Item *it) 272_elm_hoversel_item_elm_widget_item_style_get(Eo *eo_it EINA_UNUSED,
273 Elm_Hoversel_Item_Data *it)
268{ 274{
269 return elm_object_style_get(VIEW(it)); 275 return elm_object_style_get(VIEW(it));
270} 276}
271 277
272static Eina_Bool 278EOLIAN static Eina_Bool
273_item_del_pre_hook(Elm_Object_Item *it) 279_elm_hoversel_item_elm_widget_item_del_pre(Eo *eo_item EINA_UNUSED, Elm_Hoversel_Item_Data *item)
274{ 280{
275 Elm_Hoversel_Item *item = (Elm_Hoversel_Item *)it;
276
277 ELM_HOVERSEL_DATA_GET_OR_RETURN_VAL(WIDGET(item), sd, EINA_FALSE); 281 ELM_HOVERSEL_DATA_GET_OR_RETURN_VAL(WIDGET(item), sd, EINA_FALSE);
278 282
279 elm_hoversel_hover_end(WIDGET(item)); 283 elm_hoversel_hover_end(WIDGET(item));
280 sd->items = eina_list_remove(sd->items, item); 284 sd->items = eina_list_remove(sd->items, eo_item);
281 eina_stringshare_del(item->label); 285 eina_stringshare_del(item->label);
282 eina_stringshare_del(item->icon_file); 286 eina_stringshare_del(item->icon_file);
283 eina_stringshare_del(item->icon_group); 287 eina_stringshare_del(item->icon_group);
@@ -302,14 +306,15 @@ _elm_hoversel_evas_object_smart_add(Eo *obj, Elm_Hoversel_Data *_pd EINA_UNUSED)
302EOLIAN static void 306EOLIAN static void
303_elm_hoversel_evas_object_smart_del(Eo *obj, Elm_Hoversel_Data *sd) 307_elm_hoversel_evas_object_smart_del(Eo *obj, Elm_Hoversel_Data *sd)
304{ 308{
305 Elm_Hoversel_Item *item; 309 Elm_Object_Item *eo_item;
306 310
307 EINA_LIST_FREE(sd->items, item) 311 EINA_LIST_FREE(sd->items, eo_item)
308 { 312 {
313 ELM_HOVERSEL_ITEM_DATA_GET(eo_item, item);
309 eina_stringshare_del(item->label); 314 eina_stringshare_del(item->label);
310 eina_stringshare_del(item->icon_file); 315 eina_stringshare_del(item->icon_file);
311 eina_stringshare_del(item->icon_group); 316 eina_stringshare_del(item->icon_group);
312 elm_widget_item_free(item); 317 eo_del((Eo *)eo_item);
313 } 318 }
314 elm_hoversel_hover_parent_set(obj, NULL); 319 elm_hoversel_hover_parent_set(obj, NULL);
315 320
@@ -405,15 +410,16 @@ _elm_hoversel_hover_begin(Eo *obj, Elm_Hoversel_Data *sd)
405EOLIAN static void 410EOLIAN static void
406_elm_hoversel_hover_end(Eo *obj, Elm_Hoversel_Data *sd) 411_elm_hoversel_hover_end(Eo *obj, Elm_Hoversel_Data *sd)
407{ 412{
408 Elm_Object_Item *it; 413 Elm_Object_Item *eo_item;
409 Eina_List *l; 414 Eina_List *l;
410 415
411 if (!sd->hover) return; 416 if (!sd->hover) return;
412 417
413 sd->expanded = EINA_FALSE; 418 sd->expanded = EINA_FALSE;
414 419
415 EINA_LIST_FOREACH(sd->items, l, it) 420 EINA_LIST_FOREACH(sd->items, l, eo_item)
416 { 421 {
422 ELM_HOVERSEL_ITEM_DATA_GET(eo_item, it);
417 VIEW(it) = NULL; 423 VIEW(it) = NULL;
418 } 424 }
419 ELM_SAFE_FREE(sd->hover, evas_object_del); 425 ELM_SAFE_FREE(sd->hover, evas_object_del);
@@ -435,7 +441,7 @@ _elm_hoversel_clear(Eo *obj EINA_UNUSED, Elm_Hoversel_Data *sd)
435 441
436 EINA_LIST_FOREACH_SAFE(sd->items, l, ll, it) 442 EINA_LIST_FOREACH_SAFE(sd->items, l, ll, it)
437 { 443 {
438 elm_widget_item_del(it); 444 eo_do((Eo *)it, elm_wdg_item_del());
439 } 445 }
440} 446}
441 447
@@ -445,27 +451,30 @@ _elm_hoversel_items_get(Eo *obj EINA_UNUSED, Elm_Hoversel_Data *sd)
445 return sd->items; 451 return sd->items;
446} 452}
447 453
454EOLIAN static void
455_elm_hoversel_item_eo_base_constructor(Eo *obj, Elm_Hoversel_Item_Data *it)
456{
457 eo_do_super(obj, ELM_HOVERSEL_ITEM_CLASS, eo_constructor());
458 it->base = eo_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS);
459}
460
448EOLIAN static Elm_Object_Item* 461EOLIAN static Elm_Object_Item*
449_elm_hoversel_item_add(Eo *obj, Elm_Hoversel_Data *sd, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data) 462_elm_hoversel_item_add(Eo *obj, Elm_Hoversel_Data *sd, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data)
450{ 463{
451 Elm_Hoversel_Item *item = elm_widget_item_new(obj, Elm_Hoversel_Item); 464 Eo *eo_item = eo_add(ELM_HOVERSEL_ITEM_CLASS, obj);
452 if (!item) return NULL; 465 if (!eo_item) return NULL;
453 466
454 elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook); 467 ELM_HOVERSEL_ITEM_DATA_GET(eo_item, item);
455 elm_widget_item_text_get_hook_set(item, _item_text_get_hook);
456 elm_widget_item_signal_emit_hook_set(item, _item_signal_emit_hook);
457 elm_widget_item_style_set_hook_set(item, _item_style_set_hook);
458 elm_widget_item_style_get_hook_set(item, _item_style_get_hook);
459 468
460 item->label = eina_stringshare_add(label); 469 item->label = eina_stringshare_add(label);
461 item->icon_file = eina_stringshare_add(icon_file); 470 item->icon_file = eina_stringshare_add(icon_file);
462 item->icon_type = icon_type; 471 item->icon_type = icon_type;
463 item->func = func; 472 item->func = func;
464 item->base.data = data; 473 item->base->data = data;
465 474
466 sd->items = eina_list_append(sd->items, item); 475 sd->items = eina_list_append(sd->items, eo_item);
467 476
468 return (Elm_Object_Item *)item; 477 return (Elm_Object_Item *)eo_item;
469} 478}
470 479
471EAPI void 480EAPI void
@@ -474,10 +483,16 @@ elm_hoversel_item_icon_set(Elm_Object_Item *it,
474 const char *icon_group, 483 const char *icon_group,
475 Elm_Icon_Type icon_type) 484 Elm_Icon_Type icon_type)
476{ 485{
477 ELM_HOVERSEL_ITEM_CHECK_OR_RETURN(it); 486 eo_do((Eo *)it, elm_obj_hoversel_item_icon_set(icon_file, icon_group, icon_type));
478 487}
479 Elm_Hoversel_Item *item = (Elm_Hoversel_Item *)it;
480 488
489EOLIAN static void
490_elm_hoversel_item_icon_set(Eo *eo_item EINA_UNUSED,
491 Elm_Hoversel_Item_Data *item,
492 const char *icon_file,
493 const char *icon_group,
494 Elm_Icon_Type icon_type)
495{
481 eina_stringshare_replace(&item->icon_file, icon_file); 496 eina_stringshare_replace(&item->icon_file, icon_file);
482 eina_stringshare_replace(&item->icon_group, icon_group); 497 eina_stringshare_replace(&item->icon_group, icon_group);
483 498
@@ -490,24 +505,33 @@ elm_hoversel_item_icon_get(const Elm_Object_Item *it,
490 const char **icon_group, 505 const char **icon_group,
491 Elm_Icon_Type *icon_type) 506 Elm_Icon_Type *icon_type)
492{ 507{
493 ELM_HOVERSEL_ITEM_CHECK_OR_RETURN(it); 508 eo_do((Eo *)it, elm_obj_hoversel_item_icon_get(icon_file, icon_group, icon_type));
494 509}
495 Elm_Hoversel_Item *item = (Elm_Hoversel_Item *)it;
496 510
511EOLIAN static void
512_elm_hoversel_item_icon_get(Eo *eo_item EINA_UNUSED,
513 Elm_Hoversel_Item_Data *item,
514 const char **icon_file,
515 const char **icon_group,
516 Elm_Icon_Type *icon_type)
517{
497 if (icon_file) *icon_file = item->icon_file; 518 if (icon_file) *icon_file = item->icon_file;
498 if (icon_group) *icon_group = item->icon_group; 519 if (icon_group) *icon_group = item->icon_group;
499 if (icon_type) *icon_type = item->icon_type; 520 if (icon_type) *icon_type = item->icon_type;
500} 521}
501 522
502static Elm_Hoversel_Item * 523static Elm_Object_Item *
503item_focused_get(Elm_Hoversel_Data *sd) 524item_focused_get(Elm_Hoversel_Data *sd)
504{ 525{
505 Elm_Hoversel_Item *item; 526 Elm_Object_Item *eo_item;
506 Eina_List *l; 527 Eina_List *l;
507 528
508 EINA_LIST_FOREACH(sd->items, l, item) 529 EINA_LIST_FOREACH(sd->items, l, eo_item)
509 if (elm_object_focus_get(VIEW(item))) 530 {
510 return item; 531 ELM_HOVERSEL_ITEM_DATA_GET(eo_item, item);
532 if (elm_object_focus_get(VIEW(item)))
533 return eo_item;
534 }
511 return NULL; 535 return NULL;
512} 536}
513 537
@@ -517,15 +541,16 @@ _key_action_move(Evas_Object *obj, const char *params)
517 ELM_HOVERSEL_DATA_GET(obj, sd); 541 ELM_HOVERSEL_DATA_GET(obj, sd);
518 const char *dir = params; 542 const char *dir = params;
519 543
520 Elm_Hoversel_Item *litem, *fitem; 544 Elm_Object_Item *eo_litem, *eo_fitem;
521 litem = eina_list_last_data_get(sd->items); 545 eo_litem = eina_list_last_data_get(sd->items);
522 fitem = eina_list_data_get(sd->items); 546 eo_fitem = eina_list_data_get(sd->items);
523 547
524 if (!strcmp(dir, "down")) 548 if (!strcmp(dir, "down"))
525 { 549 {
526 if ((!sd->horizontal) && 550 if ((!sd->horizontal) &&
527 (item_focused_get(sd) == litem)) 551 (item_focused_get(sd) == eo_litem))
528 { 552 {
553 ELM_HOVERSEL_ITEM_DATA_GET(eo_fitem, fitem);
529 elm_object_focus_set(VIEW(fitem), EINA_TRUE); 554 elm_object_focus_set(VIEW(fitem), EINA_TRUE);
530 return EINA_TRUE; 555 return EINA_TRUE;
531 } 556 }
@@ -535,8 +560,9 @@ _key_action_move(Evas_Object *obj, const char *params)
535 else if (!strcmp(dir, "up")) 560 else if (!strcmp(dir, "up"))
536 { 561 {
537 if ((!sd->horizontal) && 562 if ((!sd->horizontal) &&
538 (item_focused_get(sd) == fitem)) 563 (item_focused_get(sd) == eo_fitem))
539 { 564 {
565 ELM_HOVERSEL_ITEM_DATA_GET(eo_litem, litem);
540 elm_object_focus_set(VIEW(litem), EINA_TRUE); 566 elm_object_focus_set(VIEW(litem), EINA_TRUE);
541 return EINA_TRUE; 567 return EINA_TRUE;
542 } 568 }
@@ -546,8 +572,9 @@ _key_action_move(Evas_Object *obj, const char *params)
546 else if (!strcmp(dir, "left")) 572 else if (!strcmp(dir, "left"))
547 { 573 {
548 if (sd->horizontal && 574 if (sd->horizontal &&
549 (item_focused_get(sd) == fitem)) 575 (item_focused_get(sd) == eo_fitem))
550 { 576 {
577 ELM_HOVERSEL_ITEM_DATA_GET(eo_litem, litem);
551 elm_object_focus_set(VIEW(litem), EINA_TRUE); 578 elm_object_focus_set(VIEW(litem), EINA_TRUE);
552 return EINA_TRUE; 579 return EINA_TRUE;
553 } 580 }
@@ -557,8 +584,9 @@ _key_action_move(Evas_Object *obj, const char *params)
557 else if (!strcmp(dir, "right")) 584 else if (!strcmp(dir, "right"))
558 { 585 {
559 if (sd->horizontal && 586 if (sd->horizontal &&
560 (item_focused_get(sd) == litem)) 587 (item_focused_get(sd) == eo_litem))
561 { 588 {
589 ELM_HOVERSEL_ITEM_DATA_GET(eo_fitem, fitem);
562 elm_object_focus_set(VIEW(fitem), EINA_TRUE); 590 elm_object_focus_set(VIEW(fitem), EINA_TRUE);
563 return EINA_TRUE; 591 return EINA_TRUE;
564 } 592 }
@@ -608,4 +636,5 @@ _elm_hoversel_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNU
608 return &atspi_actions[0]; 636 return &atspi_actions[0];
609} 637}
610 638
639#include "elm_hoversel_item.eo.c"
611#include "elm_hoversel.eo.c" 640#include "elm_hoversel.eo.c"
diff --git a/src/lib/elc_hoversel_legacy.h b/src/lib/elc_hoversel_legacy.h
index 00f00f2c9..afe03266e 100644
--- a/src/lib/elc_hoversel_legacy.h
+++ b/src/lib/elc_hoversel_legacy.h
@@ -8,40 +8,8 @@
8 */ 8 */
9EAPI Evas_Object *elm_hoversel_add(Evas_Object *parent); 9EAPI Evas_Object *elm_hoversel_add(Evas_Object *parent);
10 10
11/**
12 * @brief This sets the icon for the given hoversel item.
13 *
14 * @param it The item to set the icon
15 * @param icon_file An image file path on disk to use for the icon or standard
16 * icon name
17 * @param icon_group The edje group to use if @p icon_file is an edje file. Set this
18 * to NULL if the icon is not an edje file
19 * @param icon_type The icon type
20 *
21 * The icon can be loaded from the standard set, from an image file, or from
22 * an edje file.
23 *
24 * @see elm_hoversel_item_add()
25 *
26 * @ingroup Hoversel
27 */
28EAPI void elm_hoversel_item_icon_set(Elm_Object_Item *it, const char *icon_file, const char *icon_group, Elm_Icon_Type icon_type); 11EAPI void elm_hoversel_item_icon_set(Elm_Object_Item *it, const char *icon_file, const char *icon_group, Elm_Icon_Type icon_type);
29 12
30/**
31 * @brief Get the icon object of the hoversel item
32 *
33 * @param it The item to get the icon from
34 * @param icon_file The image file path on disk used for the icon or standard
35 * icon name
36 * @param icon_group The edje group used if @p icon_file is an edje file. NULL
37 * if the icon is not an edje file
38 * @param icon_type The icon type
39 *
40 * @see elm_hoversel_item_icon_set()
41 * @see elm_hoversel_item_add()
42 *
43 * @ingroup Hoversel
44 */
45EAPI void elm_hoversel_item_icon_get(const Elm_Object_Item *it, const char **icon_file, const char **icon_group, Elm_Icon_Type *icon_type); 13EAPI void elm_hoversel_item_icon_get(const Elm_Object_Item *it, const char **icon_file, const char **icon_group, Elm_Icon_Type *icon_type);
46 14
47#include "elm_hoversel.eo.legacy.h" \ No newline at end of file 15#include "elm_hoversel.eo.legacy.h"
diff --git a/src/lib/elm_hoversel_item.eo b/src/lib/elm_hoversel_item.eo
new file mode 100644
index 000000000..091de18b3
--- /dev/null
+++ b/src/lib/elm_hoversel_item.eo
@@ -0,0 +1,45 @@
1class Elm_Hoversel_Item(Elm_Widget_Item)
2{
3 legacy_prefix: null;
4 eo_prefix: elm_obj_hoversel_item;
5 properties {
6 icon {
7 get {
8 /*@
9 @brief This sets the icon for the given hoversel item.
10
11 The icon can be loaded from the standard set, from an image file, or from
12 an edje file.
13
14 @see elm_hoversel_item_add()
15
16 @ingroup Hoversel
17 */
18 }
19 set {
20 /*@
21 @brief Get the icon object of the hoversel item.
22
23 @see elm_hoversel_item_add()
24
25 @ingroup Hoversel
26 */
27 }
28 values {
29 const (char) *icon_file; /*@ An image file path on disk to use for the icon or standard icon name */
30 const (char) *icon_group; /*@ The edje group to use if @p icon_file is an edje file. Set this to NULL if the icon is not an edje file */
31 Elm_Icon_Type icon_type; /*@ The icon type */
32 }
33 }
34 }
35 methods {
36 }
37 implements {
38 Eo.Base.constructor;
39 Elm_Widget_Item.signal_emit;
40 Elm_Widget_Item.del_pre;
41 Elm_Widget_Item.part_text.get;
42 Elm_Widget_Item.style.get;
43 Elm_Widget_Item.style.set;
44 }
45}
diff --git a/src/lib/elm_widget_hoversel.h b/src/lib/elm_widget_hoversel.h
index 524fecd78..d9b6fee6d 100644
--- a/src/lib/elm_widget_hoversel.h
+++ b/src/lib/elm_widget_hoversel.h
@@ -2,6 +2,9 @@
2#define ELM_WIDGET_HOVERSEL_H 2#define ELM_WIDGET_HOVERSEL_H
3 3
4#include "Elementary.h" 4#include "Elementary.h"
5#include "elm_hoversel_item.eo.h"
6
7#include "elm_object_item_migration_temp.h"
5 8
6#include <Eio.h> 9#include <Eio.h>
7 10
@@ -38,10 +41,10 @@ struct _Elm_Hoversel_Data
38 Eina_Bool expanded : 1; 41 Eina_Bool expanded : 1;
39}; 42};
40 43
41typedef struct _Elm_Hoversel_Item Elm_Hoversel_Item; 44typedef struct _Elm_Hoversel_Item_Data Elm_Hoversel_Item_Data;
42struct _Elm_Hoversel_Item 45struct _Elm_Hoversel_Item_Data
43{ 46{
44 ELM_WIDGET_ITEM; 47 Elm_Widget_Item_Data *base;
45 48
46 const char *label; 49 const char *label;
47 const char *icon_file; 50 const char *icon_file;
@@ -76,16 +79,19 @@ struct _Elm_Hoversel_Item
76 return val; \ 79 return val; \
77 } 80 }
78 81
79#define ELM_HOVERSEL_CHECK(obj) \ 82#define ELM_HOVERSEL_CHECK(obj) \
80 if (EINA_UNLIKELY(!eo_isa((obj), ELM_HOVERSEL_CLASS))) \ 83 if (EINA_UNLIKELY(!eo_isa((obj), ELM_HOVERSEL_CLASS))) \
81 return 84 return
82 85
83#define ELM_HOVERSEL_ITEM_CHECK(it) \ 86#define ELM_HOVERSEL_ITEM_DATA_GET(o, sd) \
84 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item_Data *)it, ); \ 87 Elm_Hoversel_Item_Data *sd = eo_data_scope_get((Eo *)o, ELM_HOVERSEL_ITEM_CLASS)
85 ELM_HOVERSEL_CHECK(it->base.widget); 88
89#define ELM_HOVERSEL_ITEM_CHECK(it) \
90 if (EINA_UNLIKELY(!eo_isa((Eo *)it->base->eo_obj, ELM_HOVERSEL_ITEM_CLASS))) \
91 return
86 92
87#define ELM_HOVERSEL_ITEM_CHECK_OR_RETURN(it, ...) \ 93#define ELM_HOVERSEL_ITEM_CHECK_OR_RETURN(it, ...) \
88 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item_Data *)it, __VA_ARGS__); \ 94 if (EINA_UNLIKELY(!eo_isa((Eo *)it->base->eo_obj, ELM_HOVERSEL_ITEM_CLASS))) \
89 ELM_HOVERSEL_CHECK(it->base.widget) __VA_ARGS__; 95 return __VA_ARGS__;
90 96
91#endif 97#endif