2 * gcc -o inwin_example inwin_example.c `pkg-config --cflags --libs elementary`
4 #include <Elementary.h>
6 # include "elementary_config.h"
11 static Evas_Object *inwin = NULL;
12 static const char *styles[] = {
17 static int current_style = 0;
20 _inwin_hide(void *data __UNUSED__, Evas_Object *obj, void *event __UNUSED__)
24 evas_object_hide(inwin);
27 elm_object_text_set(obj, "No inwin!");
28 elm_object_disabled_set(obj, EINA_TRUE);
32 _inwin_destroy(void *data __UNUSED__, Evas_Object *obj, void *event __UNUSED__)
36 evas_object_del(inwin);
40 elm_object_text_set(obj, "No inwin!");
41 elm_object_disabled_set(obj, EINA_TRUE);
45 _btn_click_cb(void *data __UNUSED__, Evas_Object *obj, void *event __UNUSED__)
47 Evas_Object *o, *parent;
51 elm_win_inwin_activate(inwin);
55 parent = elm_object_top_widget_get(obj);
56 inwin = elm_win_inwin_add(parent);
57 elm_object_style_set(inwin, styles[current_style]);
58 evas_object_show(inwin);
60 current_style = (current_style + 1) % 3;
62 o = elm_box_add(parent);
63 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
64 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
65 elm_win_inwin_content_set(inwin, o);
68 o = elm_label_add(parent);
69 elm_object_text_set(o, "Click on the first button to hide the Inwin.<ps>"
70 "Second to destroy it<ps>");
73 elm_box_pack_end(elm_win_inwin_content_get(inwin), o);
75 o = elm_button_add(parent);
76 elm_object_text_set(o, "Hide");
79 evas_object_smart_callback_add(o, "clicked", _inwin_hide, NULL);
81 elm_box_pack_end(elm_win_inwin_content_get(inwin), o);
83 o = elm_button_add(parent);
84 elm_object_text_set(o, "Destroy");
87 evas_object_smart_callback_add(o, "clicked", _inwin_destroy, NULL);
89 elm_box_pack_end(elm_win_inwin_content_get(inwin), o);
93 _win_del_cb(void *data __UNUSED__, Evas_Object *obj, void *event __UNUSED__)
97 Evas_Object *hover, *o = elm_win_inwin_content_unset(inwin);
98 evas_object_del(inwin);
100 hover = elm_hover_add(obj);
101 elm_hover_target_set(hover, obj);
102 elm_object_part_content_set(hover, "middle", o);
103 evas_object_show(hover);
106 evas_object_del(obj);
110 _screenshot_hack_cb(void *data)
112 _btn_click_cb(NULL, data, NULL);
117 elm_main(int argc __UNUSED__, char *argv[] __UNUSED__)
119 Evas_Object *win, *bg, *box, *o;
121 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
123 win = elm_win_add(NULL, "inwin-example", ELM_WIN_BASIC);
124 elm_win_title_set(win, "Inwin Example");
125 evas_object_resize(win, 400, 400);
126 evas_object_show(win);
128 evas_object_smart_callback_add(win, "delete,request", _win_del_cb, NULL);
130 bg = elm_bg_add(win);
131 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
132 elm_win_resize_object_add(win, bg);
133 evas_object_show(bg);
135 box = elm_box_add(win);
136 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
137 elm_win_resize_object_add(win, box);
138 evas_object_show(box);
140 o = elm_button_add(win);
141 elm_object_text_set(o, "Inwin!");
142 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
143 evas_object_size_hint_align_set(o, 0.0, 0.0);
144 elm_box_pack_end(box, o);
147 evas_object_smart_callback_add(o, "clicked", _btn_click_cb, NULL);
149 if (!strncmp(elm_engine_get(), "shot", 4))
150 ecore_timer_add(0.1, _screenshot_hack_cb, o);