jaehyun pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=5038223b61526419e7b3d0c2c8b996666a2fb1c6

commit 5038223b61526419e7b3d0c2c8b996666a2fb1c6
Author: Jaehyun Cho <jae_hyun....@samsung.com>
Date:   Thu Aug 24 20:45:52 2017 +0900

    efl_animation: Add efl_animation
    
    Efl.Animation is a class which contains basic properties of animation
    for Efl.Canvas.Object.
---
 src/Makefile_Evas.am                        |   8 ++-
 src/lib/evas/Evas_Common.h                  |   7 ++
 src/lib/evas/Evas_Eo.h                      |   5 ++
 src/lib/evas/canvas/efl_animation.c         | 107 ++++++++++++++++++++++++++++
 src/lib/evas/canvas/efl_animation.eo        |  43 +++++++++++
 src/lib/evas/canvas/efl_animation_private.h |  31 ++++++++
 src/lib/evas/canvas/efl_animation_types.eot |   2 +
 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 = \
        lib/evas/canvas/efl_input_hold.eo \
        lib/evas/canvas/efl_input_focus.eo \
        lib/evas/canvas/efl_gfx_map.eo \
+       lib/evas/canvas/efl_animation.eo \
        $(NULL)
 
 evas_eolian_legacy_files = \
@@ -60,7 +61,8 @@ evas_eolian_priv_files = \
        lib/evas/include/evas_ector_buffer.eo
 
 evas_eolian_type_files = \
-    lib/evas/canvas/evas_canvas3d_types.eot
+    lib/evas/canvas/evas_canvas3d_types.eot \
+    lib/evas/canvas/efl_animation_types.eot
 
 evas_eolian_priv_c = $(evas_eolian_priv_files:%.eo=%.eo.c)
 evas_eolian_priv_h = $(evas_eolian_priv_files:%.eo=%.eo.h) \
@@ -120,7 +122,8 @@ lib/evas/canvas/evas_vg_private.h \
 lib/evas/canvas/evas_image_private.h \
 lib/evas/canvas/evas_polygon_private.h \
 lib/evas/canvas/efl_canvas_surface.h \
-lib/evas/common3d/primitives/primitive_common.h
+lib/evas/common3d/primitives/primitive_common.h \
+lib/evas/canvas/efl_animation_private.h
 
 # Linebreak
 
@@ -206,6 +209,7 @@ lib/evas/canvas/efl_input_key.c \
 lib/evas/canvas/efl_input_pointer.c \
 lib/evas/canvas/efl_input_hold.c \
 lib/evas/canvas/efl_input_focus.c \
+lib/evas/canvas/efl_animation.c \
 $(NULL)
 
 EXTRA_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
  */
 EAPI void                    evas_font_reinit(void);
 
+#ifndef _EFL_ANIMATION_EO_CLASS_TYPE
+#define _EFL_ANIMATION_EO_CLASS_TYPE
+
+typedef Eo Efl_Animation;
+
+#endif
+
 /**
  * @}
  */
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 @@
  * @}
  */
 
+#include "canvas/efl_animation_types.eot.h"
+
 #include "canvas/efl_canvas_object.eo.h"
+
+#include "canvas/efl_animation.eo.h"
+
 #endif /* EFL_EO_API_SUPPORT */
 
 #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 @@
+#include "efl_animation_private.h"
+
+static void
+_target_del_cb(void *data, const Efl_Event *event EINA_UNUSED)
+{
+   Eo *eo_obj = data;
+
+   EFL_ANIMATION_CHECK_OR_RETURN(eo_obj);
+   EFL_ANIMATION_DATA_GET(eo_obj, pd);
+
+   pd->target = NULL;
+}
+
+EOLIAN static void
+_efl_animation_target_set(Eo *eo_obj,
+                          Efl_Animation_Data *pd,
+                          Efl_Canvas_Object *target)
+{
+   EFL_ANIMATION_CHECK_OR_RETURN(eo_obj);
+
+   efl_event_callback_add(target, EFL_EVENT_DEL, _target_del_cb, eo_obj);
+
+   pd->target = target;
+}
+
+EOLIAN static Efl_Canvas_Object *
+_efl_animation_target_get(Eo *eo_obj, Efl_Animation_Data *pd)
+{
+   EFL_ANIMATION_CHECK_OR_RETURN(eo_obj, NULL);
+
+   return pd->target;
+}
+
+EOLIAN static void
+_efl_animation_duration_set(Eo *eo_obj,
+                            Efl_Animation_Data *pd,
+                            double duration)
+{
+   EFL_ANIMATION_CHECK_OR_RETURN(eo_obj);
+
+   pd->duration = duration;
+}
+
+EOLIAN static double
+_efl_animation_duration_get(Eo *eo_obj, Efl_Animation_Data *pd)
+{
+   EFL_ANIMATION_CHECK_OR_RETURN(eo_obj, 0.0);
+
+   return pd->duration;
+}
+
+EOLIAN static Eina_Bool
+_efl_animation_is_deleted(Eo *eo_obj, Efl_Animation_Data *pd)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(eo_obj, EINA_TRUE);
+
+   return pd->is_deleted;
+}
+
+EOLIAN static void
+_efl_animation_final_state_keep_set(Eo *eo_obj,
+                                    Efl_Animation_Data *pd,
+                                    Eina_Bool keep_final_state)
+{
+   EFL_ANIMATION_CHECK_OR_RETURN(eo_obj);
+
+   if (pd->keep_final_state == keep_final_state) return;
+
+   pd->keep_final_state = !!keep_final_state;
+}
+
+EOLIAN static Eina_Bool
+_efl_animation_final_state_keep_get(Eo *eo_obj, Efl_Animation_Data *pd)
+{
+   EFL_ANIMATION_CHECK_OR_RETURN(eo_obj, EINA_FALSE);
+
+   return pd->keep_final_state;
+}
+
+EOLIAN static Efl_Object *
+_efl_animation_efl_object_constructor(Eo *eo_obj,
+                                      Efl_Animation_Data *pd)
+{
+   eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
+
+   pd->target = NULL;
+
+   pd->duration = 0.0;
+
+   pd->is_deleted = EINA_FALSE;
+   pd->keep_final_state = EINA_FALSE;
+
+   return eo_obj;
+}
+
+EOLIAN static void
+_efl_animation_efl_object_destructor(Eo *eo_obj, Efl_Animation_Data *pd)
+{
+   pd->is_deleted = EINA_TRUE;
+
+   if (pd->target)
+     efl_event_callback_del(pd->target, EFL_EVENT_DEL, _target_del_cb, eo_obj);
+
+   efl_destructor(efl_super(eo_obj, MY_CLASS));
+}
+
+#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 @@
+import efl_animation_types;
+
+class Efl.Animation (Efl.Object)
+{
+   [[Efl animation class]]
+   data: Efl_Animation_Data;
+   methods {
+      @property target {
+         set {
+         }
+         get {
+         }
+         values {
+            target: Efl.Canvas.Object; [[Target object which is applied 
animation.]]
+         }
+      }
+      @property final_state_keep {
+         set {
+         }
+         get {
+         }
+         values {
+            keep_final_state: bool; [[$true to keep final state, $false 
otherwise.]]
+         }
+      }
+      @property duration {
+         set {
+         }
+         get {
+         }
+         values {
+            duration: double; [[Duration value.]]
+         }
+      }
+      is_deleted @protected {
+         return: bool; [[$true if animation is deleted, $false otherwise.]]
+      }
+   }
+   implements {
+      Efl.Object.constructor;
+      Efl.Object.destructor;
+   }
+}
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 @@
+#define EFL_ANIMATION_PROTECTED
+
+#include "evas_common_private.h"
+
+#define MY_CLASS EFL_ANIMATION_CLASS
+#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
+
+typedef struct _Efl_Animation_Data
+{
+   Efl_Canvas_Object *target;
+
+   double             duration;
+
+   Eina_Bool          is_deleted : 1;
+   Eina_Bool          keep_final_state : 1;
+} Efl_Animation_Data;
+
+#define EFL_ANIMATION_CHECK_OR_RETURN(anim, ...) \
+   do { \
+      if (!anim) { \
+         CRI("Efl_Animation " # anim " is NULL!"); \
+         return __VA_ARGS__; \
+      } \
+      if (efl_animation_is_deleted(anim)) { \
+         ERR("Efl_Animation " # anim " has already been deleted!"); \
+         return __VA_ARGS__; \
+      } \
+   } while (0)
+
+#define EFL_ANIMATION_DATA_GET(o, pd) \
+   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 @@
+// ----------------------------------------------------------------------------
+// All the below types are for Efl Animation

-- 


Reply via email to