Tizen Native API  6.5
Check example

This example will show 2 checkboxes, one with just a label and the second one with both a label and an icon. This example also illustrates how to have the checkbox change the value of a variable and how to react to those changes.

We will start with the usual setup code:

EAPI_MAIN int
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
   Evas_Object *win, *cb, *cb2, *icon;
   Eina_Bool value;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add("check", "Check");
   elm_win_autodel_set(win, EINA_TRUE);

And now we create our first checkbox, set its label, tell it to change the value of value when the checkbox stats is changed and ask to be notified of state changes:

   cb = elm_check_add(win);
   elm_object_text_set(cb, "checkbox");
   elm_check_state_pointer_set(cb, &value);
   evas_object_smart_callback_add(cb, "changed", _print, &value);
   evas_object_move(cb, 10, 10);
   evas_object_resize(cb, 200, 30);
   evas_object_show(cb);

For our second checkbox we are going to set an icon so we need to create and icon:

Note:
For simplicity we are using a rectangle as icon, but any evas object can be used.

And for our second checkbox we set the label, icon and state to true:

   cb2 = elm_check_add(win);
   elm_object_text_set(cb2, "another checkbox");
   elm_check_state_set(cb2, EINA_TRUE);
   elm_object_part_content_set(cb2, "icon", icon);
   evas_object_move(cb2, 10, 50);
   evas_object_resize(cb2, 200, 30);
   evas_object_show(cb2);

We now do some more setup:

   evas_object_resize(win, 200, 100);
   evas_object_show(win);

   elm_run();

   return 0;
}
ELM_MAIN()

And finally implement the callback that will be called when the first checkbox's state changes. This callback will use data to print a message:

static void
_print(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
   printf("check %smarked\n", *((Eina_Bool*)data) ? "" : "un");
}

Note:
This work because data is value(from the main function) and value is changed when the checkbox is changed.