summaryrefslogtreecommitdiff
path: root/src/bin/elementary/test_nstate.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/elementary/test_nstate.c')
-rw-r--r--src/bin/elementary/test_nstate.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/src/bin/elementary/test_nstate.c b/src/bin/elementary/test_nstate.c
index 98dcfd4269..ebc97d4f3c 100644
--- a/src/bin/elementary/test_nstate.c
+++ b/src/bin/elementary/test_nstate.c
@@ -4,16 +4,10 @@
4#include <Elementary.h> 4#include <Elementary.h>
5 5
6static void 6static void
7_state_changed_cb(void *d EINA_UNUSED, Evas_Object *o, void *ei EINA_UNUSED) 7_state_changed_cb(void *data EINA_UNUSED, const Efl_Event *ev)
8{ 8{
9 char buf[100]; 9 int val = efl_ui_nstate_value_get(ev->object);
10 int val; 10 efl_text_set(ev->object, eina_slstr_printf("nstate = %d", val));
11
12 val = efl_ui_nstate_value_get(o);
13
14 printf("nstate widget state: %d\n", val);
15 sprintf(buf, "nstate = %d", val);
16 elm_object_text_set(o, buf);
17} 11}
18 12
19void 13void
@@ -21,21 +15,19 @@ test_nstate(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
21{ 15{
22 Evas_Object *win, *bx, *nstate; 16 Evas_Object *win, *bx, *nstate;
23 17
24 win = elm_win_util_standard_add("nstate", "nstate"); 18 win = efl_add(EFL_UI_WIN_CLASS, NULL,
25 elm_win_autodel_set(win, EINA_TRUE); 19 efl_text_set(efl_added, "N-state widget"),
20 elm_win_autodel_set(efl_added, EINA_TRUE));
26 21
27 bx = elm_box_add(win); 22 bx = efl_add(EFL_UI_BOX_CLASS, win);
28 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 23 efl_content_set(win, bx);
29 elm_win_resize_object_add(win, bx);
30 evas_object_show(bx);
31 24
32 nstate = efl_add(EFL_UI_NSTATE_CLASS, win); 25 nstate = efl_add(EFL_UI_NSTATE_CLASS, win);
26 efl_event_callback_add(nstate, EFL_UI_NSTATE_EVENT_CHANGED,
27 _state_changed_cb, NULL);
33 efl_ui_nstate_count_set(nstate, 5); 28 efl_ui_nstate_count_set(nstate, 5);
34 elm_object_text_set(nstate, "nstate = 0"); 29 efl_text_set(nstate, "nstate = 0");
35 elm_box_pack_end(bx, nstate); 30 efl_pack(bx, nstate);
36 evas_object_smart_callback_add(nstate, "state,changed",
37 _state_changed_cb, NULL);
38 31
39 evas_object_resize(win, 100, 100); 32 efl_gfx_size_set(win, EINA_SIZE2D(120, 80));
40 evas_object_show(win);
41} 33}