summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-08-09 23:47:24 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-08-10 14:42:08 +0900
commitc87f6018f904da137b06d29566e43268ed6193ad (patch)
treee463c4fed7ceda27b5fcfeb20c9529e022caaa11
parent6372dcdc2df599381a359a7daa8feb7aaf141f58 (diff)
progressbar: Switch to Efl.Ui.Dir (EO)
Ref T5870
-rw-r--r--src/lib/elementary/efl_ui_progressbar.c111
-rw-r--r--src/lib/elementary/efl_ui_progressbar.eo5
-rw-r--r--src/lib/elementary/efl_ui_progressbar_private.h2
3 files changed, 56 insertions, 62 deletions
diff --git a/src/lib/elementary/efl_ui_progressbar.c b/src/lib/elementary/efl_ui_progressbar.c
index d7327639e9..d8dfc2c6fb 100644
--- a/src/lib/elementary/efl_ui_progressbar.c
+++ b/src/lib/elementary/efl_ui_progressbar.c
@@ -66,25 +66,39 @@ _progress_status_free(Efl_Ui_Progress_Status *ps)
66} 66}
67 67
68static inline Eina_Bool 68static inline Eina_Bool
69_is_horizontal(Efl_Orient orientation) 69_is_horizontal(Efl_Ui_Dir dir)
70{ 70{
71 if (orientation == EFL_ORIENT_LEFT || 71 return efl_ui_dir_is_horizontal(dir, EINA_TRUE);
72 orientation == EFL_ORIENT_RIGHT)
73 return EINA_TRUE;
74
75 return EINA_FALSE;
76} 72}
77 73
78static inline Eina_Bool 74static inline Eina_Bool
79_is_inverted(Efl_Orient orientation) 75_is_inverted(Efl_Ui_Dir dir)
80{ 76{
81 if (orientation == EFL_ORIENT_LEFT || 77 if ((dir == EFL_UI_DIR_LEFT) || (dir == EFL_UI_DIR_UP))
82 orientation == EFL_ORIENT_UP)
83 return EINA_TRUE; 78 return EINA_TRUE;
84 79
85 return EINA_FALSE; 80 return EINA_FALSE;
86} 81}
87 82
83static Efl_Ui_Dir
84_direction_get(Eina_Bool horizontal, Eina_Bool inverted)
85{
86 if (horizontal)
87 {
88 if (inverted)
89 return EFL_UI_DIR_LEFT;
90 else
91 return EFL_UI_DIR_RIGHT;
92 }
93 else
94 {
95 if (inverted)
96 return EFL_UI_DIR_UP;
97 else
98 return EFL_UI_DIR_DOWN;
99 }
100}
101
88static void 102static void
89_units_set(Evas_Object *obj) 103_units_set(Evas_Object *obj)
90{ 104{
@@ -122,16 +136,16 @@ _val_set(Evas_Object *obj)
122 Eina_List *l; 136 Eina_List *l;
123 137
124 EINA_LIST_FOREACH(sd->progress_status, l, ps) 138 EINA_LIST_FOREACH(sd->progress_status, l, ps)
125 { 139 {
126 pos = ps->val; 140 pos = ps->val;
127 if ((!rtl && _is_inverted(sd->orientation)) || 141 if ((!rtl && _is_inverted(sd->dir)) ||
128 (rtl && ((sd->orientation == EFL_ORIENT_UP) || 142 (rtl && ((sd->dir == EFL_UI_DIR_UP) ||
129 (sd->orientation == EFL_ORIENT_RIGHT)))) 143 (sd->dir == EFL_UI_DIR_RIGHT))))
130 pos = MAX_RATIO_LVL - pos; 144 pos = MAX_RATIO_LVL - pos;
131 145
132 edje_object_part_drag_value_set 146 edje_object_part_drag_value_set
133 (wd->resize_obj, ps->part_name, pos, pos); 147 (wd->resize_obj, ps->part_name, pos, pos);
134 } 148 }
135} 149}
136 150
137EOLIAN static void 151EOLIAN static void
@@ -197,7 +211,7 @@ _efl_ui_progressbar_elm_widget_theme_apply(Eo *obj, Efl_Ui_Progressbar_Data *sd)
197 EFL_UI_LAYOUT_DATA_GET(obj, ld); 211 EFL_UI_LAYOUT_DATA_GET(obj, ld);
198 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_FAILED); 212 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_FAILED);
199 213
200 if (_is_horizontal(sd->orientation)) 214 if (_is_horizontal(sd->dir))
201 eina_stringshare_replace(&ld->group, "horizontal"); 215 eina_stringshare_replace(&ld->group, "horizontal");
202 else eina_stringshare_replace(&ld->group, "vertical"); 216 else eina_stringshare_replace(&ld->group, "vertical");
203 217
@@ -215,7 +229,7 @@ _efl_ui_progressbar_elm_widget_theme_apply(Eo *obj, Efl_Ui_Progressbar_Data *sd)
215 if (((sd->units) || (sd->unit_format_func)) && (!sd->pulse)) 229 if (((sd->units) || (sd->unit_format_func)) && (!sd->pulse))
216 elm_layout_signal_emit(obj, "elm,state,units,visible", "elm"); 230 elm_layout_signal_emit(obj, "elm,state,units,visible", "elm");
217 231
218 if (_is_horizontal(sd->orientation)) 232 if (_is_horizontal(sd->dir))
219 evas_object_size_hint_min_set 233 evas_object_size_hint_min_set
220 (sd->spacer, (double)sd->size * efl_ui_scale_get(obj) * 234 (sd->spacer, (double)sd->size * efl_ui_scale_get(obj) *
221 elm_config_scale_get(), 1); 235 elm_config_scale_get(), 1);
@@ -224,7 +238,7 @@ _efl_ui_progressbar_elm_widget_theme_apply(Eo *obj, Efl_Ui_Progressbar_Data *sd)
224 (sd->spacer, 1, (double)sd->size * efl_ui_scale_get(obj) * 238 (sd->spacer, 1, (double)sd->size * efl_ui_scale_get(obj) *
225 elm_config_scale_get()); 239 elm_config_scale_get());
226 240
227 if (_is_inverted(sd->orientation)) 241 if (_is_inverted(sd->dir))
228 elm_layout_signal_emit(obj, "elm,state,inverted,on", "elm"); 242 elm_layout_signal_emit(obj, "elm,state,inverted,on", "elm");
229 else 243 else
230 elm_layout_signal_emit(obj, "elm,state,inverted,off", "elm"); 244 elm_layout_signal_emit(obj, "elm,state,inverted,off", "elm");
@@ -287,7 +301,7 @@ _efl_ui_progressbar_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Progressbar_Data
287 efl_canvas_group_add(efl_super(obj, MY_CLASS)); 301 efl_canvas_group_add(efl_super(obj, MY_CLASS));
288 elm_widget_sub_object_parent_add(obj); 302 elm_widget_sub_object_parent_add(obj);
289 303
290 priv->orientation = EFL_ORIENT_RIGHT; 304 priv->dir = EFL_UI_DIR_RIGHT;
291 priv->units = eina_stringshare_add("%.0f %%"); 305 priv->units = eina_stringshare_add("%.0f %%");
292 priv->val = MIN_RATIO_LVL; 306 priv->val = MIN_RATIO_LVL;
293 307
@@ -372,17 +386,17 @@ _efl_ui_progressbar_pulse_mode_get(Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data
372} 386}
373 387
374EOLIAN static void 388EOLIAN static void
375_efl_ui_progressbar_efl_orientation_orientation_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, Efl_Orient dir) 389_efl_ui_progressbar_efl_ui_direction_direction_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, Efl_Ui_Dir dir)
376{ 390{
377 sd->orientation = dir; 391 sd->dir = dir;
378 392
379 elm_obj_widget_theme_apply(obj); 393 elm_obj_widget_theme_apply(obj);
380} 394}
381 395
382EOLIAN static Efl_Orient 396EOLIAN static Efl_Ui_Dir
383_efl_ui_progressbar_efl_orientation_orientation_get(Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *sd) 397_efl_ui_progressbar_efl_ui_direction_direction_get(Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *sd)
384{ 398{
385 return sd->orientation; 399 return sd->dir;
386} 400}
387 401
388EOLIAN static void 402EOLIAN static void
@@ -392,7 +406,7 @@ _efl_ui_progressbar_efl_ui_range_span_size_set(Eo *obj, Efl_Ui_Progressbar_Data
392 406
393 sd->size = size; 407 sd->size = size;
394 408
395 if (_is_horizontal(sd->orientation)) 409 if (_is_horizontal(sd->dir))
396 evas_object_size_hint_min_set 410 evas_object_size_hint_min_set
397 (sd->spacer, (double)sd->size * efl_ui_scale_get(obj) * 411 (sd->spacer, (double)sd->size * efl_ui_scale_get(obj) *
398 elm_config_scale_get(), 1); 412 elm_config_scale_get(), 1);
@@ -568,41 +582,22 @@ elm_progressbar_unit_format_function_set(Evas_Object *obj, progressbar_func_type
568 elm_layout_sizing_eval(obj); 582 elm_layout_sizing_eval(obj);
569} 583}
570 584
571static Efl_Orient
572_orientation_get(Eina_Bool horizontal, Eina_Bool inverted)
573{
574 if (horizontal)
575 {
576 if (inverted)
577 return EFL_ORIENT_LEFT;
578 else
579 return EFL_ORIENT_RIGHT;
580 }
581 else
582 {
583 if (inverted)
584 return EFL_ORIENT_UP;
585 else
586 return EFL_ORIENT_DOWN;
587 }
588}
589
590EAPI void 585EAPI void
591elm_progressbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) 586elm_progressbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
592{ 587{
593 Efl_Orient dir; 588 Efl_Ui_Dir dir;
594 EFL_UI_PROGRESSBAR_DATA_GET(obj, sd); 589 EFL_UI_PROGRESSBAR_DATA_GET(obj, sd);
595 590
596 dir = _orientation_get(horizontal, _is_inverted(sd->orientation)); 591 dir = _direction_get(horizontal, _is_inverted(sd->dir));
597 592
598 efl_orientation_set(obj, dir); 593 efl_ui_direction_set(obj, dir);
599} 594}
600 595
601EAPI Eina_Bool 596EAPI Eina_Bool
602elm_progressbar_horizontal_get(const Evas_Object *obj) 597elm_progressbar_horizontal_get(const Evas_Object *obj)
603{ 598{
604 Efl_Orient dir; 599 Efl_Ui_Dir dir;
605 dir = efl_orientation_get(obj); 600 dir = efl_ui_direction_get(obj);
606 601
607 return _is_horizontal(dir); 602 return _is_horizontal(dir);
608} 603}
@@ -610,19 +605,19 @@ elm_progressbar_horizontal_get(const Evas_Object *obj)
610EAPI void 605EAPI void
611elm_progressbar_inverted_set(Evas_Object *obj, Eina_Bool inverted) 606elm_progressbar_inverted_set(Evas_Object *obj, Eina_Bool inverted)
612{ 607{
613 Efl_Orient dir; 608 Efl_Ui_Dir dir;
614 EFL_UI_PROGRESSBAR_DATA_GET(obj, sd); 609 EFL_UI_PROGRESSBAR_DATA_GET(obj, sd);
615 610
616 dir = _orientation_get(_is_horizontal(sd->orientation), inverted); 611 dir = _direction_get(_is_horizontal(sd->dir), inverted);
617 612
618 efl_orientation_set(obj, dir); 613 efl_ui_direction_set(obj, dir);
619} 614}
620 615
621EAPI Eina_Bool 616EAPI Eina_Bool
622elm_progressbar_inverted_get(const Evas_Object *obj) 617elm_progressbar_inverted_get(const Evas_Object *obj)
623{ 618{
624 Efl_Orient dir; 619 Efl_Ui_Dir dir;
625 dir = efl_orientation_get(obj); 620 dir = efl_ui_direction_get(obj);
626 621
627 return _is_inverted(dir); 622 return _is_inverted(dir);
628} 623}
diff --git a/src/lib/elementary/efl_ui_progressbar.eo b/src/lib/elementary/efl_ui_progressbar.eo
index 624449a81a..536891e0a4 100644
--- a/src/lib/elementary/efl_ui_progressbar.eo
+++ b/src/lib/elementary/efl_ui_progressbar.eo
@@ -1,5 +1,4 @@
1class Efl.Ui.Progressbar (Efl.Ui.Layout, Efl.Ui.Range, 1class Efl.Ui.Progressbar (Efl.Ui.Layout, Efl.Ui.Range, Efl.Ui.Direction)
2 Efl.Orientation)
3{ 2{
4 [[Elementary progressbar class]] 3 [[Elementary progressbar class]]
5 methods { 4 methods {
@@ -57,7 +56,7 @@ class Efl.Ui.Progressbar (Efl.Ui.Layout, Efl.Ui.Range,
57 Efl.Ui.Range.span_size { get; set; } 56 Efl.Ui.Range.span_size { get; set; }
58 Efl.Ui.Range.range_value { get; set; } 57 Efl.Ui.Range.range_value { get; set; }
59 Efl.Ui.Range.range_unit_format { get; set; } 58 Efl.Ui.Range.range_unit_format { get; set; }
60 Efl.Orientation.orientation { get; set; } 59 Efl.Ui.Direction.direction { get; set; }
61 Efl.Part.part; 60 Efl.Part.part;
62 } 61 }
63 events { 62 events {
diff --git a/src/lib/elementary/efl_ui_progressbar_private.h b/src/lib/elementary/efl_ui_progressbar_private.h
index 8d2707a6f3..4c0a9b89f5 100644
--- a/src/lib/elementary/efl_ui_progressbar_private.h
+++ b/src/lib/elementary/efl_ui_progressbar_private.h
@@ -34,7 +34,7 @@ struct _Efl_Ui_Progressbar_Data
34 Evas_Coord size; /**< Width or height of progressbar */ 34 Evas_Coord size; /**< Width or height of progressbar */
35 double val; /**< Value of progressbar */ 35 double val; /**< Value of progressbar */
36 36
37 Efl_Orient orientation; /**< Orientation of the progressbar */ 37 Efl_Ui_Dir dir; /**< Orientation of the progressbar */
38 Eina_Bool pulse : 1; /**< Whether object is put in the pulsing mode */ 38 Eina_Bool pulse : 1; /**< Whether object is put in the pulsing mode */
39 Eina_Bool pulse_state : 1; /**< To start the pulsing animation, otherwise to stop it */ 39 Eina_Bool pulse_state : 1; /**< To start the pulsing animation, otherwise to stop it */
40 Eina_List *progress_status; /**< The list of _Elm_Progress_Status. To save the progress value(in percentage) each part of given progress bar */ 40 Eina_List *progress_status; /**< The list of _Elm_Progress_Status. To save the progress value(in percentage) each part of given progress bar */