[access] move mouse postion if an object has a highlight by highlight_cycle(); not...
[framework/uifw/elementary.git] / src / examples / popup_example_01.c
1 //Compile with:
2 //gcc -o popup_example_01 popup_example_01.c -g `pkg-config --cflags --libs elementary`
3
4 #include <Elementary.h>
5
6 static void _block_clicked(void *data, Evas_Object *obj, void *event_info);
7 static void _timeout(void *data, Evas_Object *obj, void *event_info);
8
9 EAPI_MAIN int
10 elm_main(int argc, char **argv)
11 {
12    Evas_Object *win, *bg, *popup, *content;
13
14    win = elm_win_add(NULL, "popup", ELM_WIN_BASIC);
15    elm_win_title_set(win, "Popup");
16    elm_win_autodel_set(win, EINA_TRUE);
17    elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
18
19    bg = elm_bg_add(win);
20    elm_bg_color_set(bg, 128, 128, 128);
21    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
22    elm_win_resize_object_add(win, bg);
23    evas_object_show(bg);
24
25    content = elm_label_add(win);
26    elm_object_text_set(content, "<align=center>Content</align>");
27
28    popup = elm_popup_add(win);
29    elm_popup_timeout_set(popup, 3.0);
30    evas_object_smart_callback_add(popup, "timeout", _timeout, NULL);
31
32    //Setting popup content
33    elm_object_content_set(popup, content);
34    //Seting popup title-text
35    elm_object_part_text_set(popup, "title,text", "Title");
36    evas_object_show(popup);
37    evas_object_smart_callback_add(popup, "block,clicked", _block_clicked, NULL);
38
39    evas_object_show(win);
40    evas_object_resize(win, 480, 800);
41
42    elm_run();
43    elm_shutdown();
44
45    return 0;
46 }
47 ELM_MAIN()
48
49 static void
50 _block_clicked(void *data, Evas_Object *obj,
51                void *event_info)
52 {
53    evas_object_hide(obj);
54 }
55
56 static void
57 _timeout(void *data, Evas_Object *obj, void *event_info)
58 {
59    evas_object_hide(obj);
60 }