summaryrefslogtreecommitdiff
path: root/legacy/elementary/src/edje_externals/elm_radio.c
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2010-03-25 18:10:25 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2010-03-25 18:10:25 +0000
commitd1d996f13d9253dd1a68f65ae900e99160b00cc9 (patch)
tree0d4ef09a18d5ca107e4f821a45d0d579b7e40d83 /legacy/elementary/src/edje_externals/elm_radio.c
parent96657f33afde3bdfda67878e676e158e10f1a629 (diff)
Port to new Edje EXTERNAL API goodies!
Now it is possible to change labels and lots of other parameters directly through Edje's API. BIG FAT NOTE: this is a convenience that comes with a reasonable price. If you have hot paths, like loops, then avoid calling this and use the object directly. This functions add a cost to check edje, then find the part, then get the type, then get the param_set/param_get methods, then calling it, then finding the parameters using strcmp(), then checking the type and just then it will call the actual method. So whenever possible, just call the method directly. Due the reasoning of the "big fat note" I'm adding this inside edje externals only. The code would be almost the same to expose it in Elementary.h as elm_widget_property_set/get, but then I know people would misuse it... actually this kind of stuff could be easily ported to Evas smart object, but then abuse and slowness will hunt us foreveeeeer... SVN revision: 47457
Diffstat (limited to '')
-rw-r--r--legacy/elementary/src/edje_externals/elm_radio.c71
1 files changed, 70 insertions, 1 deletions
diff --git a/legacy/elementary/src/edje_externals/elm_radio.c b/legacy/elementary/src/edje_externals/elm_radio.c
index e32a6f4..97af308 100644
--- a/legacy/elementary/src/edje_externals/elm_radio.c
+++ b/legacy/elementary/src/edje_externals/elm_radio.c
@@ -9,7 +9,7 @@ typedef struct _Elm_Params_Radio
9} Elm_Params_Radio; 9} Elm_Params_Radio;
10 10
11static void 11static void
12external_radio_state_set(void *data, Evas_Object *obj, const void *from_params, const void *to_params, float pos) 12external_radio_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
13{ 13{
14 const Elm_Params_Radio *p1 = from_params, *p2 = to_params; 14 const Elm_Params_Radio *p1 = from_params, *p2 = to_params;
15 15
@@ -42,6 +42,75 @@ external_radio_state_set(void *data, Evas_Object *obj, const void *from_params,
42 } 42 }
43} 43}
44 44
45static Eina_Bool
46external_radio_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
47{
48 if (!strcmp(param->name, "label"))
49 {
50 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
51 {
52 elm_radio_label_set(obj, param->s);
53 return EINA_TRUE;
54 }
55 }
56 else if (!strcmp(param->name, "icon"))
57 {
58 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
59 {
60 Evas_Object *icon = external_common_param_icon_get(obj, param);
61 if (icon)
62 {
63 elm_radio_icon_set(obj, icon);
64 return EINA_TRUE;
65 }
66 }
67 }
68 else if (!strcmp(param->name, "value"))
69 {
70 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
71 {
72 elm_radio_value_set(obj, param->i);
73 return EINA_TRUE;
74 }
75 }
76
77 ERR("unknown parameter '%s' of type '%s'",
78 param->name, edje_external_param_type_str(param->type));
79
80 return EINA_FALSE;
81}
82
83static Eina_Bool
84external_radio_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
85{
86 if (!strcmp(param->name, "label"))
87 {
88 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
89 {
90 param->s = elm_radio_label_get(obj);
91 return EINA_TRUE;
92 }
93 }
94 else if (!strcmp(param->name, "icon"))
95 {
96 /* not easy to get icon name back from live object */
97 return EINA_FALSE;
98 }
99 else if (!strcmp(param->name, "value"))
100 {
101 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
102 {
103 param->i = elm_radio_value_get(obj);
104 return EINA_TRUE;
105 }
106 }
107
108 ERR("unknown parameter '%s' of type '%s'",
109 param->name, edje_external_param_type_str(param->type));
110
111 return EINA_FALSE;
112}
113
45static void * 114static void *
46external_radio_params_parse(void *data, Evas_Object *obj, const Eina_List *params) 115external_radio_params_parse(void *data, Evas_Object *obj, const Eina_List *params)
47{ 116{