--- /dev/null
+#define DAYSELECOR_DAY_POS_LEFT 1
+#define DAYSELECOR_DAY_POS_RIGHT 2
+#define DAYSELECOR_DAY_POS_MIDDLE 3
+#define DAYSELECOR_DAY_TYPE_WEEKDAY 1
+#define DAYSELECOR_DAY_TYPE_WEEKEND_DEFAULT 2
+#define DAYSELECOR_DAY_TYPE_WEEKEND_STYLE1 3
+#define DAYSELECOR_DAY_STATE_DEFAULT 1
+#define DAYSELECOR_DAY_STATE_PRESSED 2
+#define DAYSELECOR_DAY_STATE_SELECTED 3
+
+#define DAYSELECTOR_DAY(_pos, _after)\
+ part {\
+ name: "day"#_pos;\
+ type: SWALLOW;\
+ scale: 1;\
+ clip_to: "clipper";\
+ description { state: "default" 0.0;\
+ visible: 0;\
+ min: 0 0;\
+ align: 0.0 0.5;\
+ fixed: 1 0;\
+ rel1 {\
+ relative: 1.0 0.0;\
+ to: "day"#_after;\
+ offset: 1 0;\
+ }\
+ rel2 {\
+ relative: 1.0 1.0;\
+ to: "day"#_after;\
+ }\
+ }\
+ description { state: "visible" 0.0;\
+ inherit: "default" 0.0;\
+ visible: 1;\
+ min: 40 25;\
+ }\
+ }\
+ programs{\
+ program {\
+ name: "day"#_pos"visible";\
+ signal: "day"#_pos",visible";\
+ source: "elm";\
+ action: STATE_SET "visible" 0.0;\
+ target: "day"#_pos;\
+ }\
+ program {\
+ name: "day"#_pos"notvisible";\
+ signal: "day"#_pos",default";\
+ source: "elm";\
+ action: STATE_SET "default" 0.0;\
+ target: "day"#_pos;\
+ }\
+ }
+
+group {
+ name: "elm/dayselector/base/default";
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ clip_to: "clipper";
+ description { state: "default" 0.0;
+ rel1 {
+ relative: 0.5 0.0;
+ to: "day0";
+ }
+ rel2 {
+ relative: 0.5 1.0;
+ to: "day6";
+ }
+ color: 199 199 199 255;
+ }
+ }
+ part {
+ name: "day0";
+ type: SWALLOW;
+ scale: 1;
+ clip_to: "clipper";
+ description { state: "default" 0.0;
+ visible: 0;
+ min: 0 0;
+ align: 0.0 0.5;
+ fixed: 1 0;
+ rel2 {
+ relative: 0.0 1.0;
+ }
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ min: 40 25;
+ }
+ }
+ DAYSELECTOR_DAY(1, 0)
+ DAYSELECTOR_DAY(2, 1)
+ DAYSELECTOR_DAY(3, 2)
+ DAYSELECTOR_DAY(4, 3)
+ DAYSELECTOR_DAY(5, 4)
+ DAYSELECTOR_DAY(6, 5)
+ part {
+ name: "clipper";
+ type: RECT;
+ description { state: "default" 0.0;
+ rel1 {
+ relative: 0.0 0.0;
+ to: "day0";
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ to: "day6";
+ }
+ color: 255 255 255 255;
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ color: 200 200 200 255;
+ }
+ }
+ part {
+ name: "disabler";
+ type: RECT;
+ description { state: "default" 0.0;
+ color: 0 0 0 0;
+ visible: 0;
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "disble_dayselector";
+ signal: "elm,state,disabled";
+ source: "elm";
+ action: STATE_SET "visible" 0.0;
+ target: "disabler";
+ target: "clipper";
+ }
+ program {
+ name: "enable_dayselector";
+ signal: "elm,state,enabled";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "disabler";
+ target: "clipper";
+ }
+ program {
+ name: "day0_visible";
+ signal: "day0,visible";
+ source: "elm";
+ action: STATE_SET "visible" 0.0;
+ target: "day0";
+ }
+ program {
+ name: "day0_default";
+ signal: "day0,default";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "day0";
+ }
+ }
+}
+
+group {
+ name: "elm/check/base/dayselector/default";
+ images {
+ image: "seg_single_normal.png" COMP;
+ image: "seg_left_normal.png" COMP;
+ image: "seg_left_pressed.png" COMP;
+ image: "seg_left_selected.png" COMP;
+ image: "seg_right_normal.png" COMP;
+ image: "seg_right_pressed.png" COMP;
+ image: "seg_right_selected.png" COMP;
+ image: "seg_middle_normal.png" COMP;
+ image: "seg_middle_pressed.png" COMP;
+ image: "seg_middle_selected.png" COMP;
+ }
+ script {
+ public check_pos; // Left, Right, Middle.
+ public check_type; // Weekday, Weekend.
+ public check_state = DAYSELECOR_DAY_STATE_DEFAULT; // Default, Pressed, Selected.
+
+ public check_bg_show() {
+ if(get_int(check_pos) == DAYSELECOR_DAY_POS_LEFT)
+ {
+ if(get_int(check_state) == DAYSELECOR_DAY_STATE_DEFAULT)
+ set_state(PART:"bg", "default_left", 0.0);
+ else if(get_int(check_state) == DAYSELECOR_DAY_STATE_PRESSED)
+ set_state(PART:"bg", "pressed_left", 0.0);
+ else if(get_int(check_state) == DAYSELECOR_DAY_STATE_SELECTED)
+ set_state(PART:"bg", "selected_left", 0.0);
+ }
+ else if(get_int(check_pos) == DAYSELECOR_DAY_POS_RIGHT)
+ {
+ if(get_int(check_state) == DAYSELECOR_DAY_STATE_DEFAULT)
+ set_state(PART:"bg", "default_right", 0.0);
+ else if(get_int(check_state) == DAYSELECOR_DAY_STATE_PRESSED)
+ set_state(PART:"bg", "pressed_right", 0.0);
+ else if(get_int(check_state) == DAYSELECOR_DAY_STATE_SELECTED)
+ set_state(PART:"bg", "selected_right", 0.0);
+ }
+ else if(get_int(check_pos) == DAYSELECOR_DAY_POS_MIDDLE)
+ {
+ if(get_int(check_state) == DAYSELECOR_DAY_STATE_DEFAULT)
+ set_state(PART:"bg", "default_middle", 0.0);
+ else if(get_int(check_state) == DAYSELECOR_DAY_STATE_PRESSED)
+ set_state(PART:"bg", "pressed_middle", 0.0);
+ else if(get_int(check_state) == DAYSELECOR_DAY_STATE_SELECTED)
+ set_state(PART:"bg", "selected_middle", 0.0);
+ }
+ }
+ public check_text_show() {
+ if(get_int(check_state) == DAYSELECOR_DAY_STATE_SELECTED)
+ set_state(PART:"elm.text", "selected", 0.0);
+ else
+ {
+ if(get_int(check_type) == DAYSELECOR_DAY_TYPE_WEEKDAY)
+ set_state(PART:"elm.text", "default", 0.0);
+ else if (get_int(check_type) == DAYSELECOR_DAY_TYPE_WEEKEND_DEFAULT)
+ set_state(PART:"elm.text", "weekend_default", 0.0);
+ else if (get_int(check_type) == DAYSELECOR_DAY_TYPE_WEEKEND_STYLE1)
+ set_state(PART:"elm.text", "weekend_style1", 0.0);
+ }
+ }
+ }
+ parts {
+ part {
+ name: "bg";
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ image {
+ normal: "seg_single_normal.png";
+ border: 7 7 7 7;
+ border_scale: 1;
+ middle: 1;
+ }
+ }
+ description { state: "default_left" 0.0;
+ inherit: "default" 0.0;
+ image {
+ normal: "seg_left_normal.png";
+ border: 6 1 7 7;
+ }
+ }
+ description { state: "default_right" 0.0;
+ inherit: "default" 0.0;
+ image {
+ normal: "seg_right_normal.png";
+ border: 1 6 7 7;
+ }
+ }
+ description { state: "default_middle" 0.0;
+ inherit: "default" 0.0;
+ image {
+ normal: "seg_middle_normal.png";
+ border: 2 2 2 2;
+ }
+ }
+ description { state: "pressed_left" 0.0;
+ inherit: "default" 0.0;
+ image {
+ normal: "seg_left_pressed.png";
+ border: 6 1 7 7;
+ }
+ }
+ description { state: "pressed_right" 0.0;
+ inherit: "default" 0.0;
+ image {
+ normal: "seg_right_pressed.png";
+ border: 1 6 7 7;
+ }
+ }
+ description { state: "pressed_middle" 0.0;
+ inherit: "default" 0.0;
+ image {
+ normal: "seg_middle_pressed.png";
+ border: 1 1 2 2;
+ }
+ }
+ description { state: "selected_left" 0.0;
+ inherit: "default" 0.0;
+ image {
+ normal: "seg_left_selected.png";
+ border: 6 3 7 7;
+ }
+ }
+ description { state: "selected_right" 0.0;
+ inherit: "default" 0.0;
+ image {
+ normal: "seg_right_selected.png";
+ border: 3 6 7 7;
+ }
+ }
+ description { state: "selected_middle" 0.0;
+ inherit: "default" 0.0;
+ image {
+ normal: "seg_middle_selected.png";
+ border: 3 3 3 3;
+ }
+ }
+ }
+ part {
+ name: "left_padding";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 5 0;
+ visible: 0;
+ fixed: 1 0;
+ align: 0.0 0.5;
+ rel2 {
+ relative: 0.0 1.0;
+ }
+ }
+ }
+ part {
+ name: "right_padding";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description { state: "default" 0.0;
+ visible: 0;
+ min: 5 0;
+ fixed: 1 0;
+ align: 1.0 0.5;
+ rel1 {
+ relative: 1.0 0.0;
+ }
+ }
+ }
+ part {
+ name: "elm.text";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "left_padding";
+ relative: 1.0 0.0;
+ }
+ rel2 {
+ to: "right_padding";
+ relative: 0.0 1.0;
+ }
+ color: 224 224 224 255;
+ text {
+ font: "Sans,Edje-Vera";
+ size: 20;
+ min: 1 1;
+ }
+ }
+ description {
+ state: "weekend_default" 0.0;
+ inherit: "default" 0.0;
+ color: 8 96 170 255;
+ }
+ description {
+ state: "weekend_style1" 0.0;
+ inherit: "default" 0.0;
+ color: 225 49 8 255;
+ }
+ description {
+ state: "selected" 0.0;
+ inherit: "default" 0.0;
+ color: 50 50 50 255;
+ }
+ }
+ part {
+ name: "events";
+ type: RECT;
+ ignore_flags: ON_HOLD;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ to: "bg";
+ }
+ rel2 {
+ to: "bg";
+ }
+ color: 0 0 0 0;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "check,pressed";
+ signal: "mouse,down,1";
+ source: "events";
+ script {
+ set_int(check_state, DAYSELECOR_DAY_STATE_PRESSED);
+ check_bg_show();
+ }
+ }
+ program {
+ name: "check,toggle";
+ signal: "mouse,up,1";
+ source: "events";
+ action: SIGNAL_EMIT "elm,action,check,toggle" "";
+ }
+ program {
+ name: "check,on";
+ signal: "elm,state,check,on";
+ source: "elm";
+ script {
+ set_int(check_state, DAYSELECOR_DAY_STATE_SELECTED);
+ check_bg_show();
+ check_text_show();
+ }
+ }
+ program {
+ name: "check,off";
+ signal: "elm,state,check,off";
+ source: "elm";
+ script {
+ set_int(check_state, DAYSELECOR_DAY_STATE_DEFAULT);
+ check_bg_show();
+ check_text_show();
+ }
+ }
+ program { name: "check,left";
+ signal: "elm,pos,check,left";
+ source: "elm";
+ script {
+ set_int(check_pos, DAYSELECOR_DAY_POS_LEFT);
+ check_bg_show();
+ }
+ }
+ program { name: "check,right";
+ signal: "elm,pos,check,right";
+ source: "elm";
+ script {
+ set_int(check_pos, DAYSELECOR_DAY_POS_RIGHT);
+ check_bg_show();
+ }
+ }
+ program { name: "check,middle";
+ signal: "elm,pos,check,middle";
+ source: "elm";
+ script {
+ set_int(check_pos, DAYSELECOR_DAY_POS_MIDDLE);
+ check_bg_show();
+ }
+ }
+ program { name: "check,weekday";
+ signal: "elm,type,weekday,default";
+ source: "";
+ script {
+ set_int(check_type, DAYSELECOR_DAY_TYPE_WEEKDAY);
+ check_text_show();
+ }
+ }
+ program { name: "check,weekend,default";
+ signal: "elm,type,weekend,default";
+ source: "";
+ script {
+ set_int(check_type, DAYSELECOR_DAY_TYPE_WEEKEND_DEFAULT);
+ check_text_show();
+ }
+ }
+ program { name: "check,weekend,style1";
+ signal: "elm,type,weekend,style1";
+ source: "";
+ script {
+ set_int(check_type, DAYSELECOR_DAY_TYPE_WEEKEND_STYLE1);
+ check_text_show();
+ }
+ }
+ }
+}
+
+#undef DAYSELECOR_DAY_POS_LEFT
+#undef DAYSELECOR_DAY_POS_RIGHT
+#undef DAYSELECOR_DAY_POS_MIDDLE
+#undef DAYSELECOR_DAY_TYPE_WEEKDAY
+#undef DAYSELECOR_DAY_TYPE_WEEKEND_DEFAULT
+#undef DAYSELECOR_DAY_TYPE_WEEKEND_STYLE1
+#undef DAYSELECOR_DAY_STATE_DEFAULT
+#undef DAYSELECOR_DAY_STATE_PRESSED
+#undef DAYSELECOR_DAY_STATE_SELECTED
+#undef DAYSELECTOR_DAY
--- /dev/null
+#include "widget_preview_tmpl_head.c"
+
+Evas_Object *bx = elm_box_add(win);
+evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+elm_win_resize_object_add(win, bx);
+evas_object_show(bx);
+
+Evas_Object *o = elm_dayselector_add(win);
+evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
+elm_win_resize_object_add(win, o);
+elm_box_pack_end(bx, o);
+evas_object_show(o);
+
+#include "widget_preview_tmpl_foot.c"
--- /dev/null
+#include <Elementary.h>
+#ifdef HAVE_CONFIG_H
+#include "elementary_config.h"
+#endif
+#ifndef ELM_LIB_QUICKLAUNCH
+
+static void _changed_cb(void* data __UNUSED__, Evas_Object* obj, void* event_info)
+{
+ char buf[256];
+ Elm_Dayselector_Day day = (Elm_Dayselector_Day) event_info;
+ Eina_Bool checked = 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 = %d\n", buf, checked);
+}
+
+void
+test_dayselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Evas_Object *win, *bg, *bx, *dayselector, *sunday;
+
+ win = elm_win_add(NULL, "dayselector", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Day Selector");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bg = elm_bg_add(win);
+ elm_win_resize_object_add(win, bg);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(bg);
+
+ bx = elm_box_add(win);
+ elm_win_resize_object_add(win, bx);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(bx);
+
+ //Sunday first
+ 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);
+ elm_box_pack_end(bx, dayselector);
+ evas_object_show(dayselector);
+ evas_object_smart_callback_add(dayselector, "dayselector,changed", _changed_cb, NULL);
+ sunday = elm_object_part_content_get(dayselector, "day0");
+ elm_object_signal_emit(sunday, "elm,type,weekend,style1", "");
+
+ //Monday first
+ 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);
+ elm_dayselector_week_start_set(dayselector, ELM_DAYSELECTOR_MON);
+ elm_box_pack_end(bx, dayselector);
+ evas_object_show(dayselector);
+ evas_object_smart_callback_add(dayselector, "dayselector,changed", _changed_cb, NULL);
+ sunday = elm_object_part_content_get(dayselector, "day0");
+ elm_object_signal_emit(sunday, "elm,type,weekend,style1", "");
+
+ evas_object_resize(win, 350, 120);
+ evas_object_show(win);
+}
+
+#endif
--- /dev/null
+/**
+ * Simple Elementary's <b>dayselector widget</b> example, illustrating its
+ * usage and API.
+ *
+ * See stdout/stderr for output. Compile with:
+ *
+ * @verbatim
+ * gcc -g `pkg-config --cflags --libs elementary` dayselector_example.c -o dayselector_example
+ * @endverbatim
+ */
+
+#include <Elementary.h>
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#else
+# define __UNUSED__
+#endif
+
+static void
+_on_done(void *data __UNUSED__,
+ Evas_Object *obj __UNUSED__,
+ void *event_info __UNUSED__)
+{
+ elm_exit();
+}
+
+/* Callback function when a day is clicked. */
+static void _changed_cb(void* data __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 */
+
+int
+elm_main(int argc __UNUSED__, char **argv __UNUSED__)
+{
+ Evas_Object *win, *bg, *bx, *dayselector;
+
+ win = elm_win_add(NULL, "dayselector", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Dayselector Example");
+ evas_object_smart_callback_add(win, "delete,request", _on_done, NULL);
+
+ bg = elm_bg_add(win);
+ elm_win_resize_object_add(win, bg);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(bg);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ /* 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);
+
+ /* 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);
+
+ evas_object_resize(win, 350, 120);
+ evas_object_show(win);
+
+ elm_run();
+ return 0;
+}
+ELM_MAIN()
--- /dev/null
+#include <Elementary.h>
+#include "elm_priv.h"
+
+typedef struct _Widget_Data Widget_Data;
+typedef struct _Elm_Dayselector_Item Elm_Dayselector_Item;
+
+/* signals to edc */
+#define ITEM_TYPE_WEEKDAY_DEFAULT "elm,type,weekday,default"
+#define ITEM_TYPE_WEEKDAY_STYLE1 "elm,type,weekday,style1"
+#define ITEM_TYPE_WEEKEND_DEFAULT "elm,type,weekend,default"
+#define ITEM_TYPE_WEEKEND_STYLE1 "elm,type,weekend,style1"
+#define ITEM_POS_LEFT "elm,pos,check,left"
+#define ITEM_POS_RIGHT "elm,pos,check,right"
+#define ITEM_POS_MIDDLE "elm,pos,check,middle"
+
+struct _Widget_Data
+{
+ Evas_Object *base;
+ Eina_List *items;
+ Elm_Dayselector_Day week_start;
+ Elm_Dayselector_Day weekend_start;
+ unsigned int weekend_len;
+};
+
+struct _Elm_Dayselector_Item
+{
+ ELM_WIDGET_ITEM;
+ Elm_Dayselector_Day day;
+ const char *day_style;
+};
+
+static const char *widtype = NULL;
+static void _del_hook(Evas_Object *obj);
+static void _sizing_eval(Evas_Object* obj);
+static void _dayselector_resize(void *data, Evas *e __UNUSED__,
+ Evas_Object *obj __UNUSED__, void *event_info __UNUSED__);
+static void _disable_hook(Evas_Object *obj);
+static Eina_Bool _focus_next_hook(const Evas_Object *obj,
+ Elm_Focus_Direction dir __UNUSED__, Evas_Object **next __UNUSED__);
+static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
+static void _translate_hook(Evas_Object *obj);
+static void _theme_hook(Evas_Object *obj);
+static void _item_text_set_hook(Evas_Object *obj, const char *item, const char *label);
+static const char *_item_text_get_hook(const Evas_Object *obj, const char *item);
+static void _content_set_hook(Evas_Object *obj, const char *item, Evas_Object *content);
+static Evas_Object *_content_get_hook(const Evas_Object *obj, const char *item);
+static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *item);
+static void _signal_emit_cb(void *data, Evas_Object *obj, const char *emission,
+ const char *source __UNUSED__);
+static void _item_clicked_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__);
+static Elm_Dayselector_Item * _item_find(const Evas_Object *obj, Elm_Dayselector_Day day);
+static void _items_style_set(Evas_Object *obj);
+static void _update_items(Evas_Object *obj);
+static void _create_items(Evas_Object *obj);
+
+static const char SIG_CHANGED[] = "dayselector,changed";
+static const char SIG_LANG_CHANGED[] = "language,changed";
+static const Evas_Smart_Cb_Description _signals[] = {
+ {SIG_CHANGED, ""},
+ {SIG_LANG_CHANGED, ""},
+ {NULL, NULL}
+};
+
+static void
+_del_hook(Evas_Object *obj)
+{
+ Elm_Dayselector_Item *it;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ EINA_LIST_FREE(wd->items, it)
+ {
+ wd->items = eina_list_remove(wd->items, it);
+ eina_stringshare_del(it->day_style);
+ elm_widget_item_free(it);
+ }
+
+ free(wd);
+}
+
+static void
+_sizing_eval(Evas_Object* obj)
+{
+ Evas_Coord min_w = -1, min_h = -1;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ elm_coords_finger_size_adjust(ELM_DAYSELECTOR_MAX, &min_w, 1, &min_h);
+ edje_object_size_min_restricted_calc(wd->base, &min_w, &min_h, min_w, min_h);
+ elm_coords_finger_size_adjust(ELM_DAYSELECTOR_MAX, &min_w, 1, &min_h);
+ evas_object_size_hint_min_set(obj, min_w, min_h);
+}
+
+static void
+_dayselector_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
+ void *event_info __UNUSED__)
+{
+ _sizing_eval(data);
+}
+
+static void
+_disable_hook(Evas_Object *obj)
+{
+ Widget_Data* wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ if (elm_widget_disabled_get(obj))
+ edje_object_signal_emit(wd->base, "elm,state,disabled", "elm");
+ else
+ edje_object_signal_emit(wd->base, "elm,state,enabled", "elm");
+}
+
+static Eina_Bool
+_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir __UNUSED__,
+ Evas_Object **next __UNUSED__)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return EINA_FALSE;
+
+ /* TODO: Focus switch support to Elm_widget_Item is not supported yet.*/
+ return EINA_FALSE;
+}
+
+static void
+_mirrored_set(Evas_Object *obj, Eina_Bool rtl)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ edje_object_mirrored_set(wd->base, rtl);
+}
+
+static void
+_translate_hook(Evas_Object *obj)
+{
+ Eina_List *l;
+ Elm_Dayselector_Item *it;
+ struct tm time_daysel;
+ time_t t;
+ char buf[1024];
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ t = time(NULL);
+ localtime_r(&t, &time_daysel);
+ EINA_LIST_FOREACH(wd->items, l, it)
+ {
+ time_daysel.tm_wday = it->day;
+ strftime(buf, sizeof(buf), "%a", &time_daysel);
+ elm_object_text_set(VIEW(it), buf);
+ }
+ evas_object_smart_callback_call(obj, SIG_LANG_CHANGED, NULL);
+}
+
+static void
+_theme_hook(Evas_Object *obj)
+{
+ Eina_List *l;
+ Elm_Dayselector_Item *it;
+ char buf[1024];
+ unsigned int loc;
+ Widget_Data* wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ _elm_widget_mirrored_reload(obj);
+ _mirrored_set(obj, elm_widget_mirrored_get(obj));
+ _elm_theme_object_set(obj, wd->base, "dayselector", "base", elm_widget_style_get(obj));
+
+ EINA_LIST_FOREACH(wd->items, l, it)
+ {
+ snprintf(buf, sizeof(buf), "dayselector/%s", elm_object_style_get(obj));
+ elm_object_style_set(VIEW(it), buf);
+ loc = (ELM_DAYSELECTOR_MAX - wd->week_start + it->day) % ELM_DAYSELECTOR_MAX;
+ snprintf(buf, sizeof(buf), "day%d,visible", loc);
+ edje_object_signal_emit(wd->base, buf, "elm");
+ snprintf(buf, sizeof(buf), "day%d", loc);
+ edje_object_part_swallow(wd->base, buf, VIEW(it));
+ }
+ _update_items(obj);
+ _sizing_eval(obj);
+}
+
+static void
+_item_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj,
+ void *event_info __UNUSED__)
+{
+ ELM_CHECK_WIDTYPE(data, widtype);
+ Eina_List *l;
+ Elm_Dayselector_Item *it;
+ char buf[1024];
+ unsigned int loc = 0;
+ Widget_Data *wd = elm_widget_data_get(data);
+ if (!wd) return;
+
+ EINA_LIST_FOREACH(wd->items, l, it)
+ {
+ if (obj == VIEW(it))
+ {
+ wd->items = eina_list_remove(wd->items, it);
+ eina_stringshare_del(it->day_style);
+ evas_object_smart_callback_del(VIEW(it), "changed", _item_clicked_cb);
+ evas_object_event_callback_del(VIEW(it), EVAS_CALLBACK_DEL, _item_del_cb);
+ edje_object_part_unswallow(wd->base, VIEW(it));
+ loc = (ELM_DAYSELECTOR_MAX - wd->week_start + it->day) % ELM_DAYSELECTOR_MAX;
+ snprintf(buf, sizeof(buf), "day%d,default", loc);
+ edje_object_signal_emit(wd->base, buf, "elm");
+ elm_widget_item_free(it);
+ _sizing_eval(obj);
+ break;
+ }
+ }
+}
+
+static void
+_signal_emit_cb(void *data, Evas_Object *obj, const char *emission, const char *source __UNUSED__)
+{
+ Eina_List *l;
+ Elm_Dayselector_Item *it;
+ Widget_Data *wd = elm_widget_data_get(data);
+ if (!wd) return;
+
+ EINA_LIST_FOREACH(wd->items, l, it)
+ {
+ if (obj == VIEW(it))
+ {
+ eina_stringshare_replace(&it->day_style, emission);
+ return ;
+ }
+ }
+}
+
+static void
+_item_text_set_hook(Evas_Object *obj, const char *item, const char *label)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Eina_List *l;
+ Elm_Dayselector_Item *it;
+ char buf[1024];
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (item && !strcmp(item, "default")) return;
+ if (!wd) return;
+
+ EINA_LIST_FOREACH(wd->items, l, it)
+ {
+ snprintf(buf, sizeof(buf), "day%d", it->day);
+ if (!strncmp(buf, item, sizeof(buf)))
+ {
+ elm_object_text_set(VIEW(it), label);
+ _sizing_eval(obj);
+ break;
+ }
+ }
+}
+
+static const char *
+_item_text_get_hook(const Evas_Object *obj, const char *item)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Eina_List *l;
+ Elm_Dayselector_Item *it;
+ char buf[1024];
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (item && !strcmp(item, "default")) return NULL;
+ if (!wd) return NULL;
+
+ EINA_LIST_FOREACH(wd->items, l, it)
+ {
+ snprintf(buf, sizeof(buf), "day%d", it->day);
+ if (!strncmp(buf, item, sizeof(buf)))
+ return elm_object_text_get(VIEW(it));
+ }
+ return NULL;
+}
+
+static void
+_content_set_hook(Evas_Object *obj, const char *item, Evas_Object *content)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Eina_List *l;
+ Elm_Dayselector_Item *it;
+ char buf[1024];
+ unsigned int idx, loc;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd || !content) return;
+ if (item && !strcmp(item, "default")) return;
+ if(strcmp(elm_object_widget_type_get(content), "check")) return;
+
+ EINA_LIST_FOREACH(wd->items, l, it)
+ {
+ snprintf(buf, sizeof(buf), "day%d", it->day);
+ if (!strncmp(buf, item, sizeof(buf)))
+ {
+ if (VIEW(it)) evas_object_del(VIEW(it));
+ break;
+ }
+ }
+ for (idx = 0; idx < ELM_DAYSELECTOR_MAX; idx++)
+ {
+ snprintf(buf, sizeof(buf), "day%d", idx);
+ if (!strncmp(buf, item, sizeof(buf)))
+ {
+ it = elm_widget_item_new(obj, Elm_Dayselector_Item);
+ if (!it) continue;
+ VIEW(it) = content;
+ it->day = idx;
+ wd->items = eina_list_append(wd->items, it);
+ elm_widget_sub_object_add(obj, content);
+ loc = (ELM_DAYSELECTOR_MAX - wd->week_start + idx) % ELM_DAYSELECTOR_MAX;
+ snprintf(buf, sizeof(buf), "day%d", loc);
+ edje_object_part_swallow(wd->base, buf, VIEW(it));
+ snprintf(buf, sizeof(buf), "day%d,visible", loc);
+ edje_object_signal_emit(wd->base, buf, "elm");
+ evas_object_smart_callback_add(VIEW(it), "changed", _item_clicked_cb, obj);
+ evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_DEL, _item_del_cb, obj);
+ elm_object_signal_callback_add(VIEW(it), ITEM_TYPE_WEEKDAY_DEFAULT, "", _signal_emit_cb, obj);
+ elm_object_signal_callback_add(VIEW(it), ITEM_TYPE_WEEKDAY_STYLE1, "", _signal_emit_cb, obj);
+ elm_object_signal_callback_add(VIEW(it), ITEM_TYPE_WEEKEND_DEFAULT, "", _signal_emit_cb, obj);
+ elm_object_signal_callback_add(VIEW(it), ITEM_TYPE_WEEKEND_STYLE1, "", _signal_emit_cb, obj);
+ _sizing_eval(obj);
+ _update_items(obj);
+ break;
+ }
+ }
+}
+
+static Evas_Object *
+_content_get_hook(const Evas_Object *obj, const char *item)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Eina_List *l;
+ Elm_Dayselector_Item *it;
+ char buf[1024];
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ if (item && !strcmp(item, "default")) return NULL;
+
+ EINA_LIST_FOREACH(wd->items, l, it)
+ {
+ snprintf(buf, sizeof(buf), "day%d", it->day);
+ if (!strncmp(buf, item, sizeof(buf))) return VIEW(it);
+ }
+ return NULL;
+}
+
+static Evas_Object *
+_content_unset_hook(Evas_Object *obj, const char *item)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Eina_List *l;
+ Elm_Dayselector_Item *it;
+ Evas_Object *content;
+ char buf[1024];
+ unsigned int loc;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ if (item && !strcmp(item, "default")) return NULL;
+
+ EINA_LIST_FOREACH(wd->items, l, it)
+ {
+ snprintf(buf, sizeof(buf), "day%d", it->day);
+ if (!strncmp(buf, item, sizeof(buf)))
+ {
+ content = VIEW(it);
+ wd->items = eina_list_remove(wd->items, it);
+ evas_object_smart_callback_del(VIEW(it), "changed", _item_clicked_cb);
+ evas_object_event_callback_del(VIEW(it), EVAS_CALLBACK_DEL, _item_del_cb);
+ edje_object_part_unswallow(wd->base, VIEW(it));
+ loc = (ELM_DAYSELECTOR_MAX - wd->week_start + it->day) % ELM_DAYSELECTOR_MAX;
+ snprintf(buf, sizeof(buf), "day%d,default", loc);
+ edje_object_signal_emit(wd->base, buf, "elm");
+ _sizing_eval(obj);
+ return content;
+ }
+ }
+ return NULL;
+}
+
+static void
+_item_clicked_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
+{
+ Eina_List *l;
+ Elm_Dayselector_Item *it;
+ Widget_Data *wd = elm_widget_data_get(data);
+ if (!wd) return;
+
+ EINA_LIST_FOREACH(wd->items, l, it)
+ {
+ if (obj == VIEW(it))
+ {
+ evas_object_smart_callback_call(data, SIG_CHANGED, (void *)it->day);
+ return ;
+ }
+ }
+}
+
+static Elm_Dayselector_Item *
+_item_find(const Evas_Object *obj, Elm_Dayselector_Day day)
+{
+ Eina_List *l;
+ Elm_Dayselector_Item *it;
+ Widget_Data* wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+
+ EINA_LIST_FOREACH(wd->items, l, it)
+ if (day == it->day) return it;
+
+ return NULL;
+}
+
+static void
+_items_style_set(Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Eina_List *l;
+ Elm_Dayselector_Item *it;
+ unsigned int weekend_last;
+ Widget_Data* wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ weekend_last = wd->weekend_start + wd->weekend_len - 1;
+ if (weekend_last >= ELM_DAYSELECTOR_MAX)
+ weekend_last = weekend_last % ELM_DAYSELECTOR_MAX;
+
+ EINA_LIST_FOREACH(wd->items, l, it)
+ {
+ if (weekend_last >= wd->weekend_start)
+ {
+ if ((it->day >= wd->weekend_start) && (it->day <= weekend_last))
+ eina_stringshare_replace(&it->day_style, ITEM_TYPE_WEEKEND_DEFAULT);
+ else
+ eina_stringshare_replace(&it->day_style, ITEM_TYPE_WEEKDAY_DEFAULT);
+ }
+ else
+ {
+ if ((it->day >= wd->weekend_start) || (it->day <= weekend_last))
+ eina_stringshare_replace(&it->day_style, ITEM_TYPE_WEEKEND_DEFAULT);
+ else
+ eina_stringshare_replace(&it->day_style, ITEM_TYPE_WEEKDAY_DEFAULT);
+ }
+ }
+}
+
+static void
+_update_items(Evas_Object *obj)
+{
+ Eina_List *l;
+ Elm_Dayselector_Item *it;
+ unsigned int last_day;
+ Eina_Bool rtl;
+ Widget_Data* wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ last_day = wd->week_start + ELM_DAYSELECTOR_MAX - 1;
+ if (last_day >= ELM_DAYSELECTOR_MAX)
+ last_day = last_day % ELM_DAYSELECTOR_MAX;
+
+ rtl = elm_widget_mirrored_get(obj);
+ EINA_LIST_FOREACH(wd->items, l, it)
+ {
+ elm_object_signal_emit(VIEW(it), it->day_style, "");
+ if (it->day == wd->week_start)
+ {
+ if (rtl) elm_object_signal_emit(VIEW(it), ITEM_POS_RIGHT, "elm");
+ else elm_object_signal_emit(VIEW(it), ITEM_POS_LEFT, "elm");
+ }
+ else if (it->day == last_day)
+ {
+ if (rtl) elm_object_signal_emit(VIEW(it), ITEM_POS_LEFT, "elm");
+ else elm_object_signal_emit(VIEW(it), ITEM_POS_RIGHT, "elm");
+ }
+ else
+ elm_object_signal_emit(VIEW(it), ITEM_POS_MIDDLE, "elm");
+ }
+}
+
+static void
+_create_items(Evas_Object *obj)
+{
+ Elm_Dayselector_Item *it;
+ struct tm time_daysel;
+ time_t t;
+ char buf[1024];
+ unsigned int idx, loc;
+ Widget_Data* wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ t = time(NULL);
+ localtime_r(&t, &time_daysel);
+ for (idx = 0; idx < ELM_DAYSELECTOR_MAX; idx++)
+ {
+ it = elm_widget_item_new(obj, Elm_Dayselector_Item);
+ if (!it) continue;
+ VIEW(it) = elm_check_add(wd->base);
+ elm_widget_sub_object_add(obj, VIEW(it));
+ wd->items = eina_list_append(wd->items, it);
+ elm_object_style_set(VIEW(it), "dayselector/default");
+ time_daysel.tm_wday = idx;
+ strftime(buf, sizeof(buf), "%a", &time_daysel);
+ elm_object_text_set(VIEW(it), buf);
+ it->day = idx;
+ loc = (ELM_DAYSELECTOR_MAX - wd->week_start + idx) % ELM_DAYSELECTOR_MAX;
+ snprintf(buf, sizeof(buf), "day%d", loc);
+ edje_object_part_swallow(wd->base, buf, VIEW(it));
+ snprintf(buf, sizeof(buf), "day%d,visible", idx);
+ edje_object_signal_emit(wd->base, buf, "elm");
+ evas_object_smart_callback_add(VIEW(it), "changed", _item_clicked_cb, obj);
+ evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_DEL, _item_del_cb, obj);
+ elm_object_signal_callback_add(VIEW(it), ITEM_TYPE_WEEKDAY_DEFAULT, "", _signal_emit_cb, obj);
+ elm_object_signal_callback_add(VIEW(it), ITEM_TYPE_WEEKDAY_STYLE1, "", _signal_emit_cb, obj);
+ elm_object_signal_callback_add(VIEW(it), ITEM_TYPE_WEEKEND_DEFAULT, "", _signal_emit_cb, obj);
+ elm_object_signal_callback_add(VIEW(it), ITEM_TYPE_WEEKEND_STYLE1, "", _signal_emit_cb, obj);
+ }
+ _items_style_set(obj);
+ _update_items(obj);
+}
+
+EAPI Evas_Object *
+elm_dayselector_add(Evas_Object *parent)
+{
+ Evas_Object *obj;
+ Evas *e;
+ Widget_Data *wd;
+
+ ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+
+ ELM_SET_WIDTYPE(widtype, "dayselector");
+ elm_widget_type_set(obj, widtype);
+ elm_widget_sub_object_add(parent, obj);
+ elm_widget_data_set(obj, wd);
+ elm_widget_del_hook_set(obj, _del_hook);
+ elm_widget_theme_hook_set(obj, _theme_hook);
+ elm_widget_disable_hook_set(obj, _disable_hook);
+ elm_widget_focus_next_hook_set(obj, _focus_next_hook);
+ elm_widget_translate_hook_set(obj, _translate_hook);
+ elm_widget_text_set_hook_set(obj, _item_text_set_hook);
+ elm_widget_text_get_hook_set(obj, _item_text_get_hook);
+ elm_widget_content_set_hook_set(obj, _content_set_hook);
+ elm_widget_content_get_hook_set(obj, _content_get_hook);
+ elm_widget_content_unset_hook_set(obj, _content_unset_hook);
+ wd->base = edje_object_add(e);
+ _elm_theme_object_set(obj, wd->base, "dayselector", "base", "default");
+ elm_object_style_set(wd->base, "dayselector");
+ elm_widget_resize_object_set(obj, wd->base);
+
+ wd->week_start = _elm_config->week_start;
+ wd->weekend_start = _elm_config->weekend_start;
+ wd->weekend_len = _elm_config->weekend_len;
+ _create_items(obj);
+
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _dayselector_resize, obj);
+ evas_object_smart_callbacks_descriptions_set(obj, _signals);
+ _mirrored_set(obj, elm_widget_mirrored_get(obj));
+ _sizing_eval(obj);
+ return obj;
+}
+
+EAPI void
+elm_dayselector_day_selected_set(Evas_Object *obj, Elm_Dayselector_Day day, Eina_Bool selected)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data* wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ elm_check_state_set(VIEW(_item_find(obj, day)), selected);
+}
+
+EAPI Eina_Bool
+elm_dayselector_day_selected_get(const Evas_Object *obj, Elm_Dayselector_Day day)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+ Widget_Data* wd = elm_widget_data_get(obj);
+ if (!wd) return EINA_FALSE;
+
+ return elm_check_state_get(VIEW(_item_find(obj, day)));
+}
+
+EAPI void
+elm_dayselector_week_start_set(Evas_Object *obj, Elm_Dayselector_Day day)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Eina_List *l;
+ Elm_Dayselector_Item *it;
+ char buf[1024];
+ unsigned int loc;
+ Widget_Data* wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ wd->week_start = day;
+ EINA_LIST_FOREACH(wd->items, l, it)
+ {
+ loc = (ELM_DAYSELECTOR_MAX - wd->week_start + it->day) % ELM_DAYSELECTOR_MAX;
+ snprintf(buf, sizeof(buf), "day%d", loc);
+ edje_object_part_swallow(wd->base, buf, VIEW(it));
+ }
+ _update_items(obj);
+}
+
+EAPI Elm_Dayselector_Day
+elm_dayselector_week_start_get(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) ELM_DAYSELECTOR_MAX;
+ Widget_Data* wd = elm_widget_data_get(obj);
+ if (!wd) return ELM_DAYSELECTOR_MAX;
+
+ return wd->week_start;
+}
+
+EAPI void
+elm_dayselector_weekend_start_set(Evas_Object *obj, Elm_Dayselector_Day day)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data* wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ wd->weekend_start = day;
+ _items_style_set(obj);
+ _update_items(obj);
+}
+
+EAPI Elm_Dayselector_Day
+elm_dayselector_weekend_start_get(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) ELM_DAYSELECTOR_MAX;
+ Widget_Data* wd = elm_widget_data_get(obj);
+ if (!wd) return ELM_DAYSELECTOR_MAX;
+
+ return wd->weekend_start;
+}
+
+EAPI void
+elm_dayselector_weekend_length_set(Evas_Object *obj, unsigned int length)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data* wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ wd->weekend_len = length;
+ _items_style_set(obj);
+ _update_items(obj);
+}
+
+EAPI unsigned int
+elm_dayselector_weekend_length_get(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) 0;
+ Widget_Data* wd = elm_widget_data_get(obj);
+ if (!wd) return 0;
+
+ return wd->weekend_len;
+}
--- /dev/null
+/**
+ * @defgroup Dayselector Dayselector
+ *
+ * @image html img/widget/dayselector/preview-00.png
+ * @image latex img/widget/dayselector/preview-00.eps
+ *
+ * @brief <b>Dayselector widet:</b>
+ *
+ *"elm_dayselector" is a day selection widget. It displays all seven days of
+ * the week and allows the user to select multiple days.
+ *
+ * The selection can be toggle by just clicking on the day.
+ *
+ * Dayselector also provides the functionality to check whether a day is
+ * selected or not.
+ *
+ * First day of the week is taken from config settings by default. It can be
+ * altered by using the API elm_dayselector_week_start_set() API.
+ *
+ * APIs are provided for setting the duration of weekend
+ * elm_dayselector_weekend_start_set() and elm_dayselector_weekend_length_set()
+ * does this job.
+ *
+ * Two styles of weekdays and weekends are supported in Dayselector.
+ * Application can emit signals on individual check objects for setting the
+ * weekday, weekend styles.
+ *
+ * Once the weekend start day or weekend length changes, all the weekday &
+ * weekend styles will be reset to default style. It's the application's
+ * responsibility to set the styles again by sending corresponding signals.
+ *
+ * Supported elm_object_item common APIs.
+ *
+ * @li elm_object_part_text_set,
+ * @li elm_object_part_text_get,
+ * @li elm_object_part_content_set,
+ * @li elm_object_part_content_get,
+ * @li elm_object_part_content_unset
+ *
+ * @li "day0" indicates Sunday, "day1" indicates Monday etc. continues and so,
+ * "day6" indicates the Saturday part name.
+ *
+ * Application can change individual day display string by using the API
+ * elm_object_part_text_set().
+ *
+ * elm_object_part_content_set() API sets the individual day object only if
+ * the passed one is a Check widget.
+ *
+ * Check object representing a day can be set/get by the application by using
+ * the elm_object_part_content_set/get APIs thus providing a way to handle
+ * the different check styles for individual days.
+ *
+ * The widget emits the following signals:
+ *
+ * <b>"dayselector,changed"</b> - This signal is emitted when the user changes
+ * the state of a day.
+ *
+ * Available styles for dayselector are:
+ * - <b>@c default </b>
+ *
+ * This example shows the usage of the widget.
+ * @li @ref dayselector_example
+ *
+ */
+
+/**
+ * @addtogroup Dayselector
+ * @{
+ */
+
+/**
+ * Identifies the day of the week.
+ * API can call the selection/unselection of day with this as a parameter.
+ *
+ * @see elm_dayselector_day_selected_set()
+ * @see elm_dayselector_day_selected_get()
+ */
+typedef enum
+{
+ ELM_DAYSELECTOR_SUN = 0,/**< indicates Sunday */
+ ELM_DAYSELECTOR_MON, /**< indicates Monday */
+ ELM_DAYSELECTOR_TUE, /**< indicates Tuesday */
+ ELM_DAYSELECTOR_WED, /**< indicates Wednesday */
+ ELM_DAYSELECTOR_THU, /**< indicates Thursday */
+ ELM_DAYSELECTOR_FRI, /**< indicates Friday */
+ ELM_DAYSELECTOR_SAT, /**< indicates Saturday */
+ ELM_DAYSELECTOR_MAX /**< Sentinel value, @b don't use */
+} Elm_Dayselector_Day;
+
+/**
+ * Add the dayselector.
+ *
+ * @param parent Parent object
+ * @return New dayselector object or @c NULL, if it cannot be created
+ *
+ * @ingroup Dayselector
+ */
+EAPI Evas_Object *elm_dayselector_add(Evas_Object *parent);
+
+/**
+ * Set the state of given Dayselector_Day.
+ *
+ * @param obj Dayselector object
+ * @param day Dayselector_Day that the user want to set state.
+ * @param selected state of the day. @c EINA_TRUE is selected.
+ *
+ * @see Elm_Dayselector_Day
+ * @see elm_dayselector_day_selected_get()
+ *
+ */
+EAPI void elm_dayselector_day_selected_set(Evas_Object *obj, Elm_Dayselector_Day day, Eina_Bool selected);
+
+/**
+ * Get the state of given Dayselector_Day.
+ *
+ * @param obj Dayselector object
+ * @param day Dayselector_Day that the user want to know state.
+ * @return @c EINA_TRUE, if the Day is selected
+ *
+ * @see Elm_Dayselector_Day
+ * @see elm_dayselector_day_selected_set()
+ *
+ */
+EAPI Eina_Bool elm_dayselector_day_selected_get(const Evas_Object *obj, Elm_Dayselector_Day day);
+
+/**
+ * Set the starting day of Dayselector.
+ *
+ * @param obj Dayselector object
+ * @param day Dayselector_Day the first day that the user wants to display.
+ *
+ * @see Elm_Dayselector_Day
+ * @see elm_dayselector_week_start_get()
+ *
+ */
+EAPI void elm_dayselector_week_start_set(Evas_Object *obj, Elm_Dayselector_Day day);
+
+/**
+ * Get the starting day of Dayselector.
+ *
+ * @param obj Dayselector object
+ * @return Day from where Dayselector displays all the weekdays in order.
+ *
+ * @see Elm_Dayselector_Day
+ * @see elm_dayselector_week_start_set()
+ *
+ */
+EAPI Elm_Dayselector_Day elm_dayselector_week_start_get(const Evas_Object *obj);
+
+/**
+ * Set the weekend starting day of Dayselector.
+ *
+ * @param obj Dayselector object
+ * @param day Dayselector_Day the first day from where weekend starts.
+ *
+ * @see Elm_Dayselector_Day
+ * @see elm_dayselector_weekend_start_get()
+ *
+ */
+EAPI void elm_dayselector_weekend_start_set(Evas_Object *obj, Elm_Dayselector_Day day);
+
+/**
+ * Get the weekend starting day of Dayselector.
+ *
+ * @param obj Dayselector object
+ * @return Elm_Dayselector_Day Day from where weekend starts.
+ *
+ * @see Elm_Dayselector_Day
+ * @see elm_dayselector_weekend_start_set()
+ *
+ */
+EAPI Elm_Dayselector_Day elm_dayselector_weekend_start_get(const Evas_Object *obj);
+
+/**
+ * Set the weekend length of Dayselector.
+ *
+ * @param obj Dayselector object
+ * @param length Weekend length, number of days as an integer.
+ *
+ * @see elm_dayselector_weekend_length_get()
+ *
+ */
+EAPI void elm_dayselector_weekend_length_set(Evas_Object *obj, unsigned int length);
+
+/**
+ * Get the weekend length of Dayselector.
+ *
+ * @param obj Dayselector object
+ * @return Number of days marked as a weekend.
+ *
+ * @see Elm_Dayselector_Day
+ * @see elm_dayselector_weekend_length_set()
+ *
+ */
+EAPI unsigned int elm_dayselector_weekend_length_get(const Evas_Object *obj);
+
+/**
+ * @}
+ */