summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2017-05-23 20:34:06 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2017-05-25 21:43:20 +0900
commitbad9dfea133e18eb1d5d950619d75ac053b9ba45 (patch)
tree8b24fc7615fa0b9ac20692bcacca31916695a332
parent898a86c49e0dfa519dc6bfaf6630b565d6a18851 (diff)
downloadefl-bad9dfea133e18eb1d5d950619d75ac053b9ba45.tar.gz
efl_animation: Add animation group
-rw-r--r--src/Makefile_Evas.am2
-rw-r--r--src/lib/evas/Evas_Eo.h1
-rw-r--r--src/lib/evas/canvas/efl_animation_group.c108
-rw-r--r--src/lib/evas/canvas/efl_animation_group.eo32
-rw-r--r--src/lib/evas/include/evas_private.h1
5 files changed, 144 insertions, 0 deletions
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index fefa212e0d..074f7d0495 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -55,6 +55,7 @@ evas_eolian_pub_files = \
lib/evas/canvas/efl_animation_rotate.eo \
lib/evas/canvas/efl_animation_scale.eo \
lib/evas/canvas/efl_animation_translate.eo \
+ lib/evas/canvas/efl_animation_group.eo \
$(NULL)
evas_eolian_legacy_files = \
@@ -223,6 +224,7 @@ lib/evas/canvas/efl_animation_alpha.c \
lib/evas/canvas/efl_animation_rotate.c \
lib/evas/canvas/efl_animation_scale.c \
lib/evas/canvas/efl_animation_translate.c \
+lib/evas/canvas/efl_animation_group.c \
$(NULL)
EXTRA_DIST2 += \
diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h
index ae03af5d40..cc4b76346f 100644
--- a/src/lib/evas/Evas_Eo.h
+++ b/src/lib/evas/Evas_Eo.h
@@ -71,6 +71,7 @@
#include "canvas/efl_animation_rotate.eo.h"
#include "canvas/efl_animation_scale.eo.h"
#include "canvas/efl_animation_translate.eo.h"
+#include "canvas/efl_animation_group.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_group.c b/src/lib/evas/canvas/efl_animation_group.c
new file mode 100644
index 0000000000..1ddec02fa4
--- /dev/null
+++ b/src/lib/evas/canvas/efl_animation_group.c
@@ -0,0 +1,108 @@
+#define EFL_ANIMATION_PROTECTED
+
+#include "evas_common_private.h"
+#include "evas_private.h"
+
+#define MY_CLASS EFL_ANIMATION_GROUP_CLASS
+#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
+
+#define EFL_ANIMATION_GROUP_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_GROUP_DATA_GET(o, pd) \
+ Evas_Object_Animation_Group_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_GROUP_CLASS)
+
+struct _Evas_Object_Animation_Group_Data
+{
+ Eina_List *animations;
+};
+
+EOLIAN static void
+_efl_animation_group_animation_add(Eo *eo_obj, Evas_Object_Animation_Group_Data *pd, Efl_Animation*animation)
+{
+ EFL_ANIMATION_GROUP_CHECK_OR_RETURN(eo_obj);
+
+ if (!animation) return;
+
+ pd->animations = eina_list_append(pd->animations, animation);
+}
+
+EOLIAN static void
+_efl_animation_group_animation_del(Eo *eo_obj, Evas_Object_Animation_Group_Data *pd, Efl_Animation*animation)
+{
+ EFL_ANIMATION_GROUP_CHECK_OR_RETURN(eo_obj);
+
+ if (!animation) return;
+
+ pd->animations = eina_list_remove(pd->animations, animation);
+}
+
+EOLIAN static Eina_List *
+_efl_animation_group_animations_get(Eo *eo_obj, Evas_Object_Animation_Group_Data *pd)
+{
+ EFL_ANIMATION_GROUP_CHECK_OR_RETURN(eo_obj, NULL);
+
+ return pd->animations;
+}
+
+EOLIAN static void
+_efl_animation_group_efl_animation_target_set(Eo *eo_obj, Evas_Object_Animation_Group_Data *pd, Eo *target)
+ {
+ EFL_ANIMATION_GROUP_CHECK_OR_RETURN(eo_obj);
+
+ Eina_List *l;
+ Efl_Animation *anim;
+ EINA_LIST_FOREACH(pd->animations, l, anim)
+ {
+ efl_animation_target_set(anim, target);
+ }
+
+ efl_animation_target_set(efl_super(eo_obj, MY_CLASS), target);
+}
+
+EOLIAN static void
+_efl_animation_group_efl_animation_final_state_keep_set(Eo *eo_obj, Evas_Object_Animation_Group_Data *pd, Eina_Bool state_keep)
+{
+ EFL_ANIMATION_GROUP_CHECK_OR_RETURN(eo_obj);
+
+ Eina_List *l;
+ Efl_Animation *anim;
+ EINA_LIST_FOREACH(pd->animations, l, anim)
+ {
+ efl_animation_final_state_keep_set(anim, state_keep);
+ }
+
+ efl_animation_final_state_keep_set(efl_super(eo_obj, MY_CLASS), state_keep);
+}
+
+EOLIAN static Efl_Object *
+_efl_animation_group_efl_object_constructor(Eo *eo_obj, Evas_Object_Animation_Group_Data *pd)
+{
+ eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
+
+ pd->animations = NULL;
+
+ return eo_obj;
+}
+
+EOLIAN static void
+_efl_animation_group_efl_object_destructor(Eo *eo_obj, Evas_Object_Animation_Group_Data *pd)
+{
+ Efl_Animation *anim;
+
+ EINA_LIST_FREE(pd->animations, anim)
+ efl_del(anim);
+
+ efl_destructor(efl_super(eo_obj, MY_CLASS));
+}
+
+#include "efl_animation_group.eo.c"
diff --git a/src/lib/evas/canvas/efl_animation_group.eo b/src/lib/evas/canvas/efl_animation_group.eo
new file mode 100644
index 0000000000..ab0e480e8e
--- /dev/null
+++ b/src/lib/evas/canvas/efl_animation_group.eo
@@ -0,0 +1,32 @@
+import efl_animation_types;
+
+abstract Efl.Animation.Group (Efl.Animation)
+{
+ [[Efl group animation abstract class]]
+ legacy_prefix: evas_object_animation;
+ data: Evas_Object_Animation_Group_Data;
+ methods {
+ animation_add {
+ [[Add the given animation to the animation group.]]
+ params {
+ @in animation: Efl.Animation; [[The animation which needs to be added to the animation group]]
+ }
+ }
+ animation_del {
+ [[Delete the given animation from the animation group.]]
+ params {
+ @in animation: Efl.Animation; [[The animation which needs to be deleted from the animation group]]
+ }
+ }
+ animations_get {
+ [[Get the animations of the animation group.]]
+ return: list<Efl.Animation>; [[The animations of the animation group]]
+ }
+ }
+ implements {
+ Efl.Object.constructor;
+ Efl.Object.destructor;
+ Efl.Animation.target { set; }
+ Efl.Animation.final_state_keep { set; }
+ }
+}
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index 32a1938c6a..ff36f5e2b0 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -109,6 +109,7 @@ typedef struct _Evas_Object_Animation_Alpha_Data Evas_Object_Animation_Alpha_Da
typedef struct _Evas_Object_Animation_Rotate_Data Evas_Object_Animation_Rotate_Data;
typedef struct _Evas_Object_Animation_Scale_Data Evas_Object_Animation_Scale_Data;
typedef struct _Evas_Object_Animation_Translate_Data Evas_Object_Animation_Translate_Data;
+typedef struct _Evas_Object_Animation_Group_Data Evas_Object_Animation_Group_Data;
typedef struct _Evas_Object_Animation_Data Evas_Object_Animation_Data;
//These macros are matched to Efl_Animation_Event_Type enum values.