summaryrefslogtreecommitdiff
path: root/src/edje_externals/elm_actionslider.c
diff options
context:
space:
mode:
authorMichael BOUCHAUD <michael.bouchaud@gmail.com>2011-10-31 15:05:04 +0000
committerMichael BOUCHAUD <michael.bouchaud@gmail.com>2011-10-31 15:05:04 +0000
commita8b1f092c1e89a652bfa86e596723129b366f0bb (patch)
tree33779e9b27ba80d59089d55acc04b3b4a25571a0 /src/edje_externals/elm_actionslider.c
parent8aaa6f0267557a85a2d3035b61e8ea104a41b564 (diff)
elementary: adding actionslider to edje_external
SVN revision: 64568
Diffstat (limited to 'src/edje_externals/elm_actionslider.c')
-rw-r--r--src/edje_externals/elm_actionslider.c99
1 files changed, 99 insertions, 0 deletions
diff --git a/src/edje_externals/elm_actionslider.c b/src/edje_externals/elm_actionslider.c
new file mode 100644
index 000000000..aeef27e00
--- /dev/null
+++ b/src/edje_externals/elm_actionslider.c
@@ -0,0 +1,99 @@
1#include "private.h"
2
3typedef struct _Elm_Params_Actionslider
4{
5 Elm_Params base;
6 const char *label;
7} Elm_Params_Actionslider;
8
9static void
10external_actionslider_state_set(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const void *from_params, const void *to_params, float pos __UNUSED__)
11{
12 const Elm_Params_Actionslider *p;
13
14 if (to_params) p = to_params;
15 else if (from_params) p = from_params;
16 else return;
17
18 if (p->label)
19 elm_object_text_set(obj, p->label);
20}
21
22static Eina_Bool
23external_actionslider_param_set(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Edje_External_Param *param)
24{
25 if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
26 && (!strcmp(param->name, "label")))
27 {
28 elm_object_text_set(obj, param->s);
29 return EINA_TRUE;
30 }
31
32 ERR("unknown parameter '%s' of type '%s'",
33 param->name, edje_external_param_type_str(param->type));
34
35 return EINA_FALSE;
36}
37
38static Eina_Bool
39external_actionslider_param_get(void *data __UNUSED__, const Evas_Object *obj __UNUSED__, Edje_External_Param *param)
40{
41 if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
42 && (!strcmp(param->name, "label")))
43 {
44 param->s = elm_object_text_get(obj);
45 return EINA_TRUE;
46 }
47
48 ERR("unknown parameter '%s' of type '%s'",
49 param->name, edje_external_param_type_str(param->type));
50
51 return EINA_FALSE;
52}
53
54static void *
55external_actionslider_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
56{
57 Elm_Params_Actionslider *mem;
58 Edje_External_Param *param;
59 const Eina_List *l;
60
61 mem = ELM_NEW(Elm_Params_Actionslider);
62 if (!mem)
63 return NULL;
64
65 EINA_LIST_FOREACH(params, l, param)
66 {
67 if (!strcmp(param->name, "label"))
68 {
69 mem->label = eina_stringshare_add(param->s);
70 break;
71 }
72 }
73
74 return mem;
75}
76
77static Evas_Object *external_actionslider_content_get(void *data __UNUSED__,
78 const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
79{
80 ERR("No content.");
81 return NULL;
82}
83
84static void
85external_actionslider_params_free(void *params)
86{
87 Elm_Params_Actionslider *mem = params;
88 if (mem->label)
89 eina_stringshare_del(mem->label);
90 free(mem);
91}
92
93static Edje_External_Param_Info external_actionslider_params[] = {
94 DEFINE_EXTERNAL_COMMON_PARAMS,
95 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
96};
97
98DEFINE_EXTERNAL_ICON_ADD(actionslider, "actionslider")
99DEFINE_EXTERNAL_TYPE_SIMPLE(actionslider, "Actionslider");