summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorHosang Kim <hosang12.kim@samsung.com>2017-12-12 10:02:23 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-12-12 10:53:14 +0900
commit26272bf3a27dd79ffed194896d03f4af60f1b7bd (patch)
treede0591e6e4641e9876223af96e9ae442c219afbd /src/bin
parentac63a74d1dad0296773e3cca360850b3003bb161 (diff)
win: apply conformant features.
Summary: - implement indicator enable/disable - implement indicator type - add indicator swallow area to border.edc - add 'test win indicator' sample Test Plan: elementary_test -> win_indicator Reviewers: woohyun, cedric, jpeg Subscribers: taxi2se, jypark, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5418
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/elementary/test.c3
-rw-r--r--src/bin/elementary/test_win_indicator.c122
2 files changed, 125 insertions, 0 deletions
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c
index 05fb022d6b..577f600c91 100644
--- a/src/bin/elementary/test.c
+++ b/src/bin/elementary/test.c
@@ -307,6 +307,8 @@ void test_dnd_multi_features(void *data, Evas_Object *obj, void *event_info);
307void test_dnd_types(void *data, Evas_Object *obj, void *event_info); 307void test_dnd_types(void *data, Evas_Object *obj, void *event_info);
308void test_task_switcher(void *data, Evas_Object *obj, void *event_info); 308void test_task_switcher(void *data, Evas_Object *obj, void *event_info);
309void test_win_dialog(void *data, Evas_Object *obj, void *event_info); 309void test_win_dialog(void *data, Evas_Object *obj, void *event_info);
310void test_win_indicator(void *data, Evas_Object *obj, void *event_info);
311void test_win_modal(void *data, Evas_Object *obj, void *event_info);
310void test_win_modal(void *data, Evas_Object *obj, void *event_info); 312void test_win_modal(void *data, Evas_Object *obj, void *event_info);
311void test_box_disable(void *data, Evas_Object *obj, void *event_info); 313void test_box_disable(void *data, Evas_Object *obj, void *event_info);
312void test_layout_disable(void *data, Evas_Object *obj, void *event_info); 314void test_layout_disable(void *data, Evas_Object *obj, void *event_info);
@@ -748,6 +750,7 @@ add_tests:
748 ADD_TEST(NULL, "Window / Background", "Window Keygrab Set", test_win_keygrab); 750 ADD_TEST(NULL, "Window / Background", "Window Keygrab Set", test_win_keygrab);
749 ADD_TEST(NULL, "Window / Background", "Window Modal", test_win_modal); 751 ADD_TEST(NULL, "Window / Background", "Window Modal", test_win_modal);
750 ADD_TEST(NULL, "Window / Background", "Window Stack", test_win_stack); 752 ADD_TEST(NULL, "Window / Background", "Window Stack", test_win_stack);
753 ADD_TEST(NULL, "Window / Background", "Window Indicator", test_win_indicator);
751 ADD_TEST_EO(NULL, "Window / Background", "Efl.Ui.Win (Bg part)", test_bg_window); 754 ADD_TEST_EO(NULL, "Window / Background", "Efl.Ui.Win (Bg part)", test_bg_window);
752 ADD_TEST_EO(NULL, "Window / Background", "Efl.Ui.Bg", test_bg_scale_type); 755 ADD_TEST_EO(NULL, "Window / Background", "Efl.Ui.Bg", test_bg_scale_type);
753 756
diff --git a/src/bin/elementary/test_win_indicator.c b/src/bin/elementary/test_win_indicator.c
new file mode 100644
index 0000000000..d459a9eeab
--- /dev/null
+++ b/src/bin/elementary/test_win_indicator.c
@@ -0,0 +1,122 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4#include <Elementary.h>
5
6static void
7_changed_cb(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
8{
9 printf("Clock value is changed\n");
10}
11
12static Evas_Object *
13_create_indicator(void)
14{
15 const char *indi_name;
16
17 Eo *win = efl_add(EFL_UI_WIN_SOCKET_CLASS, NULL,
18 efl_text_set(efl_added, "indicator"),
19 efl_ui_win_autodel_set(efl_added, EINA_TRUE),
20 efl_ui_win_alpha_set(efl_added, EINA_TRUE));
21
22 if (!win)
23 {
24 printf("fail to create a portrait indicator window\n");
25 return NULL;
26 }
27
28 indi_name = "elm_indicator_portrait";
29
30 if (!efl_ui_win_socket_listen(win, indi_name, 0, EINA_FALSE))
31 {
32 printf("failed to listen portrait window socket.\n");
33 efl_del(win);
34 return NULL;
35 }
36
37 Eo *bx = efl_add(EFL_UI_BOX_CLASS, win,
38 efl_content_set(win, efl_added));
39
40 efl_add(EFL_UI_CLOCK_CLASS, bx,
41 efl_gfx_size_hint_weight_set(efl_added, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
42 efl_gfx_size_hint_align_set(efl_added, 0.5, 0.5),
43 efl_ui_clock_field_visible_set(efl_added, EFL_UI_CLOCK_TYPE_HOUR, EINA_FALSE),
44 efl_ui_clock_field_visible_set(efl_added, EFL_UI_CLOCK_TYPE_MINUTE, EINA_FALSE),
45 efl_ui_clock_field_visible_set(efl_added, EFL_UI_CLOCK_TYPE_AMPM, EINA_FALSE),
46 efl_ui_clock_field_visible_set(efl_added, EFL_UI_CLOCK_TYPE_SECOND, EINA_FALSE),
47 efl_ui_clock_field_visible_set(efl_added, EFL_UI_CLOCK_TYPE_DAY, EINA_FALSE),
48 efl_ui_clock_pause_set(efl_added, EINA_TRUE),
49 efl_event_callback_add(efl_added, EFL_UI_CLOCK_EVENT_CHANGED, _changed_cb, NULL),
50 efl_pack(bx, efl_added));
51
52 efl_gfx_size_set(win, EINA_SIZE2D(300, 30));
53 return win;
54}
55
56static void
57_off_clicked(void *data, const Efl_Event *ev EINA_UNUSED)
58{
59 efl_ui_win_indicator_mode_set(data, EFL_UI_WIN_INDICATOR_OFF);
60}
61
62static void
63_opaque_clicked(void *data, const Efl_Event *ev EINA_UNUSED)
64{
65 efl_ui_win_indicator_mode_set(data, EFL_UI_WIN_INDICATOR_BG_OPAQUE);
66}
67
68static void
69_transparent_clicked(void *data, const Efl_Event *ev EINA_UNUSED)
70{
71 efl_ui_win_indicator_mode_set(data, EFL_UI_WIN_INDICATOR_BG_TRANSPARENT);
72}
73
74static void
75_hidden_clicked(void *data, const Efl_Event *ev EINA_UNUSED)
76{
77 efl_ui_win_indicator_mode_set(data, EFL_UI_WIN_INDICATOR_HIDDEN);
78}
79
80static void
81_win_del(void *data, const Efl_Event *ev EINA_UNUSED)
82{
83 efl_del(data);
84}
85
86void
87test_win_indicator(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
88{
89 Eo *win, *indicator;
90
91 indicator = _create_indicator();
92
93 // FIXME: Resizing window should no cause sizing issues!
94 win = efl_add(EFL_UI_WIN_CLASS, NULL,
95 efl_ui_win_type_set(efl_added, EFL_UI_WIN_BASIC),
96 efl_text_set(efl_added, "Efl.Win.Indicator"),
97 efl_gfx_size_hint_max_set(efl_added, EINA_SIZE2D(300, -1)),
98 efl_ui_win_autodel_set(efl_added, EINA_TRUE));
99 efl_event_callback_add(win, EFL_EVENT_DEL, _win_del, indicator);
100 efl_gfx_size_set(win, EINA_SIZE2D(300, 360));
101
102 Eo *bx = efl_add(EFL_UI_BOX_CLASS, win,
103 efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(300, 0)),
104 efl_content_set(win, efl_added));
105
106 efl_add(EFL_UI_BUTTON_CLASS, win,
107 efl_text_set(efl_added, "Indicator Off"),
108 efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _off_clicked, win),
109 efl_pack(bx, efl_added));
110 efl_add(EFL_UI_BUTTON_CLASS, win,
111 efl_text_set(efl_added, "Bg Opaque"),
112 efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _opaque_clicked, win),
113 efl_pack(bx, efl_added));
114 efl_add(EFL_UI_BUTTON_CLASS, win,
115 efl_text_set(efl_added, "Bg Transparent"),
116 efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _transparent_clicked, win),
117 efl_pack(bx, efl_added));
118 efl_add(EFL_UI_BUTTON_CLASS, win,
119 efl_text_set(efl_added, "Hidden"),
120 efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _hidden_clicked, win),
121 efl_pack(bx, efl_added));
122}