diff options
Diffstat (limited to 'libraries/elementary/src/edje_externals/elm_naviframe.c')
-rw-r--r-- | libraries/elementary/src/edje_externals/elm_naviframe.c | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/libraries/elementary/src/edje_externals/elm_naviframe.c b/libraries/elementary/src/edje_externals/elm_naviframe.c new file mode 100644 index 0000000..60211a8 --- /dev/null +++ b/libraries/elementary/src/edje_externals/elm_naviframe.c | |||
@@ -0,0 +1,133 @@ | |||
1 | #include "private.h" | ||
2 | |||
3 | typedef struct _Elm_Params_Naviframe | ||
4 | { | ||
5 | Elm_Params base; | ||
6 | Eina_Bool preserve_on_pop:1; | ||
7 | Eina_Bool preserve_on_pop_exists:1; | ||
8 | Eina_Bool prev_btn_auto_push:1; | ||
9 | Eina_Bool prev_btn_auto_push_exists:1; | ||
10 | } Elm_Params_Naviframe; | ||
11 | |||
12 | static void | ||
13 | external_naviframe_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, | ||
14 | const void *to_params, float pos __UNUSED__) | ||
15 | { | ||
16 | const Elm_Params_Naviframe *p; | ||
17 | |||
18 | if (to_params) p = to_params; | ||
19 | else if (from_params) p = from_params; | ||
20 | else return; | ||
21 | |||
22 | if (p->preserve_on_pop_exists) | ||
23 | elm_naviframe_content_preserve_on_pop_set(obj, p->preserve_on_pop); | ||
24 | if (p->prev_btn_auto_push_exists) | ||
25 | elm_naviframe_prev_btn_auto_pushed_set(obj, p->prev_btn_auto_push); | ||
26 | } | ||
27 | |||
28 | static Eina_Bool | ||
29 | external_naviframe_param_set(void *data __UNUSED__, Evas_Object *obj, | ||
30 | const Edje_External_Param *param) | ||
31 | { | ||
32 | if (!strcmp(param->name, "preserve on pop")) | ||
33 | { | ||
34 | if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) | ||
35 | { | ||
36 | elm_naviframe_content_preserve_on_pop_set(obj, param->i); | ||
37 | return EINA_TRUE; | ||
38 | } | ||
39 | } | ||
40 | else if (!strcmp(param->name, "prev btn auto push")) | ||
41 | { | ||
42 | if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) | ||
43 | { | ||
44 | elm_naviframe_prev_btn_auto_pushed_set(obj, param->i); | ||
45 | return EINA_TRUE; | ||
46 | } | ||
47 | } | ||
48 | |||
49 | ERR("unknown parameter '%s' of type '%s'", | ||
50 | param->name, edje_external_param_type_str(param->type)); | ||
51 | |||
52 | return EINA_FALSE; | ||
53 | } | ||
54 | |||
55 | static Eina_Bool | ||
56 | external_naviframe_param_get(void *data __UNUSED__, const Evas_Object *obj, | ||
57 | Edje_External_Param *param) | ||
58 | { | ||
59 | if (!strcmp(param->name, "preserve on pop")) | ||
60 | { | ||
61 | if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) | ||
62 | { | ||
63 | param->i = elm_naviframe_content_preserve_on_pop_get(obj); | ||
64 | return EINA_TRUE; | ||
65 | } | ||
66 | } | ||
67 | else if (!strcmp(param->name, "prev btn auto push")) | ||
68 | { | ||
69 | if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) | ||
70 | { | ||
71 | param->i = elm_naviframe_prev_btn_auto_pushed_get(obj); | ||
72 | return EINA_TRUE; | ||
73 | } | ||
74 | } | ||
75 | |||
76 | ERR("unknown parameter '%s' of type '%s'", | ||
77 | param->name, edje_external_param_type_str(param->type)); | ||
78 | |||
79 | return EINA_FALSE; | ||
80 | } | ||
81 | |||
82 | static void * | ||
83 | external_naviframe_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, | ||
84 | const Eina_List *params) | ||
85 | { | ||
86 | Elm_Params_Naviframe *mem; | ||
87 | Edje_External_Param *param; | ||
88 | const Eina_List *l; | ||
89 | |||
90 | mem = ELM_NEW(Elm_Params_Naviframe); | ||
91 | if (!mem) | ||
92 | return NULL; | ||
93 | |||
94 | EINA_LIST_FOREACH(params, l, param) | ||
95 | { | ||
96 | if (!strcmp(param->name, "preserve on pop")) | ||
97 | { | ||
98 | mem->preserve_on_pop = !!param->i; | ||
99 | mem->preserve_on_pop_exists = EINA_TRUE; | ||
100 | } | ||
101 | else if (!strcmp(param->name, "prev btn auto push")) | ||
102 | { | ||
103 | mem->prev_btn_auto_push = !!param->i; | ||
104 | mem->prev_btn_auto_push_exists = EINA_TRUE; | ||
105 | } | ||
106 | } | ||
107 | |||
108 | return mem; | ||
109 | } | ||
110 | |||
111 | static Evas_Object *external_naviframe_content_get(void *data __UNUSED__, | ||
112 | const Evas_Object *obj __UNUSED__, const char *content __UNUSED__) | ||
113 | { | ||
114 | ERR("No content."); | ||
115 | return NULL; | ||
116 | } | ||
117 | |||
118 | static void | ||
119 | external_naviframe_params_free(void *params) | ||
120 | { | ||
121 | Elm_Params_Naviframe *mem = params; | ||
122 | free(mem); | ||
123 | } | ||
124 | |||
125 | static Edje_External_Param_Info external_naviframe_params[] = { | ||
126 | DEFINE_EXTERNAL_COMMON_PARAMS, | ||
127 | EDJE_EXTERNAL_PARAM_INFO_BOOL("preserve on pop"), | ||
128 | EDJE_EXTERNAL_PARAM_INFO_BOOL("prev btn auto push"), | ||
129 | EDJE_EXTERNAL_PARAM_INFO_SENTINEL | ||
130 | }; | ||
131 | |||
132 | DEFINE_EXTERNAL_ICON_ADD(naviframe, "naviframe"); | ||
133 | DEFINE_EXTERNAL_TYPE_SIMPLE(naviframe, "Naviframe"); | ||