summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-12-20 14:00:48 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-12-20 14:34:53 +0100
commit9fa6013b8871ae79c4f34047c4dd82c5d607e9f9 (patch)
tree87da3538e9a04e4ff24e7f7b63dd9f741ae13b55
parented7fb7ae27a1a6c1b758f8a415e1976d95a45e4b (diff)
elm_progressbar: make pulse and pulse_mode independend from legacy
the next commit will refactor this API for Efl.Ui namespace. ref T8501
-rw-r--r--src/lib/elementary/efl_ui_progressbar.c49
1 files changed, 31 insertions, 18 deletions
diff --git a/src/lib/elementary/efl_ui_progressbar.c b/src/lib/elementary/efl_ui_progressbar.c
index 61c6ece78b..77b7eb428d 100644
--- a/src/lib/elementary/efl_ui_progressbar.c
+++ b/src/lib/elementary/efl_ui_progressbar.c
@@ -618,6 +618,17 @@ _efl_ui_progressbar_efl_ui_range_display_range_value_get(const Eo *obj, Efl_Ui_P
618 return efl_ui_range_value_get(efl_part(obj, "efl.cur.progressbar")); 618 return efl_ui_range_value_get(efl_part(obj, "efl.cur.progressbar"));
619} 619}
620 620
621static void
622_apply_pulse_state(Eo *obj, Efl_Ui_Progressbar_Data *sd)
623{
624 const char *emitter = elm_widget_is_legacy(obj) ? "elm" : "efl";
625 const char *signal = elm_widget_is_legacy(obj) ? "elm,state,pulse," : "efl,state,pulse,";
626 char signal_buffer[strlen(signal) + strlen("start") + 1];
627
628 snprintf(signal_buffer, sizeof(signal_buffer), "%s%s", signal, sd->pulse_state ? "start" : "stop");
629 elm_layout_signal_emit(obj, signal_buffer, emitter);
630}
631
621EOLIAN static void 632EOLIAN static void
622_efl_ui_progressbar_pulse_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, Eina_Bool state) 633_efl_ui_progressbar_pulse_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, Eina_Bool state)
623{ 634{
@@ -626,20 +637,7 @@ _efl_ui_progressbar_pulse_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, Eina_Bool st
626 637
627 sd->pulse_state = state; 638 sd->pulse_state = state;
628 639
629 if (elm_widget_is_legacy(obj)) 640 _apply_pulse_state(obj, sd);
630 {
631 if (sd->pulse_state)
632 elm_layout_signal_emit(obj, "elm,state,pulse,start", "elm");
633 else
634 elm_layout_signal_emit(obj, "elm,state,pulse,stop", "elm");
635 }
636 else
637 {
638 if (sd->pulse_state)
639 elm_layout_signal_emit(obj, "efl,state,pulse,start", "efl");
640 else
641 elm_layout_signal_emit(obj, "efl,state,pulse,stop", "efl");
642 }
643} 641}
644 642
645EOLIAN static Eina_Bool 643EOLIAN static Eina_Bool
@@ -899,25 +897,40 @@ elm_progressbar_add(Evas_Object *parent)
899EAPI void 897EAPI void
900elm_progressbar_pulse_set(Evas_Object *obj, Eina_Bool pulse) 898elm_progressbar_pulse_set(Evas_Object *obj, Eina_Bool pulse)
901{ 899{
902 efl_ui_progressbar_pulse_mode_set(obj, pulse); 900 EFL_UI_PROGRESSBAR_DATA_GET_OR_RETURN(obj, sd);
901 pulse = !!pulse;
902 if (sd->pulse == pulse) return;
903
904 sd->pulse = pulse;
905
906 efl_ui_widget_theme_apply(obj);
903} 907}
904 908
905EAPI Eina_Bool 909EAPI Eina_Bool
906elm_progressbar_pulse_get(const Evas_Object *obj) 910elm_progressbar_pulse_get(const Evas_Object *obj)
907{ 911{
908 return efl_ui_progressbar_pulse_mode_get(obj); 912 EFL_UI_PROGRESSBAR_DATA_GET_OR_RETURN(obj, sd, EINA_FALSE);
913 return sd->pulse;
909} 914}
910 915
911EAPI void 916EAPI void
912elm_progressbar_pulse(Evas_Object *obj, Eina_Bool state) 917elm_progressbar_pulse(Evas_Object *obj, Eina_Bool state)
913{ 918{
914 efl_ui_progressbar_pulse_set(obj, state); 919 EFL_UI_PROGRESSBAR_DATA_GET_OR_RETURN(obj, sd);
920
921 state = !!state;
922 if ((!sd->pulse) || (sd->pulse_state == state)) return;
923
924 sd->pulse_state = state;
925
926 _apply_pulse_state(obj, sd);
915} 927}
916 928
917EAPI Eina_Bool 929EAPI Eina_Bool
918elm_progressbar_is_pulsing_get(const Evas_Object *obj) 930elm_progressbar_is_pulsing_get(const Evas_Object *obj)
919{ 931{
920 return efl_ui_progressbar_pulse_get(obj); 932 EFL_UI_PROGRESSBAR_DATA_GET_OR_RETURN(obj, sd, EINA_FALSE);
933 return (sd->pulse_state && sd->pulse);
921} 934}
922 935
923EAPI void 936EAPI void