summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHermet Park <hermet@hermet.pe.kr>2016-12-02 17:32:12 +0900
committerHermet Park <hermet@hermet.pe.kr>2016-12-02 17:32:12 +0900
commita63d0d8fa51d9a8a9b9953d4cdcb9ae964018f24 (patch)
treea888557e43f8a030d633a3c1dd9caf199cf7f419
parentb625cc9ce6b4c68660ad31334f417a1dfadd6349 (diff)
backup code.
-rw-r--r--efl_ui_path.c167
-rw-r--r--efl_ui_path.eo16
-rw-r--r--efl_ui_path_private.h19
3 files changed, 202 insertions, 0 deletions
diff --git a/efl_ui_path.c b/efl_ui_path.c
new file mode 100644
index 0000000..241318f
--- /dev/null
+++ b/efl_ui_path.c
@@ -0,0 +1,167 @@
1#include "efl_ui_path_private.h"
2
3#define MY_CLASS EFL_UI_PATH_CLASS
4#define MY_CLASS_NAME "Efl.Ui.Path"
5
6static void
7_configure(Eo* obj EINA_UNUSED, Efl_Ui_Path_Data *sd)
8{
9 if (!sd->vis || !sd->content) return;
10
11 ERR("configure!");
12}
13
14static void
15_changed_size_hints_cb(void *data, const Efl_Event *event EINA_UNUSED)
16{
17 Eo* obj = data;
18 Efl_Ui_Path_Data *sd = efl_data_scope_get(obj, EFL_UI_PATH_CLASS);
19 _configure(obj, sd);
20}
21
22static Eina_Bool
23_content_unset(Eo *obj, Efl_Ui_Path_Data *sd, Eo* sobj)
24{
25 if (sobj != sd->content) return EINA_FALSE;
26 if (!sobj) return EINA_FALSE;
27
28 sd->content = NULL;
29
30 efl_key_data_set(sobj, "_elm_leaveme", NULL);
31 efl_gfx_visible_set(sd->clip, EINA_FALSE);
32
33 efl_canvas_group_member_del(obj, sobj);
34 efl_canvas_object_clip_set(sobj, NULL);
35 efl_event_callback_del(sobj, EFL_GFX_EVENT_CHANGE_SIZE_HINTS, _changed_size_hints_cb,
36 obj);
37 return EINA_TRUE;
38}
39
40
41EOLIAN static void
42_efl_ui_path_efl_gfx_size_set(Eo *obj, Efl_Ui_Path_Data *sd, Evas_Coord w, Evas_Coord h)
43{
44 efl_gfx_size_set(efl_super(obj, MY_CLASS), w, h);
45 if (sd->content) efl_gfx_size_set(sd->content, w, h);
46
47 _configure(obj, sd);
48}
49
50EOLIAN static void
51_efl_ui_path_efl_gfx_position_set(Eo *obj, Efl_Ui_Path_Data *sd, Evas_Coord x, Evas_Coord y)
52{
53 efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y);
54 if (sd->content) efl_gfx_position_set(sd->content, x, y);
55
56 _configure(obj, sd);
57}
58
59EOLIAN static void
60_efl_ui_path_efl_gfx_visible_set(Eo *obj, Efl_Ui_Path_Data *sd, Eina_Bool vis)
61{
62 efl_gfx_visible_set(efl_super(obj, MY_CLASS), vis);
63
64 sd->vis = vis;
65
66 if (sd->vis) _configure(obj, sd);
67}
68
69EOLIAN static Eina_Bool
70_efl_ui_path_efl_container_content_set(Eo *obj, Efl_Ui_Path_Data *sd, Eo *content)
71{
72 if (sd->content == content) return EINA_TRUE;
73
74 if (content)
75 {
76 efl_del(sd->content);
77 efl_key_data_set(content, "_elm_leaveme", (void *)1);
78 efl_canvas_group_member_add(content, obj);
79 efl_canvas_object_clip_set(content, sd->clip);
80 efl_gfx_visible_set(sd->clip, EINA_TRUE);
81 efl_event_callback_add(content, EFL_GFX_EVENT_CHANGE_SIZE_HINTS,
82 _changed_size_hints_cb, obj);
83 Evas_Coord x, y, w, h;
84 efl_gfx_geometry_get(obj, &x, &y, &w, &h);
85 efl_gfx_position_set(content, x, y);
86 efl_gfx_size_set(content, w, h);
87
88 sd->content = content;
89 }
90 else
91 {
92 if (!_content_unset(obj, sd, sd->content)) return EINA_FALSE;
93 }
94
95 sd->content = content;
96
97 _configure(obj, sd);
98
99 return EINA_TRUE;
100}
101
102EOLIAN static Eo*
103_efl_ui_path_efl_container_content_get(Eo *obj EINA_UNUSED, Efl_Ui_Path_Data *sd)
104{
105 return sd->content;
106}
107
108EOLIAN static Eo *
109_efl_ui_path_efl_object_constructor(Eo *obj, Efl_Ui_Path_Data *pd EINA_UNUSED)
110{
111 obj = efl_constructor(efl_super(obj, MY_CLASS));
112 efl_canvas_object_type_set(obj, MY_CLASS_NAME);
113 elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_IMAGE_MAP);
114
115 return obj;
116}
117
118EOLIAN static void
119_efl_ui_path_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Path_Data *priv)
120{
121 efl_canvas_group_add(efl_super(obj, MY_CLASS));
122 elm_widget_sub_object_parent_add(obj);
123
124 priv->clip = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas_object_evas_get(obj));
125 efl_canvas_group_member_add(priv->clip, obj);
126 evas_object_static_clip_set(priv->clip, EINA_TRUE);
127 efl_gfx_position_set(priv->clip, -49999, -49999);
128 efl_gfx_size_set(priv->clip, 99999, 99999);
129
130 efl_event_callback_add(obj, EFL_GFX_EVENT_CHANGE_SIZE_HINTS,
131 _changed_size_hints_cb, obj);
132
133 elm_obj_widget_can_focus_set(obj, EINA_FALSE);
134}
135
136EOLIAN static void
137_efl_ui_path_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Path_Data *sd EINA_UNUSED)
138{
139 ERR("!");
140 efl_canvas_group_del(efl_super(obj, MY_CLASS));
141}
142
143EOLIAN static Eina_Bool
144_efl_ui_path_elm_widget_sub_object_del(Eo *obj, Efl_Ui_Path_Data *sd, Evas_Object *sobj)
145{
146 ERR("!");
147
148 if (!elm_obj_widget_sub_object_del(efl_super(obj, MY_CLASS), sobj)) return EINA_FALSE;
149 if (!_content_unset(obj, sd, sobj)) return EINA_FALSE;
150
151 _configure(obj, sd);
152
153 return EINA_TRUE;
154}
155
156EOLIAN static Elm_Theme_Apply
157_efl_ui_path_elm_widget_theme_apply(Eo *obj, Efl_Ui_Path_Data *sd EINA_UNUSED)
158{
159 Elm_Theme_Apply int_ret = elm_obj_widget_theme_apply(efl_super(obj, MY_CLASS));
160 if (ELM_THEME_APPLY_FAILED == int_ret) return ELM_THEME_APPLY_FAILED;
161
162 _configure(obj, sd);
163
164 return int_ret;
165}
166
167#include "efl_ui_path.eo.c"
diff --git a/efl_ui_path.eo b/efl_ui_path.eo
new file mode 100644
index 0000000..baa0b72
--- /dev/null
+++ b/efl_ui_path.eo
@@ -0,0 +1,16 @@
1class Efl.Ui.Path (Elm.Widget, Efl.Container, Efl.Gfx.Path, Efl.Part)
2{
3 [[Efl UI path class]]
4 implements {
5 Efl.Object.constructor;
6 Efl.Gfx.position.set;
7 Efl.Gfx.visible.set;
8 Efl.Gfx.size.set;
9 Efl.Container.content.get;
10 Efl.Container.content.set;
11 Efl.Canvas.Group.group_add;
12 Efl.Canvas.Group.group_del;
13 Elm.Widget.sub_object_del;
14 Elm.Widget.theme_apply;
15 }
16}
diff --git a/efl_ui_path_private.h b/efl_ui_path_private.h
new file mode 100644
index 0000000..20be357
--- /dev/null
+++ b/efl_ui_path_private.h
@@ -0,0 +1,19 @@
1#ifndef EFL_UI_WIDGET_PATH_H
2#define EFL_UI_WIDGET_PATH_H
3
4#ifdef HAVE_CONFIG_H
5# include "elementary_config.h"
6#endif
7
8#include <Elementary.h>
9#include "elm_priv.h"
10
11typedef struct _Efl_Ui_Path_Data
12{
13 Eo *clip;
14 Eo *content;
15
16 Eina_Bool vis : 1;
17} Efl_Ui_Path_Data;
18
19#endif