summaryrefslogtreecommitdiff
path: root/src/edje_externals/elm.c
diff options
context:
space:
mode:
authorOtavio Pontes <otavio@profusion.mobi>2010-10-21 22:03:43 +0000
committerLucas De Marchi <lucas.demarchi@profusion.mobi>2010-10-21 22:03:43 +0000
commit68511034181d22083d1dd6115e339affc2d69681 (patch)
tree7c95dbf36e6a65c28ab3c22b9beaf346219fea79 /src/edje_externals/elm.c
parentd13d14e2c38ae95fe4ed7ec6c726cf4b0af5e041 (diff)
Add support for changing style from one elm widget in edje external.
Create a param 'style' that can be used in edje external to change the style of one object. Patch by: Otavio Pontes <otavio@profusion.mobi> SVN revision: 53754
Diffstat (limited to 'src/edje_externals/elm.c')
-rw-r--r--src/edje_externals/elm.c65
1 files changed, 51 insertions, 14 deletions
diff --git a/src/edje_externals/elm.c b/src/edje_externals/elm.c
index af91e604f..1865c26f9 100644
--- a/src/edje_externals/elm.c
+++ b/src/edje_externals/elm.c
@@ -69,6 +69,34 @@ _external_signal_proxy_cb(void *data, Evas_Object *obj __UNUSED__, void *event_i
69 edje_object_signal_emit(ctxt->edje, ctxt->emission, ctxt->source); 69 edje_object_signal_emit(ctxt->edje, ctxt->emission, ctxt->source);
70} 70}
71 71
72Eina_Bool
73external_common_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
74{
75 if (!strcmp(param->name, "style"))
76 {
77 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
78 {
79 param->s = elm_object_style_get(obj);
80 return EINA_TRUE;
81 }
82 }
83 return EINA_FALSE;
84}
85
86Eina_Bool
87external_common_param_set(void *data __UNUSED__, Evas_Object *obj, Edje_External_Param *param)
88{
89 if (!strcmp(param->name, "style"))
90 {
91 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
92 {
93 elm_object_style_set(obj, param->s);
94 return EINA_TRUE;
95 }
96 }
97 return EINA_FALSE;
98}
99
72void 100void
73external_signals_proxy(Evas_Object *obj, Evas_Object *edje, const char *part_name) 101external_signals_proxy(Evas_Object *obj, Evas_Object *edje, const char *part_name)
74{ 102{
@@ -107,26 +135,34 @@ external_signals_proxy(Evas_Object *obj, Evas_Object *edje, const char *part_nam
107 } 135 }
108} 136}
109 137
110void * 138void
111external_common_params_parse_internal(size_t params_size, void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params) 139external_common_params_parse(void *mem, void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
112{ 140{
113 Elm_Params *p; 141 Elm_Params *p;
114 const Eina_List *l; 142 const Eina_List *l;
115 Edje_External_Param *param; 143 Edje_External_Param *param;
116 144
117 if (params_size < sizeof(Elm_Params)) 145 p = mem;
118 return NULL;
119
120 p = calloc(1, params_size);
121 if (!p)
122 return NULL;
123
124 EINA_LIST_FOREACH(params, l, param) 146 EINA_LIST_FOREACH(params, l, param)
125 { 147 {
126 if (!strcmp(param->name, "label")) 148 if (!strcmp(param->name, "style"))
127 p->label = param->s; 149 {
150 p->style = eina_stringshare_add(param->s);
151 break;
152 }
128 } 153 }
129 return p; 154}
155
156void
157external_common_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
158{
159 const Elm_Params *p;
160 if (to_params) p = to_params;
161 else if (from_params) p = from_params;
162 else return;
163
164 if (p->style)
165 elm_object_style_set(obj, p->style);
130} 166}
131 167
132Evas_Object * 168Evas_Object *
@@ -191,8 +227,9 @@ void
191external_common_params_free(void *params) 227external_common_params_free(void *params)
192{ 228{
193 Elm_Params *p = params; 229 Elm_Params *p = params;
194 free(p); 230 if (p->style)
195}; 231 eina_stringshare_del(p->style);
232}
196 233
197#define DEFINE_TYPE(type_name) \ 234#define DEFINE_TYPE(type_name) \
198 extern const Edje_External_Type external_##type_name##_type; 235 extern const Edje_External_Type external_##type_name##_type;