Elm button: Fix the tests to use the new elm_object_text_set/get API.
[framework/uifw/elementary.git] / src / bin / test_panes.c
1 #include <Elementary.h>
2 #ifdef HAVE_CONFIG_H
3 # include "elementary_config.h"
4 #endif
5 #ifndef ELM_LIB_QUICKLAUNCH
6
7 static double size = 0.0;
8
9 static void
10 _press(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
11 {
12     printf("press\n");
13 }
14
15 static void
16 _unpress(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
17 {
18     printf("unpress, size : %f\n", elm_panes_content_left_size_get(obj));
19 }
20
21 static void
22 _clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
23 {
24     printf("clicked\n");
25 }
26
27
28 static void
29 _clicked_double(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
30 {
31     printf("clicked double\n");
32     if(elm_panes_content_left_size_get(obj) > 0)
33     {
34         size = elm_panes_content_left_size_get(obj);
35         elm_panes_content_left_size_set(obj, 0.0);
36     }
37     else
38         elm_panes_content_left_size_set(obj, size);
39 }
40
41
42 void
43 test_panes(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
44 {
45    Evas_Object *win, *bg, *panes, *panes_h, *bt;
46
47    win = elm_win_add(NULL, "panes", ELM_WIN_BASIC);
48    elm_win_title_set(win, "Panes");
49    elm_win_autodel_set(win, 1);
50
51    bg = elm_bg_add(win);
52    elm_win_resize_object_add(win, bg);
53    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
54    elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
55    evas_object_show(bg);
56
57    panes = elm_panes_add(win);
58    elm_win_resize_object_add(win, panes);
59    evas_object_size_hint_weight_set(panes, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
60    evas_object_size_hint_align_set(panes, EVAS_HINT_FILL, EVAS_HINT_FILL);
61    evas_object_show(panes);
62
63    evas_object_smart_callback_add(panes, "clicked", _clicked, panes);
64    evas_object_smart_callback_add(panes, "clicked,double", _clicked_double, panes);
65
66    evas_object_smart_callback_add(panes, "press", _press, panes);
67    evas_object_smart_callback_add(panes, "unpress", _unpress, panes);
68
69
70    //
71    bt = elm_button_add(win);
72    elm_object_text_set(bt, "Left");
73    evas_object_size_hint_weight_set(bt, 1.0, 1.0);
74    evas_object_size_hint_align_set(bt, -1.0, -1.0);
75    evas_object_show(bt);
76    elm_panes_content_left_set(panes, bt);
77    //
78
79    //
80    panes_h = elm_panes_add(win);
81    elm_panes_horizontal_set(panes_h, EINA_TRUE);
82    evas_object_size_hint_weight_set(panes_h, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
83    evas_object_size_hint_align_set(panes_h, EVAS_HINT_FILL, EVAS_HINT_FILL);
84    evas_object_show(panes_h);
85
86    evas_object_smart_callback_add(panes_h, "clicked", _clicked, panes_h);
87    evas_object_smart_callback_add(panes_h, "clicked,double", _clicked_double, panes_h);
88
89    evas_object_smart_callback_add(panes_h, "press", _press, panes_h);
90    evas_object_smart_callback_add(panes_h, "unpress", _unpress, panes_h);
91    elm_panes_content_right_set(panes, panes_h);
92    //
93
94    //
95    bt = elm_button_add(win);
96    elm_object_text_set(bt, "Up");
97    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
98    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
99    evas_object_show(bt);
100    elm_panes_content_left_set(panes_h, bt);
101    //
102
103    //
104    bt = elm_button_add(win);
105    elm_object_text_set(bt, "Down");
106    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
107    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
108    evas_object_show(bt);
109    elm_panes_content_right_set(panes_h, bt);
110    //
111
112
113    evas_object_resize(win, 320, 400);
114    evas_object_show(win);
115 }
116
117
118 #endif