elm_box_pack_end(bxx, bx);
cal = elm_calendar_add(win);
- elm_calendar_first_day_of_week_set(cal, 1);
+ elm_calendar_first_day_of_week_set(cal, ELM_DAY_MONDAY);
evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_box_pack_end(bx, cal);
elm_calendar_min_max_year_set(cal3, -1, -1);
elm_calendar_weekdays_names_set(cal, weekdays);
- elm_calendar_first_day_of_week_set(cal, 6);
+ elm_calendar_first_day_of_week_set(cal, ELM_DAY_SATURDAY);
elm_calendar_interval_set(cal, 0.4);
elm_calendar_format_function_set(cal, _format_month_year);
elm_calendar_min_max_year_set(cal, 2010, 2020);
Eina_List *marks;
double interval, first_interval;
int year_min, year_max, spin_speed;
- int today_it, selected_it, first_day_it, first_week_day;
+ int today_it, selected_it, first_day_it;
+ Elm_Calendar_Weekday first_week_day;
Ecore_Timer *spin, *update_timer;
Elm_Calendar_Format_Cb format_func;
- const char *weekdays[7];
+ const char *weekdays[ELM_DAY_LAST];
struct tm current_time, selected_time;
Day_Color day_color[42]; // EINA_DEPRECATED
Eina_Bool selection_enabled : 1;
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Coord minw = -1, minh = -1;
if (!wd) return;
- elm_coords_finger_size_adjust(8, &minw, 7, &minh);
+ elm_coords_finger_size_adjust(8, &minw, ELM_DAY_LAST, &minh);
edje_object_size_min_restricted_calc(wd->calendar, &minw, &minh, minw, minh);
evas_object_size_hint_min_set(obj, minw, minh);
evas_object_size_hint_max_set(obj, -1, -1);
static inline int
_weekday_get(int first_week_day, int day)
{
- return (day + first_week_day - 1) % 7;
+ return (day + first_week_day - 1) % ELM_DAY_LAST;
}
// EINA_DEPRECATED
mktime(&first_day);
// Layout of the calendar is changed for removing the unfilled last row.
- if (first_day.tm_wday < wd->first_week_day)
- wd->first_day_it = first_day.tm_wday + 7 - wd->first_week_day;
+ if (first_day.tm_wday < (int)wd->first_week_day)
+ wd->first_day_it = first_day.tm_wday + ELM_DAY_LAST - wd->first_week_day;
else
wd->first_day_it = first_day.tm_wday - wd->first_week_day;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- for (i = 0; i < 7; i++)
+ for (i = 0; i < ELM_DAY_LAST; i++)
{
part[3] = i + '0';
- edje_object_part_text_set(wd->calendar, part, wd->weekdays[(i + wd->first_week_day) % 7]);
+ edje_object_part_text_set(
+ wd->calendar, part,
+ wd->weekdays[(i + wd->first_week_day) % ELM_DAY_LAST]);
}
}
}
}
- for (i = 0; i < 7; i++)
+ for (i = 0; i < ELM_DAY_LAST; i++)
eina_stringshare_del(wd->weekdays[i]);
free(wd);
else if ((!strcmp(ev->keyname, "Up")) ||
(!strcmp(ev->keyname, "KP_Up")))
{
- _update_sel_it(obj, wd->selected_it-7);
+ _update_sel_it(obj, wd->selected_it-ELM_DAY_LAST);
}
else if ((!strcmp(ev->keyname, "Down")) ||
(!strcmp(ev->keyname, "KP_Down")))
{
- _update_sel_it(obj, wd->selected_it+7);
+ _update_sel_it(obj, wd->selected_it+ELM_DAY_LAST);
}
else if ((!strcmp(ev->keyname, "Prior")) ||
(!strcmp(ev->keyname, "KP_Prior")))
evas_object_smart_callbacks_descriptions_set(obj, _signals);
- for (i = 0; i < 7; i++)
+ for (i = 0; i < ELM_DAY_LAST; i++)
{
/* FIXME: I'm not aware of a known max, so if it fails,
* just make it larger. :| */
EINA_SAFETY_ON_NULL_RETURN(weekdays);
- for (i = 0; i < 7; i++)
+ for (i = 0; i < ELM_DAY_LAST; i++)
{
eina_stringshare_replace(&wd->weekdays[i], weekdays[i]);
}
}
EAPI void
-elm_calendar_first_day_of_week_set(Evas_Object *obj, int day)
+elm_calendar_first_day_of_week_set(Evas_Object *obj, Elm_Calendar_Weekday day)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if ((day > 6) || (day < 0)) return;
+ if (day >= ELM_DAY_LAST) return;
if (wd->first_week_day != day)
{
wd->first_week_day = day;
}
}
-EAPI int
+EAPI Elm_Calendar_Weekday
elm_calendar_first_day_of_week_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) -1;