summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYeongJong Lee <yj34.lee@samsung.com>2018-02-26 19:59:31 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2018-02-26 19:59:31 +0900
commite25bd086c5078f52faf274b56452d05cfaec05ba (patch)
tree069a7b22c25772005b35f114638b7ba576c5511b
parentc422359d2efbfed4e6d4e19434d33e9381e023cc (diff)
efl.ui.radio: change signal name for icon/text
Summary: see also 73f8b3b78f0ff92ddfc1c16426bf7c176f10293a Test Plan: 1. elementary_test -to radio 2. check that icon is visible Reviewers: cedric, woohyun, Jaehyun_Cho Reviewed By: Jaehyun_Cho Differential Revision: https://phab.enlightenment.org/D5815
-rw-r--r--data/elementary/themes/edc/efl/radio.edc291
-rw-r--r--src/Makefile_Elementary.am1
-rw-r--r--src/lib/elementary/efl_ui_radio.c104
-rw-r--r--src/lib/elementary/efl_ui_radio_legacy.eo3
-rw-r--r--src/lib/elementary/efl_ui_radio_legacy_part.eo8
5 files changed, 383 insertions, 24 deletions
diff --git a/data/elementary/themes/edc/efl/radio.edc b/data/elementary/themes/edc/efl/radio.edc
index 5c6dc64aa3..8e2ccf3b63 100644
--- a/data/elementary/themes/edc/efl/radio.edc
+++ b/data/elementary/themes/edc/efl/radio.edc
@@ -1,3 +1,292 @@
1group { "efl/radio"; 1group { "efl/radio";
2 inherit: "elm/radio/base/default"; 2 images.image: "inset_shadow_circle_tiny.png" COMP;
3 images.image: "inset_circle_tiny.png" COMP;
4 images.image: "sym_radio_alum.png" COMP;
5#define ICON 1
6#define LABEL 2
7#define MASK 3
8#define DISABLE 4
9 script {
10 public btmode;
11 public eval_mode(m) {
12 new m1 = m & MASK;
13 new d = m & DISABLE;
14 if (m1 == (ICON | LABEL)) {
15 if (!d) {
16 set_state(PART:"elm.swallow.content", "visible", 0.0);
17 set_state(PART:"sizer.content", "visible", 0.0);
18 set_state(PART:"elm.text", "visible", 0.0);
19 set_state(PART:"inset", "default", 0.0);
20 set_state(PART:"clip", "default", 0.0);
21 set_state(PART:"event", "default", 0.0);
22 } else {
23 set_state(PART:"elm.swallow.content", "visible", 0.0);
24 set_state(PART:"sizer.content", "visible", 0.0);
25 set_state(PART:"elm.text", "disabled_visible", 0.0);
26 set_state(PART:"inset", "disabled", 0.0);
27 set_state(PART:"clip", "disabled", 0.0);
28 set_state(PART:"event", "disabled", 0.0);
29 }
30 } else if (m1 == (ICON)) {
31 if (!d) {
32 set_state(PART:"elm.swallow.content", "visible", 0.0);
33 set_state(PART:"sizer.content", "icononly", 0.0);
34 set_state(PART:"elm.text", "default", 0.0);
35 set_state(PART:"inset", "default", 0.0);
36 set_state(PART:"clip", "default", 0.0);
37 set_state(PART:"event", "default", 0.0);
38 } else {
39 set_state(PART:"elm.swallow.content", "visible", 0.0);
40 set_state(PART:"sizer.content", "icononly", 0.0);
41 set_state(PART:"elm.text", "disabled", 0.0);
42 set_state(PART:"inset", "disabled", 0.0);
43 set_state(PART:"clip", "disabled", 0.0);
44 set_state(PART:"event", "disabled", 0.0);
45 }
46 } else if (m1 == (LABEL)) {
47 if (!d) {
48 set_state(PART:"elm.swallow.content", "default", 0.0);
49 set_state(PART:"sizer.content", "default", 0.0);
50 set_state(PART:"elm.text", "visible", 0.0);
51 set_state(PART:"inset", "default", 0.0);
52 set_state(PART:"clip", "default", 0.0);
53 set_state(PART:"event", "default", 0.0);
54 } else {
55 set_state(PART:"elm.swallow.content", "default", 0.0);
56 set_state(PART:"sizer.content", "default", 0.0);
57 set_state(PART:"elm.text", "disabled_visible", 0.0);
58 set_state(PART:"inset", "disabled", 0.0);
59 set_state(PART:"clip", "disabled", 0.0);
60 set_state(PART:"event", "disabled", 0.0);
61 }
62 } else {
63 if (!d) {
64 set_state(PART:"elm.swallow.content", "default", 0.0);
65 set_state(PART:"sizer.content", "default", 0.0);
66 set_state(PART:"elm.text", "default", 0.0);
67 set_state(PART:"inset", "default", 0.0);
68 set_state(PART:"clip", "default", 0.0);
69 set_state(PART:"event", "default", 0.0);
70 } else {
71 set_state(PART:"elm.swallow.content", "default", 0.0);
72 set_state(PART:"sizer.content", "default", 0.0);
73 set_state(PART:"elm.text", "default", 0.0);
74 set_state(PART:"inset", "disabled", 0.0);
75 set_state(PART:"clip", "disabled", 0.0);
76 set_state(PART:"event", "disabled", 0.0);
77 }
78 }
79 }
80 }
81 parts {
82 part { name: "inset"; mouse_events: 0;
83 scale: 1;
84 description { state: "default" 0.0;
85 rel1.offset: 2 2;
86 rel2.relative: 0.0 1.0;
87 rel2.offset: 2 -3;
88 image.normal: "inset_shadow_circle_tiny.png";
89 align: 0.0 0.5;
90 min: 13 13;
91 max: 13 13;
92 fixed: 1 0;
93 }
94 description { state: "disabled" 0.0;
95 inherit: "default" 0.0;
96 image.normal: "inset_circle_tiny.png";
97 }
98 }
99 part { name: "indicator"; mouse_events: 0;
100 scale: 1;
101 clip_to: "clip";
102 description { state: "default" 0.0;
103 rel1.to: "inset";
104 rel2.to: "inset";
105 image.normal: "sym_radio_alum.png";
106 min: 11 11;
107 max: 11 11;
108 visible: 0;
109 }
110 description { state: "selected" 0.0;
111 inherit: "default" 0.0;
112 visible: 1;
113 }
114 }
115 part { name: "clip"; type: RECT;
116 description { state: "default" 0.0;
117 }
118 description { state: "disabled" 0.0;
119 inherit: "default" 0.0;
120 color: 255 255 255 64;
121 }
122 }
123 part { name: "elm.swallow.content"; type: SWALLOW;
124 required;
125 scale: 1;
126 clip_to: "clip";
127 description { state: "default" 0.0;
128 fixed: 1 0;
129 visible: 0;
130 align: 0.0 0.5;
131 max: 0 0;
132 rel1.to_x: "inset";
133 rel1.relative: 1.0 0.0;
134 rel1.offset: 1 1;
135 rel2.to_x: "inset";
136 rel2.offset: 1 -2;
137 rel2.relative: 1.0 1.0;
138 }
139 description { state: "visible" 0.0;
140 inherit: "default" 0.0;
141 visible: 1;
142 aspect: 1.0 1.0;
143 min: 16 16;
144 }
145 }
146 part { name: "sizer.content"; type: TEXT; mouse_events: 0;
147 scale: 1;
148 description { state: "default" 0.0;
149 fixed: 1 1;
150 visible: 0;
151 text { font: FN; size: 10;
152 min: 0 0;
153 text_class: "radio_text";
154 }
155 }
156 description { state: "visible" 0.0;
157 inherit: "default" 0.0;
158 rel1.to: "elm.swallow.content";
159 rel2.to: "elm.swallow.content";
160 text {
161 min: 1 1;
162 ellipsis: -1;
163 text: "M";
164 }
165 }
166 description { state: "icononly" 0.0;
167 inherit: "default" 0.0;
168 rel1.to: "elm.swallow.content";
169 rel2.to: "elm.swallow.content";
170 text {
171 min: 1 1;
172 ellipsis: -1;
173 text: "M";
174 }
175 }
176 }
177 part { name: "elm.text"; type: TEXT; mouse_events: 0;
178 effect: SHADOW BOTTOM;
179 scale: 1;
180 required;
181 description { state: "default" 0.0;
182 rel1.offset: 2 2;
183 rel1.to_x: "elm.swallow.content";
184 rel1.relative: 1.0 0.0;
185 rel2.offset: -3 -3;
186 color: FN_COL_DEFAULT;
187 color_class: "radio_text";
188 text { font: FN; size: 10;
189 min: 0 0;
190 align: 0.0 0.5;
191 text_class: "radio";
192 }
193 }
194 description { state: "disabled" 0.0;
195 inherit: "default" 0.0;
196 color_class: "radio_text_disabled";
197 color3: 255 255 255 255;
198 }
199 description { state: "visible" 0.0;
200 inherit: "default" 0.0;
201 visible: 1;
202 text.min: 1 1;
203 text.ellipsis: -1;
204 }
205 description { state: "disabled_visible" 0.0;
206 inherit: "default" 0.0;
207 color_class: "radio_text_disabled";
208 color3: 255 255 255 255;
209 visible: 1;
210 text.min: 1 1;
211 text.ellipsis: -1;
212 }
213 }
214 part { name: "event"; type: RECT;
215 description { state: "default" 0.0;
216 color: 0 0 0 0;
217 }
218 description { state: "disabled" 0.0;
219 inherit: "default" 0.0;
220 visible: 0;
221 }
222 }
223 }
224 programs {
225 program {
226 signal: "mouse,clicked,1"; source: "event";
227 action: SIGNAL_EMIT "elm,action,radio,toggle" "elm";
228 }
229 program {
230 signal: "elm,state,radio,on"; source: "elm";
231 action: STATE_SET "selected" 0.0;
232 target: "indicator";
233 }
234 program {
235 signal: "elm,state,radio,off"; source: "elm";
236 action: STATE_SET "default" 0.0;
237 target: "indicator";
238 }
239 program {
240 signal: "elm,state,elm.text,set"; source: "elm";
241 script {
242 new m = get_int(btmode);
243 m |= LABEL; set_int(btmode, m);
244 eval_mode(m);
245 }
246 }
247 program {
248 signal: "elm,state,elm.text,unset"; source: "elm";
249 script {
250 new m = get_int(btmode);
251 m &= ~LABEL; set_int(btmode, m);
252 eval_mode(m);
253 }
254 }
255 program {
256 signal: "elm,state,content,set"; source: "elm";
257 script {
258 new m = get_int(btmode);
259 m |= ICON; set_int(btmode, m);
260 eval_mode(m);
261 }
262 }
263 program {
264 signal: "elm,state,content,unset"; source: "elm";
265 script {
266 new m = get_int(btmode);
267 m &= ~ICON; set_int(btmode, m);
268 eval_mode(m);
269 }
270 }
271 program {
272 signal: "elm,state,disabled"; source: "elm";
273 script {
274 new m = get_int(btmode);
275 m |= DISABLE; set_int(btmode, m);
276 eval_mode(m);
277 }
278 }
279 program {
280 signal: "elm,state,enabled"; source: "elm";
281 script {
282 new m = get_int(btmode);
283 m &= ~DISABLE; set_int(btmode, m);
284 eval_mode(m);
285 }
286 }
287 }
288#undef ICON
289#undef LABEL
290#undef MASK
291#undef DISABLE
3} 292}
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index 2728e7830d..8cdc38478b 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -107,6 +107,7 @@ elm_public_eolian_files = \
107elm_public_eolian_files += \ 107elm_public_eolian_files += \
108 lib/elementary/efl_ui_legacy.eo \ 108 lib/elementary/efl_ui_legacy.eo \
109 lib/elementary/efl_ui_button_legacy_part.eo \ 109 lib/elementary/efl_ui_button_legacy_part.eo \
110 lib/elementary/efl_ui_radio_legacy_part.eo \
110 lib/elementary/elm_spinner.eo \ 111 lib/elementary/elm_spinner.eo \
111 lib/elementary/elm_multibuttonentry_item.eo \ 112 lib/elementary/elm_multibuttonentry_item.eo \
112 lib/elementary/elm_interface_scrollable.eo \ 113 lib/elementary/elm_interface_scrollable.eo \
diff --git a/src/lib/elementary/efl_ui_radio.c b/src/lib/elementary/efl_ui_radio.c
index 0a49b3c5fc..5cae7ec113 100644
--- a/src/lib/elementary/efl_ui_radio.c
+++ b/src/lib/elementary/efl_ui_radio.c
@@ -130,24 +130,6 @@ _key_action_activate(Evas_Object *obj, const char *params EINA_UNUSED)
130 return EINA_TRUE; 130 return EINA_TRUE;
131} 131}
132 132
133/* FIXME: replicated from elm_layout just because radio's icon spot
134 * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we
135 * can changed the theme API */
136static void
137_icon_signal_emit(Evas_Object *obj)
138{
139 char buf[64];
140 Eo *edje;
141
142 edje = elm_widget_resize_object_get(obj);
143 if (!edje) return;
144 snprintf(buf, sizeof(buf), "elm,state,icon,%s",
145 elm_layout_content_get(obj, "icon") ? "visible" : "hidden");
146
147 elm_layout_signal_emit(obj, buf, "elm");
148 edje_object_message_signal_process(edje);
149}
150
151EOLIAN static Efl_Ui_Theme_Apply 133EOLIAN static Efl_Ui_Theme_Apply
152_efl_ui_radio_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Radio_Data *sd) 134_efl_ui_radio_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Radio_Data *sd)
153{ 135{
@@ -161,11 +143,6 @@ _efl_ui_radio_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Radio_Data *sd)
161 143
162 edje_object_message_signal_process(wd->resize_obj); 144 edje_object_message_signal_process(wd->resize_obj);
163 145
164 /* FIXME: replicated from elm_layout just because radio's icon
165 * spot is elm.swallow.content, not elm.swallow.icon. Fix that
166 * whenever we can changed the theme API */
167 _icon_signal_emit(obj);
168
169 elm_layout_sizing_eval(obj); 146 elm_layout_sizing_eval(obj);
170 147
171 return int_ret; 148 return int_ret;
@@ -368,6 +345,7 @@ ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX)
368#include "efl_ui_radio.eo.c" 345#include "efl_ui_radio.eo.c"
369 346
370#include "efl_ui_radio_legacy.eo.h" 347#include "efl_ui_radio_legacy.eo.h"
348#include "efl_ui_radio_legacy_part.eo.h"
371 349
372#define MY_CLASS_NAME_LEGACY "elm_radio" 350#define MY_CLASS_NAME_LEGACY "elm_radio"
373/* Legacy APIs */ 351/* Legacy APIs */
@@ -386,6 +364,86 @@ _efl_ui_radio_legacy_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED)
386 return obj; 364 return obj;
387} 365}
388 366
367/* FIXME: replicated from elm_layout just because radio's icon spot
368 * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we
369 * can changed the theme API */
370static void
371_icon_signal_emit(Evas_Object *obj)
372{
373 char buf[63];
374 Eo *edje;
375
376 edje = elm_widget_resize_object_get(obj);
377 if (!edje) return;
378 snprintf(buf, sizeof(buf), "elm,state,icon,%s",
379 elm_layout_content_get(obj, "icon") ? "visible" : "hidden");
380
381 elm_layout_signal_emit(obj, buf, "elm");
382 edje_object_message_signal_process(edje);
383 elm_layout_sizing_eval(obj);
384}
385
386EOLIAN static Efl_Ui_Theme_Apply
387_efl_ui_radio_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED)
388{
389 Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED;
390 int_ret = efl_ui_widget_theme_apply(efl_super(obj, EFL_UI_RADIO_LEGACY_CLASS));
391 if (!int_ret) return EFL_UI_THEME_APPLY_FAILED;
392
393 /* FIXME: replicated from elm_layout just because radio's icon
394 * spot is elm.swallow.content, not elm.swallow.icon. Fix that
395 * whenever we can changed the theme API */
396 _icon_signal_emit(obj);
397
398 return int_ret;
399}
400
401/* FIXME: replicated from elm_layout just because radio's icon spot
402 * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we
403 * can changed the theme API */
404EOLIAN static Eina_Bool
405_efl_ui_radio_legacy_efl_ui_widget_widget_sub_object_del(Eo *obj, void *_pd EINA_UNUSED, Evas_Object *sobj)
406{
407 Eina_Bool int_ret = EINA_FALSE;
408
409 int_ret = elm_widget_sub_object_del(efl_super(obj, EFL_UI_RADIO_LEGACY_CLASS), sobj);
410 if (!int_ret) return EINA_FALSE;
411
412 _icon_signal_emit(obj);
413
414 return EINA_TRUE;
415}
416
417/* FIXME: replicated from elm_layout just because radio's icon spot
418 * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we
419 * can changed the theme API */
420static Eina_Bool
421_efl_ui_radio_legacy_content_set(Eo *obj, void *_pd EINA_UNUSED, const char *part, Evas_Object *content)
422{
423 Eina_Bool int_ret = EINA_FALSE;
424
425 int_ret = efl_content_set(efl_part(efl_super(obj, EFL_UI_RADIO_LEGACY_CLASS), part), content);
426 if (!int_ret) return EINA_FALSE;
427
428 _icon_signal_emit(obj);
429
430 return EINA_TRUE;
431}
432
433/* Efl.Part begin */
434
435static Eina_Bool
436_part_is_efl_ui_radio_legacy_part(const Eo *obj EINA_UNUSED, const char *part)
437{
438 return eina_streq(part, "elm.swallow.content");
439}
440
441ELM_PART_OVERRIDE_PARTIAL(efl_ui_radio_legacy, EFL_UI_RADIO_LEGACY, void, _part_is_efl_ui_radio_legacy_part)
442ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_radio_legacy, EFL_UI_RADIO_LEGACY, void)
443#include "efl_ui_radio_legacy_part.eo.c"
444
445/* Efl.Part end */
446
389EAPI Evas_Object * 447EAPI Evas_Object *
390elm_radio_add(Evas_Object *parent) 448elm_radio_add(Evas_Object *parent)
391{ 449{
diff --git a/src/lib/elementary/efl_ui_radio_legacy.eo b/src/lib/elementary/efl_ui_radio_legacy.eo
index da18c8a654..664929533b 100644
--- a/src/lib/elementary/efl_ui_radio_legacy.eo
+++ b/src/lib/elementary/efl_ui_radio_legacy.eo
@@ -5,5 +5,8 @@ class Efl.Ui.Radio_Legacy (Efl.Ui.Radio, Efl.Ui.Legacy)
5 implements { 5 implements {
6 class.constructor; 6 class.constructor;
7 Efl.Object.constructor; 7 Efl.Object.constructor;
8 Efl.Ui.Widget.theme_apply;
9 Efl.Ui.Widget.widget_sub_object_del;
10 Efl.Part.part;
8 } 11 }
9} 12}
diff --git a/src/lib/elementary/efl_ui_radio_legacy_part.eo b/src/lib/elementary/efl_ui_radio_legacy_part.eo
new file mode 100644
index 0000000000..a9882a824d
--- /dev/null
+++ b/src/lib/elementary/efl_ui_radio_legacy_part.eo
@@ -0,0 +1,8 @@
1class Efl.Ui.Radio_Legacy.Part (Efl.Ui.Layout.Part_Content)
2{
3 [[Elementary radio internal part class]]
4 data: null;
5 implements {
6 Efl.Content.content { set; }
7 }
8}