forked from enlightenment/efl
Eolian: Integration of Calendar
This commit is contained in:
parent
558c884001
commit
ede5646e76
|
@ -563,7 +563,9 @@ BUILT_SOURCES = \
|
|||
elm_bubble.eo.c \
|
||||
elm_bubble.eo.h \
|
||||
elm_button.eo.c \
|
||||
elm_button.eo.h
|
||||
elm_button.eo.h \
|
||||
elm_calendar.eo.c \
|
||||
elm_calendar.eo.h
|
||||
|
||||
EXTRA_DIST += \
|
||||
elm_widget.eo \
|
||||
|
@ -585,7 +587,8 @@ EXTRA_DIST += \
|
|||
elm_bg.eo \
|
||||
elm_box.eo \
|
||||
elm_bubble.eo \
|
||||
elm_button.eo
|
||||
elm_button.eo \
|
||||
elm_calendar.eo
|
||||
|
||||
nodist_includesunstable_HEADERS = \
|
||||
elm_widget.eo.h \
|
||||
|
@ -607,5 +610,6 @@ nodist_includesunstable_HEADERS = \
|
|||
elm_box.eo.h \
|
||||
elm_bg.eo.h \
|
||||
elm_bubble.eo.h \
|
||||
elm_button.eo.h
|
||||
elm_button.eo.h \
|
||||
elm_calendar.eo.h
|
||||
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
#include "elm_priv.h"
|
||||
#include "elm_widget_calendar.h"
|
||||
|
||||
EAPI Eo_Op ELM_OBJ_CALENDAR_BASE_ID = EO_NOOP;
|
||||
|
||||
#define MY_CLASS ELM_OBJ_CALENDAR_CLASS
|
||||
|
||||
#define MY_CLASS_NAME "Elm_Calendar"
|
||||
|
@ -65,9 +63,8 @@ _mark_free(Elm_Calendar_Mark *mark)
|
|||
free(mark);
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_calendar_smart_sizing_eval(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
|
||||
|
||||
EOLIAN static void
|
||||
_elm_calendar_elm_layout_sizing_eval(Eo *obj, Elm_Calendar_Data *_pd EINA_UNUSED)
|
||||
{
|
||||
Evas_Coord minw = -1, minh = -1;
|
||||
ELM_CALENDAR_DATA_GET(obj, sd);
|
||||
|
@ -118,7 +115,7 @@ _select(Evas_Object *obj,
|
|||
}
|
||||
|
||||
static inline void
|
||||
_not_today(Elm_Calendar_Smart_Data *sd)
|
||||
_not_today(Elm_Calendar_Data *sd)
|
||||
{
|
||||
char emission[32];
|
||||
|
||||
|
@ -128,7 +125,7 @@ _not_today(Elm_Calendar_Smart_Data *sd)
|
|||
}
|
||||
|
||||
static inline void
|
||||
_today(Elm_Calendar_Smart_Data *sd,
|
||||
_today(Elm_Calendar_Data *sd,
|
||||
int it)
|
||||
{
|
||||
char emission[32];
|
||||
|
@ -185,7 +182,7 @@ _weekday_get(int first_week_day,
|
|||
|
||||
// EINA_DEPRECATED
|
||||
static void
|
||||
_text_day_color_update(Elm_Calendar_Smart_Data *sd,
|
||||
_text_day_color_update(Elm_Calendar_Data *sd,
|
||||
int pos)
|
||||
{
|
||||
char emission[32];
|
||||
|
@ -212,7 +209,7 @@ _text_day_color_update(Elm_Calendar_Smart_Data *sd,
|
|||
}
|
||||
|
||||
static void
|
||||
_set_month_year(Elm_Calendar_Smart_Data *sd)
|
||||
_set_month_year(Elm_Calendar_Data *sd)
|
||||
{
|
||||
char *buf;
|
||||
|
||||
|
@ -556,23 +553,21 @@ _set_headers(Evas_Object *obj)
|
|||
elm_layout_thaw(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_calendar_smart_theme(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_calendar_elm_widget_theme_apply(Eo *obj, Elm_Calendar_Data *_pd EINA_UNUSED)
|
||||
{
|
||||
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
||||
if (ret) *ret = EINA_FALSE;
|
||||
Eina_Bool int_ret = EINA_FALSE;
|
||||
|
||||
eo_do_super(obj, MY_CLASS, elm_obj_widget_theme_apply(&int_ret));
|
||||
if (!int_ret) return;
|
||||
if (!int_ret) return EINA_FALSE;
|
||||
|
||||
evas_object_smart_changed(obj);
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
/* Set correct tm_wday and tm_yday after other fields changes*/
|
||||
static inline void
|
||||
_fix_selected_time(Elm_Calendar_Smart_Data *sd)
|
||||
_fix_selected_time(Elm_Calendar_Data *sd)
|
||||
{
|
||||
if (sd->selected_time.tm_mon != sd->shown_time.tm_mon)
|
||||
sd->selected_time.tm_mon = sd->shown_time.tm_mon;
|
||||
|
@ -852,20 +847,14 @@ _update_cur_date(void *data)
|
|||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_calendar_smart_event(Eo *obj, void *_pd, va_list *list)
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_calendar_elm_widget_event(Eo *obj, Elm_Calendar_Data *sd, Evas_Object *src, Evas_Callback_Type type, void *event_info)
|
||||
{
|
||||
Evas_Object *src = va_arg(*list, Evas_Object *);
|
||||
Evas_Callback_Type type = va_arg(*list, Evas_Callback_Type);
|
||||
Evas_Event_Key_Down *ev = va_arg(*list, void *);
|
||||
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
|
||||
if (ret) *ret = EINA_FALSE;
|
||||
(void) src;
|
||||
Evas_Event_Key_Down *ev = event_info;
|
||||
|
||||
if (elm_widget_disabled_get(obj)) return;
|
||||
if (type != EVAS_CALLBACK_KEY_DOWN) return;
|
||||
if (elm_widget_disabled_get(obj)) return EINA_FALSE;
|
||||
if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
|
||||
|
||||
if ((!strcmp(ev->key, "Prior")) ||
|
||||
((!strcmp(ev->key, "KP_Prior")) && (!ev->string)))
|
||||
|
@ -913,15 +902,15 @@ _elm_calendar_smart_event(Eo *obj, void *_pd, va_list *list)
|
|||
&& (sd->shown_time.tm_mon == sd->selected_time.tm_mon)))
|
||||
_update_sel_it(obj, sd->selected_it + ELM_DAY_LAST);
|
||||
}
|
||||
else return;
|
||||
else return EINA_FALSE;
|
||||
}
|
||||
else return;
|
||||
else return EINA_FALSE;
|
||||
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_calendar_smart_calculate(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
|
||||
EOLIAN static void
|
||||
_elm_calendar_evas_smart_calculate(Eo *obj, Elm_Calendar_Data *_pd EINA_UNUSED)
|
||||
{
|
||||
elm_layout_freeze(obj);
|
||||
|
||||
|
@ -947,14 +936,13 @@ _style_changed(void *data,
|
|||
_set_month_year(sd);
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_calendar_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
||||
EOLIAN static void
|
||||
_elm_calendar_evas_smart_add(Eo *obj, Elm_Calendar_Data *priv)
|
||||
{
|
||||
time_t weekday = 259200; /* Just the first sunday since epoch */
|
||||
time_t current_time;
|
||||
int i, t;
|
||||
|
||||
Elm_Calendar_Smart_Data *priv = _pd;
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
|
||||
|
@ -1034,12 +1022,11 @@ _elm_calendar_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
|||
_access_calendar_spinner_register(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_calendar_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
||||
EOLIAN static void
|
||||
_elm_calendar_evas_smart_del(Eo *obj, Elm_Calendar_Data *sd)
|
||||
{
|
||||
int i;
|
||||
Elm_Calendar_Mark *mark;
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
|
||||
ecore_timer_del(sd->spin_month);
|
||||
ecore_timer_del(sd->spin_year);
|
||||
|
@ -1061,36 +1048,26 @@ _elm_calendar_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
|||
|
||||
static Eina_Bool _elm_calendar_smart_focus_next_enable = EINA_FALSE;
|
||||
|
||||
static void
|
||||
_elm_calendar_smart_focus_next_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_calendar_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Elm_Calendar_Data *_pd EINA_UNUSED)
|
||||
{
|
||||
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
||||
*ret = _elm_calendar_smart_focus_next_enable;
|
||||
return _elm_calendar_smart_focus_next_enable;
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_calendar_smart_focus_direction_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_calendar_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elm_Calendar_Data *_pd EINA_UNUSED)
|
||||
{
|
||||
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
||||
*ret = EINA_FALSE;
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_calendar_smart_focus_next(Eo *obj, void *_pd, va_list *list)
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_calendar_elm_widget_focus_next(Eo *obj, Elm_Calendar_Data *sd, Elm_Focus_Direction dir, Evas_Object **next)
|
||||
{
|
||||
Elm_Focus_Direction dir = va_arg(*list, Elm_Focus_Direction);
|
||||
Evas_Object **next = va_arg(*list, Evas_Object **);
|
||||
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
||||
if (ret) *ret = EINA_FALSE;
|
||||
Eina_Bool int_ret;
|
||||
|
||||
int maxdays, day, i;
|
||||
Eina_List *items = NULL;
|
||||
Evas_Object *ao;
|
||||
Evas_Object *po;
|
||||
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
|
||||
items = eina_list_append(items, sd->month_access);
|
||||
items = eina_list_append(items, sd->dec_btn_month_access);
|
||||
items = eina_list_append(items, sd->inc_btn_month_access);
|
||||
|
@ -1116,9 +1093,8 @@ _elm_calendar_smart_focus_next(Eo *obj, void *_pd, va_list *list)
|
|||
}
|
||||
}
|
||||
|
||||
int_ret = elm_widget_focus_list_next_get
|
||||
return elm_widget_focus_list_next_get
|
||||
(obj, items, eina_list_data_get, dir, next);
|
||||
if (ret) *ret = int_ret;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1169,10 +1145,10 @@ _access_obj_process(Evas_Object *obj, Eina_Bool is_access)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_calendar_smart_access(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
|
||||
EOLIAN static void
|
||||
_elm_calendar_elm_widget_access(Eo *obj EINA_UNUSED, Elm_Calendar_Data *_pd EINA_UNUSED, Eina_Bool access)
|
||||
{
|
||||
_elm_calendar_smart_focus_next_enable = va_arg(*list, int);
|
||||
_elm_calendar_smart_focus_next_enable = access;
|
||||
_access_obj_process(obj, _elm_calendar_smart_focus_next_enable);
|
||||
}
|
||||
|
||||
|
@ -1185,10 +1161,9 @@ elm_calendar_add(Evas_Object *parent)
|
|||
return obj;
|
||||
}
|
||||
|
||||
static void
|
||||
_constructor(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
||||
EOLIAN static void
|
||||
_elm_calendar_eo_base_constructor(Eo *obj, Elm_Calendar_Data *sd)
|
||||
{
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
sd->obj = obj;
|
||||
|
||||
eo_do_super(obj, MY_CLASS, eo_constructor());
|
||||
|
@ -1197,21 +1172,11 @@ _constructor(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
|||
evas_obj_smart_callbacks_descriptions_set(_smart_callbacks, NULL));
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_calendar_weekdays_names_set(Evas_Object *obj,
|
||||
const char *weekdays[])
|
||||
EOLIAN static void
|
||||
_elm_calendar_weekdays_names_set(Eo *obj, Elm_Calendar_Data *sd, const char **weekdays)
|
||||
{
|
||||
ELM_CALENDAR_CHECK(obj);
|
||||
eo_do(obj, elm_obj_calendar_weekdays_names_set(weekdays));
|
||||
}
|
||||
|
||||
static void
|
||||
_weekdays_names_set(Eo *obj, void *_pd, va_list *list)
|
||||
{
|
||||
const char **weekdays = va_arg(*list, const char **);
|
||||
int i;
|
||||
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
EINA_SAFETY_ON_NULL_RETURN(weekdays);
|
||||
|
||||
for (i = 0; i < ELM_DAY_LAST; i++)
|
||||
|
@ -1222,75 +1187,27 @@ _weekdays_names_set(Eo *obj, void *_pd, va_list *list)
|
|||
evas_object_smart_changed(obj);
|
||||
}
|
||||
|
||||
EAPI const char **
|
||||
elm_calendar_weekdays_names_get(const Evas_Object *obj)
|
||||
EOLIAN static const char**
|
||||
_elm_calendar_weekdays_names_get(Eo *obj EINA_UNUSED, Elm_Calendar_Data *sd)
|
||||
{
|
||||
ELM_CALENDAR_CHECK(obj) NULL;
|
||||
const char **ret = NULL;
|
||||
eo_do((Eo *) obj, elm_obj_calendar_weekdays_names_get(&ret));
|
||||
return ret;
|
||||
return sd->weekdays;
|
||||
}
|
||||
|
||||
static void
|
||||
_weekdays_names_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
EOLIAN static void
|
||||
_elm_calendar_interval_set(Eo *obj EINA_UNUSED, Elm_Calendar_Data *sd, double interval)
|
||||
{
|
||||
const char ***ret = va_arg(*list, const char ***);
|
||||
*ret = NULL;
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
|
||||
*ret = sd->weekdays;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_calendar_interval_set(Evas_Object *obj,
|
||||
double interval)
|
||||
{
|
||||
ELM_CALENDAR_CHECK(obj);
|
||||
eo_do(obj, elm_obj_calendar_interval_set(interval));
|
||||
}
|
||||
|
||||
static void
|
||||
_interval_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
{
|
||||
double interval = va_arg(*list, double);
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
sd->first_interval = interval;
|
||||
}
|
||||
|
||||
EAPI double
|
||||
elm_calendar_interval_get(const Evas_Object *obj)
|
||||
EOLIAN static double
|
||||
_elm_calendar_interval_get(Eo *obj EINA_UNUSED, Elm_Calendar_Data *sd)
|
||||
{
|
||||
ELM_CALENDAR_CHECK(obj) 0.0;
|
||||
double ret = 0.0;
|
||||
eo_do((Eo *) obj, elm_obj_calendar_interval_get(&ret));
|
||||
return ret;
|
||||
return sd->first_interval;
|
||||
}
|
||||
|
||||
static void
|
||||
_interval_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
EOLIAN static void
|
||||
_elm_calendar_min_max_year_set(Eo *obj, Elm_Calendar_Data *sd, int min, int max)
|
||||
{
|
||||
double *ret = va_arg(*list, double *);
|
||||
*ret = 0.0;
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
*ret = sd->first_interval;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_calendar_min_max_year_set(Evas_Object *obj,
|
||||
int min,
|
||||
int max)
|
||||
{
|
||||
ELM_CALENDAR_CHECK(obj);
|
||||
eo_do(obj, elm_obj_calendar_min_max_year_set(min, max));
|
||||
}
|
||||
|
||||
static void
|
||||
_min_max_year_set(Eo *obj, void *_pd, va_list *list)
|
||||
{
|
||||
int min = va_arg(*list, int);
|
||||
int max = va_arg(*list, int);
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
|
||||
min -= 1900;
|
||||
max -= 1900;
|
||||
if ((sd->year_min == min) && (sd->year_max == max)) return;
|
||||
|
@ -1306,22 +1223,9 @@ _min_max_year_set(Eo *obj, void *_pd, va_list *list)
|
|||
evas_object_smart_changed(obj);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_calendar_min_max_year_get(const Evas_Object *obj,
|
||||
int *min,
|
||||
int *max)
|
||||
EOLIAN static void
|
||||
_elm_calendar_min_max_year_get(Eo *obj EINA_UNUSED, Elm_Calendar_Data *sd, int *min, int *max)
|
||||
{
|
||||
ELM_CALENDAR_CHECK(obj);
|
||||
eo_do((Eo *) obj, elm_obj_calendar_min_max_year_get(min, max));
|
||||
}
|
||||
|
||||
static void
|
||||
_min_max_year_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
{
|
||||
int *min = va_arg(*list, int *);
|
||||
int *max = va_arg(*list, int *);
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
|
||||
if (min) *min = sd->year_min + 1900;
|
||||
if (max) *max = sd->year_max + 1900;
|
||||
}
|
||||
|
@ -1347,19 +1251,9 @@ elm_calendar_day_selection_disabled_get(const Evas_Object *obj)
|
|||
return !!(sd->select_mode == ELM_CALENDAR_SELECT_MODE_NONE);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_calendar_selected_time_set(Evas_Object *obj,
|
||||
struct tm *selected_time)
|
||||
EOLIAN static void
|
||||
_elm_calendar_selected_time_set(Eo *obj, Elm_Calendar_Data *sd, struct tm *selected_time)
|
||||
{
|
||||
ELM_CALENDAR_CHECK(obj);
|
||||
eo_do(obj, elm_obj_calendar_selected_time_set(selected_time));
|
||||
}
|
||||
|
||||
static void
|
||||
_selected_time_set(Eo *obj, void *_pd, va_list *list)
|
||||
{
|
||||
struct tm *selected_time = va_arg(*list, struct tm *);
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
EINA_SAFETY_ON_NULL_RETURN(selected_time);
|
||||
|
||||
if (sd->selectable & ELM_CALENDAR_SELECTABLE_YEAR)
|
||||
|
@ -1387,82 +1281,37 @@ _selected_time_set(Eo *obj, void *_pd, va_list *list)
|
|||
evas_object_smart_changed(obj);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_calendar_selected_time_get(const Evas_Object *obj,
|
||||
struct tm *selected_time)
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_calendar_selected_time_get(Eo *obj EINA_UNUSED, Elm_Calendar_Data *sd, struct tm *selected_time)
|
||||
{
|
||||
ELM_CALENDAR_CHECK(obj) EINA_FALSE;
|
||||
Eina_Bool ret = EINA_FALSE;
|
||||
eo_do((Eo *) obj, elm_obj_calendar_selected_time_get(selected_time, &ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
_selected_time_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
{
|
||||
struct tm *selected_time = va_arg(*list, struct tm *);
|
||||
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
||||
if (ret) *ret = EINA_FALSE;
|
||||
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
EINA_SAFETY_ON_NULL_RETURN(selected_time);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(selected_time, EINA_FALSE);
|
||||
|
||||
if ((sd->select_mode == ELM_CALENDAR_SELECT_MODE_ONDEMAND)
|
||||
&& (!sd->selected))
|
||||
return;
|
||||
return EINA_FALSE;
|
||||
*selected_time = sd->selected_time;
|
||||
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_calendar_format_function_set(Evas_Object *obj,
|
||||
Elm_Calendar_Format_Cb format_function)
|
||||
EOLIAN static void
|
||||
_elm_calendar_format_function_set(Eo *obj EINA_UNUSED, Elm_Calendar_Data *sd, Elm_Calendar_Format_Cb format_function)
|
||||
{
|
||||
ELM_CALENDAR_CHECK(obj);
|
||||
eo_do(obj, elm_obj_calendar_format_function_set(format_function));
|
||||
}
|
||||
|
||||
static void
|
||||
_format_function_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
{
|
||||
Elm_Calendar_Format_Cb format_function = va_arg(*list, Elm_Calendar_Format_Cb);
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
|
||||
sd->format_func = format_function;
|
||||
if (sd->double_spinners) /* theme has spinner for year */
|
||||
_set_month_year(sd);
|
||||
}
|
||||
|
||||
EAPI Elm_Calendar_Mark *
|
||||
elm_calendar_mark_add(Evas_Object *obj,
|
||||
const char *mark_type,
|
||||
struct tm *mark_time,
|
||||
Elm_Calendar_Mark_Repeat_Type repeat)
|
||||
EOLIAN static Elm_Calendar_Mark*
|
||||
_elm_calendar_mark_add(Eo *obj, Elm_Calendar_Data *sd, const char *mark_type, struct tm *mark_time, Elm_Calendar_Mark_Repeat_Type repeat)
|
||||
{
|
||||
ELM_CALENDAR_CHECK(obj) NULL;
|
||||
Elm_Calendar_Mark *ret = NULL;
|
||||
eo_do(obj, elm_obj_calendar_mark_add(mark_type, mark_time, repeat, &ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
_mark_add(Eo *obj, void *_pd, va_list *list)
|
||||
{
|
||||
const char *mark_type = va_arg(*list, const char *);
|
||||
struct tm *mark_time = va_arg(*list, struct tm *);
|
||||
Elm_Calendar_Mark_Repeat_Type repeat = va_arg(*list, Elm_Calendar_Mark_Repeat_Type);
|
||||
Elm_Calendar_Mark **ret = va_arg(*list, Elm_Calendar_Mark **);
|
||||
if (ret) *ret = NULL;
|
||||
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
Elm_Calendar_Mark *mark;
|
||||
|
||||
mark = _mark_new(obj, mark_type, mark_time, repeat);
|
||||
sd->marks = eina_list_append(sd->marks, mark);
|
||||
mark->node = eina_list_last(sd->marks);
|
||||
|
||||
if (ret) *ret = mark;
|
||||
return mark;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -1476,67 +1325,30 @@ elm_calendar_mark_del(Elm_Calendar_Mark *mark)
|
|||
_mark_free(mark);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_calendar_marks_clear(Evas_Object *obj)
|
||||
EOLIAN static void
|
||||
_elm_calendar_marks_clear(Eo *obj EINA_UNUSED, Elm_Calendar_Data *sd)
|
||||
{
|
||||
ELM_CALENDAR_CHECK(obj);
|
||||
eo_do(obj, elm_obj_calendar_marks_clear());
|
||||
}
|
||||
|
||||
static void
|
||||
_marks_clear(Eo *obj EINA_UNUSED, void *_pd, va_list *list EINA_UNUSED)
|
||||
{
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
Elm_Calendar_Mark *mark;
|
||||
|
||||
EINA_LIST_FREE(sd->marks, mark)
|
||||
_mark_free(mark);
|
||||
}
|
||||
|
||||
EAPI const Eina_List *
|
||||
elm_calendar_marks_get(const Evas_Object *obj)
|
||||
EOLIAN static const Eina_List*
|
||||
_elm_calendar_marks_get(Eo *obj EINA_UNUSED, Elm_Calendar_Data *sd)
|
||||
{
|
||||
ELM_CALENDAR_CHECK(obj) NULL;
|
||||
const Eina_List *ret = NULL;
|
||||
eo_do((Eo *) obj, elm_obj_calendar_marks_get(&ret));
|
||||
return ret;
|
||||
return sd->marks;
|
||||
}
|
||||
|
||||
static void
|
||||
_marks_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
{
|
||||
const Eina_List **ret = va_arg(*list, const Eina_List **);
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
*ret = sd->marks;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_calendar_marks_draw(Evas_Object *obj)
|
||||
{
|
||||
ELM_CALENDAR_CHECK(obj);
|
||||
eo_do(obj, elm_obj_calendar_marks_draw());
|
||||
}
|
||||
|
||||
static void
|
||||
_marks_draw(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
|
||||
EOLIAN static void
|
||||
_elm_calendar_marks_draw(Eo *obj, Elm_Calendar_Data *_pd EINA_UNUSED)
|
||||
{
|
||||
evas_object_smart_changed(obj);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_calendar_first_day_of_week_set(Evas_Object *obj,
|
||||
Elm_Calendar_Weekday day)
|
||||
EOLIAN static void
|
||||
_elm_calendar_first_day_of_week_set(Eo *obj, Elm_Calendar_Data *sd, Elm_Calendar_Weekday day)
|
||||
{
|
||||
ELM_CALENDAR_CHECK(obj);
|
||||
eo_do(obj, elm_obj_calendar_first_day_of_week_set(day));
|
||||
}
|
||||
|
||||
static void
|
||||
_first_day_of_week_set(Eo *obj, void *_pd, va_list *list)
|
||||
{
|
||||
Elm_Calendar_Weekday day = va_arg(*list, Elm_Calendar_Weekday);
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
|
||||
if (day >= ELM_DAY_LAST) return;
|
||||
if (sd->first_week_day != day)
|
||||
{
|
||||
|
@ -1545,36 +1357,15 @@ _first_day_of_week_set(Eo *obj, void *_pd, va_list *list)
|
|||
}
|
||||
}
|
||||
|
||||
EAPI Elm_Calendar_Weekday
|
||||
elm_calendar_first_day_of_week_get(const Evas_Object *obj)
|
||||
EOLIAN static Elm_Calendar_Weekday
|
||||
_elm_calendar_first_day_of_week_get(Eo *obj EINA_UNUSED, Elm_Calendar_Data *sd)
|
||||
{
|
||||
ELM_CALENDAR_CHECK(obj) - 1;
|
||||
Elm_Calendar_Weekday ret = -1;
|
||||
eo_do((Eo *) obj, elm_obj_calendar_first_day_of_week_get(&ret));
|
||||
return ret;
|
||||
return sd->first_week_day;
|
||||
}
|
||||
|
||||
static void
|
||||
_first_day_of_week_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
EOLIAN static void
|
||||
_elm_calendar_select_mode_set(Eo *obj, Elm_Calendar_Data *sd, Elm_Calendar_Select_Mode mode)
|
||||
{
|
||||
Elm_Calendar_Weekday *ret = va_arg(*list, Elm_Calendar_Weekday *);
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
*ret = sd->first_week_day;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_calendar_select_mode_set(Evas_Object *obj,
|
||||
Elm_Calendar_Select_Mode mode)
|
||||
{
|
||||
ELM_CALENDAR_CHECK(obj);
|
||||
eo_do(obj, elm_obj_calendar_select_mode_set(mode));
|
||||
}
|
||||
|
||||
static void
|
||||
_select_mode_set(Eo *obj, void *_pd, va_list *list)
|
||||
{
|
||||
Elm_Calendar_Select_Mode mode = va_arg(*list, Elm_Calendar_Select_Mode);
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
|
||||
if ((mode <= ELM_CALENDAR_SELECT_MODE_ONDEMAND)
|
||||
&& (sd->select_mode != mode))
|
||||
|
@ -1590,158 +1381,39 @@ _select_mode_set(Eo *obj, void *_pd, va_list *list)
|
|||
}
|
||||
}
|
||||
|
||||
EAPI Elm_Calendar_Select_Mode
|
||||
elm_calendar_select_mode_get(const Evas_Object *obj)
|
||||
EOLIAN static Elm_Calendar_Select_Mode
|
||||
_elm_calendar_select_mode_get(Eo *obj EINA_UNUSED, Elm_Calendar_Data *sd)
|
||||
{
|
||||
ELM_CALENDAR_CHECK(obj) - 1;
|
||||
Elm_Calendar_Select_Mode ret = -1;
|
||||
eo_do((Eo *) obj, elm_obj_calendar_select_mode_get(&ret));
|
||||
return ret;
|
||||
return sd->select_mode;
|
||||
}
|
||||
|
||||
static void
|
||||
_select_mode_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
EOLIAN static void
|
||||
_elm_calendar_selectable_set(Eo *obj EINA_UNUSED, Elm_Calendar_Data *sd, Elm_Calendar_Selectable selectable)
|
||||
{
|
||||
Elm_Calendar_Select_Mode *ret = va_arg(*list, Elm_Calendar_Select_Mode *);
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
*ret = sd->select_mode;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_calendar_selectable_set(Evas_Object *obj, Elm_Calendar_Selectable selectable)
|
||||
{
|
||||
ELM_CALENDAR_CHECK(obj);
|
||||
eo_do(obj, elm_obj_calendar_selectable_set(selectable));
|
||||
}
|
||||
|
||||
static void
|
||||
_selectable_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
{
|
||||
Elm_Calendar_Selectable selectable = va_arg(*list, Elm_Calendar_Selectable);
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
sd->selectable = selectable;
|
||||
}
|
||||
|
||||
EAPI Elm_Calendar_Selectable
|
||||
elm_calendar_selectable_get(const Evas_Object *obj)
|
||||
EOLIAN static Elm_Calendar_Selectable
|
||||
_elm_calendar_selectable_get(Eo *obj EINA_UNUSED, Elm_Calendar_Data *sd)
|
||||
{
|
||||
ELM_CALENDAR_CHECK(obj) -1;
|
||||
Elm_Calendar_Selectable ret = -1;
|
||||
eo_do((Eo *) obj, elm_obj_calendar_selectable_get(&ret));
|
||||
return ret;
|
||||
return sd->selectable;
|
||||
}
|
||||
|
||||
static void
|
||||
_selectable_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_calendar_displayed_time_get(Eo *obj EINA_UNUSED, Elm_Calendar_Data *sd, struct tm *displayed_time)
|
||||
{
|
||||
Elm_Calendar_Selectable *ret = va_arg(*list, Elm_Calendar_Selectable *);
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
*ret = sd->selectable;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_calendar_displayed_time_get(const Evas_Object *obj, struct tm *displayed_time)
|
||||
{
|
||||
ELM_CALENDAR_CHECK(obj) EINA_FALSE;
|
||||
Eina_Bool ret = EINA_FALSE;
|
||||
eo_do((Eo *) obj, elm_obj_calendar_displayed_time_get(displayed_time, &ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
_displayed_time_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
{
|
||||
struct tm *displayed_time = va_arg(*list, struct tm *);
|
||||
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
||||
if (ret) *ret = EINA_FALSE;
|
||||
EINA_SAFETY_ON_NULL_RETURN(displayed_time);
|
||||
Elm_Calendar_Smart_Data *sd = _pd;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(displayed_time, EINA_FALSE);
|
||||
*displayed_time = sd->shown_time;
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_class_constructor(Eo_Class *klass)
|
||||
_elm_calendar_class_constructor(Eo_Class *klass)
|
||||
{
|
||||
const Eo_Op_Func_Description func_desc[] = {
|
||||
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
|
||||
|
||||
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ADD), _elm_calendar_smart_add),
|
||||
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_DEL), _elm_calendar_smart_del),
|
||||
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_CALCULATE), _elm_calendar_smart_calculate),
|
||||
|
||||
EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_THEME_APPLY), _elm_calendar_smart_theme),
|
||||
EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_EVENT), _elm_calendar_smart_event),
|
||||
EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_FOCUS_NEXT_MANAGER_IS), _elm_calendar_smart_focus_next_manager_is),
|
||||
EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_FOCUS_DIRECTION_MANAGER_IS), _elm_calendar_smart_focus_direction_manager_is),
|
||||
EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_FOCUS_NEXT), _elm_calendar_smart_focus_next),
|
||||
EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_ACCESS), _elm_calendar_smart_access),
|
||||
|
||||
EO_OP_FUNC(ELM_OBJ_LAYOUT_ID(ELM_OBJ_LAYOUT_SUB_ID_SIZING_EVAL), _elm_calendar_smart_sizing_eval),
|
||||
|
||||
EO_OP_FUNC(ELM_OBJ_CALENDAR_ID(ELM_OBJ_CALENDAR_SUB_ID_WEEKDAYS_NAMES_SET), _weekdays_names_set),
|
||||
EO_OP_FUNC(ELM_OBJ_CALENDAR_ID(ELM_OBJ_CALENDAR_SUB_ID_WEEKDAYS_NAMES_GET), _weekdays_names_get),
|
||||
EO_OP_FUNC(ELM_OBJ_CALENDAR_ID(ELM_OBJ_CALENDAR_SUB_ID_INTERVAL_SET), _interval_set),
|
||||
EO_OP_FUNC(ELM_OBJ_CALENDAR_ID(ELM_OBJ_CALENDAR_SUB_ID_INTERVAL_GET), _interval_get),
|
||||
EO_OP_FUNC(ELM_OBJ_CALENDAR_ID(ELM_OBJ_CALENDAR_SUB_ID_MIN_MAX_YEAR_SET), _min_max_year_set),
|
||||
EO_OP_FUNC(ELM_OBJ_CALENDAR_ID(ELM_OBJ_CALENDAR_SUB_ID_MIN_MAX_YEAR_GET), _min_max_year_get),
|
||||
EO_OP_FUNC(ELM_OBJ_CALENDAR_ID(ELM_OBJ_CALENDAR_SUB_ID_SELECTED_TIME_SET), _selected_time_set),
|
||||
EO_OP_FUNC(ELM_OBJ_CALENDAR_ID(ELM_OBJ_CALENDAR_SUB_ID_SELECTED_TIME_GET), _selected_time_get),
|
||||
EO_OP_FUNC(ELM_OBJ_CALENDAR_ID(ELM_OBJ_CALENDAR_SUB_ID_FORMAT_FUNCTION_SET), _format_function_set),
|
||||
EO_OP_FUNC(ELM_OBJ_CALENDAR_ID(ELM_OBJ_CALENDAR_SUB_ID_MARK_ADD), _mark_add),
|
||||
EO_OP_FUNC(ELM_OBJ_CALENDAR_ID(ELM_OBJ_CALENDAR_SUB_ID_MARKS_CLEAR), _marks_clear),
|
||||
EO_OP_FUNC(ELM_OBJ_CALENDAR_ID(ELM_OBJ_CALENDAR_SUB_ID_MARKS_GET), _marks_get),
|
||||
EO_OP_FUNC(ELM_OBJ_CALENDAR_ID(ELM_OBJ_CALENDAR_SUB_ID_MARKS_DRAW), _marks_draw),
|
||||
EO_OP_FUNC(ELM_OBJ_CALENDAR_ID(ELM_OBJ_CALENDAR_SUB_ID_FIRST_DAY_OF_WEEK_SET), _first_day_of_week_set),
|
||||
EO_OP_FUNC(ELM_OBJ_CALENDAR_ID(ELM_OBJ_CALENDAR_SUB_ID_FIRST_DAY_OF_WEEK_GET), _first_day_of_week_get),
|
||||
EO_OP_FUNC(ELM_OBJ_CALENDAR_ID(ELM_OBJ_CALENDAR_SUB_ID_SELECT_MODE_SET), _select_mode_set),
|
||||
EO_OP_FUNC(ELM_OBJ_CALENDAR_ID(ELM_OBJ_CALENDAR_SUB_ID_SELECT_MODE_GET), _select_mode_get),
|
||||
EO_OP_FUNC(ELM_OBJ_CALENDAR_ID(ELM_OBJ_CALENDAR_SUB_ID_SELECTABLE_SET), _selectable_set),
|
||||
EO_OP_FUNC(ELM_OBJ_CALENDAR_ID(ELM_OBJ_CALENDAR_SUB_ID_SELECTABLE_GET), _selectable_get),
|
||||
EO_OP_FUNC(ELM_OBJ_CALENDAR_ID(ELM_OBJ_CALENDAR_SUB_ID_DISPLAYED_TIME_GET), _displayed_time_get),
|
||||
EO_OP_FUNC_SENTINEL
|
||||
};
|
||||
eo_class_funcs_set(klass, func_desc);
|
||||
|
||||
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
||||
|
||||
if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF)
|
||||
_elm_calendar_smart_focus_next_enable = EINA_TRUE;
|
||||
}
|
||||
|
||||
static const Eo_Op_Description op_desc[] = {
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_CALENDAR_SUB_ID_WEEKDAYS_NAMES_SET, "Set weekdays names to be displayed by the calendar."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_CALENDAR_SUB_ID_WEEKDAYS_NAMES_GET, "Get weekdays names displayed by the calendar."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_CALENDAR_SUB_ID_INTERVAL_SET, "Set the interval on time updates for an user mouse button hold."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_CALENDAR_SUB_ID_INTERVAL_GET, "Get the interval on time updates for an user mouse button hold."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_CALENDAR_SUB_ID_MIN_MAX_YEAR_SET, "Set the minimum and maximum values for the year."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_CALENDAR_SUB_ID_MIN_MAX_YEAR_GET, "Get the minimum and maximum values for the year."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_CALENDAR_SUB_ID_SELECTED_TIME_SET, "Set selected date to be highlighted on calendar."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_CALENDAR_SUB_ID_SELECTED_TIME_GET, "Get selected date."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_CALENDAR_SUB_ID_FORMAT_FUNCTION_SET, "Set a function to format the string that will be used to display."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_CALENDAR_SUB_ID_MARK_ADD, "Add a new mark to the calendar."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_CALENDAR_SUB_ID_MARKS_CLEAR, "Remove all calendar's marks."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_CALENDAR_SUB_ID_MARKS_GET, "Get a list of all the calendar marks."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_CALENDAR_SUB_ID_MARKS_DRAW, "Draw calendar marks."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_CALENDAR_SUB_ID_FIRST_DAY_OF_WEEK_SET, "Set the first day of week to use on calendar widgets'."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_CALENDAR_SUB_ID_FIRST_DAY_OF_WEEK_GET, "Get the first day of week, who are used on calendar widgets'."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_CALENDAR_SUB_ID_SELECT_MODE_SET, "Set select day mode to use."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_CALENDAR_SUB_ID_SELECT_MODE_GET, "Get the select day mode used."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_CALENDAR_SUB_ID_SELECTABLE_SET, "Define which fields of a tm struct will be taken into account, when *elm_calendar_selected_time_set() is invoked."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_CALENDAR_SUB_ID_SELECTABLE_GET, "Get how elm_calendar_selected_time_set manage a date."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_CALENDAR_SUB_ID_DISPLAYED_TIME_GET, "Get the current time displayed in the widget"),
|
||||
EO_OP_DESCRIPTION_SENTINEL
|
||||
};
|
||||
|
||||
static const Eo_Class_Description class_desc = {
|
||||
EO_VERSION,
|
||||
MY_CLASS_NAME,
|
||||
EO_CLASS_TYPE_REGULAR,
|
||||
EO_CLASS_DESCRIPTION_OPS(&ELM_OBJ_CALENDAR_BASE_ID, op_desc, ELM_OBJ_CALENDAR_SUB_ID_LAST),
|
||||
NULL,
|
||||
sizeof(Elm_Calendar_Smart_Data),
|
||||
_class_constructor,
|
||||
NULL
|
||||
};
|
||||
|
||||
EO_DEFINE_CLASS(elm_obj_calendar_class_get, &class_desc, ELM_OBJ_LAYOUT_CLASS, NULL);
|
||||
#include "elm_calendar.eo.c"
|
||||
|
|
|
@ -0,0 +1,419 @@
|
|||
class Elm_Calendar (Elm_Layout)
|
||||
{
|
||||
eo_prefix: elm_obj_calendar;
|
||||
properties {
|
||||
first_day_of_week {
|
||||
set {
|
||||
/*@
|
||||
Set the first day of week to use on calendar widgets'.
|
||||
|
||||
@ingroup Calendar */
|
||||
}
|
||||
get {
|
||||
/*@
|
||||
Get the first day of week, who are used on calendar widgets'.
|
||||
|
||||
@return An int which correspond to the first day of the week (Sunday = 0, Monday = 1,
|
||||
..., Saturday = 6)
|
||||
|
||||
@see elm_calendar_first_day_of_week_set() for more details
|
||||
|
||||
@ingroup Calendar */
|
||||
}
|
||||
values {
|
||||
Elm_Calendar_Weekday day; /*@ An int which correspond to the first day of the week (Sunday = 0, Monday = 1,
|
||||
..., Saturday = 6) */
|
||||
}
|
||||
}
|
||||
selectable {
|
||||
set {
|
||||
/*@
|
||||
Define which fields of a @b tm struct will be taken into account, when
|
||||
elm_calendar_selected_time_set() is invoked.
|
||||
|
||||
By Default the bitmask is set to use all fields of a @b tm struct (year,
|
||||
month and day of the month).
|
||||
|
||||
@ingroup Calendar
|
||||
@see elm_calendar_selected_time_set
|
||||
@since 1.8 */
|
||||
}
|
||||
get {
|
||||
/*@
|
||||
Get how elm_calendar_selected_time_set manage a date
|
||||
|
||||
@return The flag used to manage a date with a elm_calendar_selected_time_set
|
||||
|
||||
@ingroup Calendar
|
||||
@see elm_calendar_selectable_set
|
||||
@see elm_calendar_selected_time_set
|
||||
@since 1.8 */
|
||||
}
|
||||
values {
|
||||
Elm_Calendar_Selectable selectable; /*@ A bitmask of Elm_Calendar_Selectable */
|
||||
}
|
||||
}
|
||||
interval {
|
||||
set {
|
||||
/*@
|
||||
Set the interval on time updates for an user mouse button hold
|
||||
on calendar widgets' month/year selection.
|
||||
|
||||
This interval value is @b decreased while the user holds the
|
||||
mouse pointer either selecting next or previous month/year.
|
||||
|
||||
This helps the user to get to a given month distant from the
|
||||
current one easier/faster, as it will start to change quicker and
|
||||
quicker on mouse button holds.
|
||||
|
||||
The calculation for the next change interval value, starting from
|
||||
the one set with this call, is the previous interval divided by
|
||||
1.05, so it decreases a little bit.
|
||||
|
||||
The default starting interval value for automatic changes is
|
||||
@b 0.85 seconds.
|
||||
|
||||
@see elm_calendar_interval_get()
|
||||
|
||||
@ingroup Calendar */
|
||||
}
|
||||
get {
|
||||
/*@
|
||||
Get the interval on time updates for an user mouse button hold
|
||||
on calendar widgets' month/year selection.
|
||||
|
||||
@return The (first) interval value, in seconds, set on it
|
||||
|
||||
@see elm_calendar_interval_set() for more details
|
||||
|
||||
@ingroup Calendar */
|
||||
}
|
||||
values {
|
||||
double interval; /*@ The (first) interval value in seconds */
|
||||
}
|
||||
}
|
||||
weekdays_names {
|
||||
set {
|
||||
/*@
|
||||
Set weekdays names to be displayed by the calendar.
|
||||
|
||||
By default, weekdays abbreviations get from system are displayed:
|
||||
E.g. for an en_US locale: "Sun, Mon, Tue, Wed, Thu, Fri, Sat"
|
||||
|
||||
The first string should be related to Sunday, the second to Monday...
|
||||
|
||||
The usage should be like this:
|
||||
@code
|
||||
const char *weekdays[] =
|
||||
{
|
||||
"Sunday", "Monday", "Tuesday", "Wednesday",
|
||||
"Thursday", "Friday", "Saturday"
|
||||
};
|
||||
elm_calendar_weekdays_names_set(calendar, weekdays);
|
||||
@endcode
|
||||
|
||||
@see elm_calendar_weekdays_name_get()
|
||||
|
||||
@ref calendar_example_02
|
||||
|
||||
@ingroup Calendar */
|
||||
}
|
||||
get {
|
||||
/*@
|
||||
Get weekdays names displayed by the calendar.
|
||||
|
||||
@return Array of seven strings to be used as weekday names.
|
||||
|
||||
By default, weekdays abbreviations get from system are displayed:
|
||||
E.g. for an en_US locale: "Sun, Mon, Tue, Wed, Thu, Fri, Sat"
|
||||
The first string is related to Sunday, the second to Monday...
|
||||
|
||||
@see elm_calendar_weekdays_name_set()
|
||||
|
||||
@ref calendar_example_05
|
||||
|
||||
@ingroup Calendar */
|
||||
}
|
||||
values {
|
||||
const char **weekdays; /*@ Array of seven strings to be used as weekday names.
|
||||
@warning It must have 7 elements, or it will access invalid memory.
|
||||
@warning The strings must be NULL terminated ('@\0'). */
|
||||
}
|
||||
}
|
||||
select_mode {
|
||||
set {
|
||||
/*@
|
||||
Set select day mode to use.
|
||||
|
||||
Set the day selection mode used.
|
||||
|
||||
@ingroup Calendar */
|
||||
}
|
||||
get {
|
||||
/*@
|
||||
Get the select day mode used.
|
||||
|
||||
@return the selected mode
|
||||
|
||||
Get the day selection mode used.
|
||||
|
||||
@see elm_calendar_select_mode_set() for more details
|
||||
|
||||
@ingroup Calendar */
|
||||
}
|
||||
values {
|
||||
Elm_Calendar_Select_Mode mode; /*@ The select mode to use. */
|
||||
}
|
||||
}
|
||||
min_max_year {
|
||||
set {
|
||||
/*@
|
||||
Set the minimum and maximum values for the year
|
||||
|
||||
Maximum must be greater than minimum, except if you don't want to set
|
||||
maximum year.
|
||||
Default values are 1902 and -1.
|
||||
|
||||
If the maximum year is a negative value, it will be limited depending
|
||||
on the platform architecture (year 2037 for 32 bits);
|
||||
|
||||
@see elm_calendar_min_max_year_get()
|
||||
|
||||
@ref calendar_example_03
|
||||
|
||||
@ingroup Calendar */
|
||||
}
|
||||
get {
|
||||
/*@
|
||||
Get the minimum and maximum values for the year
|
||||
|
||||
Default values are 1902 and -1.
|
||||
|
||||
@see elm_calendar_min_max_year_set() for more details.
|
||||
|
||||
@ref calendar_example_05
|
||||
|
||||
@ingroup Calendar */
|
||||
}
|
||||
values {
|
||||
int min; /*@ The minimum year, greater than 1901; */
|
||||
int max; /*@ The maximum year; */
|
||||
}
|
||||
}
|
||||
format_function {
|
||||
set {
|
||||
/*@
|
||||
Set a function to format the string that will be used to display
|
||||
month and year;
|
||||
|
||||
By default it uses strftime with "%B %Y" format string.
|
||||
It should allocate the memory that will be used by the string,
|
||||
that will be freed by the widget after usage.
|
||||
A pointer to the string and a pointer to the time struct will be provided.
|
||||
|
||||
Example:
|
||||
@code
|
||||
static char
|
||||
_format_month_year(struct tm *selected_time)
|
||||
{
|
||||
char buf[32];
|
||||
if (!strftime(buf, sizeof(buf), "%B %Y", selected_time)) return NULL;
|
||||
return strdup(buf);
|
||||
}
|
||||
|
||||
elm_calendar_format_function_set(calendar, _format_month_year);
|
||||
@endcode
|
||||
|
||||
@ref calendar_example_02
|
||||
|
||||
@ingroup Calendar */
|
||||
}
|
||||
values {
|
||||
Elm_Calendar_Format_Cb format_function; /*@ Function to set the month-year string given
|
||||
the selected date */
|
||||
}
|
||||
}
|
||||
marks {
|
||||
get {
|
||||
/*@
|
||||
Get a list of all the calendar marks.
|
||||
|
||||
@return An @c Eina_List of calendar marks objects, or @c NULL on failure.
|
||||
|
||||
@see elm_calendar_mark_add()
|
||||
@see elm_calendar_mark_del()
|
||||
@see elm_calendar_marks_clear()
|
||||
|
||||
@ingroup Calendar */
|
||||
return const Eina_List *;
|
||||
}
|
||||
}
|
||||
}
|
||||
methods {
|
||||
selected_time_set {
|
||||
/*@
|
||||
Set selected date to be highlighted on calendar.
|
||||
|
||||
Set the selected date, changing the displayed month if needed.
|
||||
Selected date changes when the user goes to next/previous month or
|
||||
select a day pressing over it on calendar.
|
||||
|
||||
@see elm_calendar_selected_time_get()
|
||||
|
||||
@ref calendar_example_04
|
||||
|
||||
@ingroup Calendar */
|
||||
|
||||
params {
|
||||
@in struct tm *selected_time; /*@ A @b tm struct to represent the selected date. */
|
||||
}
|
||||
}
|
||||
selected_time_get {
|
||||
/*@
|
||||
Get selected date.
|
||||
|
||||
@return EINA_FALSE means an error occurred and returned time shouldn't
|
||||
be considered.
|
||||
|
||||
Get date selected by the user or set by function
|
||||
elm_calendar_selected_time_set().
|
||||
Selected date changes when the user goes to next/previous month or
|
||||
select a day pressing over it on calendar.
|
||||
|
||||
@see elm_calendar_selected_time_get()
|
||||
|
||||
@ref calendar_example_05
|
||||
|
||||
@ingroup Calendar */
|
||||
|
||||
const;
|
||||
return Eina_Bool;
|
||||
params {
|
||||
@inout struct tm *selected_time; /*@ A @b tm struct to point to selected date */
|
||||
}
|
||||
}
|
||||
mark_add {
|
||||
/*@
|
||||
Add a new mark to the calendar
|
||||
|
||||
@return The created mark or @p NULL upon failure.
|
||||
|
||||
Add a mark that will be drawn in the calendar respecting the insertion
|
||||
time and periodicity. It will emit the type as signal to the widget theme.
|
||||
Default theme supports "holiday" and "checked", but it can be extended.
|
||||
|
||||
It won't immediately update the calendar, drawing the marks.
|
||||
For this, call elm_calendar_marks_draw(). However, when user selects
|
||||
next or previous month calendar forces marks drawn.
|
||||
|
||||
Marks created with this method can be deleted with
|
||||
elm_calendar_mark_del().
|
||||
|
||||
Example
|
||||
@code
|
||||
struct tm selected_time;
|
||||
time_t current_time;
|
||||
|
||||
current_time = time(NULL) + 5 * (24 * 60 * 60);
|
||||
localtime_r(¤t_time, &selected_time);
|
||||
elm_calendar_mark_add(cal, "holiday", selected_time,
|
||||
ELM_CALENDAR_ANNUALLY);
|
||||
|
||||
current_time = time(NULL) + 1 * (24 * 60 * 60);
|
||||
localtime_r(¤t_time, &selected_time);
|
||||
elm_calendar_mark_add(cal, "checked", selected_time, ELM_CALENDAR_UNIQUE);
|
||||
|
||||
elm_calendar_marks_draw(cal);
|
||||
@endcode
|
||||
|
||||
@see elm_calendar_marks_draw()
|
||||
@see elm_calendar_mark_del()
|
||||
|
||||
@ref calendar_example_06
|
||||
|
||||
@ingroup Calendar */
|
||||
|
||||
return Elm_Calendar_Mark *;
|
||||
params {
|
||||
@in const char *mark_type; /*@ A string used to define the type of mark. It will be
|
||||
emitted to the theme, that should display a related modification on these
|
||||
days representation. */
|
||||
@in struct tm *mark_time; /*@ A time struct to represent the date of inclusion of the
|
||||
mark. For marks that repeats it will just be displayed after the inclusion
|
||||
date in the calendar. */
|
||||
@in Elm_Calendar_Mark_Repeat_Type repeat; /*@ Repeat the event following this periodicity. Can be a unique
|
||||
mark (that don't repeat), daily, weekly, monthly or annually. */
|
||||
}
|
||||
}
|
||||
marks_clear {
|
||||
/*@
|
||||
Remove all calendar's marks
|
||||
|
||||
@see elm_calendar_mark_add()
|
||||
@see elm_calendar_mark_del()
|
||||
|
||||
@ingroup Calendar */
|
||||
|
||||
}
|
||||
marks_draw {
|
||||
/*@
|
||||
Draw calendar marks.
|
||||
|
||||
Should be used after adding, removing or clearing marks.
|
||||
It will go through the entire marks list updating the calendar.
|
||||
If lots of marks will be added, add all the marks and then call
|
||||
this function.
|
||||
|
||||
When the month is changed, i.e. user selects next or previous month,
|
||||
marks will be drawn.
|
||||
|
||||
@see elm_calendar_mark_add()
|
||||
@see elm_calendar_mark_del()
|
||||
@see elm_calendar_marks_clear()
|
||||
|
||||
@ref calendar_example_06
|
||||
|
||||
@ingroup Calendar */
|
||||
|
||||
}
|
||||
displayed_time_get {
|
||||
/*@
|
||||
Get the current time displayed in the widget
|
||||
|
||||
@return EINA_FALSE means an error occurred. If it's an error the returned
|
||||
time is zero filled.
|
||||
|
||||
@ingroup Calendar
|
||||
@since 1.8 */
|
||||
|
||||
const;
|
||||
return Eina_Bool;
|
||||
params {
|
||||
@inout struct tm *displayed_time; /*@ A @b tm struct to point to displayed date */
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
class::constructor;
|
||||
Eo_Base::constructor;
|
||||
Evas_Smart::calculate;
|
||||
Evas_Smart::add;
|
||||
Evas_Smart::del;
|
||||
Elm_Widget::theme_apply;
|
||||
Elm_Widget::focus_next_manager_is;
|
||||
Elm_Widget::focus_direction_manager_is;
|
||||
Elm_Widget::access;
|
||||
Elm_Widget::focus_next;
|
||||
Elm_Widget::event;
|
||||
Elm_Layout::sizing_eval;
|
||||
}
|
||||
events {
|
||||
changed;
|
||||
display,changed;
|
||||
language,changed;
|
||||
access,changed;
|
||||
focused;
|
||||
unfocused;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,3 +1,6 @@
|
|||
#include "elm_calendar.eo.h"
|
||||
|
||||
#if 0
|
||||
#define ELM_OBJ_CALENDAR_CLASS elm_obj_calendar_class_get()
|
||||
|
||||
const Eo_Class *elm_obj_calendar_class_get(void) EINA_CONST;
|
||||
|
@ -317,3 +320,4 @@ enum
|
|||
* @ingroup Calendar
|
||||
*/
|
||||
#define elm_obj_calendar_displayed_time_get(displayed_time, ret) ELM_OBJ_CALENDAR_ID(ELM_OBJ_CALENDAR_SUB_ID_DISPLAYED_TIME_GET), EO_TYPECHECK(struct tm *, displayed_time), EO_TYPECHECK(Eina_Bool *, ret)
|
||||
#endif
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
/**
|
||||
* Base layout smart data extended with calendar instance data.
|
||||
*/
|
||||
typedef struct _Elm_Calendar_Smart_Data Elm_Calendar_Smart_Data;
|
||||
typedef struct _Elm_Calendar_Data Elm_Calendar_Data;
|
||||
|
||||
typedef enum _Day_Color // EINA_DEPRECATED
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ typedef enum _Day_Color // EINA_DEPRECATED
|
|||
DAY_SUNDAY = 2
|
||||
} Day_Color;
|
||||
|
||||
struct _Elm_Calendar_Smart_Data
|
||||
struct _Elm_Calendar_Data
|
||||
{
|
||||
Evas_Object *obj; // the object itself
|
||||
Eina_List *marks;
|
||||
|
@ -68,7 +68,7 @@ struct _Elm_Calendar_Mark
|
|||
*/
|
||||
|
||||
#define ELM_CALENDAR_DATA_GET(o, sd) \
|
||||
Elm_Calendar_Smart_Data * sd = eo_data_scope_get(o, ELM_OBJ_CALENDAR_CLASS)
|
||||
Elm_Calendar_Data * sd = eo_data_scope_get(o, ELM_OBJ_CALENDAR_CLASS)
|
||||
|
||||
#define ELM_CALENDAR_CHECK(obj) \
|
||||
if (EINA_UNLIKELY(!eo_isa((obj), ELM_OBJ_CALENDAR_CLASS))) \
|
||||
|
|
Loading…
Reference in New Issue