3 typedef struct _Elm_Params_Button
8 double autorepeat_initial;
10 Eina_Bool autorepeat:1;
11 Eina_Bool autorepeat_exists:1;
12 Eina_Bool autorepeat_gap_exists:1;
13 Eina_Bool autorepeat_initial_exists:1;
17 external_button_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
19 const Elm_Params_Button *p;
21 if (to_params) p = to_params;
22 else if (from_params) p = from_params;
26 elm_object_text_set(obj, p->label);
28 elm_object_part_content_set(obj, "icon", p->icon);
29 if (p->autorepeat_gap_exists)
30 elm_button_autorepeat_gap_timeout_set(obj, p->autorepeat_gap);
31 if (p->autorepeat_initial_exists)
32 elm_button_autorepeat_initial_timeout_set(obj, p->autorepeat_initial);
33 if (p->autorepeat_exists)
34 elm_button_autorepeat_set(obj, p->autorepeat);
38 external_button_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
40 if (!strcmp(param->name, "label"))
42 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
44 elm_object_text_set(obj, param->s);
48 else if (!strcmp(param->name, "icon"))
50 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
52 Evas_Object *icon = external_common_param_icon_get(obj, param);
53 if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE;
54 elm_object_part_content_set(obj, "icon", icon);
58 else if (!strcmp(param->name, "autorepeat_initial"))
60 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
62 elm_button_autorepeat_initial_timeout_set(obj, param->d);
66 else if (!strcmp(param->name, "autorepeat_gap"))
68 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
70 elm_button_autorepeat_gap_timeout_set(obj, param->d);
74 else if (!strcmp(param->name, "autorepeat"))
76 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
78 elm_button_autorepeat_set(obj, param->i);
83 ERR("unknown parameter '%s' of type '%s'",
84 param->name, edje_external_param_type_str(param->type));
90 external_button_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
92 if (!strcmp(param->name, "label"))
94 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
96 param->s = elm_object_text_get(obj);
100 else if (!strcmp(param->name, "icon"))
102 /* not easy to get icon name back from live object */
105 else if (!strcmp(param->name, "autorepeat_initial"))
107 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
109 param->d = elm_button_autorepeat_initial_timeout_get(obj);
113 else if (!strcmp(param->name, "autorepeat_gap"))
115 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
117 param->d = elm_button_autorepeat_gap_timeout_get(obj);
121 else if (!strcmp(param->name, "autorepeat"))
123 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
125 param->i = elm_button_autorepeat_get(obj);
130 ERR("unknown parameter '%s' of type '%s'",
131 param->name, edje_external_param_type_str(param->type));
137 external_button_params_parse(void *data __UNUSED__, Evas_Object *obj, const Eina_List *params)
139 Elm_Params_Button *mem;
140 Edje_External_Param *param;
143 mem = ELM_NEW(Elm_Params_Button);
147 external_common_icon_param_parse(&mem->icon, obj, params);
149 EINA_LIST_FOREACH(params, l, param)
151 if (!strcmp(param->name, "autorepeat_initial"))
153 mem->autorepeat_initial = param->d;
154 mem->autorepeat_initial_exists = EINA_TRUE;
156 else if (!strcmp(param->name, "autorepeat_gap"))
158 mem->autorepeat_gap = param->d;
159 mem->autorepeat_gap_exists = EINA_TRUE;
161 else if (!strcmp(param->name, "autorepeat"))
163 mem->autorepeat = !!param->i;
164 mem->autorepeat_exists = EINA_TRUE;
166 else if (!strcmp(param->name, "label"))
167 mem->label = eina_stringshare_add(param->s);
173 static Evas_Object *external_button_content_get(void *data __UNUSED__,
174 const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
181 external_button_params_free(void *params)
183 Elm_Params_Button *mem = params;
185 eina_stringshare_del(mem->label);
189 static Edje_External_Param_Info external_button_params[] = {
190 DEFINE_EXTERNAL_COMMON_PARAMS,
191 EDJE_EXTERNAL_PARAM_INFO_STRING("label"),
192 EDJE_EXTERNAL_PARAM_INFO_STRING("icon"),
193 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("autorepeat_initial"),
194 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("autorepeat_gap"),
195 EDJE_EXTERNAL_PARAM_INFO_BOOL("autorepeat"),
196 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
199 DEFINE_EXTERNAL_ICON_ADD(button, "button");
200 DEFINE_EXTERNAL_TYPE_SIMPLE(button, "Button");