3 typedef struct _Elm_Params_Spinner
6 const char *label_format;
7 double min, max, step, value;
8 Eina_Bool min_exists:1;
9 Eina_Bool max_exists:1;
10 Eina_Bool step_exists:1;
11 Eina_Bool value_exists:1;
12 Eina_Bool wrap_exists:1;
17 external_spinner_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
19 const Elm_Params_Spinner *p;
21 if (to_params) p = to_params;
22 else if (from_params) p = from_params;
26 elm_spinner_label_format_set(obj, p->label_format);
27 if ((p->min_exists) && (p->max_exists))
28 elm_spinner_min_max_set(obj, p->min, p->max);
29 else if ((p->min_exists) || (p->max_exists))
32 elm_spinner_min_max_get(obj, &min, &max);
34 elm_spinner_min_max_set(obj, p->min, max);
36 elm_spinner_min_max_set(obj, min, p->max);
39 elm_spinner_step_set(obj, p->step);
41 elm_spinner_value_set(obj, p->value);
43 elm_spinner_wrap_set(obj, p->wrap);
47 external_spinner_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
49 if (!strcmp(param->name, "label format"))
51 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
53 elm_spinner_label_format_set(obj, param->s);
57 else if (!strcmp(param->name, "min"))
59 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
62 elm_spinner_min_max_get(obj, &min, &max);
63 elm_spinner_min_max_set(obj, param->d, max);
67 else if (!strcmp(param->name, "max"))
69 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
72 elm_spinner_min_max_get(obj, &min, &max);
73 elm_spinner_min_max_set(obj, min, param->d);
77 else if (!strcmp(param->name, "step"))
79 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
81 elm_spinner_step_set(obj, param->d);
85 else if (!strcmp(param->name, "value"))
87 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
89 elm_spinner_value_set(obj, param->d);
93 else if (!strcmp(param->name, "wrap"))
95 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
97 elm_spinner_wrap_set(obj, param->i);
102 ERR("unknown parameter '%s' of type '%s'",
103 param->name, edje_external_param_type_str(param->type));
109 external_spinner_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
111 if (!strcmp(param->name, "label format"))
113 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
115 param->s = elm_spinner_label_format_get(obj);
119 else if (!strcmp(param->name, "min"))
121 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
124 elm_spinner_min_max_get(obj, &min, &max);
129 else if (!strcmp(param->name, "max"))
131 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
134 elm_spinner_min_max_get(obj, &min, &max);
139 else if (!strcmp(param->name, "step"))
141 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
143 param->d = elm_spinner_step_get(obj);
147 else if (!strcmp(param->name, "value"))
149 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
151 param->d = elm_spinner_value_get(obj);
155 else if (!strcmp(param->name, "wrap"))
157 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
159 param->i = elm_spinner_value_get(obj);
164 ERR("unknown parameter '%s' of type '%s'",
165 param->name, edje_external_param_type_str(param->type));
171 external_spinner_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
173 Elm_Params_Spinner *mem;
174 Edje_External_Param *param;
177 mem = calloc(1, sizeof(Elm_Params_Spinner));
181 EINA_LIST_FOREACH(params, l, param)
183 if (!strcmp(param->name, "label format"))
184 mem->label_format = eina_stringshare_add(param->s);
185 else if (!strcmp(param->name, "min"))
188 mem->min_exists = EINA_TRUE;
190 else if (!strcmp(param->name, "max"))
193 mem->max_exists = EINA_TRUE;
195 else if (!strcmp(param->name, "step"))
197 mem->step = param->d;
198 mem->step_exists = EINA_TRUE;
200 else if (!strcmp(param->name, "value"))
202 mem->value = param->d;
203 mem->value_exists = EINA_TRUE;
205 else if (!strcmp(param->name, "wrap"))
207 mem->wrap = param->i;
208 mem->wrap_exists = EINA_TRUE;
215 static Evas_Object *external_spinner_content_get(void *data __UNUSED__,
216 const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
223 external_spinner_params_free(void *params)
225 Elm_Params_Spinner *mem = params;
227 if (mem->label_format)
228 eina_stringshare_del(mem->label_format);
232 static Edje_External_Param_Info external_spinner_params[] = {
233 DEFINE_EXTERNAL_COMMON_PARAMS,
234 EDJE_EXTERNAL_PARAM_INFO_STRING_DEFAULT("label format", "%1.2f"),
235 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("min"),
236 EDJE_EXTERNAL_PARAM_INFO_DOUBLE_DEFAULT("max", 100.0),
237 EDJE_EXTERNAL_PARAM_INFO_DOUBLE_DEFAULT("step", 1.0),
238 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("value"),
239 EDJE_EXTERNAL_PARAM_INFO_BOOL("wrap"),
240 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
243 DEFINE_EXTERNAL_ICON_ADD(spinner, "spinner")
244 DEFINE_EXTERNAL_TYPE_SIMPLE(spinner, "Spinner")