Image: Use file interface.

This commit is contained in:
Tom Hacohen 2014-07-22 15:38:33 +01:00
parent f1440487f7
commit 4cc392ce5e
5 changed files with 32 additions and 46 deletions

View File

@ -367,7 +367,7 @@ _edje_signals_free(Elm_Icon_Data *sd)
}
EOLIAN static Eina_Bool
_elm_icon_elm_image_file_set(Eo *obj, Elm_Icon_Data *sd, const char *file, const char *key)
_elm_icon_efl_file_file_set(Eo *obj, Elm_Icon_Data *sd, const char *file, const char *key)
{
Evas_Object *pclip;
@ -383,7 +383,7 @@ _elm_icon_elm_image_file_set(Eo *obj, Elm_Icon_Data *sd, const char *file, const
if (!sd->is_video)
{
Eina_Bool int_ret = EINA_FALSE;
eo_do_super(obj, MY_CLASS, int_ret = elm_obj_image_file_set(file, key));
eo_do_super(obj, MY_CLASS, int_ret = efl_file_set(file, key));
return int_ret;
}
@ -728,7 +728,7 @@ elm_icon_file_set(Evas_Object *obj,
EINA_SAFETY_ON_NULL_RETURN_VAL(file, EINA_FALSE);
Eina_Bool ret = EINA_FALSE;
eo_do(obj, ret = elm_obj_image_file_set(file, group));
eo_do(obj, ret = efl_file_set(file, group));
return ret;
}

View File

@ -102,7 +102,7 @@ class Elm_Icon (Elm_Image)
Elm_Widget.theme_apply;
Elm_Image.memfile.set;
Elm_Image.sizing_eval;
Elm_Image.file.set;
Efl.File.file.set;
}
events {
thumb,done;

View File

@ -412,7 +412,7 @@ _elm_image_drag_n_drop_cb(void *elm_obj,
Elm_Selection_Data *drop)
{
Eina_Bool ret = EINA_FALSE;
eo_do(obj, ret = elm_obj_image_file_set(drop->data, NULL));
eo_do(obj, ret = efl_file_set(drop->data, NULL));
if (ret)
{
DBG("dnd: %s, %s, %s", elm_widget_type_get(elm_obj),
@ -751,11 +751,17 @@ elm_image_file_set(Evas_Object *obj,
ELM_IMAGE_CHECK(obj) EINA_FALSE;
EINA_SAFETY_ON_NULL_RETURN_VAL(file, EINA_FALSE);
eo_do(obj, ret = elm_obj_image_file_set(file, group));
eo_do(obj, ret = efl_file_set(file, group));
eo_do(obj, elm_obj_image_sizing_eval());
return ret;
}
EAPI void
elm_image_file_get(const Eo *obj, const char **file, const char **group)
{
eo_do((Eo *) obj, efl_file_get(file, group));
}
EAPI Eina_Bool
elm_image_mmap_set(Evas_Object *obj,
const Eina_File *file,
@ -879,7 +885,7 @@ static const char *remote_uri[] = {
};
EOLIAN static Eina_Bool
_elm_image_file_set(Eo *obj, Elm_Image_Data *sd, const char *file, const char *key)
_elm_image_efl_file_file_set(Eo *obj, Elm_Image_Data *sd, const char *file, const char *key)
{
Eina_Bool ret = EINA_FALSE;
unsigned int i;
@ -927,7 +933,7 @@ _elm_image_mmap_set(Eo *obj, Elm_Image_Data *sd, const Eina_File *f, const char
}
EOLIAN static void
_elm_image_file_get(Eo *obj EINA_UNUSED, Elm_Image_Data *sd, const char **file, const char **key)
_elm_image_efl_file_file_get(Eo *obj EINA_UNUSED, Elm_Image_Data *sd, const char **file, const char **key)
{
if (sd->edje)
edje_object_file_get(sd->img, file, key);

View File

@ -1,4 +1,4 @@
class Elm_Image (Elm_Widget, Evas.Clickable_Interface,
class Elm_Image (Elm_Widget, Efl.File, Evas.Clickable_Interface,
Elm_Interface_Atspi_Image, Elm_Interface_Atspi_Widget_Action)
{
eo_prefix: elm_obj_image;
@ -235,43 +235,6 @@ class Elm_Image (Elm_Widget, Evas.Clickable_Interface,
double scale;
}
}
file {
set {
/*@
Set the file that will be used as the image's source.
@return (@c EINA_TRUE = success, @c EINA_FALSE = error)
@see elm_image_file_get()
@note This function will trigger the Edje file case based on the
extension of the @a file string (expects @c ".edj", for this
case).
@note If you use animated gif image and create multiple image objects with
one gif image file, you should set the @p group differently for each object.
Or image objects will share one evas image cache entry and you will get
unwanted frames.
@ingroup Image */
return: bool;
legacy: null;
}
get {
/*@
Get the file that will be used as image.
@see elm_image_file_set()
@ingroup Image */
}
values {
const(char)* file; /*@ The path to file that will be used as image source */
const(char)* group; /*@ The group that the image belongs to, in case it's an
EET (including Edje case) file. This can be used as a key inside
evas image cache if this is a normal image file not eet file. */
}
}
fill_inside {
set {
/*@ No description supplied by the EAPI. */
@ -536,6 +499,8 @@ class Elm_Image (Elm_Widget, Evas.Clickable_Interface,
implements {
class.constructor;
Eo.Base.constructor;
Efl.File.file.set;
Efl.File.file.get;
Evas.Object_Smart.hide;
Evas.Object_Smart.clip.set;
Evas.Object_Smart.clip_unset;

View File

@ -36,6 +36,21 @@ EAPI Evas_Object *elm_image_add(Evas_Object *parent);
*/
EAPI Eina_Bool elm_image_file_set(Evas_Object *obj, const char *file, const char *group);
/**
*
* Get the file that will be used as image.
*
* @see elm_image_file_set()
*
* @ingroup Image
*
* @param[out] file The path to file that will be used as image source
* @param[out] group The group that the image belongs to, in case it's an
EET (including Edje case) file. This can be used as a key inside
evas image cache if this is a normal image file not eet file.
*/
EAPI void elm_image_file_get(const Eo *obj, const char **file, const char **group);
/**
* Set the prescale size for the image
*