summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2017-08-24 20:45:52 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2017-10-12 21:03:49 +0900
commit5038223b61526419e7b3d0c2c8b996666a2fb1c6 (patch)
treea5643a263dc86367574854c14b99e1d746db3bfe /src
parent72f1fbf4f1eddbc1cde4455081be4f3a9b8a1a44 (diff)
efl_animation: Add efl_animation
Efl.Animation is a class which contains basic properties of animation for Efl.Canvas.Object.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile_Evas.am8
-rw-r--r--src/lib/evas/Evas_Common.h7
-rw-r--r--src/lib/evas/Evas_Eo.h5
-rw-r--r--src/lib/evas/canvas/efl_animation.c107
-rw-r--r--src/lib/evas/canvas/efl_animation.eo43
-rw-r--r--src/lib/evas/canvas/efl_animation_private.h31
-rw-r--r--src/lib/evas/canvas/efl_animation_types.eot2
7 files changed, 201 insertions, 2 deletions
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index 9b141d17b8..ce53ba0716 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -44,6 +44,7 @@ evas_eolian_pub_files = \
44 lib/evas/canvas/efl_input_hold.eo \ 44 lib/evas/canvas/efl_input_hold.eo \
45 lib/evas/canvas/efl_input_focus.eo \ 45 lib/evas/canvas/efl_input_focus.eo \
46 lib/evas/canvas/efl_gfx_map.eo \ 46 lib/evas/canvas/efl_gfx_map.eo \
47 lib/evas/canvas/efl_animation.eo \
47 $(NULL) 48 $(NULL)
48 49
49evas_eolian_legacy_files = \ 50evas_eolian_legacy_files = \
@@ -60,7 +61,8 @@ evas_eolian_priv_files = \
60 lib/evas/include/evas_ector_buffer.eo 61 lib/evas/include/evas_ector_buffer.eo
61 62
62evas_eolian_type_files = \ 63evas_eolian_type_files = \
63 lib/evas/canvas/evas_canvas3d_types.eot 64 lib/evas/canvas/evas_canvas3d_types.eot \
65 lib/evas/canvas/efl_animation_types.eot
64 66
65evas_eolian_priv_c = $(evas_eolian_priv_files:%.eo=%.eo.c) 67evas_eolian_priv_c = $(evas_eolian_priv_files:%.eo=%.eo.c)
66evas_eolian_priv_h = $(evas_eolian_priv_files:%.eo=%.eo.h) \ 68evas_eolian_priv_h = $(evas_eolian_priv_files:%.eo=%.eo.h) \
@@ -120,7 +122,8 @@ lib/evas/canvas/evas_vg_private.h \
120lib/evas/canvas/evas_image_private.h \ 122lib/evas/canvas/evas_image_private.h \
121lib/evas/canvas/evas_polygon_private.h \ 123lib/evas/canvas/evas_polygon_private.h \
122lib/evas/canvas/efl_canvas_surface.h \ 124lib/evas/canvas/efl_canvas_surface.h \
123lib/evas/common3d/primitives/primitive_common.h 125lib/evas/common3d/primitives/primitive_common.h \
126lib/evas/canvas/efl_animation_private.h
124 127
125# Linebreak 128# Linebreak
126 129
@@ -206,6 +209,7 @@ lib/evas/canvas/efl_input_key.c \
206lib/evas/canvas/efl_input_pointer.c \ 209lib/evas/canvas/efl_input_pointer.c \
207lib/evas/canvas/efl_input_hold.c \ 210lib/evas/canvas/efl_input_hold.c \
208lib/evas/canvas/efl_input_focus.c \ 211lib/evas/canvas/efl_input_focus.c \
212lib/evas/canvas/efl_animation.c \
209$(NULL) 213$(NULL)
210 214
211EXTRA_DIST2 += \ 215EXTRA_DIST2 += \
diff --git a/src/lib/evas/Evas_Common.h b/src/lib/evas/Evas_Common.h
index 72ec2b9dfc..d97b856208 100644
--- a/src/lib/evas/Evas_Common.h
+++ b/src/lib/evas/Evas_Common.h
@@ -3330,6 +3330,13 @@ EAPI const Eina_List *evas_font_path_global_list(void) EINA_WARN_UNUSED_R
3330 */ 3330 */
3331EAPI void evas_font_reinit(void); 3331EAPI void evas_font_reinit(void);
3332 3332
3333#ifndef _EFL_ANIMATION_EO_CLASS_TYPE
3334#define _EFL_ANIMATION_EO_CLASS_TYPE
3335
3336typedef Eo Efl_Animation;
3337
3338#endif
3339
3333/** 3340/**
3334 * @} 3341 * @}
3335 */ 3342 */
diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h
index 24a4047eb8..b81a6ad6fa 100644
--- a/src/lib/evas/Evas_Eo.h
+++ b/src/lib/evas/Evas_Eo.h
@@ -51,7 +51,12 @@
51 * @} 51 * @}
52 */ 52 */
53 53
54#include "canvas/efl_animation_types.eot.h"
55
54#include "canvas/efl_canvas_object.eo.h" 56#include "canvas/efl_canvas_object.eo.h"
57
58#include "canvas/efl_animation.eo.h"
59
55#endif /* EFL_EO_API_SUPPORT */ 60#endif /* EFL_EO_API_SUPPORT */
56 61
57#if defined(EFL_BETA_API_SUPPORT) && defined(EFL_EO_API_SUPPORT) 62#if defined(EFL_BETA_API_SUPPORT) && defined(EFL_EO_API_SUPPORT)
diff --git a/src/lib/evas/canvas/efl_animation.c b/src/lib/evas/canvas/efl_animation.c
new file mode 100644
index 0000000000..92bef8feee
--- /dev/null
+++ b/src/lib/evas/canvas/efl_animation.c
@@ -0,0 +1,107 @@
1#include "efl_animation_private.h"
2
3static void
4_target_del_cb(void *data, const Efl_Event *event EINA_UNUSED)
5{
6 Eo *eo_obj = data;
7
8 EFL_ANIMATION_CHECK_OR_RETURN(eo_obj);
9 EFL_ANIMATION_DATA_GET(eo_obj, pd);
10
11 pd->target = NULL;
12}
13
14EOLIAN static void
15_efl_animation_target_set(Eo *eo_obj,
16 Efl_Animation_Data *pd,
17 Efl_Canvas_Object *target)
18{
19 EFL_ANIMATION_CHECK_OR_RETURN(eo_obj);
20
21 efl_event_callback_add(target, EFL_EVENT_DEL, _target_del_cb, eo_obj);
22
23 pd->target = target;
24}
25
26EOLIAN static Efl_Canvas_Object *
27_efl_animation_target_get(Eo *eo_obj, Efl_Animation_Data *pd)
28{
29 EFL_ANIMATION_CHECK_OR_RETURN(eo_obj, NULL);
30
31 return pd->target;
32}
33
34EOLIAN static void
35_efl_animation_duration_set(Eo *eo_obj,
36 Efl_Animation_Data *pd,
37 double duration)
38{
39 EFL_ANIMATION_CHECK_OR_RETURN(eo_obj);
40
41 pd->duration = duration;
42}
43
44EOLIAN static double
45_efl_animation_duration_get(Eo *eo_obj, Efl_Animation_Data *pd)
46{
47 EFL_ANIMATION_CHECK_OR_RETURN(eo_obj, 0.0);
48
49 return pd->duration;
50}
51
52EOLIAN static Eina_Bool
53_efl_animation_is_deleted(Eo *eo_obj, Efl_Animation_Data *pd)
54{
55 EINA_SAFETY_ON_NULL_RETURN_VAL(eo_obj, EINA_TRUE);
56
57 return pd->is_deleted;
58}
59
60EOLIAN static void
61_efl_animation_final_state_keep_set(Eo *eo_obj,
62 Efl_Animation_Data *pd,
63 Eina_Bool keep_final_state)
64{
65 EFL_ANIMATION_CHECK_OR_RETURN(eo_obj);
66
67 if (pd->keep_final_state == keep_final_state) return;
68
69 pd->keep_final_state = !!keep_final_state;
70}
71
72EOLIAN static Eina_Bool
73_efl_animation_final_state_keep_get(Eo *eo_obj, Efl_Animation_Data *pd)
74{
75 EFL_ANIMATION_CHECK_OR_RETURN(eo_obj, EINA_FALSE);
76
77 return pd->keep_final_state;
78}
79
80EOLIAN static Efl_Object *
81_efl_animation_efl_object_constructor(Eo *eo_obj,
82 Efl_Animation_Data *pd)
83{
84 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
85
86 pd->target = NULL;
87
88 pd->duration = 0.0;
89
90 pd->is_deleted = EINA_FALSE;
91 pd->keep_final_state = EINA_FALSE;
92
93 return eo_obj;
94}
95
96EOLIAN static void
97_efl_animation_efl_object_destructor(Eo *eo_obj, Efl_Animation_Data *pd)
98{
99 pd->is_deleted = EINA_TRUE;
100
101 if (pd->target)
102 efl_event_callback_del(pd->target, EFL_EVENT_DEL, _target_del_cb, eo_obj);
103
104 efl_destructor(efl_super(eo_obj, MY_CLASS));
105}
106
107#include "efl_animation.eo.c"
diff --git a/src/lib/evas/canvas/efl_animation.eo b/src/lib/evas/canvas/efl_animation.eo
new file mode 100644
index 0000000000..67da77c0f9
--- /dev/null
+++ b/src/lib/evas/canvas/efl_animation.eo
@@ -0,0 +1,43 @@
1import efl_animation_types;
2
3class Efl.Animation (Efl.Object)
4{
5 [[Efl animation class]]
6 data: Efl_Animation_Data;
7 methods {
8 @property target {
9 set {
10 }
11 get {
12 }
13 values {
14 target: Efl.Canvas.Object; [[Target object which is applied animation.]]
15 }
16 }
17 @property final_state_keep {
18 set {
19 }
20 get {
21 }
22 values {
23 keep_final_state: bool; [[$true to keep final state, $false otherwise.]]
24 }
25 }
26 @property duration {
27 set {
28 }
29 get {
30 }
31 values {
32 duration: double; [[Duration value.]]
33 }
34 }
35 is_deleted @protected {
36 return: bool; [[$true if animation is deleted, $false otherwise.]]
37 }
38 }
39 implements {
40 Efl.Object.constructor;
41 Efl.Object.destructor;
42 }
43}
diff --git a/src/lib/evas/canvas/efl_animation_private.h b/src/lib/evas/canvas/efl_animation_private.h
new file mode 100644
index 0000000000..44c48a0b88
--- /dev/null
+++ b/src/lib/evas/canvas/efl_animation_private.h
@@ -0,0 +1,31 @@
1#define EFL_ANIMATION_PROTECTED
2
3#include "evas_common_private.h"
4
5#define MY_CLASS EFL_ANIMATION_CLASS
6#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
7
8typedef struct _Efl_Animation_Data
9{
10 Efl_Canvas_Object *target;
11
12 double duration;
13
14 Eina_Bool is_deleted : 1;
15 Eina_Bool keep_final_state : 1;
16} Efl_Animation_Data;
17
18#define EFL_ANIMATION_CHECK_OR_RETURN(anim, ...) \
19 do { \
20 if (!anim) { \
21 CRI("Efl_Animation " # anim " is NULL!"); \
22 return __VA_ARGS__; \
23 } \
24 if (efl_animation_is_deleted(anim)) { \
25 ERR("Efl_Animation " # anim " has already been deleted!"); \
26 return __VA_ARGS__; \
27 } \
28 } while (0)
29
30#define EFL_ANIMATION_DATA_GET(o, pd) \
31 Efl_Animation_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_CLASS)
diff --git a/src/lib/evas/canvas/efl_animation_types.eot b/src/lib/evas/canvas/efl_animation_types.eot
new file mode 100644
index 0000000000..f9047e3061
--- /dev/null
+++ b/src/lib/evas/canvas/efl_animation_types.eot
@@ -0,0 +1,2 @@
1// ----------------------------------------------------------------------------
2// All the below types are for Efl Animation