summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/elementary/test_bg.c11
-rw-r--r--src/lib/elementary/efl_ui_bg.c53
-rw-r--r--src/lib/elementary/efl_ui_bg.eo3
3 files changed, 43 insertions, 24 deletions
diff --git a/src/bin/elementary/test_bg.c b/src/bin/elementary/test_bg.c
index 5ebf59f..7ec6fe6 100644
--- a/src/bin/elementary/test_bg.c
+++ b/src/bin/elementary/test_bg.c
@@ -382,11 +382,16 @@ static void
382_cb_check_changed_scale_type(void *data, const Efl_Event *ev) 382_cb_check_changed_scale_type(void *data, const Efl_Event *ev)
383{ 383{
384 Evas_Object *o_bg = data; 384 Evas_Object *o_bg = data;
385 int r, g, b, a;
385 386
386 if (efl_ui_check_selected_get(ev->object)) 387 if (efl_ui_check_selected_get(ev->object))
387 efl_gfx_color_set(o_bg, 255, 128, 128, 255); 388 efl_gfx_color_set(o_bg, 255, 128, 128, 255);
388 else 389 else
389 efl_gfx_color_set(o_bg, 0, 0, 0, 0); 390 efl_gfx_color_set(o_bg, 0, 0, 0, 0);
391
392 efl_gfx_color_get(o_bg, &r, &g, &b, &a);
393 printf("bg color: %d %d %d %d\n", r, g, b, a);
394 fflush(stdout);
390} 395}
391 396
392void 397void
@@ -431,7 +436,7 @@ test_bg_scale_type(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
431 efl_gfx_size_hint_weight_set(efl_added, EFL_GFX_SIZE_HINT_EXPAND, 0.0), 436 efl_gfx_size_hint_weight_set(efl_added, EFL_GFX_SIZE_HINT_EXPAND, 0.0),
432 efl_event_callback_add(efl_added, EFL_UI_RADIO_EVENT_CHANGED, _cb_radio_changed_scale_type, o_bg), 437 efl_event_callback_add(efl_added, EFL_UI_RADIO_EVENT_CHANGED, _cb_radio_changed_scale_type, o_bg),
433 efl_pack(hbox, efl_added)); 438 efl_pack(hbox, efl_added));
434 439
435 rd = efl_add(EFL_UI_RADIO_CLASS, hbox, 440 rd = efl_add(EFL_UI_RADIO_CLASS, hbox,
436 efl_ui_radio_state_value_set(efl_added, EFL_UI_IMAGE_SCALE_TYPE_FIT_INSIDE), 441 efl_ui_radio_state_value_set(efl_added, EFL_UI_IMAGE_SCALE_TYPE_FIT_INSIDE),
437 efl_ui_radio_group_add(efl_added, rdg), 442 efl_ui_radio_group_add(efl_added, rdg),
@@ -440,7 +445,7 @@ test_bg_scale_type(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
440 efl_event_callback_add(efl_added, EFL_UI_RADIO_EVENT_CHANGED, _cb_radio_changed_scale_type, o_bg), 445 efl_event_callback_add(efl_added, EFL_UI_RADIO_EVENT_CHANGED, _cb_radio_changed_scale_type, o_bg),
441 efl_pack(hbox, efl_added)); 446 efl_pack(hbox, efl_added));
442 447
443 448
444 rd = efl_add(EFL_UI_RADIO_CLASS, hbox, 449 rd = efl_add(EFL_UI_RADIO_CLASS, hbox,
445 efl_ui_radio_state_value_set(efl_added, EFL_UI_IMAGE_SCALE_TYPE_FIT_OUTSIDE), 450 efl_ui_radio_state_value_set(efl_added, EFL_UI_IMAGE_SCALE_TYPE_FIT_OUTSIDE),
446 efl_ui_radio_group_add(efl_added, rdg), 451 efl_ui_radio_group_add(efl_added, rdg),
@@ -448,7 +453,7 @@ test_bg_scale_type(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
448 efl_gfx_size_hint_weight_set(efl_added, EFL_GFX_SIZE_HINT_EXPAND, 0.0), 453 efl_gfx_size_hint_weight_set(efl_added, EFL_GFX_SIZE_HINT_EXPAND, 0.0),
449 efl_event_callback_add(efl_added, EFL_UI_RADIO_EVENT_CHANGED, _cb_radio_changed_scale_type, o_bg), 454 efl_event_callback_add(efl_added, EFL_UI_RADIO_EVENT_CHANGED, _cb_radio_changed_scale_type, o_bg),
450 efl_pack(hbox, efl_added)); 455 efl_pack(hbox, efl_added));
451 456
452 rd = efl_add(EFL_UI_RADIO_CLASS, hbox, 457 rd = efl_add(EFL_UI_RADIO_CLASS, hbox,
453 efl_ui_radio_state_value_set(efl_added, EFL_UI_IMAGE_SCALE_TYPE_NONE), 458 efl_ui_radio_state_value_set(efl_added, EFL_UI_IMAGE_SCALE_TYPE_NONE),
454 efl_ui_radio_group_add(efl_added, rdg), 459 efl_ui_radio_group_add(efl_added, rdg),
diff --git a/src/lib/elementary/efl_ui_bg.c b/src/lib/elementary/efl_ui_bg.c
index a3838b7..3a38c4a 100644
--- a/src/lib/elementary/efl_ui_bg.c
+++ b/src/lib/elementary/efl_ui_bg.c
@@ -98,6 +98,9 @@ EOLIAN static void
98_efl_ui_bg_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Bg_Data *priv) 98_efl_ui_bg_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Bg_Data *priv)
99{ 99{
100 100
101 priv->rect = evas_object_rectangle_add(evas_object_evas_get(obj));
102 evas_object_color_set(priv->rect, 0, 0, 0, 0);
103
101 efl_canvas_group_add(efl_super(obj, MY_CLASS)); 104 efl_canvas_group_add(efl_super(obj, MY_CLASS));
102 elm_widget_sub_object_parent_add(obj); 105 elm_widget_sub_object_parent_add(obj);
103 elm_widget_can_focus_set(obj, EINA_FALSE); 106 elm_widget_can_focus_set(obj, EINA_FALSE);
@@ -108,6 +111,7 @@ _efl_ui_bg_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Bg_Data *priv)
108 111
109 if (!elm_layout_theme_set(obj, "bg", "base", elm_widget_style_get(obj))) 112 if (!elm_layout_theme_set(obj, "bg", "base", elm_widget_style_get(obj)))
110 CRI("Failed to set layout!"); 113 CRI("Failed to set layout!");
114 elm_layout_content_set(obj, "elm.swallow.rectangle", priv->rect);
111} 115}
112 116
113EAPI Evas_Object * 117EAPI Evas_Object *
@@ -129,6 +133,20 @@ _efl_ui_bg_efl_object_constructor(Eo *obj, Efl_Ui_Bg_Data *_pd EINA_UNUSED)
129 return obj; 133 return obj;
130} 134}
131 135
136/* FIXME: Efl.Canvas.group_member_add in Elm.Widget sets child's colors as the same
137 * with that of obj. The color of resize_obj of Bg should not be changed
138 * because actual color is the color of rectangle in resize_obj.
139 */
140EOLIAN static void
141_efl_ui_bg_efl_canvas_group_group_member_add(Eo *obj, Efl_Ui_Bg_Data *_pd EINA_UNUSED, Evas_Object *child)
142{
143 efl_canvas_group_member_add(efl_super(obj, MY_CLASS), child);
144 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
145
146 if (wd->resize_obj == child)
147 evas_object_color_set(child, 255, 255, 255, 255);
148}
149
132EOLIAN static Eina_Bool 150EOLIAN static Eina_Bool
133_efl_ui_bg_efl_file_file_set(Eo *obj, Efl_Ui_Bg_Data *sd, const char *file, const char *group) 151_efl_ui_bg_efl_file_file_set(Eo *obj, Efl_Ui_Bg_Data *sd, const char *file, const char *group)
134{ 152{
@@ -265,31 +283,20 @@ elm_bg_color_set(Evas_Object *obj,
265 int g, 283 int g,
266 int b) 284 int b)
267{ 285{
286 int a = 255;
268 EFL_UI_BG_CHECK(obj); 287 EFL_UI_BG_CHECK(obj);
269 efl_gfx_color_set(obj, r, g, b, 255);
270}
271
272EOLIAN static void
273_efl_ui_bg_efl_gfx_color_set(Eo *obj, Efl_Ui_Bg_Data *sd, int r, int g, int b, int a)
274{
275 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
276 288
277 // reset color 289 // reset color
278 if ((r == -1) && (g == -1) && (b == -1)) 290 if ((r == -1) && (g == -1) && (b == -1))
279 { 291 {
280 ELM_SAFE_FREE(sd->rect, evas_object_del); 292 r = g = b = a = 0;
281 return; 293 }
282 } 294 efl_gfx_color_set(obj, r, g, b, a);
283 295}
284 if (!sd->rect)
285 {
286 sd->rect = evas_object_rectangle_add
287 (evas_object_evas_get(wd->resize_obj));
288 efl_gfx_visible_set(sd->rect, EINA_TRUE);
289 elm_layout_content_set(obj, "elm.swallow.rectangle", sd->rect);
290 elm_layout_sizing_eval(obj);
291 }
292 296
297EOLIAN static void
298_efl_ui_bg_efl_gfx_color_set(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd, int r, int g, int b, int a)
299{
293 evas_object_color_set(sd->rect, r, g, b, a); 300 evas_object_color_set(sd->rect, r, g, b, a);
294} 301}
295 302
@@ -303,6 +310,12 @@ elm_bg_color_get(const Evas_Object *obj,
303 efl_gfx_color_get((Eo *) obj, r, g, b, NULL); 310 efl_gfx_color_get((Eo *) obj, r, g, b, NULL);
304} 311}
305 312
313EOLIAN static void
314_efl_ui_bg_efl_gfx_color_get(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd, int *r, int *g, int *b, int *a)
315{
316 evas_object_color_get(sd->rect, r, g, b, a);
317}
318
306EAPI void 319EAPI void
307elm_bg_load_size_set(Evas_Object *obj, int w, int h) 320elm_bg_load_size_set(Evas_Object *obj, int w, int h)
308{ 321{
diff --git a/src/lib/elementary/efl_ui_bg.eo b/src/lib/elementary/efl_ui_bg.eo
index 280fe4d..d6976da 100644
--- a/src/lib/elementary/efl_ui_bg.eo
+++ b/src/lib/elementary/efl_ui_bg.eo
@@ -10,8 +10,9 @@ class Efl.Ui.Bg (Efl.Ui.Layout, Efl.Ui.Image)
10 implements { 10 implements {
11 class.constructor; 11 class.constructor;
12 Efl.Object.constructor; 12 Efl.Object.constructor;
13 Efl.Canvas.Group.group_member_add;
13 Efl.File.file { get; set; } 14 Efl.File.file { get; set; }
14 Efl.Gfx.color { set; } 15 Efl.Gfx.color { get; set; }
15 Efl.Ui.Image.scale_type { get; set; } 16 Efl.Ui.Image.scale_type { get; set; }
16 } 17 }
17} 18}