clock: add elm_clock_pause_set and elm_clock_pause_get functions 58/15558/3
authorMichal Jagiello <m.jagiello@samsung.com>
Wed, 22 Jan 2014 13:39:08 +0000 (14:39 +0100)
committerPhilippe Coval <philippe.coval@open.eurogiciel.org>
Tue, 15 Apr 2014 13:23:08 +0000 (06:23 -0700)
With this patch it is possible to pause the clock widget without set an editable mode.

Change-Id: I15bd405e288af587b51f4bfb2385c347aa2420a1
Signed-off-by: Michal Jagiello <m.jagiello@samsung.com>
src/lib/elm_clock.c
src/lib/elm_clock.h
src/lib/elm_widget_clock.h

index 3796cce..63a9f18 100644 (file)
@@ -672,3 +672,31 @@ elm_clock_first_interval_get(const Evas_Object *obj)
 
    return sd->first_interval;
 }
+
+EAPI void
+elm_clock_pause_set(Evas_Object *obj, Eina_Bool paused)
+{
+   ELM_CLOCK_CHECK(obj);
+   ELM_CLOCK_DATA_GET(obj, sd);
+
+   paused = !!paused;
+   if (sd->paused == paused)
+     return;
+   sd->paused = paused;
+   if (paused)
+     ecore_timer_freeze(sd->ticker);
+   else
+     {
+        _timediff_set(sd);
+        ecore_timer_thaw(sd->ticker);
+     }
+}
+
+EAPI Eina_Bool
+elm_clock_pause_get(const Evas_Object *obj)
+{
+   ELM_CLOCK_CHECK(obj) EINA_FALSE;
+   ELM_CLOCK_DATA_GET(obj, sd);
+
+   return sd->paused;
+}
index a085d4b..7887b31 100644 (file)
@@ -306,5 +306,33 @@ EAPI void              elm_clock_first_interval_set(Evas_Object *obj, double int
 EAPI double            elm_clock_first_interval_get(const Evas_Object *obj);
 
 /**
+ * Set whether the given clock widget should be paused or not.
+ *
+ * @param obj The clock object
+ * @param pause @c EINA_TRUE to pause clock, @c EINA_FALSE otherwise
+ *
+ * This function pauses or starts the clock widget.
+ *
+ * @see elm_clock_pause_get()
+ *
+ * @ingroup Clock
+ */
+EAPI void              elm_clock_pause_set(Evas_Object *obj, Eina_Bool pause);
+
+/**
+ * Get whether the given clock widget is paused.
+ *
+ * @param obj The clock object
+ * @return @c EINA_TRUE if it's paused @c EINA_FALSE otherwise
+ *
+ * This function gets whether the clock is paused or not.
+ *
+ * @see elm_clock_pause_set()
+ *
+ * @ingroup Clock
+ */
+EAPI Eina_Bool         elm_clock_pause_get(const Evas_Object *obj);
+
+/**
  * @}
  */
index 54f043c..715948b 100644 (file)
@@ -146,6 +146,7 @@ struct _Elm_Clock_Smart_Data
       Eina_Bool           edit : 1;
    } cur;
 
+   Eina_Bool paused : 1; /**< a flag whether clock is paused or not */
    Eina_Bool seconds : 1;
    Eina_Bool am_pm : 1;
    Eina_Bool edit : 1;