elm_transit: Add elm_transit_go_in() API
authorJee-Yong Um <jc9.um@samsung.com>
Mon, 16 Feb 2015 23:34:46 +0000 (08:34 +0900)
committerDaniel Juyung Seo <seojuyung2@gmail.com>
Mon, 16 Feb 2015 23:34:46 +0000 (08:34 +0900)
Summary:
elm_transit_go() is executed immediately after it is called.
elm_transit_go_in() starts transit in given seconds.

@feature

Reviewers: Hermet, seoz

Reviewed By: seoz

Subscribers: seoz, Hermet

Differential Revision: https://phab.enlightenment.org/D1954

legacy/elementary/src/lib/elm_transit.c
legacy/elementary/src/lib/elm_transit.h

index eb2ab53..c2332b5 100644 (file)
@@ -30,6 +30,7 @@ struct _Elm_Transit
    EINA_MAGIC;
 
    Ecore_Animator *animator;
+   Ecore_Timer *timer; /**< Timer used by elm_transit_go_in() */
    Eina_Inlist *effect_list;
    Eina_List *objs;
    Elm_Transit *prev_chain_transit;
@@ -266,6 +267,8 @@ _transit_del(Elm_Transit *transit)
    if (transit->del_data.func)
      transit->del_data.func(transit->del_data.arg, transit);
 
+   ecore_timer_del(transit->timer);
+
    //cut off the chain transit relationship
    EINA_LIST_FOREACH_SAFE(transit->next_chain_transits, elist, elist_next, chain_transit)
      chain_transit->prev_chain_transit = NULL;
@@ -460,6 +463,17 @@ _recover_image_uv(Evas_Object *obj, Evas_Map *map, Eina_Bool revert, Eina_Bool b
    return EINA_TRUE;
 }
 
+static Eina_Bool
+_transit_go_in_cb(void *data)
+{
+   Elm_Transit *transit = data;
+
+   transit->timer = NULL;
+   elm_transit_go(transit);
+
+   return ECORE_CALLBACK_CANCEL;
+}
+
 EAPI Elm_Transit *
 elm_transit_add(void)
 {
@@ -724,6 +738,8 @@ elm_transit_go(Elm_Transit *transit)
 {
    ELM_TRANSIT_CHECK_OR_RETURN(transit);
 
+   ELM_SAFE_FREE(transit->timer, ecore_timer_del);
+
    Eina_List *elist;
    Evas_Object *obj;
 
@@ -747,6 +763,15 @@ elm_transit_go(Elm_Transit *transit)
 }
 
 EAPI void
+elm_transit_go_in(Elm_Transit *transit, double in)
+{
+   ELM_TRANSIT_CHECK_OR_RETURN(transit);
+
+   if (transit->timer) ecore_timer_del(transit->timer);
+   transit->timer = ecore_timer_add(in, _transit_go_in_cb, transit);
+}
+
+EAPI void
 elm_transit_paused_set(Elm_Transit *transit, Eina_Bool paused)
 {
    ELM_TRANSIT_CHECK_OR_RETURN(transit);
index a99bc87..cce70d7 100644 (file)
@@ -579,6 +579,19 @@ EAPI double                 elm_transit_duration_get(const Elm_Transit *transit)
 EAPI void                   elm_transit_go(Elm_Transit *transit);
 
 /**
+ * Starts the transition in given seconds.
+ *
+ * @note @p transit can not be NULL
+ *
+ * @param transit The transit object.
+ * @param in The interval value in seconds
+ *
+ * @since 1.14
+ * @ingroup Transit
+ */
+EAPI void                   elm_transit_go_in(Elm_Transit *transit, double in);
+
+/**
  * Pause/Resume the transition.
  *
  * If you call elm_transit_go again, the transit will be started from the