3 typedef struct _Elm_Params_Progressbar
11 Eina_Bool value_exists:1;
12 Eina_Bool span_exists:1;
14 Eina_Bool inverted_exists:1;
15 Eina_Bool horizontal:1;
16 Eina_Bool horizontal_exists:1;
17 } Elm_Params_Progressbar;
20 external_progressbar_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
22 const Elm_Params_Progressbar *p;
24 if (to_params) p = to_params;
25 else if (from_params) p = from_params;
29 elm_object_text_set(obj, p->label);
31 elm_progressbar_icon_set(obj, p->icon);
33 elm_progressbar_span_size_set(obj, p->span);
35 elm_progressbar_value_set(obj, p->value);
36 if (p->inverted_exists)
37 elm_progressbar_inverted_set(obj, p->inverted);
38 if (p->horizontal_exists)
39 elm_progressbar_horizontal_set(obj, p->horizontal);
41 elm_progressbar_unit_format_set(obj, p->unit);
45 external_progressbar_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
47 if (!strcmp(param->name, "label"))
49 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
51 elm_object_text_set(obj, param->s);
55 else if (!strcmp(param->name, "icon"))
57 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
59 Evas_Object *icon = external_common_param_icon_get(obj, param);
60 if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE;
61 elm_progressbar_icon_set(obj, icon);
65 else if (!strcmp(param->name, "value"))
67 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
69 elm_progressbar_value_set(obj, param->d);
73 else if (!strcmp(param->name, "horizontal"))
75 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
77 elm_progressbar_horizontal_set(obj, param->i);
81 else if (!strcmp(param->name, "inverted"))
83 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
85 elm_progressbar_inverted_set(obj, param->i);
89 else if (!strcmp(param->name, "span"))
91 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
93 elm_progressbar_span_size_set(obj, param->i);
97 else if (!strcmp(param->name, "unit format"))
99 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
101 elm_progressbar_unit_format_set(obj, param->s);
106 ERR("unknown parameter '%s' of type '%s'",
107 param->name, edje_external_param_type_str(param->type));
113 external_progressbar_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
115 if (!strcmp(param->name, "label"))
117 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
119 param->s = elm_object_text_get(obj);
123 else if (!strcmp(param->name, "icon"))
125 /* not easy to get icon name back from live object */
128 else if (!strcmp(param->name, "value"))
130 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
132 param->d = elm_progressbar_value_get(obj);
136 else if (!strcmp(param->name, "horizontal"))
138 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
140 param->i = elm_progressbar_horizontal_get(obj);
144 else if (!strcmp(param->name, "inverted"))
146 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
148 param->i = elm_progressbar_inverted_get(obj);
152 else if (!strcmp(param->name, "span"))
154 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
156 param->i = elm_progressbar_span_size_get(obj);
160 else if (!strcmp(param->name, "unit format"))
162 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
164 param->s = elm_progressbar_unit_format_get(obj);
169 ERR("unknown parameter '%s' of type '%s'",
170 param->name, edje_external_param_type_str(param->type));
176 external_progressbar_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
178 Elm_Params_Progressbar *mem;
179 Edje_External_Param *param;
182 mem = calloc(1, sizeof(Elm_Params_Progressbar));
186 external_common_icon_param_parse(&mem->icon, obj, params);
188 EINA_LIST_FOREACH(params, l, param)
190 if (!strcmp(param->name, "span"))
192 mem->span = param->i;
193 mem->span_exists = EINA_TRUE;
195 else if (!strcmp(param->name, "value"))
197 mem->value = param->d;
198 mem->value_exists = EINA_TRUE;
200 else if (!strcmp(param->name, "inverted"))
202 mem->inverted = !!param->i;
203 mem->inverted_exists = EINA_TRUE;
205 else if (!strcmp(param->name, "horizontal"))
207 mem->horizontal = !!param->i;
208 mem->horizontal_exists = EINA_TRUE;
210 else if (!strcmp(param->name, "unit format"))
211 mem->unit = eina_stringshare_add(param->s);
212 else if (!strcmp(param->name, "label"))
213 mem->label = eina_stringshare_add(param->s);
219 static Evas_Object *external_progressbar_content_get(void *data __UNUSED__,
220 const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
227 external_progressbar_params_free(void *params)
229 Elm_Params_Progressbar *mem = params;
232 eina_stringshare_del(mem->unit);
234 eina_stringshare_del(mem->label);
238 static Edje_External_Param_Info external_progressbar_params[] = {
239 DEFINE_EXTERNAL_COMMON_PARAMS,
240 EDJE_EXTERNAL_PARAM_INFO_STRING("label"),
241 EDJE_EXTERNAL_PARAM_INFO_STRING("icon"),
242 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("value"),
243 EDJE_EXTERNAL_PARAM_INFO_BOOL("horizontal"),
244 EDJE_EXTERNAL_PARAM_INFO_BOOL("inverted"),
245 EDJE_EXTERNAL_PARAM_INFO_INT("span"),
246 EDJE_EXTERNAL_PARAM_INFO_STRING_DEFAULT("unit format", "%1.2f"),
247 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
250 DEFINE_EXTERNAL_ICON_ADD(progressbar, "progressbar")
251 DEFINE_EXTERNAL_TYPE_SIMPLE(progressbar, "Progressbar")