Check
This feature is supported in wearable applications only.
The check component is similar to the radio component, except that it does not work as a group. It toggles the value of a boolean between true and false.
This UI component inherits from the layout component. All layout functions can be used on the check component.
Figure: Check component
Figure: Check hierarchy
Adding a Check Component
The following example shows how to create a check component.
Evas_Object *check, *parent; check = elm_check_add(parent);
Modifying the Check Styles
The check component style can be set with the elm_object_style_set() function.
The following styles are available for the rectangular UI component:
- default
- on and off
The following styles are available for the circular UI component:
- default
- small
- on and off
The following example sets the on and off style on our check object.
elm_object_style_set(check, "on and off");
To get the current style, use the elm_object_style_get() function.
char *style = elm_object_style_get(check);
Using the Check Component
After having created a check object, it is possible to set its boolean value to EINA_TRUE.
elm_check_state_set(check, EINA_TRUE);
You can also retrieve the current value of the check object.
Eina_Bool value = elm_check_state_get(check);
As with a radio object, an icon can be set for the rectangular UI component.
// Create a Home icon Evas_Object *icon; icon = elm_icon_add(parent); elm_icon_standard_set(icon, "home"); // Set it to the check object elm_object_part_content_set(check, "icon", icon);
The get functions of the elementary object API can be used to retrieve the content set to the check object.
// Get the content set in the icon part Evas_Object *icon = elm_object_part_content_get(check, "icon");
Using the Check Callbacks
When the value is changed by the user, the changed signal is emitted. The event_info parameter is NULL.
The following example shows how to register a callback on this signal.
{ evas_object_smart_callback_add(check, "changed", changed_cb, data); } // Callback function for the "changed" signal // This callback is called when the check value changes void changed_cb(void *data, Evas_Object *obj, void *event_info) { dlog_print(DLOG_INFO, LOG_TAG, "The value has changed\n"); }