summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Levin <avi.levin@samsung.com>2015-05-13 18:15:59 +0300
committerAvi Levin <avi.levin@samsung.com>2015-06-29 17:03:33 +0300
commite4a3bd43a93f5952f3b944a45f8d92aea1a4d298 (patch)
tree9bad7d6c7be83e3657f38fe8cba94bcec6be81b0
parent4376527991b95afb462a63213c4f1cc483b43ece (diff)
elm_menu: porting evas smart callbacks to eo
-rw-r--r--src/lib/elm_menu.c53
-rw-r--r--src/lib/elm_menu.eo3
2 files changed, 34 insertions, 22 deletions
diff --git a/src/lib/elm_menu.c b/src/lib/elm_menu.c
index cf5dbf144..173325429 100644
--- a/src/lib/elm_menu.c
+++ b/src/lib/elm_menu.c
@@ -419,14 +419,16 @@ _menu_hide(void *data,
419 } 419 }
420} 420}
421 421
422static void 422static Eina_Bool
423_hover_dismissed_cb(void *data, 423_hover_dismissed_cb(void *data,
424 Evas_Object *obj, 424 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
425 void *event_info)
426{ 425{
427 _menu_hide(data, obj, event_info); 426 _menu_hide(data, obj, event_info);
428 evas_object_smart_callback_call(data, SIG_CLICKED, NULL); 427 eo_do(data, eo_event_callback_call
429 evas_object_smart_callback_call(data, SIG_DISMISSED, NULL); 428 (EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, NULL));
429 eo_do(data, eo_event_callback_call(ELM_MENU_EVENT_DISMISSED, NULL));
430
431 return EINA_TRUE;
430} 432}
431 433
432static void 434static void
@@ -509,8 +511,9 @@ _menu_item_inactivate_cb(void *data,
509 if (item->submenu.open) _submenu_hide(item); 511 if (item->submenu.open) _submenu_hide(item);
510} 512}
511 513
512static void 514static Eina_Bool
513_block_menu(void *_sd, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 515_block_menu(void *_sd,
516 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
514{ 517{
515 const Eina_List *l; 518 const Eina_List *l;
516 Elm_Object_Item *eo_current; 519 Elm_Object_Item *eo_current;
@@ -524,10 +527,13 @@ _block_menu(void *_sd, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSE
524 current->blocked = EINA_TRUE; 527 current->blocked = EINA_TRUE;
525 elm_object_item_disabled_set(eo_current, EINA_TRUE); 528 elm_object_item_disabled_set(eo_current, EINA_TRUE);
526 } 529 }
530
531 return EINA_TRUE;
527} 532}
528 533
529static void 534static Eina_Bool
530_unblock_menu(void *_sd, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 535_unblock_menu(void *_sd,
536 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
531{ 537{
532 const Eina_List *l; 538 const Eina_List *l;
533 Elm_Object_Item *eo_current; 539 Elm_Object_Item *eo_current;
@@ -539,6 +545,8 @@ _unblock_menu(void *_sd, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNU
539 elm_object_item_disabled_set(eo_current, !current->was_enabled); 545 elm_object_item_disabled_set(eo_current, !current->was_enabled);
540 current->blocked = EINA_FALSE; 546 current->blocked = EINA_FALSE;
541 } 547 }
548
549 return EINA_TRUE;
542} 550}
543 551
544EOLIAN static void 552EOLIAN static void
@@ -605,8 +613,8 @@ _item_submenu_obj_create(Elm_Menu_Item_Data *item)
605 { 613 {
606 snprintf(style, sizeof(style), "main_menu_submenu/%s", elm_widget_style_get(WIDGET(item))); 614 snprintf(style, sizeof(style), "main_menu_submenu/%s", elm_widget_style_get(WIDGET(item)));
607 elm_object_style_set(hv, style); 615 elm_object_style_set(hv, style);
608 evas_object_smart_callback_add(hv, "dismissed", 616 eo_do(hv, eo_event_callback_add
609 _hover_dismissed_cb, WIDGET(item)); 617 (ELM_HOVER_EVENT_DISMISSED, _hover_dismissed_cb, WIDGET(item)));
610 } 618 }
611 else 619 else
612 { 620 {
@@ -667,8 +675,8 @@ _elm_menu_evas_object_smart_add(Eo *obj, Elm_Menu_Data *priv)
667 elm_widget_mirrored_set(priv->hv, EINA_FALSE); 675 elm_widget_mirrored_set(priv->hv, EINA_FALSE);
668 676
669 elm_object_style_set(priv->hv, "menu/default"); 677 elm_object_style_set(priv->hv, "menu/default");
670 evas_object_smart_callback_add(priv->hv, "dismissed", 678 eo_do(priv->hv, eo_event_callback_add
671 _hover_dismissed_cb, obj); 679 (ELM_HOVER_EVENT_DISMISSED, _hover_dismissed_cb, obj));
672 680
673 priv->bx = elm_box_add(obj); 681 priv->bx = elm_box_add(obj);
674 elm_widget_mirrored_set(priv->bx, EINA_FALSE); 682 elm_widget_mirrored_set(priv->bx, EINA_FALSE);
@@ -741,16 +749,17 @@ _elm_menu_menu_bar_set(Eo *obj, Eina_Bool menu_bar)
741 749
742 if (menu_bar) 750 if (menu_bar)
743 { 751 {
744 evas_object_smart_callback_add(item->submenu.hv, "clicked", 752 eo_do(item->submenu.hv, eo_event_callback_add
745 _hover_dismissed_cb, WIDGET(item)); 753 (EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED,
754 _hover_dismissed_cb, WIDGET(item)));
746 snprintf(style, sizeof(style), "main_menu_submenu//%s", elm_widget_style_get(obj)); 755 snprintf(style, sizeof(style), "main_menu_submenu//%s", elm_widget_style_get(obj));
747 elm_object_style_set(item->submenu.hv, style); 756 elm_object_style_set(item->submenu.hv, style);
748 } 757 }
749 else 758 else
750 { 759 {
751 evas_object_smart_callback_del_full(item->submenu.hv, "clicked", 760 eo_do(item->submenu.hv, eo_event_callback_del(
752 _hover_dismissed_cb, 761 EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED,
753 WIDGET(item)); 762 _hover_dismissed_cb, WIDGET(item)));
754 snprintf(style, sizeof(style), "submenu/%s", elm_widget_style_get(obj)); 763 snprintf(style, sizeof(style), "submenu/%s", elm_widget_style_get(obj));
755 elm_object_style_set(item->submenu.hv, style); 764 elm_object_style_set(item->submenu.hv, style);
756 } 765 }
@@ -786,10 +795,10 @@ _elm_menu_eo_base_constructor(Eo *obj, Elm_Menu_Data *sd)
786 (sd->hv, ELM_HOVER_AXIS_VERTICAL), sd->bx); 795 (sd->hv, ELM_HOVER_AXIS_VERTICAL), sd->bx);
787 796
788 _sizing_eval(obj); 797 _sizing_eval(obj);
789 evas_object_smart_callback_add(obj, "elm,action,block_menu", 798 eo_do(obj, eo_event_callback_add
790 _block_menu, sd); 799 (ELM_MENU_EVENT_ELM_ACTION_BLOCK_MENU, _block_menu, sd));
791 evas_object_smart_callback_add(obj, "elm,action,unblock_menu", 800 eo_do(obj, eo_event_callback_add
792 _unblock_menu, sd); 801 (ELM_MENU_EVENT_ELM_ACTION_UNBLOCK_MENU, _unblock_menu, sd));
793 802
794 return obj; 803 return obj;
795} 804}
diff --git a/src/lib/elm_menu.eo b/src/lib/elm_menu.eo
index 82df81b80..1e0e33ae0 100644
--- a/src/lib/elm_menu.eo
+++ b/src/lib/elm_menu.eo
@@ -124,6 +124,9 @@ class Elm.Menu (Elm.Widget, Evas.Clickable_Interface)
124 events { 124 events {
125 language,changed; 125 language,changed;
126 access,changed; 126 access,changed;
127 dismissed;
128 elm,action,block_menu;
129 elm,action,unblock_menu;
127 } 130 }
128 131
129} 132}