From: Carsten Haitzler Date: Thu, 14 Jan 2010 03:47:28 +0000 (+0000) Subject: patch from - horizontal context menu option. X-Git-Tag: v1.0.0~4884 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0b6b9d2a9549f3d55231063272f04f3e217369b5;p=platform%2Fupstream%2Felementary.git patch from - horizontal context menu option. SVN revision: 45105 --- diff --git a/src/bin/test_entry.c b/src/bin/test_entry.c index 58a339e77..c4015e8aa 100644 --- a/src/bin/test_entry.c +++ b/src/bin/test_entry.c @@ -196,6 +196,7 @@ test_entry_scrolled(void *data, Evas_Object *obj, void *event_info) elm_box_pack_end(bx, sc); en = elm_entry_add(win); + elm_entry_context_menu_horizontal_set(en, 1); elm_entry_context_menu_item_add(en, "Hello", NULL, ELM_ICON_NONE, NULL, NULL); elm_entry_context_menu_item_add(en, "World", NULL, ELM_ICON_NONE, NULL, NULL); elm_entry_entry_set(en, diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index ec4f72ab7..c8de5ef84 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -560,6 +560,7 @@ extern "C" { EAPI void elm_entry_selection_copy(Evas_Object *obj); EAPI void elm_entry_selection_paste(Evas_Object *obj); EAPI void elm_entry_context_menu_clear(Evas_Object *obj); + EAPI void elm_entry_context_menu_horizontal_set(Evas_Object *obj, Eina_Bool horizontal); EAPI void elm_entry_context_menu_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *data); EAPI void elm_entry_context_menu_disabled_set(Evas_Object *obj, Eina_Bool disabled); EAPI Eina_Bool elm_entry_context_menu_disabled_get(Evas_Object *obj); @@ -665,6 +666,7 @@ extern "C" { */ EAPI Evas_Object *elm_hoversel_add(Evas_Object *parent); + EAPI void elm_hoversel_horizontal_set(Evas_Object *obj, Eina_Bool horizontal); EAPI void elm_hoversel_hover_parent_set(Evas_Object *obj, Evas_Object *parent); EAPI void elm_hoversel_label_set(Evas_Object *obj, const char *label); EAPI const char *elm_hoversel_label_get(Evas_Object *obj); diff --git a/src/lib/elc_hoversel.c b/src/lib/elc_hoversel.c index bbb79b64a..10c8d0594 100644 --- a/src/lib/elc_hoversel.c +++ b/src/lib/elc_hoversel.c @@ -26,6 +26,7 @@ struct _Widget_Data Evas_Object *btn, *hover; Evas_Object *hover_parent; Eina_List *items; + Eina_Bool horizontal:1; }; struct _Elm_Hoversel_Item @@ -151,6 +152,7 @@ _activate(Evas_Object *obj) bx = elm_box_add(wd->hover); elm_box_homogenous_set(bx, 1); + elm_box_horizontal_set(bx, wd->horizontal); snprintf(buf, sizeof(buf), "hoversel_vertical_entry/%s", elm_widget_style_get(obj)); @@ -185,6 +187,8 @@ _activate(Evas_Object *obj) evas_object_show(wd->hover); evas_object_smart_callback_call(obj, "clicked", NULL); + + if(wd->horizontal)evas_object_hide(wd->btn); } static void @@ -282,6 +286,13 @@ elm_hoversel_label_set(Evas_Object *obj, const char *label) elm_button_label_set(wd->btn, label); } +EAPI void +elm_hoversel_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) +{ + Widget_Data *wd = elm_widget_data_get(obj); + wd->horizontal = !!horizontal; +} + /** * Get the hoversel button label * diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c index 541e01729..d87baea04 100644 --- a/src/lib/elm_entry.c +++ b/src/lib/elm_entry.c @@ -33,6 +33,7 @@ struct _Widget_Data Eina_Bool deferred_cur : 1; Eina_Bool disabled : 1; Eina_Bool context_menu : 1; + Eina_Bool horizontal : 1; }; struct _Elm_Entry_Context_Menu_Item @@ -387,6 +388,7 @@ _long_press(void *data) if (wd->hoversel) evas_object_del(wd->hoversel); else elm_widget_scroll_freeze_push(data); wd->hoversel = elm_hoversel_add(data); + elm_hoversel_horizontal_set(wd->hoversel, wd->horizontal); elm_object_style_set(wd->hoversel, "entry"); elm_widget_sub_object_add(data, wd->hoversel); elm_hoversel_label_set(wd->hoversel, "Text"); @@ -1457,6 +1459,13 @@ elm_entry_context_menu_clear(Evas_Object *obj) } } +EAPI void +elm_entry_context_menu_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) +{ + Widget_Data *wd = elm_widget_data_get(obj); + wd->horizontal = !!horizontal; +} + EAPI void elm_entry_context_menu_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *data) {