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:
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);
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:
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);
evas_object_show(dayselector);
The following code exemplifies the selection APIs of Dayselector:
static void _changed_cb(void* data, Evas_Object* obj, void* event_info)
{
char buf[256];
Eina_Bool selected;
switch(day)
{
case ELM_DAYSELECTOR_SUN: snprintf(buf, sizeof(buf), "%s", "Sun"); break;
default: snprintf(buf, sizeof(buf), "%s", "???"); break;
}
fprintf(stderr, "%s state is %d\n", buf, selected);
}
See the full example, whose window should look like this picture:
See the full source code for this example.