1 #include <Elementary.h>
3 # include "elementary_config.h"
5 #ifndef ELM_LIB_QUICKLAUNCH
7 static Evas_Object *win, *bg, *menu, *rect;
10 _show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
12 Evas_Event_Mouse_Down *ev = event_info;
13 elm_menu_move(data, ev->canvas.x, ev->canvas.y);
14 evas_object_show(data);
18 _populate_4(Elm_Object_Item *menu_it)
20 Elm_Object_Item *menu_it2;
22 elm_menu_item_add(menu, menu_it, "go-bottom", "menu 2", NULL, NULL);
23 elm_menu_item_add(menu, menu_it, "go-first", "menu 3", NULL, NULL);
24 elm_menu_item_separator_add(menu, menu_it);
25 menu_it2 = elm_menu_item_add(menu, menu_it, "go-last", "Disabled item", NULL,
27 elm_object_item_disabled_set(menu_it2, EINA_TRUE);
28 menu_it2 = elm_menu_item_add(menu, menu_it, "go-next", "Disabled item", NULL,
30 elm_object_item_disabled_set(menu_it2, EINA_TRUE);
31 menu_it2 = elm_menu_item_add(menu, menu_it, "go-up", "Disabled item", NULL,
33 elm_object_item_disabled_set(menu_it2, EINA_TRUE);
37 _populate_3(Elm_Object_Item *menu_it)
39 Elm_Object_Item *menu_it2;
41 elm_menu_item_add(menu, menu_it, "media-eject", "menu 2", NULL, NULL);
42 elm_menu_item_add(menu, menu_it, "media-playback-start", "menu 3", NULL,
44 elm_menu_item_separator_add(menu, menu_it);
45 menu_it2 = elm_menu_item_add(menu, menu_it, "media-playback-stop",
46 "Disabled item", NULL, NULL);
47 elm_object_item_disabled_set(menu_it2, EINA_TRUE);
51 _populate_2(Elm_Object_Item *menu_it)
53 Elm_Object_Item *menu_it2, *menu_it3;
55 elm_menu_item_add(menu, menu_it, "system-reboot", "menu 2", NULL, NULL);
56 menu_it2 = elm_menu_item_add(menu, menu_it, "system-shutdown", "menu 3",
58 _populate_3(menu_it2);
60 elm_menu_item_separator_add(menu, menu_it);
61 elm_menu_item_separator_add(menu, menu_it);
62 elm_menu_item_separator_add(menu, menu_it);
63 elm_menu_item_separator_add(menu, menu_it);
64 elm_menu_item_separator_add(menu, menu_it);
65 elm_menu_item_separator_add(menu, menu_it);
66 elm_menu_item_separator_add(menu, menu_it);
68 menu_it2 = elm_menu_item_add(menu, menu_it, "system-lock-screen", "menu 2",
70 elm_menu_item_separator_add(menu, menu_it);
72 menu_it3 = elm_menu_item_add(menu, menu_it, "system-run", "Disabled item",
74 elm_object_item_disabled_set(menu_it3, EINA_TRUE);
76 _populate_4(menu_it2);
80 _populate_1(Evas_Object *obj, Elm_Object_Item *menu_it)
82 Elm_Object_Item *menu_it2, *menu_it3;
85 radio = elm_radio_add(obj);
86 elm_radio_state_value_set(radio, 0);
87 elm_radio_value_set(radio, 0);
88 elm_object_text_set(radio, "radio in menu");
89 menu_it2 = elm_menu_item_add(menu, menu_it, "object-rotate-left", "menu 1",
91 menu_it3 = elm_menu_item_add(menu, menu_it, NULL, NULL, NULL, NULL);
92 elm_object_item_content_set(menu_it3, radio);
94 _populate_2(menu_it2);
98 test_menu(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
100 Elm_Object_Item *menu_it;
102 win = elm_win_add(NULL, "menu", ELM_WIN_BASIC);
103 elm_win_title_set(win, "Menu");
104 elm_win_autodel_set(win, EINA_TRUE);
106 bg = elm_bg_add(win);
107 elm_win_resize_object_add(win, bg);
108 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
109 evas_object_show(bg);
111 rect = evas_object_rectangle_add(evas_object_evas_get(win));
112 elm_win_resize_object_add(win, rect);
113 evas_object_size_hint_weight_set(rect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
114 evas_object_color_set(rect, 0, 0, 0, 0);
115 evas_object_show(rect);
117 menu = elm_menu_add(win);
118 elm_menu_item_add(menu, NULL, NULL, "first item", NULL, NULL);
120 menu_it = elm_menu_item_add(menu, NULL, "mail-reply-all", "second item",
122 _populate_1(win, menu_it);
124 elm_menu_item_add(menu, menu_it, "window-new", "sub menu", NULL, NULL);
126 evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_DOWN, _show, menu);
128 evas_object_resize(win, 350, 200);
129 evas_object_show(win);