summaryrefslogtreecommitdiff
path: root/src/edje_externals/elm_check.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_check.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_check.c')
-rw-r--r--src/edje_externals/elm_check.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/edje_externals/elm_check.c b/src/edje_externals/elm_check.c
index 28ab6885b..b489b28fb 100644
--- a/src/edje_externals/elm_check.c
+++ b/src/edje_externals/elm_check.c
@@ -3,6 +3,7 @@
3typedef struct _Elm_Params_Check 3typedef struct _Elm_Params_Check
4{ 4{
5 Elm_Params base; 5 Elm_Params base;
6 const char *label;
6 Evas_Object *icon; 7 Evas_Object *icon;
7 Eina_Bool state:1; 8 Eina_Bool state:1;
8 Eina_Bool state_exists:1; 9 Eina_Bool state_exists:1;
@@ -17,8 +18,8 @@ external_check_state_set(void *data __UNUSED__, Evas_Object *obj, const void *fr
17 else if (from_params) p = from_params; 18 else if (from_params) p = from_params;
18 else return; 19 else return;
19 20
20 if (p->base.label) 21 if (p->label)
21 elm_check_label_set(obj, p->base.label); 22 elm_check_label_set(obj, p->label);
22 if (p->icon) 23 if (p->icon)
23 elm_check_icon_set(obj, p->icon); 24 elm_check_icon_set(obj, p->icon);
24 if (p->state_exists) 25 if (p->state_exists)
@@ -97,18 +98,23 @@ external_check_params_parse(void *data, Evas_Object *obj, const Eina_List *param
97{ 98{
98 Elm_Params_Check *mem; 99 Elm_Params_Check *mem;
99 Edje_External_Param *param; 100 Edje_External_Param *param;
101 const Eina_List *l;
100 102
101 mem = external_common_params_parse(Elm_Params_Check, data, obj, params); 103 mem = calloc(1, sizeof(Elm_Params_Check));
102 if (!mem) 104 if (!mem)
103 return NULL; 105 return NULL;
104 106
105 external_common_icon_param_parse(&mem->icon, obj, params); 107 external_common_icon_param_parse(&mem->icon, obj, params);
106 108
107 param = edje_external_param_find(params, "state"); 109 EINA_LIST_FOREACH(params, l, param)
108 if (param)
109 { 110 {
110 mem->state = !!param->i; 111 if (!strcmp(param->name, "state"))
111 mem->state_exists = EINA_TRUE; 112 {
113 mem->state = !!param->i;
114 mem->state_exists = EINA_TRUE;
115 }
116 else if (!strcmp(param->name, "label"))
117 mem->label = eina_stringshare_add(param->s);
112 } 118 }
113 119
114 return mem; 120 return mem;
@@ -124,11 +130,15 @@ static Evas_Object *external_check_content_get(void *data __UNUSED__,
124static void 130static void
125external_check_params_free(void *params) 131external_check_params_free(void *params)
126{ 132{
127 external_common_params_free(params); 133 Elm_Params_Check *mem = params;
134 if (mem->label)
135 eina_stringshare_del(mem->label);
136 free(params);
128} 137}
129 138
130static Edje_External_Param_Info external_check_params[] = { 139static Edje_External_Param_Info external_check_params[] = {
131 DEFINE_EXTERNAL_COMMON_PARAMS, 140 DEFINE_EXTERNAL_COMMON_PARAMS,
141 EDJE_EXTERNAL_PARAM_INFO_STRING("label"),
132 EDJE_EXTERNAL_PARAM_INFO_STRING("icon"), 142 EDJE_EXTERNAL_PARAM_INFO_STRING("icon"),
133 EDJE_EXTERNAL_PARAM_INFO_BOOL_FULL("state", 0, "unchecked", "checked"), 143 EDJE_EXTERNAL_PARAM_INFO_BOOL_FULL("state", 0, "unchecked", "checked"),
134 EDJE_EXTERNAL_PARAM_INFO_SENTINEL 144 EDJE_EXTERNAL_PARAM_INFO_SENTINEL