5 typedef struct _Elm_Params_Photocam
11 Eina_Bool paused_exists:1;
12 Eina_Bool zoom_exists:1;
13 } Elm_Params_Photocam;
15 static const char* choices[] = {"manual", "auto fit", "auto fill", NULL};
17 static Elm_Photocam_Zoom_Mode
18 _zoom_mode_setting_get(const char *zoom_mode_str)
22 assert(sizeof(choices)/sizeof(choices[0]) == ELM_PHOTOCAM_ZOOM_MODE_LAST + 1);
24 for (i = 0; i < sizeof(choices); i++)
26 if (!strcmp(zoom_mode_str, choices[i]))
29 return ELM_PHOTOCAM_ZOOM_MODE_LAST;
33 external_photocam_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
35 const Elm_Params_Photocam *p;
37 if (to_params) p = to_params;
38 else if (from_params) p = from_params;
42 elm_photocam_file_set(obj, p->file);
44 elm_photocam_zoom_set(obj, p->zoom);
47 Elm_Photocam_Zoom_Mode set = _zoom_mode_setting_get(p->zoom_mode);
48 if (set == ELM_PHOTOCAM_ZOOM_MODE_LAST) return;
49 elm_photocam_zoom_mode_set(obj, set);
52 elm_photocam_paused_set(obj, p->paused);
56 external_photocam_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
58 if (!strcmp(param->name, "file"))
60 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
62 elm_photocam_file_set(obj, param->s);
66 else if (!strcmp(param->name, "zoom"))
68 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
70 elm_photocam_zoom_set(obj, param->d);
74 else if (!strcmp(param->name, "zoom mode"))
76 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
78 Elm_Photocam_Zoom_Mode set = _zoom_mode_setting_get(param->s);
79 if (set == ELM_PHOTOCAM_ZOOM_MODE_LAST) return EINA_FALSE;
80 elm_photocam_zoom_mode_set(obj, set);
84 else if (!strcmp(param->name, "paused"))
86 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
88 elm_photocam_paused_set(obj, param->i);
93 ERR("unknown parameter '%s' of type '%s'",
94 param->name, edje_external_param_type_str(param->type));
100 external_photocam_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
102 if (!strcmp(param->name, "file"))
104 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
106 param->s = elm_photocam_file_get(obj);
110 else if (!strcmp(param->name, "zoom"))
112 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
114 param->d = elm_photocam_zoom_get(obj);
118 else if (!strcmp(param->name, "zoom mode"))
120 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
122 Elm_Photocam_Zoom_Mode zoom_mode_set = elm_photocam_zoom_mode_get(obj);
124 if (zoom_mode_set == ELM_PHOTOCAM_ZOOM_MODE_LAST)
127 param->s = choices[zoom_mode_set];
131 else if(!strcmp(param->name, "paused"))
133 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
135 param->i = elm_photocam_paused_get(obj);
140 ERR("unknown parameter '%s' of type '%s'",
141 param->name, edje_external_param_type_str(param->type));
147 external_photocam_params_parse(void *data, Evas_Object *obj, const Eina_List *params)
149 Elm_Params_Photocam *mem;
150 Edje_External_Param *param;
153 mem = calloc(1, sizeof(Elm_Params_Photocam));
157 EINA_LIST_FOREACH(params, l, param)
159 if (!strcmp(param->name, "file"))
160 mem->file = eina_stringshare_add(param->s);
161 else if (!strcmp(param->name, "zoom"))
163 mem->zoom = param->d;
164 mem->zoom_exists = EINA_TRUE;
166 else if (!strcmp(param->name, "zoom mode"))
167 mem->zoom_mode = eina_stringshare_add(param->s);
168 else if (!strcmp(param->name, "paused"))
170 mem->paused = !!param->i;
171 mem->paused_exists = EINA_TRUE;
179 external_photocam_params_free(void *params)
181 Elm_Params_Photocam *mem = params;
184 eina_stringshare_del(mem->file);
186 eina_stringshare_del(mem->zoom_mode);
190 static Edje_External_Param_Info external_photocam_params[] = {
191 EDJE_EXTERNAL_PARAM_INFO_STRING("file"),
192 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("zoom"),
193 EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("zoom mode", "manual", choices),
194 EDJE_EXTERNAL_PARAM_INFO_BOOL("paused"),
195 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
198 DEFINE_EXTERNAL_ICON_ADD(photocam, "photocam");
199 DEFINE_EXTERNAL_TYPE_SIMPLE(photocam, "Photocam");