Progressbar
This feature is supported in mobile applications only.
The progressbar component is used to display the progress status of a given job. It inherits from the layout component, which means that the layout component functions can be used on the progressbar component.
For more information, see the Progress bar API.
Figure: Progressbar component
Figure: Progressbar hierarchy
Adding a Progressbar Component
To create a progressbar component, use the elm_progressbar_add() function:
Evas_Object *pb = elm_progressbar_add(win);
Using the Progressbar Styles
The progressbar has several styles:
- default
- pending_list
- process_large
- process_medium
- process_small
In the following example, the style of the progressbar is set to pending_list.
elm_object_style_set(pb, "pending_list");
Using the Progressbar
By default, the progressbar does not show a label or an icon, and the unit label is set to %.0f %%.
To modify the label, icon, and unit label:
-
Set a label. In this example it is named Test label.
elm_object_text_set(pb, "Test label");
-
Set an icon with the elm_object_part_content_set() function using the icon partname:
elm_object_part_content_set(pb, "icon", icon_object);
-
Modify the unit label format string using a printf style format. Set it to be a float number with 2 decimals.
elm_progressbar_unit_format_set(pb, "%1.2f%%");
Configuring the Progressbar
To configure the progressbar:
-
Activate the progressbar pulse mode to make the progressbar loop infinitely between the start and end position:
elm_progressbar_pulse_set(pb, EINA_TRUE); elm_progressbar_pulse(pb, EINA_TRUE);
-
Invert the progressbar. In the inverted mode the high values are on the left and the low values on the right.
elm_progressbar_inverted_set(pb, EINA_TRUE);
-
Change the value with the elm_progressbar_value_set() function. The progressbar emits the changed signal when the progress value changes. In the following example, the pb progress value is set to 20%.
elm_progressbar_value_set(pb, 0.2);
-
Read the current value:
double value = elm_progressbar_value_get(pb);
-
Set the orientation of the progressbar to vertical instead of the default horizontal orientation:
elm_progressbar_horizontal_set(pb, EINA_FALSE);
Using the Progressbar Callbacks
The changed signal is the only signal specifically emitted by the progressbar component.
The following example shows how to register a callback on this signal.
{ evas_object_smart_callback_add(pb, "changed", changed_cb, data); } // Callback function for the "changed" signal // This callback is called when the progressbar value changes void changed_cb(void *data, Evas_Object *obj, void *event_info) { dlog_print(DLOG_INFO, LOG_TAG, "The value has changed\n"); }
Note |
---|
Except as noted, this content is licensed under LGPLv2.1+. |