style { name: "calendar_date_today_style";\
base: "font="FN" font_size=10 color=#3399ff style=glow glow_color=#3399ff18 align=center";\
}\
+ style { name: "calendar_date_disabled_style";\
+ base: "font="FN" font_size=10 color=#151515 style=shadow_bottom shadow_color=#ffffffc0 align=center";\
+ }\
#define CAL_SPIN(_sufix, _signal_sufix, _text, _relative)\
part { name: "left_bt"#_sufix; type: RECT;\
inherit: "default" 0.0; \
text.style: "calendar_date_today_style"; \
} \
+ description { state: "disabled" 0.0; \
+ inherit: "default" 0.0; \
+ text.style: "calendar_date_disabled_style"; \
+ } \
} \
part { name: "cit_"#_pos".check"; mouse_events: 0; \
scale: 1; \
target: "cit_"#_pos".text"; \
} \
program { \
+ name: "cit_"#_pos".enable"; \
+ signal: "cit_"#_pos",enable"; \
+ source: "elm"; \
+ script { \
+ new st[31]; \
+ new Float:vl; \
+ get_state(PART:"cit_"#_pos".text", st, 30, vl); \
+ if (!strcmp(st, "disabled")) \
+ set_state(PART:"cit_"#_pos".text", "default", 0.0); \
+ } \
+ } \
+ program { \
+ name: "cit_"#_pos".disable"; \
+ signal: "cit_"#_pos",disable"; \
+ source: "elm"; \
+ action: STATE_SET "disabled" 0.0; \
+ target: "cit_"#_pos".text"; \
+ } \
+ program { \
source: "cit_"#_pos".clicked"; \
signal: "mouse,down,1"; \
source: "cit_"#_pos".event"; \
}
static inline int
-_maxdays_get(struct tm *selected_time)
+_maxdays_get(struct tm *selected_time, int month_offset)
{
int month, year;
- month = selected_time->tm_mon;
+ month = (selected_time->tm_mon + month_offset) % 12;
year = selected_time->tm_year + 1900;
+ if (month < 0) month += 12;
+
return _days_in_month
[((!(year % 4)) && ((!(year % 400)) || (year % 100)))][month];
}
sd->today_it = it;
}
+static inline void
+_enable(Elm_Calendar_Data *sd,
+ int it)
+{
+ char emission[32];
+
+ snprintf(emission, sizeof(emission), "cit_%i,enable", it);
+ elm_layout_signal_emit(sd->obj, emission, "elm");
+ sd->today_it = it;
+}
+
+static inline void
+_disable(Elm_Calendar_Data *sd,
+ int it)
+{
+ char emission[32];
+
+ snprintf(emission, sizeof(emission), "cit_%i,disable", it);
+ elm_layout_signal_emit(sd->obj, emission, "elm");
+ sd->today_it = it;
+}
+
static char *
_format_month_year(struct tm *selected_time)
{
ELM_CALENDAR_DATA_GET(obj, sd);
day = 0;
- maxdays = _maxdays_get(&sd->shown_time);
+ maxdays = _maxdays_get(&sd->shown_time, 0);
for (i = 0; i < 42; i++)
{
if ((!day) && (i == sd->first_day_it)) day = 1;
static void
_populate(Evas_Object *obj)
{
- int maxdays, day, mon, yr, i;
+ int maxdays, prev_month_maxdays, day, mon, yr, i;
Elm_Calendar_Mark *mark;
char part[12], day_s[3];
struct tm first_day;
sd->filling = EINA_FALSE;
if (sd->today_it > 0) _not_today(sd);
- maxdays = _maxdays_get(&sd->shown_time);
+ maxdays = _maxdays_get(&sd->shown_time, 0);
+ prev_month_maxdays = _maxdays_get(&sd->shown_time, -1);
mon = sd->shown_time.tm_mon;
yr = sd->shown_time.tm_year;
}
if ((day) && (day <= maxdays))
- snprintf(day_s, sizeof(day_s), "%i", day++);
+ {
+ _enable(sd, i);
+ snprintf(day_s, sizeof(day_s), "%i", day++);
+ }
else
- day_s[0] = 0;
+ {
+ _disable(sd, i);
+
+ if (day <= maxdays)
+ snprintf(day_s, sizeof(day_s), "%i", prev_month_maxdays - sd->first_day_it + i + 1);
+ else
+ snprintf(day_s, sizeof(day_s), "%i", i - sd->first_day_it - maxdays + 1);
+ }
snprintf(part, sizeof(part), "cit_%i.text", i);
elm_layout_text_set(obj, part, day_s);
if ((sd->select_mode != ELM_CALENDAR_SELECT_MODE_ONDEMAND)
&& (sd->select_mode != ELM_CALENDAR_SELECT_MODE_NONE))
{
- maxdays = _maxdays_get(&sd->shown_time);
+ maxdays = _maxdays_get(&sd->shown_time, 0);
if (sd->selected_time.tm_mday > maxdays)
sd->selected_time.tm_mday = maxdays;
ELM_CALENDAR_DATA_GET(obj, sd);
day = selected_it - sd->first_day_it + 1;
- if ((day < 0) || (day > _maxdays_get(&sd->shown_time)))
+ if ((day < 0) || (day > _maxdays_get(&sd->shown_time, 0)))
return 0;
return day;
items = eina_list_append(items, sd->inc_btn_year_access);
day = 0;
- maxdays = _maxdays_get(&sd->shown_time);
+ maxdays = _maxdays_get(&sd->shown_time, 0);
for (i = 0; i < 42; i++)
{
if ((!day) && (i == sd->first_day_it)) day = 1;
else
{
day = 0;
- maxdays = _maxdays_get(&sd->shown_time);
+ maxdays = _maxdays_get(&sd->shown_time, 0);
for (i = 0; i < 42; i++)
{
if ((!day) && (i == sd->first_day_it)) day = 1;