aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/elementary/src/edje_externals/elm_slideshow.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/elementary/src/edje_externals/elm_slideshow.c')
-rw-r--r--libraries/elementary/src/edje_externals/elm_slideshow.c182
1 files changed, 182 insertions, 0 deletions
diff --git a/libraries/elementary/src/edje_externals/elm_slideshow.c b/libraries/elementary/src/edje_externals/elm_slideshow.c
new file mode 100644
index 0000000..ca4b7f9
--- /dev/null
+++ b/libraries/elementary/src/edje_externals/elm_slideshow.c
@@ -0,0 +1,182 @@
1#include "private.h"
2
3typedef struct _Elm_Params_Slideshow
4{
5 Elm_Params base;
6 double timeout;
7 const char *transition;
8 const char *layout;
9 Eina_Bool loop:1;
10 Eina_Bool timeout_exists:1;
11 Eina_Bool loop_exists:1;
12} Elm_Params_Slideshow;
13
14static const char *transitions[] = { "fade", "black_fade", "horizontal",
15 "vertical", "square", NULL};
16static const char *layout[] = { "fullscreen", "not_fullscreen", NULL};
17
18static void
19external_slideshow_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
20{
21 const Elm_Params_Slideshow *p;
22
23 if (to_params) p = to_params;
24 else if (from_params) p = from_params;
25 else return;
26
27 if (p->timeout_exists)
28 elm_slideshow_timeout_set(obj , p->timeout);
29 if (p->loop_exists)
30 elm_slideshow_loop_set(obj, p->loop);
31 if (p->transition) {
32 elm_slideshow_transition_set(obj, p->transition);
33 }
34 if (p->layout) {
35 elm_slideshow_layout_set(obj, p->layout);
36 }
37}
38
39static Eina_Bool
40external_slideshow_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
41{
42 if (!strcmp(param->name, "timeout"))
43 {
44 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
45 {
46 elm_slideshow_timeout_set(obj, param->d);
47 return EINA_TRUE;
48 }
49 }
50 else if (!strcmp(param->name, "loop"))
51 {
52 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
53 {
54 elm_slideshow_loop_set(obj, param->i);
55 return EINA_TRUE;
56 }
57 }
58 else if (!strcmp(param->name, "transition"))
59 {
60 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
61 {
62 elm_slideshow_transition_set(obj, param->s);
63 return EINA_TRUE;
64 }
65 }
66 else if (!strcmp(param->name, "layout"))
67 {
68 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
69 {
70 elm_slideshow_layout_set(obj, param->s);
71 return EINA_TRUE;
72 }
73 }
74
75 ERR("unknown parameter '%s' of type '%s'",
76 param->name, edje_external_param_type_str(param->type));
77
78 return EINA_FALSE;
79}
80
81static Eina_Bool
82external_slideshow_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
83{
84 if (!strcmp(param->name, "timeout"))
85 {
86 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
87 {
88 param->d = elm_slideshow_timeout_get(obj);
89 return EINA_TRUE;
90 }
91 }
92 else if (!strcmp(param->name, "loop"))
93 {
94 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
95 {
96 param->i = elm_slideshow_loop_get(obj);
97 return EINA_TRUE;
98 }
99 }
100 else if (!strcmp(param->name, "transition"))
101 {
102 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
103 {
104 param->s = elm_slideshow_transition_get(obj);
105 return EINA_TRUE;
106 }
107 }
108 else if (!strcmp(param->name, "layout"))
109 {
110 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
111 {
112 param->s = elm_slideshow_layout_get(obj);
113 return EINA_TRUE;
114 }
115 }
116
117 ERR("unknown parameter '%s' of type '%s'",
118 param->name, edje_external_param_type_str(param->type));
119
120 return EINA_FALSE;
121}
122
123static void *
124external_slideshow_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
125{
126 Elm_Params_Slideshow *mem;
127 Edje_External_Param *param;
128 const Eina_List *l;
129
130 mem = calloc(1, sizeof(Elm_Params_Slideshow));
131 if (!mem)
132 return NULL;
133
134 EINA_LIST_FOREACH(params, l, param)
135 {
136 if (!strcmp(param->name, "timeout"))
137 {
138 mem->timeout = param->d;
139 mem->timeout_exists = EINA_TRUE;
140 }
141 else if (!strcmp(param->name, "loop"))
142 {
143 mem->loop = param->i;
144 mem->loop_exists = EINA_TRUE;
145 }
146 else if (!strcmp(param->name, "transition"))
147 {
148 mem->transition = param->s;
149 }
150 else if (!strcmp(param->name, "layout"))
151 {
152 mem->layout = param->s;
153 }
154 }
155
156 return mem;
157}
158
159static Evas_Object *external_slideshow_content_get(void *data __UNUSED__,
160 const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
161{
162 ERR("No content.");
163 return NULL;
164}
165
166static void
167external_slideshow_params_free(void *params __UNUSED__)
168{
169 return;
170}
171
172static Edje_External_Param_Info external_slideshow_params[] = {
173 DEFINE_EXTERNAL_COMMON_PARAMS,
174 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("timeout"),
175 EDJE_EXTERNAL_PARAM_INFO_BOOL("loop"),
176 EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("transition", "fade", transitions),
177 EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("layout", "fullscreen", layout),
178 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
179};
180
181DEFINE_EXTERNAL_ICON_ADD(slideshow, "slideshow");
182DEFINE_EXTERNAL_TYPE_SIMPLE(slideshow, "Slideshow");