summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitesh Singh <amitesh.sh@samsung.com>2017-05-24 17:02:37 +0900
committerAmitesh Singh <amitesh.sh@samsung.com>2017-05-24 19:25:28 +0900
commit99738e4d39a9228738bac6853de2942b1e364eb0 (patch)
tree90b2f6673b94dfdf60738ddb6c199203441289d6
parent071bdb6b221121f5afcfd605ce85cf57e2c5728c (diff)
Efl.Ui.Progressbar: Implement Efl.Ui.Progress intf for progressbar part
and remove part_value_set/get as EO APIs ref T5360 Signed-off-by: Amitesh Singh <amitesh.sh@samsung.com>
-rw-r--r--src/lib/elementary/efl_ui_progressbar.c146
-rw-r--r--src/lib/elementary/efl_ui_progressbar.eo21
-rw-r--r--src/lib/elementary/efl_ui_progressbar_internal_part.eo5
-rw-r--r--src/lib/elementary/elm_progressbar_legacy.h30
4 files changed, 125 insertions, 77 deletions
diff --git a/src/lib/elementary/efl_ui_progressbar.c b/src/lib/elementary/efl_ui_progressbar.c
index 0a71905233..e8ef50fdbf 100644
--- a/src/lib/elementary/efl_ui_progressbar.c
+++ b/src/lib/elementary/efl_ui_progressbar.c
@@ -422,12 +422,62 @@ _efl_ui_progressbar_efl_ui_progress_span_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Pr
422 return sd->size; 422 return sd->size;
423} 423}
424 424
425static void
426_progressbar_part_value_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, const char *part_name, double val)
427{
428 Efl_Ui_Progress_Status *ps;
429 Eina_Bool existing_ps = EINA_FALSE;
430 Eina_List *l;
431
432 if (val < MIN_RATIO_LVL) val = MIN_RATIO_LVL;
433 if (val > MAX_RATIO_LVL) val = MAX_RATIO_LVL;
434
435 if (!strcmp(part_name, "elm.cur.progressbar"))
436 sd->val = val;
437
438 EINA_LIST_FOREACH(sd->progress_status, l, ps)
439 {
440 if (!strcmp(ps->part_name, part_name))
441 {
442 existing_ps = EINA_TRUE;
443 break;
444 }
445 }
446
447 if (!existing_ps)
448 {
449 ps = _progress_status_new(part_name, val);
450 sd->progress_status = eina_list_append(sd->progress_status, ps);
451 }
452 else
453 ps->val = val;
454
455 _val_set(obj);
456 _units_set(obj);
457 efl_event_callback_legacy_call
458 (obj, EFL_UI_PROGRESSBAR_EVENT_CHANGED, NULL);
459}
460
461static double
462_progressbar_part_value_get(Efl_Ui_Progressbar_Data *sd, const char* part)
463{
464 Efl_Ui_Progress_Status *ps;
465 Eina_List *l;
466
467 EINA_LIST_FOREACH(sd->progress_status, l, ps)
468 {
469 if (!strcmp(ps->part_name, part)) return ps->val;
470 }
471
472 return 0.0;
473}
474
425EOLIAN static void 475EOLIAN static void
426_efl_ui_progressbar_efl_ui_progress_progress_value_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, double val) 476_efl_ui_progressbar_efl_ui_progress_progress_value_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, double val)
427{ 477{
428 if (EINA_DBL_EQ(sd->val, val)) return; 478 if (EINA_DBL_EQ(sd->val, val)) return;
429 479
430 elm_progressbar_part_value_set(obj, "elm.cur.progressbar", val); 480 _progressbar_part_value_set(obj, sd, "elm.cur.progressbar", val);
431} 481}
432 482
433EOLIAN static double 483EOLIAN static double
@@ -477,56 +527,6 @@ _efl_ui_progressbar_pulse_get(Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *sd)
477 return (sd->pulse_state && sd->pulse); 527 return (sd->pulse_state && sd->pulse);
478} 528}
479 529
480EOLIAN static void
481_efl_ui_progressbar_part_value_set(Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *sd, const char *part_name, double val)
482{
483 Efl_Ui_Progress_Status *ps;
484 Eina_Bool existing_ps = EINA_FALSE;
485 Eina_List *l;
486
487 if (val < MIN_RATIO_LVL) val = MIN_RATIO_LVL;
488 if (val > MAX_RATIO_LVL) val = MAX_RATIO_LVL;
489
490 if (!strcmp(part_name, "elm.cur.progressbar"))
491 sd->val = val;
492
493 EINA_LIST_FOREACH(sd->progress_status, l, ps)
494 {
495 if (!strcmp(ps->part_name, part_name))
496 {
497 existing_ps = EINA_TRUE;
498 break;
499 }
500 }
501
502 if (!existing_ps)
503 {
504 ps = _progress_status_new(part_name, val);
505 sd->progress_status = eina_list_append(sd->progress_status, ps);
506 }
507 else
508 ps->val = val;
509
510 _val_set(obj);
511 _units_set(obj);
512 efl_event_callback_legacy_call
513 (obj, EFL_UI_PROGRESSBAR_EVENT_CHANGED, NULL);
514}
515
516EOLIAN static double
517_efl_ui_progressbar_part_value_get(const Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *sd, const char* part)
518{
519 Efl_Ui_Progress_Status *ps;
520 Eina_List *l;
521
522 EINA_LIST_FOREACH(sd->progress_status, l, ps)
523 {
524 if (!strcmp(ps->part_name, part)) return ps->val;
525 }
526
527 return 0.0;
528}
529
530EAPI void 530EAPI void
531elm_progressbar_value_set(Evas_Object *obj, double val) 531elm_progressbar_value_set(Evas_Object *obj, double val)
532{ 532{
@@ -658,9 +658,34 @@ _efl_ui_progressbar_class_constructor(Efl_Class *klass)
658} 658}
659 659
660/* Efl.Part begin */ 660/* Efl.Part begin */
661
662ELM_PART_OVERRIDE(efl_ui_progressbar, EFL_UI_PROGRESSBAR, ELM_LAYOUT, Efl_Ui_Progressbar_Data, Elm_Part_Data) 661ELM_PART_OVERRIDE(efl_ui_progressbar, EFL_UI_PROGRESSBAR, ELM_LAYOUT, Efl_Ui_Progressbar_Data, Elm_Part_Data)
663ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_progressbar, EFL_UI_PROGRESSBAR, ELM_LAYOUT, Efl_Ui_Progressbar_Data, Elm_Part_Data) 662
663static EOLIAN Eina_Bool
664_efl_ui_progressbar_internal_part_efl_container_content_set(Eo *obj, Elm_Part_Data *_pd EINA_UNUSED, Efl_Gfx *content)
665{
666 Elm_Part_Data *pd = efl_data_scope_get(obj, ELM_LAYOUT_INTERNAL_PART_CLASS);
667 Efl_Ui_Progressbar_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_PROGRESSBAR_CLASS);
668 ELM_PART_RETURN_VAL(_efl_ui_progressbar_content_set(pd->obj, sd, pd->part, content));
669}
670
671EOLIAN static void
672_efl_ui_progressbar_internal_part_efl_ui_progress_progress_value_set(Eo *obj, Elm_Part_Data *_pd EINA_UNUSED, double val)
673{
674 Elm_Part_Data *pd = efl_data_scope_get(obj, ELM_LAYOUT_INTERNAL_PART_CLASS);
675 Efl_Ui_Progressbar_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_PROGRESSBAR_CLASS);
676
677 _progressbar_part_value_set(pd->obj, sd, pd->part, val);
678}
679
680EOLIAN static double
681_efl_ui_progressbar_internal_part_efl_ui_progress_progress_value_get(Eo *obj, Elm_Part_Data *_pd EINA_UNUSED)
682{
683 Elm_Part_Data *pd = efl_data_scope_get(obj, ELM_LAYOUT_INTERNAL_PART_CLASS);
684 Efl_Ui_Progressbar_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_PROGRESSBAR_CLASS);
685
686 return _progressbar_part_value_get(sd, pd->part);
687}
688
664#include "efl_ui_progressbar_internal_part.eo.c" 689#include "efl_ui_progressbar_internal_part.eo.c"
665 690
666/* Efl.Part end */ 691/* Efl.Part end */
@@ -694,4 +719,17 @@ EAPI Eina_Bool
694elm_progressbar_is_pulsing_get(const Evas_Object *obj) 719elm_progressbar_is_pulsing_get(const Evas_Object *obj)
695{ 720{
696 return efl_ui_progressbar_pulse_get(obj); 721 return efl_ui_progressbar_pulse_get(obj);
697} \ No newline at end of file 722}
723
724EAPI void
725elm_progressbar_part_value_set(Evas_Object *obj, const char *part, double val)
726{
727 if (EINA_DBL_EQ(efl_ui_progress_value_get(efl_part(obj, part)), val)) return;
728 efl_ui_progress_value_set(efl_part(obj, part), val);
729}
730
731EAPI double
732elm_progressbar_part_value_get(const Evas_Object *obj, const char *part)
733{
734 return efl_ui_progress_value_get(efl_part(obj, part));
735}
diff --git a/src/lib/elementary/efl_ui_progressbar.eo b/src/lib/elementary/efl_ui_progressbar.eo
index d067e117c1..2dcaf65040 100644
--- a/src/lib/elementary/efl_ui_progressbar.eo
+++ b/src/lib/elementary/efl_ui_progressbar.eo
@@ -2,7 +2,6 @@ class Efl.Ui.Progressbar (Elm.Layout, Efl.Ui.Progress,
2 Efl.Orientation) 2 Efl.Orientation)
3{ 3{
4 [[Elementary progressbar class]] 4 [[Elementary progressbar class]]
5 //legacy_prefix: elm_progressbar;
6 methods { 5 methods {
7 @property pulse_mode { 6 @property pulse_mode {
8 [[Control whether a given progress bar widget is at "pulsing mode" or not. 7 [[Control whether a given progress bar widget is at "pulsing mode" or not.
@@ -47,26 +46,6 @@ class Efl.Ui.Progressbar (Elm.Layout, Efl.Ui.Progress,
47 state: bool; [[$true, to start the pulsing animation, $false to stop it]] 46 state: bool; [[$true, to start the pulsing animation, $false to stop it]]
48 } 47 }
49 } 48 }
50 part_value_set {
51 [[Set the progress value (in percentage) on a given progress bar widget for the given part name
52
53 Use this call to set progress bar status for more than one progress status .
54
55 @since 1.8]]
56 params {
57 @in part: string; [[The partname to which val have to set]]
58 @in val: double; [[The progress value (must be between $0.0 and 1.0)]]
59 }
60 }
61 part_value_get @const {
62 [[Get the progress value (in percentage) on a given progress bar widget for a particular part
63
64 @since 1.8]]
65 return: double; [[The value of the progressbar]]
66 params {
67 @in part: string; [[The part name of the progress bar]]
68 }
69 }
70 } 49 }
71 implements { 50 implements {
72 class.constructor; 51 class.constructor;
diff --git a/src/lib/elementary/efl_ui_progressbar_internal_part.eo b/src/lib/elementary/efl_ui_progressbar_internal_part.eo
index 080ba5d8f4..09f40ee3d7 100644
--- a/src/lib/elementary/efl_ui_progressbar_internal_part.eo
+++ b/src/lib/elementary/efl_ui_progressbar_internal_part.eo
@@ -1,8 +1,9 @@
1class Efl.Ui.Progressbar.Internal.Part (Elm.Layout.Internal.Part) 1class Efl.Ui.Progressbar.Internal.Part (Elm.Layout.Internal.Part, Efl.Ui.Progress)
2{ 2{
3 [[Elementary progressbar internal part class]] 3 [[Elementary progressbar internal part class]]
4 data: null; 4 data: Elm_Part_Data;
5 implements { 5 implements {
6 Efl.Container.content { set; } 6 Efl.Container.content { set; }
7 Efl.Ui.Progress.progress_value { set; get; }
7 } 8 }
8} 9}
diff --git a/src/lib/elementary/elm_progressbar_legacy.h b/src/lib/elementary/elm_progressbar_legacy.h
index 57ae0a8c13..5068bc0dee 100644
--- a/src/lib/elementary/elm_progressbar_legacy.h
+++ b/src/lib/elementary/elm_progressbar_legacy.h
@@ -253,4 +253,34 @@ EAPI void elm_progressbar_pulse(Evas_Object *obj, Eina_Bool state);
253 */ 253 */
254EAPI Eina_Bool elm_progressbar_is_pulsing_get(const Evas_Object *obj); 254EAPI Eina_Bool elm_progressbar_is_pulsing_get(const Evas_Object *obj);
255 255
256
257/**
258 * @brief Set the progress value (in percentage) on a given progress bar widget
259 * for the given part name
260 *
261 * Use this call to set progress bar status for more than one progress status .
262 *
263 * @param[in] part The partname to which val have to set
264 * @param[in] val The progress value (must be between $0.0 and 1.0)
265 *
266 * @since 1.8
267 *
268 * @ingroup Elm_Progressbar
269 */
270EAPI void elm_progressbar_part_value_set(Evas_Object *obj, const char *part, double val);
271
272/**
273 * @brief Get the progress value (in percentage) on a given progress bar widget
274 * for a particular part
275 *
276 * @param[in] part The part name of the progress bar
277 *
278 * @return The value of the progressbar
279 *
280 * @since 1.8
281 *
282 * @ingroup Elm_Progressbar
283 */
284EAPI double elm_progressbar_part_value_get(const Evas_Object *obj, const char *part);
285
256#include "efl_ui_progressbar.eo.legacy.h" \ No newline at end of file 286#include "efl_ui_progressbar.eo.legacy.h" \ No newline at end of file