3 typedef struct _Elm_Params_Datepicker
9 Eina_Bool year_exists:1;
10 Eina_Bool mon_exists:1;
11 Eina_Bool day_exists:1;
12 } Elm_Params_Datepicker;
15 external_datepicker_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
17 const Elm_Params_Datepicker *p;
19 if (to_params) p = to_params;
20 else if (from_params) p = from_params;
23 if (p->format) elm_datepicker_date_format_set(obj, p->format);
24 if ((p->year_exists) || (p->mon_exists) || (p->day_exists))
27 elm_datepicker_date_get(obj, &year, &mon, &day);
29 if (p->year_exists) year = p->year;
30 if (p->mon_exists) mon = p->mon;
31 if (p->day_exists) day = p->day;
32 elm_datepicker_date_set(obj, year, mon, day);
37 external_datepicker_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
39 if (!strcmp(param->name, "format"))
41 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
43 elm_datepicker_date_format_set(obj, param->s);
47 else if (!strcmp(param->name, "years"))
49 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
52 elm_datepicker_date_get(obj, NULL, &mon, &day);
53 elm_datepicker_date_set(obj, param->i, mon, day);
57 else if (!strcmp(param->name, "months"))
59 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
62 elm_datepicker_date_get(obj, &year, NULL, &day);
63 elm_datepicker_date_set(obj, year, param->i, day);
67 else if (!strcmp(param->name, "days"))
69 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
72 elm_datepicker_date_get(obj, &year, &mon, NULL);
73 elm_datepicker_date_set(obj, year, mon, param->i);
78 ERR("unknown parameter '%s' of type '%s'",
79 param->name, edje_external_param_type_str(param->type));
85 external_datepicker_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
87 if (!strcmp(param->name, "format"))
89 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
91 param->s = elm_datepicker_date_format_get(obj);
95 else if (!strcmp(param->name, "years"))
97 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
99 elm_datepicker_date_get(obj, &(param->i), NULL, NULL);
103 else if (!strcmp(param->name, "months"))
105 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
107 elm_datepicker_date_get(obj, NULL, &(param->i), NULL);
111 else if (!strcmp(param->name, "days"))
113 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
115 elm_datepicker_date_get(obj, NULL, NULL, &(param->i));
120 ERR("unknown parameter '%s' of type '%s'",
121 param->name, edje_external_param_type_str(param->type));
127 external_datepicker_params_parse(void *data, Evas_Object *obj, const Eina_List *params)
129 Elm_Params_Datepicker *mem;
130 Edje_External_Param *param;
133 mem = calloc(1, sizeof(Elm_Params_Datepicker));
137 EINA_LIST_FOREACH(params, l, param)
139 if (!strcmp(param->name, "format"))
140 mem->format = eina_stringshare_add(param->s);
141 else if (!strcmp(param->name, "years"))
143 mem->year = param->i;
144 mem->year_exists = EINA_TRUE;
146 else if (!strcmp(param->name, "months"))
149 mem->mon_exists = EINA_TRUE;
151 else if (!strcmp(param->name, "days"))
154 mem->day_exists = EINA_TRUE;
161 static Evas_Object *external_datepicker_content_get(void *data __UNUSED__,
162 const Evas_Object *obj, const char *content)
169 external_datepicker_params_free(void *params)
171 Elm_Params_Datepicker *mem = params;
174 eina_stringshare_del(mem->format);
179 static Edje_External_Param_Info external_datepicker_params[] = {
180 EDJE_EXTERNAL_PARAM_INFO_STRING("format"),
181 EDJE_EXTERNAL_PARAM_INFO_INT_DEFAULT("years", 1900),
182 EDJE_EXTERNAL_PARAM_INFO_INT_DEFAULT("months", 1),
183 EDJE_EXTERNAL_PARAM_INFO_INT_DEFAULT("days", 1),
184 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
187 DEFINE_EXTERNAL_ICON_ADD(datepicker, "datepicker");
188 DEFINE_EXTERNAL_TYPE_SIMPLE(datepicker, "Datepicker");