summaryrefslogtreecommitdiff
path: root/legacy/elementary/src/edje_externals/elm_gengrid.c
diff options
context:
space:
mode:
authorMichael BOUCHAUD <michael.bouchaud@gmail.com>2011-02-09 15:14:28 +0000
committerMichael BOUCHAUD <michael.bouchaud@gmail.com>2011-02-09 15:14:28 +0000
commit863cd6e598a64b16e092dcacfb124d82924853e8 (patch)
treeda258582a81bbb56068de2c2da521c01de26c2a1 /legacy/elementary/src/edje_externals/elm_gengrid.c
parent22fb070ad7d7204de20655cd4216e307bc0c6cc1 (diff)
elementary: add edje_external gengrid
SVN revision: 56843
Diffstat (limited to 'legacy/elementary/src/edje_externals/elm_gengrid.c')
-rw-r--r--legacy/elementary/src/edje_externals/elm_gengrid.c225
1 files changed, 225 insertions, 0 deletions
diff --git a/legacy/elementary/src/edje_externals/elm_gengrid.c b/legacy/elementary/src/edje_externals/elm_gengrid.c
new file mode 100644
index 0000000..4af1880
--- /dev/null
+++ b/legacy/elementary/src/edje_externals/elm_gengrid.c
@@ -0,0 +1,225 @@
1#include <assert.h>
2
3#include "private.h"
4
5typedef struct _Elm_Params_Gengrid
6{
7 Elm_Params base;
8 Eina_Bool multi : 1;
9 Eina_Bool multi_exists : 1;
10 Eina_Bool no_select : 1;
11 Eina_Bool no_select_exists : 1;
12 Eina_Bool always_select : 1;
13 Eina_Bool always_select_exists : 1;
14 Eina_Bool h_bounce:1;
15 Eina_Bool h_bounce_exists:1;
16 Eina_Bool v_bounce:1;
17 Eina_Bool v_bounce_exists:1;
18} Elm_Params_Gengrid;
19
20static void
21external_gengrid_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
22{
23 const Elm_Params_Gengrid *p;
24
25 if (to_params) p = to_params;
26 else if (from_params) p = from_params;
27 else return;
28
29 if (p->multi_exists)
30 elm_gengrid_multi_select_set(obj, p->multi);
31 if (p->no_select_exists)
32 elm_gengrid_no_select_mode_set (obj, p->no_select);
33 if (p->always_select_exists)
34 elm_gengrid_always_select_mode_set (obj, p->always_select);
35 if (p->h_bounce_exists)
36 {
37 Eina_Bool h_bounce, v_bounce;
38 elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce);
39 elm_gengrid_bounce_set(obj, p->h_bounce, v_bounce);
40 }
41 if (p->v_bounce_exists)
42 {
43 Eina_Bool h_bounce, v_bounce;
44 elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce);
45 elm_gengrid_bounce_set(obj, h_bounce, p->v_bounce);
46 }
47}
48
49static Eina_Bool
50external_gengrid_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
51{
52 if (!strcmp(param->name, "multi select"))
53 {
54 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
55 {
56 elm_gengrid_multi_select_set(obj, param->i);
57 return EINA_TRUE;
58 }
59 }
60 else if (!strcmp(param->name, "no selected"))
61 {
62 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
63 {
64 elm_gengrid_no_select_mode_set(obj, param->i);
65 return EINA_TRUE;
66 }
67 }
68 else if (!strcmp(param->name, "always select"))
69 {
70 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
71 {
72 elm_gengrid_always_select_mode_set(obj, param->i);
73 return EINA_TRUE;
74 }
75 }
76 else if (!strcmp(param->name, "height bounce"))
77 {
78 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
79 {
80 Eina_Bool h_bounce, v_bounce;
81 elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce);
82 elm_gengrid_bounce_set(obj, param->i, v_bounce);
83 return EINA_TRUE;
84 }
85 }
86 else if (!strcmp(param->name, "width bounce"))
87 {
88 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
89 {
90 Eina_Bool h_bounce, v_bounce;
91 elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce);
92 elm_gengrid_bounce_set(obj, h_bounce, param->i);
93 return EINA_TRUE;
94 }
95 }
96
97 ERR("unknown parameter '%s' of type '%s'",
98 param->name, edje_external_param_type_str(param->type));
99
100 return EINA_FALSE;
101}
102
103static Eina_Bool
104external_gengrid_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
105{
106 if (!strcmp(param->name, "multi select"))
107 {
108 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
109 {
110 param->i = elm_gengrid_multi_select_get(obj);
111 return EINA_TRUE;
112 }
113 }
114 else if (!strcmp(param->name, "no selected"))
115 {
116 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
117 {
118 param->i = elm_gengrid_no_select_mode_get(obj);
119 return EINA_TRUE;
120 }
121 }
122 else if (!strcmp(param->name, "always select"))
123 {
124 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
125 {
126 param->i = elm_gengrid_always_select_mode_get(obj);
127 return EINA_TRUE;
128 }
129 }
130 else if (!strcmp(param->name, "height bounce"))
131 {
132 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
133 {
134 Eina_Bool h_bounce, v_bounce;
135 elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce);
136 param->i = h_bounce;
137 return EINA_TRUE;
138 }
139 }
140 else if (!strcmp(param->name, "width bounce"))
141 {
142 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
143 {
144 Eina_Bool h_bounce, v_bounce;
145 elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce);
146 param->i = v_bounce;
147 return EINA_TRUE;
148 }
149 }
150
151 ERR("unknown parameter '%s' of type '%s'",
152 param->name, edje_external_param_type_str(param->type));
153
154 return EINA_FALSE;
155}
156
157static void *
158external_gengrid_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
159{
160 Elm_Params_Gengrid *mem;
161 Edje_External_Param *param;
162 const Eina_List *l;
163
164 mem = ELM_NEW(Elm_Params_Gengrid);
165 if (!mem)
166 return NULL;
167
168 EINA_LIST_FOREACH(params, l, param)
169 {
170 if (!strcmp(param->name, "multi select"))
171 {
172 mem->multi = !!param->i;
173 mem->multi_exists = EINA_TRUE;
174 }
175 else if (!strcmp(param->name, "no selected"))
176 {
177 mem->no_select = !!param->i;
178 mem->no_select_exists = EINA_TRUE;
179 }
180 else if (!strcmp(param->name, "always select"))
181 {
182 mem->always_select = !!param->i;
183 mem->always_select_exists = EINA_TRUE;
184 }
185 else if (!strcmp(param->name, "height bounce"))
186 {
187 mem->h_bounce = !!param->i;
188 mem->h_bounce_exists = EINA_TRUE;
189 }
190 else if (!strcmp(param->name, "width bounce"))
191 {
192 mem->v_bounce = !!param->i;
193 mem->v_bounce_exists = EINA_TRUE;
194 }
195 }
196
197 return mem;
198}
199
200static Evas_Object *
201external_gengrid_content_get(void *data __UNUSED__, const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
202{
203 ERR("No content.");
204 return NULL;
205}
206
207static void
208external_gengrid_params_free(void *params)
209{
210 Elm_Params_Gengrid *mem = params;
211 free(mem);
212}
213
214static Edje_External_Param_Info external_gengrid_params[] = {
215 DEFINE_EXTERNAL_COMMON_PARAMS,
216 EDJE_EXTERNAL_PARAM_INFO_BOOL("multi select"),
217 EDJE_EXTERNAL_PARAM_INFO_BOOL("no select"),
218 EDJE_EXTERNAL_PARAM_INFO_BOOL("always select"),
219 EDJE_EXTERNAL_PARAM_INFO_BOOL("height bounce"),
220 EDJE_EXTERNAL_PARAM_INFO_BOOL("width bounce"),
221 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
222};
223
224DEFINE_EXTERNAL_ICON_ADD(gengrid, "gengrid");
225DEFINE_EXTERNAL_TYPE_SIMPLE(gengrid, "Generic Grid");