3 typedef struct _Elm_Params_Clock
7 Eina_Bool hrs_exists:1;
8 Eina_Bool min_exists:1;
9 Eina_Bool sec_exists:1;
16 external_clock_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
18 const Elm_Params_Clock *p;
20 if (to_params) p = to_params;
21 else if (from_params) p = from_params;
24 if ((p->hrs_exists) && (p->min_exists) && (p->sec_exists))
25 elm_clock_time_set(obj, p->hrs, p->min, p->sec);
26 else if ((p->hrs_exists) || (p->min_exists) || (p->sec_exists))
29 elm_clock_time_get(obj, &hrs, &min, &sec);
36 elm_clock_time_set(obj, hrs, min, sec);
39 elm_clock_edit_set(obj, p->edit);
41 elm_clock_show_am_pm_set(obj, p->ampm);
43 elm_clock_show_seconds_set(obj, p->seconds);
47 external_clock_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
49 if (!strcmp(param->name, "hours"))
51 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
54 elm_clock_time_get(obj, &hrs, &min, &sec);
55 elm_clock_time_set(obj, param->d, min, sec);
59 else if (!strcmp(param->name, "minutes"))
61 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
64 elm_clock_time_get(obj, &hrs, &min, &sec);
65 elm_clock_time_set(obj, hrs, param->d, sec);
69 else if (!strcmp(param->name, "seconds"))
71 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
74 elm_clock_time_get(obj, &hrs, &min, &sec);
75 elm_clock_time_set(obj, hrs, min, param->d);
79 else if (!strcmp(param->name, "editable"))
81 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
83 elm_clock_edit_set(obj, param->i);
87 else if (!strcmp(param->name, "am/pm"))
89 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
91 elm_clock_show_am_pm_set(obj, param->i);
95 else if (!strcmp(param->name, "show seconds"))
97 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
99 elm_clock_show_seconds_set(obj, param->i);
104 ERR("unknown parameter '%s' of type '%s'",
105 param->name, edje_external_param_type_str(param->type));
111 external_clock_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
113 if (!strcmp(param->name, "hours"))
115 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
118 elm_clock_time_get(obj, &hrs, &min, &sec);
123 else if (!strcmp(param->name, "minutes"))
125 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
128 elm_clock_time_get(obj, &hrs, &min, &sec);
133 else if (!strcmp(param->name, "seconds"))
135 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
138 elm_clock_time_get(obj, &hrs, &min, &sec);
143 else if (!strcmp(param->name, "editable"))
145 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
147 param->i = elm_clock_edit_get(obj);
151 else if (!strcmp(param->name, "am/pm"))
153 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
155 param->i = elm_clock_show_am_pm_get(obj);
159 else if (!strcmp(param->name, "show seconds"))
161 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
163 param->i = elm_clock_show_seconds_get(obj);
169 ERR("unknown parameter '%s' of type '%s'",
170 param->name, edje_external_param_type_str(param->type));
176 external_clock_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
178 Elm_Params_Clock *mem;
179 Edje_External_Param *param;
182 mem = calloc(1, sizeof(Elm_Params_Clock));
186 EINA_LIST_FOREACH(params, l, param)
188 if (!strcmp(param->name, "hours"))
191 mem->hrs_exists = EINA_TRUE;
193 else if (!strcmp(param->name, "minutes"))
196 mem->min_exists = EINA_TRUE;
198 else if (!strcmp(param->name, "seconds"))
201 mem->sec_exists = EINA_TRUE;
203 else if (!strcmp(param->name, "editable"))
204 mem->edit = !!param->i;
205 else if (!strcmp(param->name, "am/pm"))
206 mem->ampm = !!param->i;
207 else if (!strcmp(param->name, "show seconds"))
208 mem->seconds = !!param->i;
214 static Evas_Object *external_clock_content_get(void *data __UNUSED__,
215 const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
222 external_clock_params_free(void *params)
224 Elm_Params_Clock *mem = params;
229 static Edje_External_Param_Info external_clock_params[] = {
230 DEFINE_EXTERNAL_COMMON_PARAMS,
231 EDJE_EXTERNAL_PARAM_INFO_INT("hours"),
232 EDJE_EXTERNAL_PARAM_INFO_INT("minutes"),
233 EDJE_EXTERNAL_PARAM_INFO_INT("seconds"),
234 EDJE_EXTERNAL_PARAM_INFO_BOOL("editable"),
235 EDJE_EXTERNAL_PARAM_INFO_BOOL("am/pm"),
236 EDJE_EXTERNAL_PARAM_INFO_BOOL("show seconds"),
237 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
240 DEFINE_EXTERNAL_ICON_ADD(clock, "clock")
241 DEFINE_EXTERNAL_TYPE_SIMPLE(clock, "Clock")