Elm_thumb: move all api from eo to legacy

elm_thumb,elm_icon,elm_photo will be removed.
This commit is contained in:
Ji-Youn Park 2016-04-11 21:31:42 +08:30
parent 626decac68
commit 02a37da0ed
3 changed files with 436 additions and 344 deletions

View File

@ -603,16 +603,6 @@ _elm_thumb_eo_base_constructor(Eo *obj, Elm_Thumb_Data *sd)
return obj;
}
EOLIAN static void
_elm_thumb_reload(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd)
{
eina_stringshare_replace(&(sd->thumb.file), NULL);
eina_stringshare_replace(&(sd->thumb.key), NULL);
if (evas_object_visible_get(obj))
_thumb_show(sd);
}
EOLIAN static Eina_Bool
_elm_thumb_efl_file_file_set(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, const char *file, const char *key)
{
@ -663,145 +653,6 @@ _elm_thumb_efl_file_file_get(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, const char
*key = sd->key;
}
EOLIAN static void
_elm_thumb_path_get(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, const char **file, const char **key)
{
if (file)
*file = sd->thumb.file;
if (key)
*key = sd->thumb.key;
}
EOLIAN static void
_elm_thumb_aspect_set(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, Ethumb_Thumb_Aspect aspect)
{
sd->thumb.aspect = aspect;
}
EOLIAN static Ethumb_Thumb_Aspect
_elm_thumb_aspect_get(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd)
{
return sd->thumb.aspect;
}
EOLIAN static void
_elm_thumb_fdo_size_set(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, Ethumb_Thumb_FDO_Size size)
{
sd->thumb.size = size;
}
EOLIAN static Ethumb_Thumb_FDO_Size
_elm_thumb_fdo_size_get(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd)
{
return sd->thumb.size;
}
EOLIAN static void
_elm_thumb_format_set(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, Ethumb_Thumb_Format format)
{
sd->thumb.format = format;
}
EOLIAN static Ethumb_Thumb_Format
_elm_thumb_format_get(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd)
{
return sd->thumb.format;
}
EOLIAN static void
_elm_thumb_orientation_set(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, Ethumb_Thumb_Orientation orient)
{
sd->thumb.orient = orient;
}
EOLIAN static Ethumb_Thumb_Orientation
_elm_thumb_orientation_get(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd)
{
return sd->thumb.orient;
}
EOLIAN static void
_elm_thumb_size_set(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, int tw, int th)
{
sd->thumb.tw = tw;
sd->thumb.th = th;
}
EOLIAN static void
_elm_thumb_size_get(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, int *tw, int *th)
{
if (tw)
*tw = sd->thumb.tw;
if (th)
*th = sd->thumb.th;
}
EOLIAN static void
_elm_thumb_crop_align_set(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, double cropx, double cropy)
{
sd->thumb.cropx = cropx;
sd->thumb.cropy = cropy;
}
EOLIAN static void
_elm_thumb_crop_align_get(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, double *cropx, double *cropy)
{
if (cropx)
*cropx = sd->thumb.cropx;
if (cropy)
*cropy = sd->thumb.cropy;
}
EOLIAN static void
_elm_thumb_compress_set(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, int compress)
{
sd->thumb.compress = compress;
}
EOLIAN static void
_elm_thumb_compress_get(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, int *compress)
{
if (compress)
*compress = sd->thumb.compress;
}
EOLIAN static void
_elm_thumb_quality_set(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, int quality)
{
sd->thumb.quality = quality;
}
EOLIAN static void
_elm_thumb_quality_get(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, int *quality)
{
if (quality)
*quality = sd->thumb.quality;
}
EOLIAN static void
_elm_thumb_animate_set(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd, Elm_Thumb_Animation_Setting setting)
{
EINA_SAFETY_ON_TRUE_RETURN(setting >= ELM_THUMB_ANIMATION_LAST);
sd->anim_setting = setting;
if ((sd->is_video) && (sd->thumb.format == ETHUMB_THUMB_EET))
{
if (setting == ELM_THUMB_ANIMATION_LOOP)
edje_object_signal_emit(sd->view, "elm,action,animate_loop", "elm");
else if (setting == ELM_THUMB_ANIMATION_START)
edje_object_signal_emit(sd->view, "elm,action,animate", "elm");
else if (setting == ELM_THUMB_ANIMATION_STOP)
edje_object_signal_emit(sd->view, "elm,action,animate_stop", "elm");
}
}
EOLIAN static Elm_Thumb_Animation_Setting
_elm_thumb_animate_get(Eo *obj EINA_UNUSED, Elm_Thumb_Data *sd)
{
return sd->anim_setting;
}
EAPI void *
elm_thumb_ethumb_client_get(void)
{
@ -875,4 +726,193 @@ elm_thumb_editable_get(const Evas_Object *obj)
return evas_draggable_interface_drag_target_get(obj);
}
EAPI void
elm_thumb_aspect_set(Evas_Object *obj, Ethumb_Thumb_Aspect aspect)
{
ELM_THUMB_CHECK(obj);
ELM_THUMB_DATA_GET(obj, sd);
sd->thumb.aspect = aspect;
}
EAPI Ethumb_Thumb_Aspect
elm_thumb_aspect_get(const Evas_Object *obj)
{
ELM_THUMB_CHECK(obj) ETHUMB_THUMB_KEEP_ASPECT;
ELM_THUMB_DATA_GET(obj, sd);
return sd->thumb.aspect;
}
EAPI void
elm_thumb_fdo_size_set(Evas_Object *obj, Ethumb_Thumb_FDO_Size size)
{
ELM_THUMB_CHECK(obj);
ELM_THUMB_DATA_GET(obj, sd);
sd->thumb.size = size;
}
EAPI Ethumb_Thumb_FDO_Size
elm_thumb_fdo_size_get(const Evas_Object *obj)
{
ELM_THUMB_CHECK(obj) ETHUMB_THUMB_NORMAL;
ELM_THUMB_DATA_GET(obj, sd);
return sd->thumb.size;
}
EAPI void
elm_thumb_format_set(Evas_Object *obj, Ethumb_Thumb_Format format)
{
ELM_THUMB_CHECK(obj);
ELM_THUMB_DATA_GET(obj, sd);
sd->thumb.format = format;
}
EAPI Ethumb_Thumb_Format
elm_thumb_format_get(const Evas_Object *obj)
{
ELM_THUMB_CHECK(obj) ETHUMB_THUMB_FDO;
ELM_THUMB_DATA_GET(obj, sd);
return sd->thumb.format;
}
EAPI void
elm_thumb_orientation_set(Evas_Object *obj, Ethumb_Thumb_Orientation orient)
{
ELM_THUMB_CHECK(obj);
ELM_THUMB_DATA_GET(obj, sd);
sd->thumb.orient = orient;
}
EAPI Ethumb_Thumb_Orientation
elm_thumb_orientation_get(const Evas_Object *obj)
{
ELM_THUMB_CHECK(obj) ETHUMB_THUMB_ORIENT_NONE;
ELM_THUMB_DATA_GET(obj, sd);
return sd->thumb.orient;
}
EAPI void
elm_thumb_size_set(Evas_Object *obj, int tw, int th)
{
ELM_THUMB_CHECK(obj);
ELM_THUMB_DATA_GET(obj, sd);
sd->thumb.tw = tw;
sd->thumb.th = th;
}
EAPI void
elm_thumb_size_get(const Evas_Object *obj, int *tw, int *th)
{
ELM_THUMB_CHECK(obj);
ELM_THUMB_DATA_GET(obj, sd);
if (tw)
*tw = sd->thumb.tw;
if (th)
*th = sd->thumb.th;
}
EAPI void
elm_thumb_crop_align_set(Evas_Object *obj, double cropx, double cropy)
{
ELM_THUMB_CHECK(obj);
ELM_THUMB_DATA_GET(obj, sd);
sd->thumb.cropx = cropx;
sd->thumb.cropy = cropy;
}
EAPI void
elm_thumb_crop_align_get(const Evas_Object *obj, double *cropx, double *cropy)
{
ELM_THUMB_CHECK(obj);
ELM_THUMB_DATA_GET(obj, sd);
if (cropx)
*cropx = sd->thumb.cropx;
if (cropy)
*cropy = sd->thumb.cropy;
}
EAPI void
elm_thumb_compress_set(Evas_Object *obj, int compress)
{
ELM_THUMB_CHECK(obj);
ELM_THUMB_DATA_GET(obj, sd);
sd->thumb.compress = compress;
}
EAPI void
elm_thumb_compress_get(const Evas_Object *obj, int *compress)
{
ELM_THUMB_CHECK(obj);
ELM_THUMB_DATA_GET(obj, sd);
if (compress)
*compress = sd->thumb.compress;
}
EAPI void
elm_thumb_quality_set(Evas_Object *obj, int quality)
{
ELM_THUMB_CHECK(obj);
ELM_THUMB_DATA_GET(obj, sd);
sd->thumb.quality = quality;
}
EAPI void
elm_thumb_quality_get(const Evas_Object *obj, int *quality)
{
ELM_THUMB_CHECK(obj);
ELM_THUMB_DATA_GET(obj, sd);
if (quality)
*quality = sd->thumb.quality;
}
EAPI void
elm_thumb_animate_set(Evas_Object *obj, Elm_Thumb_Animation_Setting setting)
{
ELM_THUMB_CHECK(obj);
ELM_THUMB_DATA_GET(obj, sd);
EINA_SAFETY_ON_TRUE_RETURN(setting >= ELM_THUMB_ANIMATION_LAST);
sd->anim_setting = setting;
if ((sd->is_video) && (sd->thumb.format == ETHUMB_THUMB_EET))
{
if (setting == ELM_THUMB_ANIMATION_LOOP)
edje_object_signal_emit(sd->view, "elm,action,animate_loop", "elm");
else if (setting == ELM_THUMB_ANIMATION_START)
edje_object_signal_emit(sd->view, "elm,action,animate", "elm");
else if (setting == ELM_THUMB_ANIMATION_STOP)
edje_object_signal_emit(sd->view, "elm,action,animate_stop", "elm");
}
}
EAPI Elm_Thumb_Animation_Setting
elm_thumb_animate_get(const Evas_Object *obj)
{
ELM_THUMB_CHECK(obj) 0;
ELM_THUMB_DATA_GET(obj, sd);
return sd->anim_setting;
}
EAPI void
elm_thumb_path_get(const Evas_Object *obj, const char **file, const char **key)
{
ELM_THUMB_CHECK(obj);
ELM_THUMB_DATA_GET(obj, sd);
if (file)
*file = sd->thumb.file;
if (key)
*key = sd->thumb.key;
}
EAPI void
elm_thumb_reload(Evas_Object *obj)
{
ELM_THUMB_CHECK(obj);
ELM_THUMB_DATA_GET(obj, sd);
eina_stringshare_replace(&(sd->thumb.file), NULL);
eina_stringshare_replace(&(sd->thumb.key), NULL);
if (evas_object_visible_get(obj))
_thumb_show(sd);
}
#include "elm_thumb.eo.c"

View File

@ -1,203 +1,8 @@
enum Elm.Thumb.Animation_Setting
{
[[Used to set if a video thumbnail is animating or not]]
legacy: elm_thumb_animation;
start = 0, [[Play animation once]]
loop, [[Keep playing animation until stop is requested]]
stop, [[Stop playing the animation]]
last
}
class Elm.Thumb (Elm.Layout, Efl.File, Evas.Clickable_Interface,
Evas.Draggable_Interface)
{
eo_prefix: elm_obj_thumb;
methods {
@property compress {
set {
[[Set the compression for the thumb object.
@since 1.8
]]
}
get {
[[Get the compression of the thumb object.
@since 1.8
]]
return: void; [[Force the return type to be sure the argument
doesn't become the return]]
}
values {
compress: int; [[The compression of the thumb.]]
}
}
@property format {
set {
[[Set the format for the thumb object.
@since 1.8
]]
}
get {
[[Get the format of the thumb object.
@since 1.8
]]
}
values {
format: Ethumb_Thumb_Format; [[The format setting.]]
}
}
@property animate {
set {
[[Set the animation state for the thumb object.
If its content is an animated video, you may start/stop the
animation or tell it o play continuously and looping.
]]
}
get {
[[Get the animation state for the thumb object.]]
}
values {
setting: Elm.Thumb.Animation_Setting; [[The animation setting or
#ELM_THUMB_ANIMATION_LAST]]
}
}
@property fdo_size {
set {
[[Set the FDO size for the thumb object.
@since 1.8
]]
}
get {
[[Get the fdo size of the thumb object.
@since 1.8
]]
}
values {
size: Ethumb_Thumb_FDO_Size; [[The FDO size setting.]]
}
}
@property orientation {
set {
[[Set the orientation for the thumb object.
@since 1.8
]]
}
get {
[[Get the orientation of the thumb object.
@since 1.8
]]
}
values {
orient: Ethumb_Thumb_Orientation; [[The orientation setting.]]
}
}
@property aspect {
set {
[[Set the aspect for the thumb object.
@since 1.8
]]
}
get {
[[Get the aspect of the thumb object.
@since 1.8
]]
}
values {
aspect: Ethumb_Thumb_Aspect; [[The aspect setting.]]
}
}
@property quality {
set {
[[Set the quality for the thumb object.
@since 1.8
]]
}
get {
[[Get the quality of the thumb object.
@since 1.8
]]
return: void;
}
values {
quality: int; [[The quality of the thumb.]]
}
}
@property size {
set {
[[Set the size for the thumb object.
@since 1.8
]]
}
get {
[[Get the size of the thumb object.
@since 1.8
]]
}
values {
tw: int; [[The width of the thumb.]]
th: int; [[The height of the thumb.]]
}
}
@property crop_align {
set {
[[Set the crop alignment for the thumb object.
@since 1.8
]]
}
get {
[[Get the crop alignment of the thumb object.
@since 1.8
]]
}
values {
cropx: double; [[The x coordinate of the crop.]]
cropy: double; [[The y coordinate of the crop.]]
}
}
@property path {
get {
[[Get the path and key to the image or video thumbnail generated
by ethumb.
One just needs to make sure that the thumbnail was generated
before getting its path; otherwise, the path will be $null.
One way to do that is by asking for the path when/after the
"generate,stop" smart callback is called.
]]
}
values {
file: const(char)* @optional; [[Pointer to thumb path.]]
key: const(char)* @optional; [[Pointer to thumb key.]]
}
}
reload {
[[Reload thumbnail if it was generated before.
This is useful if the ethumb client configuration changed, like its
size, aspect or any other property one set in the handle returned
by elm_thumb_ethumb_client_get().
If the options didn't change, the thumbnail won't be generated
again, but the old one will still be used.
]]
}
}
implements {
class.constructor;
Eo.Base.constructor;

View File

@ -1,3 +1,16 @@
/** Used to set if a video thumbnail is animating or not
*
* @ingroup Elm_Thumb
*/
typedef enum
{
ELM_THUMB_ANIMATION_START = 0, /** Play animation once */
ELM_THUMB_ANIMATION_LOOP, /** Keep playing animation until stop is requested
*/
ELM_THUMB_ANIMATION_STOP, /** Stop playing the animation */
ELM_THUMB_ANIMATION_LAST
} Elm_Thumb_Animation_Setting;
/**
* Add a new thumb object to the parent.
*
@ -67,4 +80,238 @@ EAPI Eina_Bool elm_thumb_editable_set(Evas_Object *obj, Eina_Bool edit);
* @ingroup Elm_Thumb
*/
EAPI Eina_Bool elm_thumb_editable_get(const Evas_Object *obj);
/**
* @brief Set the compression for the thumb object.
*
* @param[in] compress The compression of the thumb.
*
* @since 1.8
*
* @ingroup Elm_Thumb
*/
EAPI void elm_thumb_compress_set(Evas_Object *obj, int compress);
/**
* @brief Get the compression of the thumb object.
*
* @param[out] compress The compression of the thumb.
*
* @return Force the return type to be sure the argument doesn't become the
* return
*
* @since 1.8
*
* @ingroup Elm_Thumb
*/
EAPI void elm_thumb_compress_get(const Evas_Object *obj, int *compress);
/**
* @brief Set the format for the thumb object.
*
* @param[in] format The format setting.
*
* @since 1.8
*
* @ingroup Elm_Thumb
*/
EAPI void elm_thumb_format_set(Evas_Object *obj, Ethumb_Thumb_Format format);
/**
* @brief Get the format of the thumb object.
*
* @return The format setting.
*
* @since 1.8
*
* @ingroup Elm_Thumb
*/
EAPI Ethumb_Thumb_Format elm_thumb_format_get(const Evas_Object *obj);
/**
* @brief Set the animation state for the thumb object.
*
* If its content is an animated video, you may start/stop the animation or
* tell it o play continuously and looping.
*
* @param[in] setting The animation setting or #ELM_THUMB_ANIMATION_LAST
*
* @ingroup Elm_Thumb
*/
EAPI void elm_thumb_animate_set(Evas_Object *obj, Elm_Thumb_Animation_Setting setting);
/**
* @brief Get the animation state for the thumb object.
*
* @return The animation setting or #ELM_THUMB_ANIMATION_LAST
*
* @ingroup Elm_Thumb
*/
EAPI Elm_Thumb_Animation_Setting elm_thumb_animate_get(const Evas_Object *obj);
/**
* @brief Set the FDO size for the thumb object.
*
* @param[in] size The FDO size setting.
*
* @since 1.8
*
* @ingroup Elm_Thumb
*/
EAPI void elm_thumb_fdo_size_set(Evas_Object *obj, Ethumb_Thumb_FDO_Size size);
/**
* @brief Get the fdo size of the thumb object.
*
* @return The FDO size setting.
*
* @since 1.8
*
* @ingroup Elm_Thumb
*/
EAPI Ethumb_Thumb_FDO_Size elm_thumb_fdo_size_get(const Evas_Object *obj);
/**
* @brief Set the orientation for the thumb object.
*
* @param[in] orient The orientation setting.
*
* @since 1.8
*
* @ingroup Elm_Thumb
*/
EAPI void elm_thumb_orientation_set(Evas_Object *obj, Ethumb_Thumb_Orientation orient);
/**
* @brief Get the orientation of the thumb object.
*
* @return The orientation setting.
*
* @since 1.8
*
* @ingroup Elm_Thumb
*/
EAPI Ethumb_Thumb_Orientation elm_thumb_orientation_get(const Evas_Object *obj);
/**
* @brief Set the aspect for the thumb object.
*
* @param[in] aspect The aspect setting.
*
* @since 1.8
*
* @ingroup Elm_Thumb
*/
EAPI void elm_thumb_aspect_set(Evas_Object *obj, Ethumb_Thumb_Aspect aspect);
/**
* @brief Get the aspect of the thumb object.
*
* @return The aspect setting.
*
* @since 1.8
*
* @ingroup Elm_Thumb
*/
EAPI Ethumb_Thumb_Aspect elm_thumb_aspect_get(const Evas_Object *obj);
/**
* @brief Set the quality for the thumb object.
*
* @param[in] quality The quality of the thumb.
*
* @since 1.8
*
* @ingroup Elm_Thumb
*/
EAPI void elm_thumb_quality_set(Evas_Object *obj, int quality);
/**
* @brief Get the quality of the thumb object.
*
* @param[out] quality The quality of the thumb.
*
* @since 1.8
*
* @ingroup Elm_Thumb
*/
EAPI void elm_thumb_quality_get(const Evas_Object *obj, int *quality);
/**
* @brief Set the size for the thumb object.
*
* @param[in] tw The width of the thumb.
* @param[in] th The height of the thumb.
*
* @since 1.8
*
* @ingroup Elm_Thumb
*/
EAPI void elm_thumb_size_set(Evas_Object *obj, int tw, int th);
/**
* @brief Get the size of the thumb object.
*
* @param[out] tw The width of the thumb.
* @param[out] th The height of the thumb.
*
* @since 1.8
*
* @ingroup Elm_Thumb
*/
EAPI void elm_thumb_size_get(const Evas_Object *obj, int *tw, int *th);
/**
* @brief Set the crop alignment for the thumb object.
*
* @param[in] cropx The x coordinate of the crop.
* @param[in] cropy The y coordinate of the crop.
*
* @since 1.8
*
* @ingroup Elm_Thumb
*/
EAPI void elm_thumb_crop_align_set(Evas_Object *obj, double cropx, double cropy);
/**
* @brief Get the crop alignment of the thumb object.
*
* @param[out] cropx The x coordinate of the crop.
* @param[out] cropy The y coordinate of the crop.
*
* @since 1.8
*
* @ingroup Elm_Thumb
*/
EAPI void elm_thumb_crop_align_get(const Evas_Object *obj, double *cropx, double *cropy);
/**
* @brief Get the path and key to the image or video thumbnail generated by
* ethumb.
*
* One just needs to make sure that the thumbnail was generated before getting
* its path; otherwise, the path will be @c null. One way to do that is by
* asking for the path when/after the "generate,stop" smart callback is called.
*
* @param[out] file Pointer to thumb path.
* @param[out] key Pointer to thumb key.
*
* @ingroup Elm_Thumb
*/
EAPI void elm_thumb_path_get(const Evas_Object *obj, const char **file, const char **key);
/**
* @brief Reload thumbnail if it was generated before.
*
* This is useful if the ethumb client configuration changed, like its size,
* aspect or any other property one set in the handle returned by
* elm_thumb_ethumb_client_get().
*
* If the options didn't change, the thumbnail won't be generated again, but
* the old one will still be used.
*
* @ingroup Elm_Thumb
*/
EAPI void elm_thumb_reload(Evas_Object *obj);
#include "elm_thumb.eo.legacy.h"