Elm_photo: move api from eo to legacy.

elm_photo will be deprecated in the future.
so move all api from eo to legacy.
This commit is contained in:
Ji-Youn Park 2016-04-11 13:21:05 +08:30
parent 62841aee3c
commit 7b4c23489d
3 changed files with 144 additions and 122 deletions

View File

@ -328,70 +328,6 @@ _elm_photo_efl_file_file_set(Eo *obj, Elm_Photo_Data *sd, const char *file, cons
return EINA_TRUE;
}
EOLIAN static void
_elm_photo_size_set(Eo *obj, Elm_Photo_Data *sd, int size)
{
sd->size = (size > 0) ? size : 0;
elm_image_prescale_set(sd->icon, sd->size);
_sizing_eval(obj);
}
EOLIAN static int
_elm_photo_size_get(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd)
{
return sd->size;
}
EOLIAN static void
_elm_photo_fill_inside_set(Eo *obj, Elm_Photo_Data *sd, Eina_Bool fill)
{
elm_image_fill_outside_set(sd->icon, !fill);
sd->fill_inside = !!fill;
_sizing_eval(obj);
}
EOLIAN static Eina_Bool
_elm_photo_fill_inside_get(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd)
{
return sd->fill_inside;
}
EOLIAN static void
_elm_photo_evas_draggable_interface_drag_target_set(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, Eina_Bool set)
{
elm_image_editable_set(sd->icon, set);
}
EOLIAN static Eina_Bool
_elm_photo_evas_draggable_interface_drag_target_get(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd)
{
return elm_image_editable_get(sd->icon);
}
EOLIAN static void
_elm_photo_thumb_set(const Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, const char *file, const char *group)
{
eina_stringshare_replace(&sd->thumb.file.path, file);
eina_stringshare_replace(&sd->thumb.file.key, group);
elm_icon_thumb_set(sd->icon, file, group);
}
EOLIAN static void
_elm_photo_aspect_fixed_set(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, Eina_Bool fixed)
{
elm_image_aspect_fixed_set(sd->icon, fixed);
}
EOLIAN static Eina_Bool
_elm_photo_aspect_fixed_get(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd)
{
return elm_image_aspect_fixed_get(sd->icon);
}
static void
_elm_photo_class_constructor(Eo_Class *klass)
{
@ -408,13 +344,83 @@ elm_photo_file_set(Eo *obj, const char *file)
EAPI void
elm_photo_editable_set(Evas_Object *obj, Eina_Bool edit)
{
evas_draggable_interface_drag_target_set(obj, edit);
ELM_PHOTO_CHECK(obj);
ELM_PHOTO_DATA_GET(obj, sd);
elm_image_editable_set(sd->icon, edit);
}
EAPI Eina_Bool
elm_photo_editable_get(const Evas_Object *obj)
{
return evas_draggable_interface_drag_target_get(obj);
ELM_PHOTO_CHECK(obj) EINA_FALSE;
ELM_PHOTO_DATA_GET(obj, sd);
return elm_image_editable_get(sd->icon);
}
EAPI void
elm_photo_size_set(Evas_Object *obj, int size)
{
ELM_PHOTO_CHECK(obj);
ELM_PHOTO_DATA_GET(obj, sd);
sd->size = (size > 0) ? size : 0;
elm_image_prescale_set(sd->icon, sd->size);
_sizing_eval(obj);
}
EAPI int
elm_photo_size_get(const Evas_Object *obj)
{
ELM_PHOTO_CHECK(obj) 0;
ELM_PHOTO_DATA_GET(obj, sd);
return sd->size;
}
EAPI void
elm_photo_fill_inside_set(Evas_Object *obj, Eina_Bool fill)
{
ELM_PHOTO_CHECK(obj);
ELM_PHOTO_DATA_GET(obj, sd);
elm_image_fill_outside_set(sd->icon, !fill);
sd->fill_inside = !!fill;
_sizing_eval(obj);
}
EAPI Eina_Bool
elm_photo_fill_inside_get(const Evas_Object *obj)
{
ELM_PHOTO_CHECK(obj) EINA_FALSE;
ELM_PHOTO_DATA_GET(obj, sd);
return sd->fill_inside;
}
EAPI void
elm_photo_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed)
{
ELM_PHOTO_CHECK(obj);
ELM_PHOTO_DATA_GET(obj, sd);
elm_image_aspect_fixed_set(sd->icon, fixed);
}
EAPI Eina_Bool
elm_photo_aspect_fixed_get(const Evas_Object *obj)
{
ELM_PHOTO_CHECK(obj) EINA_FALSE;
ELM_PHOTO_DATA_GET(obj, sd);
return elm_image_aspect_fixed_get(sd->icon);
}
EAPI void
elm_photo_thumb_set(Evas_Object *obj, const char *file, const char *group)
{
ELM_PHOTO_CHECK(obj);
ELM_PHOTO_DATA_GET(obj, sd);
eina_stringshare_replace(&sd->thumb.file.path, file);
eina_stringshare_replace(&sd->thumb.file.key, group);
elm_icon_thumb_set(sd->icon, file, group);
}
#include "elm_photo.eo.c"

View File

@ -1,68 +1,12 @@
class Elm.Photo (Elm.Widget, Efl.File, Evas.Clickable_Interface, Evas.Draggable_Interface)
{
eo_prefix: elm_obj_photo;
methods {
@property fill_inside {
set {
[[Set if the photo should be completely visible or not.]]
}
get {
[[Get if the photo should be completely visible or not.]]
}
values {
fill: bool; [[Photo visibility.]]
}
}
@property aspect_fixed {
set {
[[Set whether the original aspect ratio of the photo should be kept
on resize.
The original aspect ratio (width / height) of the photo is
usually distorted to match the object's size. Enabling this
option will fix this original aspect, and the way that the
photo is fit into the object's area.
See also @.aspect_fixed.get.
]]
}
get {
[[Get if the object keeps the original aspect ratio.]]
}
values {
fixed: bool; [[$true if the photo should fix the aspect,
$false otherwise.]]
}
}
@property size {
set {
[[Set the size that will be used on the photo]]
}
get {
[[Get the size that will be used on the photo]]
}
values {
size: int; [[The size of the photo]]
}
}
thumb_set @const {
[[Set the file that will be used as thumbnail in the photo.]]
params {
@in file: const(char)* @nullable; [[The path to file that will be
used as thumbnail.]]
@in group: const(char)* @optional; [[The key used in case of an EET
file.]]
}
}
}
implements {
class.constructor;
Eo.Base.constructor;
Efl.File.file.set;
Evas.Object_Smart.add;
Evas.Object_Smart.del;
Evas.Draggable_Interface.drag_target.set;
Evas.Draggable_Interface.drag_target.get;
Elm.Widget.theme_apply;
}

View File

@ -44,4 +44,76 @@ EAPI void elm_photo_editable_set(Evas_Object *obj, Eina_Bool set);
* @ingroup Elm_Photo
*/
EAPI Eina_Bool elm_photo_editable_get(const Evas_Object *obj);
/**
* @brief Set if the photo should be completely visible or not.
*
* @param[in] fill Photo visibility.
*
* @ingroup Elm_Photo
*/
EAPI void elm_photo_fill_inside_set(Evas_Object *obj, Eina_Bool fill);
/**
* @brief Get if the photo should be completely visible or not.
*
* @return Photo visibility.
*
* @ingroup Elm_Photo
*/
EAPI Eina_Bool elm_photo_fill_inside_get(const Evas_Object *obj);
/**
* @brief Set whether the original aspect ratio of the photo should be kept on
* resize.
*
* The original aspect ratio (width / height) of the photo is usually distorted
* to match the object's size. Enabling this option will fix this original
* aspect, and the way that the photo is fit into the object's area.
*
* See also @ref elm_photo_aspect_fixed_get.
*
* @param[in] fixed @c true if the photo should fix the aspect, @c false
* otherwise.
*
* @ingroup Elm_Photo
*/
EAPI void elm_photo_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed);
/**
* @brief Get if the object keeps the original aspect ratio.
*
* @return @c true if the photo should fix the aspect, @c false otherwise.
*
* @ingroup Elm_Photo
*/
EAPI Eina_Bool elm_photo_aspect_fixed_get(const Evas_Object *obj);
/**
* @brief Set the size that will be used on the photo
*
* @param[in] size The size of the photo
*
* @ingroup Elm_Photo
*/
EAPI void elm_photo_size_set(Evas_Object *obj, int size);
/**
* @brief Get the size that will be used on the photo
*
* @return The size of the photo
*
* @ingroup Elm_Photo
*/
EAPI int elm_photo_size_get(const Evas_Object *obj);
/**
* @brief Set the file that will be used as thumbnail in the photo.
*
* @param[in] group The key used in case of an EET file.
*
* @ingroup Elm_Photo
*/
EAPI void elm_photo_thumb_set(Evas_Object *obj, const char *file, const char *group);
#include "elm_photo.eo.legacy.h"