5 typedef struct _Elm_Params_Thumb
11 static const char* choices[] = {"loop", "start", "stop", NULL};
13 static Elm_Thumb_Animation_Setting
14 _anim_setting_get(const char *anim_str)
18 assert(sizeof(choices)/sizeof(choices[0]) == ELM_THUMB_ANIMATION_LAST + 1);
20 for (i = 0; i < ELM_THUMB_ANIMATION_LAST; i++)
22 if (!strcmp(anim_str, choices[i]))
25 return ELM_THUMB_ANIMATION_LAST;
29 external_thumb_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
31 const Elm_Params_Thumb *p;
33 if (to_params) p = to_params;
34 else if (from_params) p = from_params;
39 Elm_Thumb_Animation_Setting set = _anim_setting_get(p->animate);
40 if (set != ELM_THUMB_ANIMATION_LAST)
41 elm_thumb_animate_set(obj, set);
46 external_thumb_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
48 if (!strcmp(param->name, "animate"))
50 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE)
52 Elm_Thumb_Animation_Setting set = _anim_setting_get(param->s);
53 if (set == ELM_THUMB_ANIMATION_LAST) return EINA_FALSE;
54 elm_thumb_animate_set(obj, set);
59 ERR("unknown parameter '%s' of type '%s'",
60 param->name, edje_external_param_type_str(param->type));
66 external_thumb_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
68 if (!strcmp(param->name, "animate"))
70 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE)
72 Elm_Thumb_Animation_Setting anim_set = elm_thumb_animate_get(obj);
74 if (anim_set == ELM_THUMB_ANIMATION_LAST)
77 param->s = choices[anim_set];
82 ERR("unknown parameter '%s' of type '%s'",
83 param->name, edje_external_param_type_str(param->type));
89 external_thumb_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
91 Elm_Params_Thumb *mem;
92 Edje_External_Param *param;
95 mem = calloc(1, sizeof(Elm_Params_Thumb));
99 EINA_LIST_FOREACH(params, l, param)
101 if (!strcmp(param->name, "animate"))
102 mem->animate = eina_stringshare_add(param->s);
108 static Evas_Object *external_thumb_content_get(void *data __UNUSED__,
109 const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
116 external_thumb_params_free(void *params)
118 Elm_Params_Thumb *mem = params;
121 eina_stringshare_del(mem->animate);
125 static Edje_External_Param_Info external_thumb_params[] =
127 DEFINE_EXTERNAL_COMMON_PARAMS,
128 EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("animate", "loop", choices),
129 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
132 DEFINE_EXTERNAL_ICON_ADD(thumb, "thumb")
135 external_thumb_add(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *edje, const Eina_List *params __UNUSED__, const char *part_name)
137 Evas_Object *parent, *obj;
139 parent = elm_widget_parent_widget_get(edje);
140 if (!parent) parent = edje;
141 elm_need_ethumb(); /* extra command needed */
142 obj = elm_thumb_add(parent);
143 external_signals_proxy(obj, edje, part_name);
146 DEFINE_EXTERNAL_TYPE(thumb, "Thumbnail")