Tizen Native API  5.0
Dayselector widget example

This code places two Elementary dayselector widgets on a window, each of them exemplifying the different widget styles.

The first of them is the dayselector in default style:

   /* add a dayselector widget showing weekdays starting from Sunday */
   dayselector = elm_dayselector_add(win);
   evas_object_size_hint_weight_set(dayselector, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(dayselector, EVAS_HINT_FILL, 0.5);
   evas_object_smart_callback_add(dayselector, "dayselector,changed", _changed_cb, NULL);
   elm_box_pack_end(bx, dayselector);
   evas_object_show(dayselector);

As you see, the default style displays the weekdays starting from Sunday.

One can select/unselect a day just by clicking on the day object. The selection toggles once it is being pressed.

For showing weekdays starting from Monday, see the second dayselector:

   /* add a dayselector widget showing weekdays starting from Monday */
   dayselector = elm_dayselector_add(win);
   evas_object_size_hint_weight_set(dayselector, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(dayselector, EVAS_HINT_FILL, 0.5);
   evas_object_smart_callback_add(dayselector, "dayselector,changed", _changed_cb, NULL);
   elm_object_style_set(dayselector, "mon_first");
   elm_box_pack_end(bx, dayselector);
   evas_object_show(dayselector);

The following code exemplifies the selection APIs of Dayselector:

/* Callback function when a day is clicked. */
static void _changed_cb(void *data EINA_UNUSED, Evas_Object *obj,
                        void *event_info)
{
   char buf[256];
   Elm_Dayselector_Day day;
   Eina_Bool selected;

   /* get which day's state is changed */
   day = (Elm_Dayselector_Day) event_info;
   /* get the state of corresponding day's check object */
   selected = elm_dayselector_day_selected_get(obj, day);
   switch(day)
     {
      case ELM_DAYSELECTOR_SUN: snprintf(buf, sizeof(buf), "%s", "Sun");   break;
      case ELM_DAYSELECTOR_MON: snprintf(buf, sizeof(buf), "%s", "Mon");   break;
      case ELM_DAYSELECTOR_TUE: snprintf(buf, sizeof(buf), "%s", "Tue");   break;
      case ELM_DAYSELECTOR_WED: snprintf(buf, sizeof(buf), "%s", "Wed");   break;
      case ELM_DAYSELECTOR_THU: snprintf(buf, sizeof(buf), "%s", "Thu");   break;
      case ELM_DAYSELECTOR_FRI: snprintf(buf, sizeof(buf), "%s", "Fri");   break;
      case ELM_DAYSELECTOR_SAT: snprintf(buf, sizeof(buf), "%s", "Sat");   break;
      default: snprintf(buf, sizeof(buf), "%s", "???"); break;
     }
   fprintf(stderr, "%s state is %d\n", buf, selected);
}
/* End of clicked callback */

See the full source code for this example.