summaryrefslogtreecommitdiff
path: root/src/edje_externals/elm_fileselector.c
diff options
context:
space:
mode:
authorGustavo Lima Chaves <glima@profusion.mobi>2010-03-31 20:19:55 +0000
committerGustavo Lima Chaves <glima@profusion.mobi>2010-03-31 20:19:55 +0000
commit6d02acc4c08f0988506fdcbc4258f4b2fe17852e (patch)
treeff9402273f79dada066943ead7cc643e5e307540 /src/edje_externals/elm_fileselector.c
parent91c382fd8722e39722a211e8e2ae3fda5a99a842 (diff)
Elm_fileselector as edje external.
SVN revision: 47634
Diffstat (limited to 'src/edje_externals/elm_fileselector.c')
-rw-r--r--src/edje_externals/elm_fileselector.c176
1 files changed, 176 insertions, 0 deletions
diff --git a/src/edje_externals/elm_fileselector.c b/src/edje_externals/elm_fileselector.c
new file mode 100644
index 000000000..b1b88a4e0
--- /dev/null
+++ b/src/edje_externals/elm_fileselector.c
@@ -0,0 +1,176 @@
1#include <assert.h>
2
3#include "private.h"
4
5typedef struct _Elm_Params_Fileselector
6{
7 Eina_Bool is_save:1;
8 Eina_Bool is_save_set:1;
9 Eina_Bool folder_only:1;
10 Eina_Bool folder_only_set:1;
11 Eina_Bool show_buttons:1;
12 Eina_Bool show_buttons_set:1;
13 Eina_Bool expandable:1;
14 Eina_Bool expandable_set:1;
15} Elm_Params_Fileselector;
16
17static void
18external_fileselector_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
19{
20 const Elm_Params_Fileselector *p;
21
22 if (to_params) p = to_params;
23 else if (from_params) p = from_params;
24 else return;
25
26 if (p->is_save_set && p->is_save)
27 elm_fileselector_is_save_set(obj, p->is_save);
28 if (p->folder_only_set && p->folder_only)
29 elm_fileselector_folder_only_set(obj, p->folder_only);
30 if (p->show_buttons_set && p->show_buttons)
31 elm_fileselector_buttons_ok_cancel_set(obj, p->show_buttons);
32 if (p->expandable_set && p->expandable)
33 elm_fileselector_expandable_set(obj, p->expandable);
34}
35
36static Eina_Bool
37external_fileselector_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
38{
39 if (!strcmp(param->name, "save"))
40 {
41 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
42 {
43 elm_fileselector_is_save_set(obj, param->i);
44 return EINA_TRUE;
45 }
46 }
47 else if (!strcmp(param->name, "folder only"))
48 {
49 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
50 {
51 elm_fileselector_folder_only_set(obj, param->i);
52 return EINA_TRUE;
53 }
54 }
55 else if (!strcmp(param->name, "show buttons"))
56 {
57 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
58 {
59 elm_fileselector_buttons_ok_cancel_set(obj, param->i);
60 return EINA_TRUE;
61 }
62 }
63 else if (!strcmp(param->name, "expandable"))
64 {
65 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
66 {
67 elm_fileselector_expandable_set(obj, param->i);
68 return EINA_TRUE;
69 }
70 }
71
72 ERR("unknown parameter '%s' of type '%s'",
73 param->name, edje_external_param_type_str(param->type));
74
75 return EINA_FALSE;
76}
77
78static Eina_Bool
79external_fileselector_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
80{
81 if (!strcmp(param->name, "save"))
82 {
83 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
84 {
85 param->i = elm_fileselector_is_save_get(obj);
86 return EINA_TRUE;
87 }
88 }
89 else if (!strcmp(param->name, "folder only"))
90 {
91 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
92 {
93 param->i = elm_fileselector_folder_only_get(obj);
94 return EINA_TRUE;
95 }
96 }
97 else if (!strcmp(param->name, "show buttons"))
98 {
99 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
100 {
101 param->i = elm_fileselector_buttons_ok_cancel_get(obj);
102 return EINA_TRUE;
103 }
104 }
105 else if (!strcmp(param->name, "expandable"))
106 {
107 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
108 {
109 param->i = elm_fileselector_expandable_get(obj);
110 return EINA_TRUE;
111 }
112 }
113
114 ERR("unknown parameter '%s' of type '%s'",
115 param->name, edje_external_param_type_str(param->type));
116
117 return EINA_FALSE;
118}
119
120static void *
121external_fileselector_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
122{
123 Elm_Params_Fileselector *mem;
124 Edje_External_Param *param;
125 const Eina_List *l;
126
127 mem = calloc(1, sizeof(Elm_Params_Fileselector));
128 if (!mem)
129 return NULL;
130
131 EINA_LIST_FOREACH(params, l, param)
132 {
133 if (!strcmp(param->name, "save"))
134 {
135 mem->is_save = !!param->i;
136 mem->is_save_set = EINA_TRUE;
137 }
138 else if (!strcmp(param->name, "folder only"))
139 {
140 mem->folder_only = !!param->i;
141 mem->folder_only_set = EINA_TRUE;
142 }
143 else if (!strcmp(param->name, "show buttons"))
144 {
145 mem->show_buttons = !!param->i;
146 mem->show_buttons_set = EINA_TRUE;
147 }
148 else if (!strcmp(param->name, "expandable"))
149 {
150 mem->expandable = !!param->i;
151 mem->expandable_set = EINA_TRUE;
152 }
153 }
154
155 return mem;
156}
157
158static void
159external_fileselector_params_free(void *params)
160{
161 Elm_Params_Fileselector *mem = params;
162 free(mem);
163}
164
165static Edje_External_Param_Info external_fileselector_params[] =
166 {
167 EDJE_EXTERNAL_PARAM_INFO_BOOL("save"),
168 EDJE_EXTERNAL_PARAM_INFO_BOOL("folder only"),
169 EDJE_EXTERNAL_PARAM_INFO_BOOL("show buttons"),
170 EDJE_EXTERNAL_PARAM_INFO_BOOL("expandable"),
171 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
172 };
173
174DEFINE_EXTERNAL_ICON_ADD(fileselector, "fileselector")
175DEFINE_EXTERNAL_TYPE_SIMPLE(fileselector, "File Selector")
176