summaryrefslogtreecommitdiff
path: root/src/edje_externals/elm_panes.c
diff options
context:
space:
mode:
authorJonathan Atton <jonathan.atton@gmail.com>2010-07-26 20:33:33 +0000
committerJonathan Atton <jonathan.atton@gmail.com>2010-07-26 20:33:33 +0000
commit8bfe460faa0aa5099e8a0bbbc37a87f272050f55 (patch)
tree2f4190af312dbd552662c11889826ba5d9417eb3 /src/edje_externals/elm_panes.c
parent3123e3596b9331890bad68c9ecfdd39fa1774323 (diff)
elementary: add elm_panes in edje external
SVN revision: 50520
Diffstat (limited to 'src/edje_externals/elm_panes.c')
-rw-r--r--src/edje_externals/elm_panes.c159
1 files changed, 159 insertions, 0 deletions
diff --git a/src/edje_externals/elm_panes.c b/src/edje_externals/elm_panes.c
new file mode 100644
index 000000000..e4d181738
--- /dev/null
+++ b/src/edje_externals/elm_panes.c
@@ -0,0 +1,159 @@
1#include "private.h"
2#include <assert.h>
3
4
5typedef struct _Elm_Params_Panes Elm_Params_Panes;
6
7struct _Elm_Params_Panes {
8 Elm_Params base;
9 Evas_Object *content_left;
10 Evas_Object *content_right;
11 Eina_Bool is_horizontal;
12 Eina_Bool horizontal;
13 Eina_Bool is_left_size;
14 double left_size;
15};
16
17static void external_panes_state_set(void *data __UNUSED__,
18 Evas_Object *obj, const void *from_params,
19 const void *to_params, float pos __UNUSED__)
20{
21 const Elm_Params_Panes *p;
22
23 if (to_params) p = to_params;
24 else if (from_params) p = from_params;
25 else return;
26
27 if (p->content_left)
28 elm_panes_content_left_set(obj, p->content_left);
29
30 if (p->content_right)
31 elm_panes_content_right_set(obj, p->content_right);
32
33 if(p->is_left_size)
34 elm_panes_content_left_size_set(obj, p->left_size);
35
36 if(p->is_horizontal)
37 elm_panes_horizontal_set(obj, p->horizontal);
38}
39
40static Eina_Bool external_panes_param_set(void *data __UNUSED__,
41 Evas_Object *obj, const Edje_External_Param *param)
42{
43 if (!strcmp(param->name, "content left")
44 && param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
45 {
46 Evas_Object *content = external_common_param_edje_object_get(obj, param);
47 if ((strcmp(param->s, "")) && (!content))
48 return EINA_FALSE;
49 elm_panes_content_left_set(obj, content);
50 return EINA_TRUE;
51 }
52 else if (!strcmp(param->name, "content right")
53 && param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
54 {
55 Evas_Object *content = external_common_param_edje_object_get(obj, param);
56 if ((strcmp(param->s, "")) && (!content))
57 return EINA_FALSE;
58 elm_panes_content_right_set(obj, content);
59 return EINA_TRUE;
60 }
61 else if (!strcmp(param->name, "horizontal")
62 && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
63 {
64 elm_panes_horizontal_set(obj, param->i);
65 return EINA_TRUE;
66 }
67 else if (!strcmp(param->name, "left size")
68 && param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
69 {
70 elm_panes_content_left_size_set(obj, param->d);
71 return EINA_TRUE;
72 }
73
74 ERR("unknown parameter '%s' of type '%s'",
75 param->name, edje_external_param_type_str(param->type));
76
77 return EINA_FALSE;
78}
79
80static Eina_Bool external_panes_param_get(void *data __UNUSED__,
81 const Evas_Object *obj, Edje_External_Param *param)
82{
83 if (!strcmp(param->name, "content left"))
84 {
85 /* not easy to get content name back from live object */
86 return EINA_FALSE;
87 }
88 else if (!strcmp(param->name, "content right"))
89 {
90 /* not easy to get content name back from live object */
91 return EINA_FALSE;
92 }
93 else if (!strcmp(param->name, "horizontal")
94 && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
95 {
96 param->i = elm_panes_horizontal_is(obj);
97 return EINA_TRUE;
98 }
99 else if (!strcmp(param->name, "left size")
100 && param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
101 {
102 param->d = elm_panes_content_left_size_get(obj);
103 return EINA_TRUE;
104 }
105
106 ERR("unknown parameter '%s' of type '%s'",
107 param->name, edje_external_param_type_str(param->type));
108
109 return EINA_FALSE;
110}
111
112static void * external_panes_params_parse(void *data, Evas_Object *obj,
113 const Eina_List *params) {
114 Elm_Params_Panes *mem;
115 Edje_External_Param *param;
116 const Eina_List *l;
117
118 mem = external_common_params_parse(Elm_Params_Panes, data, obj, params);
119 if (!mem)
120 return NULL;
121
122 EINA_LIST_FOREACH(params, l, param)
123 {
124 if (!strcmp(param->name, "content left"))
125 mem->content_left = external_common_param_edje_object_get(obj, param);
126 else if (!strcmp(param->name, "content right"))
127 mem->content_right = external_common_param_edje_object_get(obj, param);
128 else if (!strcmp(param->name, "horizontal"))
129 {
130 mem->is_horizontal = EINA_TRUE;
131 mem->horizontal = param->i;
132 }
133 else if (!strcmp(param->name, "left size"))
134 {
135 mem->is_left_size = EINA_TRUE;
136 mem->left_size = param->d;
137 }
138 }
139
140 return mem;
141}
142
143static void external_panes_params_free(void *params) {
144 Elm_Params_Panes *mem = params;
145
146 external_common_params_free(params);
147}
148
149static Edje_External_Param_Info external_panes_params[] = {
150 DEFINE_EXTERNAL_COMMON_PARAMS,
151 EDJE_EXTERNAL_PARAM_INFO_STRING("content left"),
152 EDJE_EXTERNAL_PARAM_INFO_STRING("content right"),
153 EDJE_EXTERNAL_PARAM_INFO_BOOL("horizontal"),
154 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("left size"),
155 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
156};
157
158DEFINE_EXTERNAL_ICON_ADD(panes, "panes");
159DEFINE_EXTERNAL_TYPE_SIMPLE(panes, "panes");