1 #include <Elementary.h>
4 # include "elementary_config.h"
6 #ifndef ELM_LIB_QUICKLAUNCH
10 # include "elementary_config.h"
12 # ifndef ELM_LIB_QUICKLAUNCH
18 typedef struct _Api_Data Api_Data;
22 unsigned int state; /* What state we are testing */
25 typedef struct _api_data api_data;
35 typedef enum _api_state api_state;
38 set_api_state(api_data *api)
40 Api_Data *dt = &api->data;
44 { /* Put all api-changes under switch */
45 case GRID_PACK_SET: /* 0 */
46 elm_grid_pack_set(dt->child, 5, 15, 60, 40);
49 case GRID_UNPACK: /* 1 */
50 elm_grid_unpack(dt->grid, dt->child);
51 evas_object_del(dt->child);
54 case GRID_SIZE: /* 2 */
55 elm_grid_size_get(dt->grid, &w, &h);
56 printf("size w=<%d> h=<%d>\n", w, h);
57 w = h = 100; /* grid size returns wrong values */
61 elm_grid_size_set(dt->grid, w, h);
64 case GRID_CLEAR: /* 3 */
65 elm_grid_clear(dt->grid, EINA_TRUE);
74 _api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__)
75 { /* Will add here a SWITCH command containing code to modify test-object */
76 /* in accordance a->state value. */
80 printf("clicked event on API Button: api_state=<%d>\n", a->state);
83 sprintf(str, "Next API function (%u)", a->state);
84 elm_object_text_set(obj, str);
85 elm_object_disabled_set(obj, a->state == API_STATE_LAST);
88 >>>>>>> remotes/origin/upstream
90 _ch_grid(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
94 elm_grid_pack_get(obj, &x, &y, &w, &h);
95 elm_grid_pack_set(obj, x - 1, y - 1, w + 2, h + 2);
101 _cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
106 >>>>>>> remotes/origin/upstream
108 test_grid(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
110 Evas_Object *win, *bg, *gd, *bt, *rc, *en;
112 win = elm_win_add(NULL, "grid", ELM_WIN_BASIC);
113 elm_win_title_set(win, "Grid");
114 elm_win_autodel_set(win, EINA_TRUE);
117 api_data *api = calloc(1, sizeof(api_data));
118 >>>>>>> remotes/origin/upstream
120 bg = elm_bg_add(win);
121 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
122 elm_win_resize_object_add(win, bg);
123 evas_object_show(bg);
126 evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api);
127 >>>>>>> remotes/origin/upstream
129 gd = elm_grid_add(win);
130 elm_grid_size_set(gd, 100, 100);
131 elm_win_resize_object_add(win, gd);
132 evas_object_size_hint_weight_set(gd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
136 >>>>>>> remotes/origin/upstream
137 evas_object_show(gd);
139 en = elm_entry_add(win);
140 elm_entry_scrollable_set(en, EINA_TRUE);
141 elm_object_text_set(en, "Entry text");
143 elm_entry_single_line_set(en, 1);
145 elm_entry_single_line_set(en, EINA_TRUE);
146 >>>>>>> remotes/origin/upstream
147 elm_grid_pack(gd, en, 50, 10, 40, 10);
148 evas_object_show(en);
150 en = elm_entry_add(win);
151 elm_entry_scrollable_set(en, EINA_TRUE);
152 elm_object_text_set(en, "Entry text 2");
154 elm_entry_single_line_set(en, 1);
156 elm_entry_single_line_set(en, EINA_TRUE);
157 >>>>>>> remotes/origin/upstream
158 elm_grid_pack(gd, en, 60, 20, 30, 10);
159 evas_object_show(en);
161 bt = elm_button_add(win);
164 elm_object_text_set(bt, "Next API function");
165 evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api);
166 elm_grid_pack(gd, bt, 30, 0, 40, 10);
167 elm_object_disabled_set(bt, api->state == API_STATE_LAST);
168 evas_object_show(bt);
170 bt = elm_button_add(win);
171 >>>>>>> remotes/origin/upstream
172 elm_object_text_set(bt, "Button");
173 elm_grid_pack(gd, bt, 0, 0, 20, 20);
174 evas_object_show(bt);
176 bt = elm_button_add(win);
177 elm_object_text_set(bt, "Button");
178 elm_grid_pack(gd, bt, 10, 10, 40, 20);
181 api->data.child = bt;
182 >>>>>>> remotes/origin/upstream
183 evas_object_show(bt);
185 bt = elm_button_add(win);
186 elm_object_text_set(bt, "Button");
187 elm_grid_pack(gd, bt, 10, 30, 20, 50);
188 evas_object_show(bt);
190 bt = elm_button_add(win);
191 elm_object_text_set(bt, "Button");
192 elm_grid_pack(gd, bt, 80, 80, 20, 20);
193 evas_object_show(bt);
195 bt = elm_button_add(win);
196 elm_object_text_set(bt, "Change");
197 elm_grid_pack(gd, bt, 40, 40, 20, 20);
198 evas_object_smart_callback_add(bt, "clicked", _ch_grid, gd);
199 evas_object_show(bt);
201 rc = evas_object_rectangle_add(evas_object_evas_get(win));
202 evas_object_color_set(rc, 128, 0, 0, 128);
203 elm_grid_pack(gd, rc, 40, 70, 20, 10);
204 evas_object_show(rc);
206 rc = evas_object_rectangle_add(evas_object_evas_get(win));
207 evas_object_color_set(rc, 0, 128, 0, 128);
208 elm_grid_pack(gd, rc, 60, 70, 10, 10);
209 evas_object_show(rc);
211 rc = evas_object_rectangle_add(evas_object_evas_get(win));
212 evas_object_color_set(rc, 0, 0, 128, 128);
213 elm_grid_pack(gd, rc, 40, 80, 10, 10);
214 evas_object_show(rc);
216 rc = evas_object_rectangle_add(evas_object_evas_get(win));
217 evas_object_color_set(rc, 128, 0, 128, 128);
218 elm_grid_pack(gd, rc, 50, 80, 10, 10);
219 evas_object_show(rc);
221 rc = evas_object_rectangle_add(evas_object_evas_get(win));
222 evas_object_color_set(rc, 128, 64, 0, 128);
223 elm_grid_pack(gd, rc, 60, 80, 10, 10);
224 evas_object_show(rc);
226 evas_object_resize(win, 480, 480);
227 evas_object_show(win);