summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitor Sousa <vitorsousasilva@gmail.com>2015-02-25 15:13:36 -0300
committerVitor Sousa <vitorsousasilva@gmail.com>2015-04-10 18:54:52 -0300
commit0f8dcc0030d1029660a0352d1477808ce50088ae (patch)
tree5ae0c601ec68b82f87574b0ee4a834cc11500f46
parent3f96338dfc2ec2ed676e748a011d270d6b30420f (diff)
downloadelementary-0f8dcc0030d1029660a0352d1477808ce50088ae.tar.gz
elm_image: Solve clash on the meaning of "animated"
Both Elm_Image and its base interface Efl.Image have a property named "animated". The meaning for Efl.Image is whether or not the image has animation. On the other hand, Elm_Image use it to set whether an image, which supports animation, is to animate itself or not. Thus Elm_Image have another property (animated_available) to tell whether the image have animation or not, making it even more confusing. Renamed the "animated" property of Elm_Image to "animated_enable" to make the intended meaning clearer. Also replaced the "animated_available" property with the "animated" property from the Efl.Image interface, since both refers to the same thing, in order to reduce the API. Added implementations of the legacy methods for backward compatibility.
-rw-r--r--src/lib/elm_image.c28
-rw-r--r--src/lib/elm_image.eo23
-rw-r--r--src/lib/elm_image_legacy.h57
3 files changed, 84 insertions, 24 deletions
diff --git a/src/lib/elm_image.c b/src/lib/elm_image.c
index b0db368bb..6a40f6257 100644
--- a/src/lib/elm_image.c
+++ b/src/lib/elm_image.c
@@ -1459,16 +1459,30 @@ _elm_image_aspect_fixed_get(Eo *obj EINA_UNUSED, Elm_Image_Data *sd)
return sd->aspect_fixed;
}
+EAPI Eina_Bool
+elm_image_animated_available_get(const Evas_Object *obj)
+{
+ Eina_Bool ret;
+ eo_do(obj, ret = efl_image_animated_get());
+ return ret;
+}
+
EOLIAN static Eina_Bool
-_elm_image_animated_available_get(Eo *obj, Elm_Image_Data *sd)
+_elm_image_efl_image_animated_get(Eo *obj, Elm_Image_Data *sd)
{
if (sd->edje) return EINA_FALSE;
return evas_object_image_animated_get(elm_image_object_get(obj));
}
+EAPI void
+elm_image_animated_set(Evas_Object *obj, Eina_Bool anim)
+{
+ eo_do(obj, elm_obj_image_animated_enable_set(anim));
+}
+
EOLIAN static void
-_elm_image_animated_set(Eo *obj, Elm_Image_Data *sd, Eina_Bool anim)
+_elm_image_animated_enable_set(Eo *obj, Elm_Image_Data *sd, Eina_Bool anim)
{
anim = !!anim;
if (sd->anim == anim) return;
@@ -1502,8 +1516,16 @@ _elm_image_animated_set(Eo *obj, Elm_Image_Data *sd, Eina_Bool anim)
return;
}
+EAPI Eina_Bool
+elm_image_animated_get(const Evas_Object *obj)
+{
+ Eina_Bool ret;
+ eo_do(obj, ret = elm_obj_image_animated_enable_get());
+ return ret;
+}
+
EOLIAN static Eina_Bool
-_elm_image_animated_get(Eo *obj EINA_UNUSED, Elm_Image_Data *sd)
+_elm_image_animated_enable_get(Eo *obj EINA_UNUSED, Elm_Image_Data *sd)
{
if (sd->edje)
return edje_object_animation_get(sd->img);
diff --git a/src/lib/elm_image.eo b/src/lib/elm_image.eo
index 58b5f6ece..cbbbd1ccd 100644
--- a/src/lib/elm_image.eo
+++ b/src/lib/elm_image.eo
@@ -182,7 +182,7 @@ class Elm_Image (Elm_Widget, Efl.File, Efl.Image, Evas.Clickable_Interface,
otherwise. Default is @c EINA_FALSE. */
}
}
- animated {
+ animated_enable {
set {
/*@
Set whether an image object (which supports animation) is to
@@ -470,26 +470,6 @@ class Elm_Image (Elm_Widget, Efl.File, Efl.Image, Evas.Clickable_Interface,
image loader (eg. if @p img is a memory-mapped EET file) */
}
}
- animated_available {
- get {
- /*@
- Get whether an image object supports animation or not.
-
- @return @c EINA_TRUE if the image supports animation,
- @c EINA_FALSE otherwise.
-
- This function returns if this Elementary image object's internal
- image can be animated. Currently Evas only supports GIF
- animation. If the return value is @b EINA_FALSE, other
- @c elm_image_animated_xxx API calls won't work.
-
- @see elm_image_animated_set()
-
- @ingroup Image
- @since 1.7 */
- return: bool;
- }
- }
object {
get {
/*@
@@ -546,6 +526,7 @@ class Elm_Image (Elm_Widget, Efl.File, Efl.Image, Evas.Clickable_Interface,
Efl.Image.load_size.get;
Efl.Image.smooth_scale.set;
Efl.Image.smooth_scale.get;
+ Efl.Image.animated.get;
Edje.Object.signal_emit;
Edje.Object.size_min.get;
Edje.Object.size_max.get;
diff --git a/src/lib/elm_image_legacy.h b/src/lib/elm_image_legacy.h
index 55923c253..9ee947b89 100644
--- a/src/lib/elm_image_legacy.h
+++ b/src/lib/elm_image_legacy.h
@@ -112,4 +112,61 @@ EAPI int elm_image_prescale_get(const Evas_Object *obj);
*/
EAPI Eina_Bool elm_image_mmap_set(Evas_Object *obj, const Eina_File *file, const char *group);
+/**
+ *
+ * Set whether an image object (which supports animation) is to
+ * animate itself or not.
+ *
+ * An image object, even if it supports animation, will be displayed
+ * by default without animation. Call this function with @a animated
+ * set to @c EINA_TRUE to enable its animation. To start or stop the
+ * animation, actually, use elm_image_animated_play_set().
+ *
+ * @see elm_image_animated_get()
+ * @see elm_image_animated_available_get()
+ * @see elm_image_animated_play_set()
+ *
+ * @ingroup Image
+ * @since 1.7
+ *
+ * @param[in] anim @c EINA_TRUE if the object is to animate itself,
+ * @c EINA_FALSE otherwise. Default is @c EINA_FALSE.
+ */
+EAPI void elm_image_animated_set(Evas_Object *obj, Eina_Bool anim);
+
+/**
+ *
+ * Get whether an image object has animation enabled or not.
+ *
+ * @return @c EINA_TRUE if the image has animation enabled,
+ * @c EINA_FALSE otherwise.
+ *
+ * @see elm_image_animated_set()
+ *
+ * @ingroup Image
+ * @since 1.7
+ *
+ */
+EAPI Eina_Bool elm_image_animated_get(const Evas_Object *obj);
+
+/**
+ *
+ * Get whether an image object supports animation or not.
+ *
+ * @return @c EINA_TRUE if the image supports animation,
+ * @c EINA_FALSE otherwise.
+ *
+ * This function returns if this Elementary image object's internal
+ * image can be animated. Currently Evas only supports GIF
+ * animation. If the return value is @b EINA_FALSE, other
+ * @c elm_image_animated_xxx API calls won't work.
+ *
+ * @see elm_image_animated_set()
+ *
+ * @ingroup Image
+ * @since 1.7
+ *
+ */
+EAPI Eina_Bool elm_image_animated_available_get(const Evas_Object *obj);
+
#include "elm_image.eo.legacy.h"