slider/progressbar: implement format_string of Efl.Ui.Format
remove the unit_format from Efl.Ui.Range.
This commit is contained in:
parent
5798e226d5
commit
85d4a618a7
|
@ -52,7 +52,7 @@ test_slider_interval(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
|
|||
efl_add(EFL_UI_SLIDER_INTERVAL_CLASS, bx,
|
||||
efl_text_set(efl_added, "Manual step"),
|
||||
efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(120, 0)),
|
||||
efl_ui_range_unit_format_set(efl_added, "%1.1f units"),
|
||||
efl_ui_format_string_set(efl_added, "%1.1f units"),
|
||||
efl_ui_slider_indicator_format_set(efl_added, "%1.1f"),
|
||||
efl_ui_slider_interval_value_set(efl_added, 0.4, 0.9),
|
||||
efl_ui_slider_step_set(efl_added, step),
|
||||
|
@ -61,7 +61,7 @@ test_slider_interval(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
|
|||
efl_add(EFL_UI_SLIDER_INTERVAL_CLASS, bx,
|
||||
efl_text_set(efl_added, "Disabled"),
|
||||
efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(120, 0)),
|
||||
efl_ui_range_unit_format_set(efl_added, "%1.0f units"),
|
||||
efl_ui_format_string_set(efl_added, "%1.0f units"),
|
||||
efl_ui_slider_indicator_format_set(efl_added, "%1.0f"),
|
||||
efl_ui_range_min_max_set(efl_added, 10, 145),
|
||||
efl_ui_slider_interval_value_set(efl_added, 50, 100),
|
||||
|
@ -76,7 +76,7 @@ test_slider_interval(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
|
|||
efl_add(EFL_UI_SLIDER_INTERVAL_CLASS, hbx,
|
||||
efl_text_set(efl_added, "Vertical"),
|
||||
efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(0, 160)),
|
||||
efl_ui_range_unit_format_set(efl_added, "%1.0f units"),
|
||||
efl_ui_format_string_set(efl_added, "%1.0f units"),
|
||||
efl_ui_slider_indicator_format_set(efl_added, "%1.0f"),
|
||||
efl_ui_range_min_max_set(efl_added, 10, 145),
|
||||
efl_ui_slider_interval_value_set(efl_added, 50, 100),
|
||||
|
@ -87,7 +87,7 @@ test_slider_interval(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
|
|||
efl_add(EFL_UI_SLIDER_INTERVAL_CLASS, hbx,
|
||||
efl_text_set(efl_added, "Disabled"),
|
||||
efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(0, 160)),
|
||||
efl_ui_range_unit_format_set(efl_added, "%1.0f units"),
|
||||
efl_ui_format_string_set(efl_added, "%1.0f units"),
|
||||
efl_ui_slider_indicator_format_set(efl_added, "%1.0f"),
|
||||
efl_ui_range_min_max_set(efl_added, 10, 145),
|
||||
efl_ui_slider_interval_value_set(efl_added, 50, 100),
|
||||
|
@ -100,7 +100,7 @@ test_slider_interval(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
|
|||
efl_text_set(efl_added, "Limited (100-500)"),
|
||||
efl_ui_slider_indicator_visible_mode_set(efl_added, EFL_UI_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS),
|
||||
efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(260, 0)),
|
||||
efl_ui_range_unit_format_set(efl_added, "%1.0f units"),
|
||||
efl_ui_format_string_set(efl_added, "%1.0f units"),
|
||||
efl_ui_slider_indicator_format_set(efl_added, "%1.0f"),
|
||||
efl_ui_range_min_max_set(efl_added, 0, 600),
|
||||
efl_ui_slider_interval_value_set(efl_added, 100, 500),
|
||||
|
|
|
@ -12,7 +12,7 @@ interface Efl.Ui.Format
|
|||
{
|
||||
[[interface class for format_func]]
|
||||
methods {
|
||||
@property format_cb @protected {
|
||||
@property format_cb {
|
||||
set {
|
||||
[[Set the format function pointer to format the string.
|
||||
]]
|
||||
|
@ -21,7 +21,7 @@ interface Efl.Ui.Format
|
|||
func: Efl.Ui.Format_Func_Cb @nullable; [[The format function callback]]
|
||||
}
|
||||
}
|
||||
@property format_string @protected {
|
||||
@property format_string {
|
||||
[[Control the format string for a given units label
|
||||
|
||||
If $NULL is passed on $format, it will make $obj's units
|
||||
|
@ -34,8 +34,6 @@ interface Efl.Ui.Format
|
|||
Note: The default format string is an integer percentage,
|
||||
as in $"%.0f %%".
|
||||
]]
|
||||
set {
|
||||
}
|
||||
values {
|
||||
units: string @nullable; [[The format string for $obj's units label.]]
|
||||
}
|
||||
|
|
|
@ -46,26 +46,5 @@ interface Efl.Ui.Range
|
|||
max: double; [[The maximum value.]]
|
||||
}
|
||||
}
|
||||
@property range_unit_format {
|
||||
[[Control the format string for a given range widget's units label
|
||||
|
||||
If $NULL is passed on $format, it will make $obj's units
|
||||
area to be hidden completely. If not, it'll set the <b>format
|
||||
string</b> for the units label's text. The units label is
|
||||
provided a floating point value, so the units text is up display
|
||||
at most one floating point value. Note that the units label is
|
||||
optional. Use a format string such as "%1.2f meters" for
|
||||
example.
|
||||
|
||||
Note: The default format string for a range is an integer
|
||||
percentage, as in $"%.0f %%".]]
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
units: string @nullable; [[The format string for $obj's units label]]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -473,7 +473,7 @@ _efl_ui_progressbar_efl_ui_range_range_value_get(Eo *obj EINA_UNUSED, Efl_Ui_Pro
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_progressbar_efl_ui_range_range_unit_format_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, const char *units)
|
||||
_efl_ui_progressbar_efl_ui_format_format_string_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, const char *units)
|
||||
{
|
||||
const char *sig;
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
@ -488,7 +488,7 @@ _efl_ui_progressbar_efl_ui_range_range_unit_format_set(Eo *obj, Efl_Ui_Progressb
|
|||
}
|
||||
|
||||
EOLIAN static const char *
|
||||
_efl_ui_progressbar_efl_ui_range_range_unit_format_get(Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *sd)
|
||||
_efl_ui_progressbar_efl_ui_format_format_string_get(Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *sd)
|
||||
{
|
||||
return sd->units;
|
||||
}
|
||||
|
@ -542,13 +542,13 @@ elm_progressbar_span_size_get(const Evas_Object *obj)
|
|||
EAPI void
|
||||
elm_progressbar_unit_format_set(Evas_Object *obj, const char *units)
|
||||
{
|
||||
efl_ui_range_unit_format_set(obj, units);
|
||||
efl_ui_format_string_set(obj, units);
|
||||
}
|
||||
|
||||
EAPI const char *
|
||||
elm_progressbar_unit_format_get(const Evas_Object *obj)
|
||||
{
|
||||
return efl_ui_range_unit_format_get(obj);
|
||||
return efl_ui_format_string_get(obj);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Efl.Ui.Progressbar (Efl.Ui.Layout, Efl.Ui.Range, Efl.Ui.Direction)
|
||||
class Efl.Ui.Progressbar (Efl.Ui.Layout, Efl.Ui.Range, Efl.Ui.Format, Efl.Ui.Direction)
|
||||
{
|
||||
[[Elementary progressbar class]]
|
||||
methods {
|
||||
|
@ -53,8 +53,8 @@ class Efl.Ui.Progressbar (Efl.Ui.Layout, Efl.Ui.Range, Efl.Ui.Direction)
|
|||
Elm.Widget.widget_sub_object_add;
|
||||
Elm.Widget.widget_sub_object_del;
|
||||
Efl.Ui.Range.range_value { get; set; }
|
||||
Efl.Ui.Range.range_unit_format { get; set; }
|
||||
Efl.Ui.Direction.direction { get; set; }
|
||||
Efl.Ui.Format.format_string { get; set; }
|
||||
Efl.Part.part;
|
||||
}
|
||||
events {
|
||||
|
|
|
@ -1232,39 +1232,6 @@ _efl_ui_slider_efl_ui_direction_direction_get(Eo *obj EINA_UNUSED, Efl_Ui_Slider
|
|||
return sd->dir;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_slider_efl_ui_range_range_unit_format_set(Eo *obj, Efl_Ui_Slider_Data *sd, const char *units)
|
||||
{
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
eina_stringshare_replace(&sd->units, units);
|
||||
if (units)
|
||||
{
|
||||
elm_layout_signal_emit(obj, "elm,state,units,visible", "elm");
|
||||
edje_object_message_signal_process(wd->resize_obj);
|
||||
if (sd->popup)
|
||||
edje_object_signal_emit(sd->popup, "elm,state,units,visible", "elm");
|
||||
if (sd->popup2)
|
||||
edje_object_signal_emit(sd->popup2, "elm,state,units,visible", "elm");
|
||||
}
|
||||
else
|
||||
{
|
||||
elm_layout_signal_emit(obj, "elm,state,units,hidden", "elm");
|
||||
edje_object_message_signal_process(wd->resize_obj);
|
||||
if (sd->popup)
|
||||
edje_object_signal_emit(sd->popup, "elm,state,units,hidden", "elm");
|
||||
if (sd->popup2)
|
||||
edje_object_signal_emit(sd->popup2, "elm,state,units,hidden", "elm");
|
||||
}
|
||||
evas_object_smart_changed(obj);
|
||||
}
|
||||
|
||||
EOLIAN static const char *
|
||||
_efl_ui_slider_efl_ui_range_range_unit_format_get(Eo *obj EINA_UNUSED, Efl_Ui_Slider_Data *sd)
|
||||
{
|
||||
return sd->units;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_slider_indicator_format_set(Eo *obj, Efl_Ui_Slider_Data *sd, const char *indicator)
|
||||
{
|
||||
|
@ -1462,6 +1429,39 @@ _efl_ui_slider_efl_access_value_increment_get(Eo *obj EINA_UNUSED, Efl_Ui_Slider
|
|||
return sd->step;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_slider_efl_ui_format_format_string_set(Eo *obj, Efl_Ui_Slider_Data *sd, const char *units)
|
||||
{
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
eina_stringshare_replace(&sd->units, units);
|
||||
if (units)
|
||||
{
|
||||
elm_layout_signal_emit(obj, "elm,state,units,visible", "elm");
|
||||
edje_object_message_signal_process(wd->resize_obj);
|
||||
if (sd->popup)
|
||||
edje_object_signal_emit(sd->popup, "elm,state,units,visible", "elm");
|
||||
if (sd->popup2)
|
||||
edje_object_signal_emit(sd->popup2, "elm,state,units,visible", "elm");
|
||||
}
|
||||
else
|
||||
{
|
||||
elm_layout_signal_emit(obj, "elm,state,units,hidden", "elm");
|
||||
edje_object_message_signal_process(wd->resize_obj);
|
||||
if (sd->popup)
|
||||
edje_object_signal_emit(sd->popup, "elm,state,units,hidden", "elm");
|
||||
if (sd->popup2)
|
||||
edje_object_signal_emit(sd->popup2, "elm,state,units,hidden", "elm");
|
||||
}
|
||||
evas_object_smart_changed(obj);
|
||||
}
|
||||
|
||||
EOLIAN static const char *
|
||||
_efl_ui_slider_efl_ui_format_format_string_get(Eo *obj EINA_UNUSED, Efl_Ui_Slider_Data *sd)
|
||||
{
|
||||
return sd->units;
|
||||
}
|
||||
|
||||
EOLIAN const Elm_Atspi_Action *
|
||||
_efl_ui_slider_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNUSED, Efl_Ui_Slider_Data *pd EINA_UNUSED)
|
||||
{
|
||||
|
@ -1534,13 +1534,13 @@ elm_slider_span_size_get(const Evas_Object *obj)
|
|||
EAPI void
|
||||
elm_slider_unit_format_set(Evas_Object *obj, const char *units)
|
||||
{
|
||||
efl_ui_range_unit_format_set(obj, units);
|
||||
efl_ui_format_string_set(obj, units);
|
||||
}
|
||||
|
||||
EAPI const char *
|
||||
elm_slider_unit_format_get(const Evas_Object *obj)
|
||||
{
|
||||
return efl_ui_range_unit_format_get(obj);
|
||||
return efl_ui_format_string_get(obj);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
|
|
@ -2,7 +2,7 @@ type slider_func_type: __undefined_type; [[Elementary slider function type]]
|
|||
type slider_freefunc_type: __undefined_type; [[Elementary slider free function type]]
|
||||
|
||||
class Efl.Ui.Slider (Efl.Ui.Layout, Efl.Ui.Range, Efl.Ui.Direction,
|
||||
Efl.Access.Value, Efl.Text, Efl.Text.Markup,
|
||||
Efl.Access.Value, Efl.Text, Efl.Text.Markup, Efl.Ui.Format,
|
||||
Efl.Ui.Translatable, Elm.Interface.Atspi_Widget_Action)
|
||||
{
|
||||
[[Elementary slider class]]
|
||||
|
@ -120,7 +120,6 @@ class Efl.Ui.Slider (Efl.Ui.Layout, Efl.Ui.Range, Efl.Ui.Direction,
|
|||
Elm.Widget.on_focus_update;
|
||||
Elm.Widget.widget_event;
|
||||
Efl.Ui.Range.range_value { get; set; }
|
||||
Efl.Ui.Range.range_unit_format { get; set; }
|
||||
Efl.Ui.Range.range_min_max {get; set; }
|
||||
Efl.Ui.Direction.direction { get; set; }
|
||||
Efl.Access.Value.value_and_text { get; set; }
|
||||
|
@ -129,6 +128,7 @@ class Efl.Ui.Slider (Efl.Ui.Layout, Efl.Ui.Range, Efl.Ui.Direction,
|
|||
Elm.Interface.Atspi_Widget_Action.elm_actions { get; }
|
||||
Efl.Text.text { get; set; }
|
||||
Efl.Text.Markup.markup { get; set; }
|
||||
Efl.Ui.Format.format_string { get; set; }
|
||||
Efl.Ui.Translatable.translatable_text { get; set; }
|
||||
}
|
||||
events {
|
||||
|
|
Loading…
Reference in New Issue