summaryrefslogtreecommitdiff
path: root/src/lib/elementary
diff options
context:
space:
mode:
authorYeongjong Lee <yj34.lee@samsung.com>2019-10-02 12:04:12 +0200
committerXavi Artigas <xavierartigas@yahoo.es>2019-10-02 12:11:15 +0200
commitfa908800556d8e4be7ce8785e7b88123df89e0a5 (patch)
treee670516cca6f661e97d3684d04969bfd68c8cd67 /src/lib/elementary
parent7b4a58313b3ab6f8e5610e90c5a1153c7f27b1c5 (diff)
efl_gfx_arrangement: change content_padding param type and remove scalable
Summary: This change `content_padding` parameter type to int from double for consistency of size properties. `scalable` should be handled in more common size API. Co-authored-by: Mike Blumenkrantz <zmike@samsung.com> ref T7864 Test Plan: ninja test Reviewers: zmike Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T7864 Differential Revision: https://phab.enlightenment.org/D10154
Diffstat (limited to 'src/lib/elementary')
-rw-r--r--src/lib/elementary/efl_page_indicator_icon.c2
-rw-r--r--src/lib/elementary/efl_ui_box.c10
-rw-r--r--src/lib/elementary/efl_ui_box_private.h3
-rw-r--r--src/lib/elementary/efl_ui_container_layout.c6
-rw-r--r--src/lib/elementary/efl_ui_container_layout.h3
-rw-r--r--src/lib/elementary/efl_ui_spotlight_indicator_icon.c2
-rw-r--r--src/lib/elementary/efl_ui_table.c10
-rw-r--r--src/lib/elementary/efl_ui_table_private.h3
-rw-r--r--src/lib/elementary/efl_ui_tags.c16
9 files changed, 20 insertions, 35 deletions
diff --git a/src/lib/elementary/efl_page_indicator_icon.c b/src/lib/elementary/efl_page_indicator_icon.c
index 258b494..4a13db3 100644
--- a/src/lib/elementary/efl_page_indicator_icon.c
+++ b/src/lib/elementary/efl_page_indicator_icon.c
@@ -148,7 +148,7 @@ _efl_page_indicator_icon_efl_page_indicator_bind(Eo *obj,
148 if (spd->pager.obj) 148 if (spd->pager.obj)
149 { 149 {
150 efl_ui_layout_orientation_set(spd->idbox, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL); 150 efl_ui_layout_orientation_set(spd->idbox, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL);
151 efl_gfx_arrangement_content_padding_set(spd->idbox, 15, 15, EINA_TRUE); 151 efl_gfx_arrangement_content_padding_set(spd->idbox, 15, 15);
152 152
153 pd->v = eina_value_float_new(0.0); 153 pd->v = eina_value_float_new(0.0);
154 154
diff --git a/src/lib/elementary/efl_ui_box.c b/src/lib/elementary/efl_ui_box.c
index 3cee95c..7d97ec3 100644
--- a/src/lib/elementary/efl_ui_box.c
+++ b/src/lib/elementary/efl_ui_box.c
@@ -406,27 +406,23 @@ _efl_ui_box_efl_ui_layout_orientable_orientation_get(const Eo *obj EINA_UNUSED,
406} 406}
407 407
408EOLIAN static void 408EOLIAN static void
409_efl_ui_box_efl_gfx_arrangement_content_padding_set(Eo *obj, Efl_Ui_Box_Data *pd, double h, double v, Eina_Bool scalable) 409_efl_ui_box_efl_gfx_arrangement_content_padding_set(Eo *obj, Efl_Ui_Box_Data *pd, unsigned int h, unsigned int v)
410{ 410{
411 scalable = !!scalable;
412 if (h < 0) h = 0; 411 if (h < 0) h = 0;
413 if (v < 0) v = 0; 412 if (v < 0) v = 0;
414 413
415 if (EINA_DBL_EQ(pd->pad.h, h) && EINA_DBL_EQ(pd->pad.v, v) && 414 if (EINA_DBL_EQ(pd->pad.h, h) && EINA_DBL_EQ(pd->pad.v, v))
416 (pd->pad.scalable == scalable))
417 return; 415 return;
418 416
419 pd->pad.h = h; 417 pd->pad.h = h;
420 pd->pad.v = v; 418 pd->pad.v = v;
421 pd->pad.scalable = scalable;
422 419
423 efl_pack_layout_request(obj); 420 efl_pack_layout_request(obj);
424} 421}
425 422
426EOLIAN static void 423EOLIAN static void
427_efl_ui_box_efl_gfx_arrangement_content_padding_get(const Eo *obj EINA_UNUSED, Efl_Ui_Box_Data *pd, double *h, double *v, Eina_Bool *scalable) 424_efl_ui_box_efl_gfx_arrangement_content_padding_get(const Eo *obj EINA_UNUSED, Efl_Ui_Box_Data *pd, unsigned int *h, unsigned int *v)
428{ 425{
429 if (scalable) *scalable = pd->pad.scalable;
430 if (h) *h = pd->pad.h; 426 if (h) *h = pd->pad.h;
431 if (v) *v = pd->pad.v; 427 if (v) *v = pd->pad.v;
432} 428}
diff --git a/src/lib/elementary/efl_ui_box_private.h b/src/lib/elementary/efl_ui_box_private.h
index 4cb94c5..bc9fca1 100644
--- a/src/lib/elementary/efl_ui_box_private.h
+++ b/src/lib/elementary/efl_ui_box_private.h
@@ -19,8 +19,7 @@ struct _Efl_Ui_Box_Data
19 Eina_List *children; 19 Eina_List *children;
20 20
21 struct { 21 struct {
22 double h, v; 22 unsigned int h, v;
23 Eina_Bool scalable: 1;
24 } pad; 23 } pad;
25 24
26 struct { 25 struct {
diff --git a/src/lib/elementary/efl_ui_container_layout.c b/src/lib/elementary/efl_ui_container_layout.c
index 34a8bbb..60bdaa8 100644
--- a/src/lib/elementary/efl_ui_container_layout.c
+++ b/src/lib/elementary/efl_ui_container_layout.c
@@ -111,16 +111,12 @@ void
111_efl_ui_container_layout_init(Eo* obj, Efl_Ui_Container_Layout_Calc *calc) 111_efl_ui_container_layout_init(Eo* obj, Efl_Ui_Container_Layout_Calc *calc)
112{ 112{
113 Eina_Rect geom; 113 Eina_Rect geom;
114 Eina_Bool pad_scalable;
115 114
116 geom = efl_gfx_entity_geometry_get(obj); 115 geom = efl_gfx_entity_geometry_get(obj);
117 efl_gfx_hint_margin_get(obj, &calc[0].margin[0], &calc[0].margin[1], 116 efl_gfx_hint_margin_get(obj, &calc[0].margin[0], &calc[0].margin[1],
118 &calc[1].margin[0], &calc[1].margin[1]); 117 &calc[1].margin[0], &calc[1].margin[1]);
119 calc[0].scale = calc[1].scale = efl_gfx_entity_scale_get(obj);
120 118
121 efl_gfx_arrangement_content_padding_get(obj, &calc[0].pad, &calc[1].pad, &pad_scalable); 119 efl_gfx_arrangement_content_padding_get(obj, &calc[0].pad, &calc[1].pad);
122 calc[0].pad = pad_scalable ? (calc[0].pad * calc[0].scale) : calc[0].pad;
123 calc[1].pad = pad_scalable ? (calc[1].pad * calc[1].scale) : calc[1].pad;
124 120
125 // pack align is used if "no item has a weight" 121 // pack align is used if "no item has a weight"
126 efl_gfx_arrangement_content_align_get(obj, &calc[0].align, &calc[1].align); 122 efl_gfx_arrangement_content_align_get(obj, &calc[0].align, &calc[1].align);
diff --git a/src/lib/elementary/efl_ui_container_layout.h b/src/lib/elementary/efl_ui_container_layout.h
index 097abee..031dd30 100644
--- a/src/lib/elementary/efl_ui_container_layout.h
+++ b/src/lib/elementary/efl_ui_container_layout.h
@@ -30,8 +30,7 @@ struct _Efl_Ui_Container_Layout_Calc
30 int size; 30 int size;
31 int margin[2]; 31 int margin[2];
32 double align; 32 double align;
33 double scale; 33 unsigned int pad;
34 double pad;
35 Eina_Bool fill : 1; 34 Eina_Bool fill : 1;
36}; 35};
37 36
diff --git a/src/lib/elementary/efl_ui_spotlight_indicator_icon.c b/src/lib/elementary/efl_ui_spotlight_indicator_icon.c
index 2165ec9..c7bc2a3 100644
--- a/src/lib/elementary/efl_ui_spotlight_indicator_icon.c
+++ b/src/lib/elementary/efl_ui_spotlight_indicator_icon.c
@@ -81,7 +81,7 @@ _efl_ui_spotlight_indicator_icon_efl_ui_spotlight_indicator_bind(Eo *obj, Efl_Ui
81 efl_content_set(efl_part(pd->container, "efl.indicator"), pd->indicator); 81 efl_content_set(efl_part(pd->container, "efl.indicator"), pd->indicator);
82 efl_gfx_entity_visible_set(pd->indicator, EINA_TRUE); 82 efl_gfx_entity_visible_set(pd->indicator, EINA_TRUE);
83 efl_ui_layout_orientation_set(pd->indicator, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL); 83 efl_ui_layout_orientation_set(pd->indicator, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL);
84 efl_gfx_arrangement_content_padding_set(pd->indicator, 15, 15, EINA_TRUE); 84 efl_gfx_arrangement_content_padding_set(pd->indicator, 15, 15);
85 85
86 for (int i = 0; i < efl_content_count(pd->container); ++i) 86 for (int i = 0; i < efl_content_count(pd->container); ++i)
87 { 87 {
diff --git a/src/lib/elementary/efl_ui_table.c b/src/lib/elementary/efl_ui_table.c
index 865fc76..9e70116 100644
--- a/src/lib/elementary/efl_ui_table.c
+++ b/src/lib/elementary/efl_ui_table.c
@@ -267,27 +267,23 @@ _efl_ui_table_efl_object_invalidate(Eo *obj, Efl_Ui_Table_Data *pd)
267} 267}
268 268
269EOLIAN static void 269EOLIAN static void
270_efl_ui_table_efl_gfx_arrangement_content_padding_set(Eo *obj, Efl_Ui_Table_Data *pd, double h, double v, Eina_Bool scalable) 270_efl_ui_table_efl_gfx_arrangement_content_padding_set(Eo *obj, Efl_Ui_Table_Data *pd, unsigned int h, unsigned int v)
271{ 271{
272 scalable = !!scalable;
273 if (h < 0) h = 0; 272 if (h < 0) h = 0;
274 if (v < 0) v = 0; 273 if (v < 0) v = 0;
275 274
276 if (EINA_DBL_EQ(pd->pad.h, h) && EINA_DBL_EQ(pd->pad.v, v) && 275 if (EINA_DBL_EQ(pd->pad.h, h) && EINA_DBL_EQ(pd->pad.v, v))
277 (pd->pad.scalable == scalable))
278 return; 276 return;
279 277
280 pd->pad.h = h; 278 pd->pad.h = h;
281 pd->pad.v = v; 279 pd->pad.v = v;
282 pd->pad.scalable = scalable;
283 280
284 efl_pack_layout_request(obj); 281 efl_pack_layout_request(obj);
285} 282}
286 283
287EOLIAN static void 284EOLIAN static void
288_efl_ui_table_efl_gfx_arrangement_content_padding_get(const Eo *obj EINA_UNUSED, Efl_Ui_Table_Data *pd, double *h, double *v, Eina_Bool *scalable) 285_efl_ui_table_efl_gfx_arrangement_content_padding_get(const Eo *obj EINA_UNUSED, Efl_Ui_Table_Data *pd, unsigned int *h, unsigned int *v)
289{ 286{
290 if (scalable) *scalable = pd->pad.scalable;
291 if (h) *h = pd->pad.h; 287 if (h) *h = pd->pad.h;
292 if (v) *v = pd->pad.v; 288 if (v) *v = pd->pad.v;
293} 289}
diff --git a/src/lib/elementary/efl_ui_table_private.h b/src/lib/elementary/efl_ui_table_private.h
index 47d1cc4..5b24e04 100644
--- a/src/lib/elementary/efl_ui_table_private.h
+++ b/src/lib/elementary/efl_ui_table_private.h
@@ -38,8 +38,7 @@ struct _Efl_Ui_Table_Data
38 int last_col, last_row; // only used by pack api 38 int last_col, last_row; // only used by pack api
39 Efl_Ui_Layout_Orientation fill_dir; // direction in which cells are added when using pack() 39 Efl_Ui_Layout_Orientation fill_dir; // direction in which cells are added when using pack()
40 struct { 40 struct {
41 double h, v; 41 unsigned int h, v;
42 Eina_Bool scalable: 1;
43 } pad; 42 } pad;
44 struct { 43 struct {
45 double h, v; 44 double h, v;
diff --git a/src/lib/elementary/efl_ui_tags.c b/src/lib/elementary/efl_ui_tags.c
index b06e4a5..2a8fb84 100644
--- a/src/lib/elementary/efl_ui_tags.c
+++ b/src/lib/elementary/efl_ui_tags.c
@@ -50,10 +50,10 @@ _shrink_mode_set(Eo *obj,
50 if (shrink == EINA_TRUE) 50 if (shrink == EINA_TRUE)
51 { 51 {
52 Evas_Coord w = 0; 52 Evas_Coord w = 0;
53 double box_inner_item_width_padding = 0; 53 unsigned int box_inner_item_width_padding = 0;
54 Eina_Value val; 54 Eina_Value val;
55 55
56 efl_gfx_arrangement_content_padding_get(sd->box, &box_inner_item_width_padding, NULL, NULL); 56 efl_gfx_arrangement_content_padding_get(sd->box, &box_inner_item_width_padding, NULL);
57 // unpack all items and entry 57 // unpack all items and entry
58 efl_pack_unpack_all(sd->box); 58 efl_pack_unpack_all(sd->box);
59 EINA_LIST_FOREACH(sd->layouts, l, layout) 59 EINA_LIST_FOREACH(sd->layouts, l, layout)
@@ -69,7 +69,7 @@ _shrink_mode_set(Eo *obj,
69 Eina_Size2D label_min = 69 Eina_Size2D label_min =
70 efl_gfx_hint_size_combined_min_get(sd->label); 70 efl_gfx_hint_size_combined_min_get(sd->label);
71 w -= label_min.w; 71 w -= label_min.w;
72 w -= box_inner_item_width_padding; 72 w -= (Evas_Coord)box_inner_item_width_padding;
73 } 73 }
74 74
75 layout = NULL; 75 layout = NULL;
@@ -487,14 +487,14 @@ _box_resize_cb(void *data,
487 Eina_Rect r; 487 Eina_Rect r;
488 Eina_List *l; 488 Eina_List *l;
489 Eo *layout; 489 Eo *layout;
490 double hpad; 490 unsigned int hpad;
491 491
492 Efl_Ui_Tags_Data *sd = efl_data_scope_get(data, EFL_UI_TAGS_CLASS); 492 Efl_Ui_Tags_Data *sd = efl_data_scope_get(data, EFL_UI_TAGS_CLASS);
493 493
494 r = efl_gfx_entity_geometry_get(sd->box); 494 r = efl_gfx_entity_geometry_get(sd->box);
495 if ((r.w <= elm_config_finger_size_get()) || (r.h <= elm_config_finger_size_get())) return; 495 if ((r.w <= elm_config_finger_size_get()) || (r.h <= elm_config_finger_size_get())) return;
496 496
497 efl_gfx_arrangement_content_padding_get(obj, &hpad, NULL, NULL); 497 efl_gfx_arrangement_content_padding_get(obj, &hpad, NULL);
498 498
499 if (sd->h_box < r.h) 499 if (sd->h_box < r.h)
500 efl_event_callback_call 500 efl_event_callback_call
@@ -511,9 +511,9 @@ _box_resize_cb(void *data,
511 511
512 min = efl_gfx_hint_size_combined_min_get(layout); 512 min = efl_gfx_hint_size_combined_min_get(layout);
513 513
514 if (min.w > r.w - hpad) 514 if (min.w > r.w - (int)hpad)
515 { 515 {
516 min.w = r.w - hpad; 516 min.w = r.w - (int)hpad;
517 efl_gfx_hint_size_min_set(layout, EINA_SIZE2D(min.w, min.h)); 517 efl_gfx_hint_size_min_set(layout, EINA_SIZE2D(min.w, min.h));
518 efl_gfx_entity_size_set(layout, EINA_SIZE2D(min.w, min.h)); 518 efl_gfx_entity_size_set(layout, EINA_SIZE2D(min.w, min.h));
519 } 519 }
@@ -746,7 +746,7 @@ _view_init(Evas_Object *obj, Efl_Ui_Tags_Data *sd)
746 if (str) hpad = atoi(str); 746 if (str) hpad = atoi(str);
747 str = elm_layout_data_get(obj, "vertical_pad"); 747 str = elm_layout_data_get(obj, "vertical_pad");
748 if (str) vpad = atoi(str); 748 if (str) vpad = atoi(str);
749 efl_gfx_arrangement_content_padding_set(sd->box, hpad, vpad, EINA_TRUE); 749 efl_gfx_arrangement_content_padding_set(sd->box, hpad, vpad);
750 750
751 efl_content_set(efl_part(obj, "efl.box"), sd->box); 751 efl_content_set(efl_part(obj, "efl.box"), sd->box);
752 752