2 * gcc -o inwin_example inwin_example.c `pkg-config --cflags --libs elementary`
4 #include <Elementary.h>
6 static Evas_Object *inwin = NULL;
7 static const char *styles[] = {
12 static int current_style = 0;
15 _inwin_hide(void *data, Evas_Object *obj, void *event)
19 evas_object_hide(inwin);
22 elm_object_text_set(obj, "No inwin!");
23 elm_object_disabled_set(obj, EINA_TRUE);
27 _inwin_destroy(void *data, Evas_Object *obj, void *event)
31 evas_object_del(inwin);
35 elm_object_text_set(obj, "No inwin!");
36 elm_object_disabled_set(obj, EINA_TRUE);
40 _btn_click_cb(void *data, Evas_Object *obj, void *event)
42 Evas_Object *o, *parent;
46 elm_win_inwin_activate(inwin);
50 parent = elm_object_top_widget_get(obj);
51 inwin = elm_win_inwin_add(parent);
52 elm_object_style_set(inwin, styles[current_style]);
53 evas_object_show(inwin);
55 current_style = (current_style + 1) % 3;
57 o = elm_box_add(parent);
58 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
59 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
60 elm_win_inwin_content_set(inwin, o);
63 o = elm_label_add(parent);
64 elm_object_text_set(o, "Click on the first button to hide the Inwin.<ps>"
65 "Second to destroy it<ps>");
68 elm_box_pack_end(elm_win_inwin_content_get(inwin), o);
70 o = elm_button_add(parent);
71 elm_object_text_set(o, "Hide");
74 evas_object_smart_callback_add(o, "clicked", _inwin_hide, NULL);
76 elm_box_pack_end(elm_win_inwin_content_get(inwin), o);
78 o = elm_button_add(parent);
79 elm_object_text_set(o, "Destroy");
82 evas_object_smart_callback_add(o, "clicked", _inwin_destroy, NULL);
84 elm_box_pack_end(elm_win_inwin_content_get(inwin), o);
88 _win_del_cb(void *data, Evas_Object *obj, void *event)
92 Evas_Object *hover, *o = elm_win_inwin_content_unset(inwin);
93 evas_object_del(inwin);
95 hover = elm_hover_add(obj);
96 elm_hover_target_set(hover, obj);
97 elm_object_part_content_set(hover, "middle", o);
98 evas_object_show(hover);
101 evas_object_del(obj);
105 _screenshot_hack_cb(void *data)
107 _btn_click_cb(NULL, data, NULL);
112 elm_main(int argc, char *argv[])
114 Evas_Object *win, *bg, *box, *o;
116 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
118 win = elm_win_add(NULL, "inwin-example", ELM_WIN_BASIC);
119 elm_win_title_set(win, "Inwin Example");
120 evas_object_resize(win, 400, 400);
121 evas_object_show(win);
123 evas_object_smart_callback_add(win, "delete,request", _win_del_cb, NULL);
125 bg = elm_bg_add(win);
126 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
127 elm_win_resize_object_add(win, bg);
128 evas_object_show(bg);
130 box = elm_box_add(win);
131 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
132 elm_win_resize_object_add(win, box);
133 evas_object_show(box);
135 o = elm_button_add(win);
136 elm_object_text_set(o, "Inwin!");
137 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
138 evas_object_size_hint_align_set(o, 0.0, 0.0);
139 elm_box_pack_end(box, o);
142 evas_object_smart_callback_add(o, "clicked", _btn_click_cb, NULL);
144 if (!strncmp(elm_config_engine_get(), "shot", 4))
145 ecore_timer_add(0.1, _screenshot_hack_cb, o);