diff options
author | Ji-Youn Park <jy0703.park@samsung.com> | 2016-04-11 13:21:05 +0830 |
---|---|---|
committer | Ji-Youn Park <jy0703.park@samsung.com> | 2016-04-11 13:21:05 +0830 |
commit | 7b4c23489d134b18a937ed90eac0d964f77e98fd (patch) | |
tree | 060f68662b6115afe1cee794e12e165b67df7ec7 | |
parent | 62841aee3ce838321149b329008a54185341f9f8 (diff) | |
download | efl-7b4c23489d134b18a937ed90eac0d964f77e98fd.tar.gz |
Elm_photo: move api from eo to legacy.
elm_photo will be deprecated in the future.
so move all api from eo to legacy.
-rw-r--r-- | src/lib/elementary/elm_photo.c | 110 | ||||
-rw-r--r-- | src/lib/elementary/elm_photo.eo | 56 | ||||
-rw-r--r-- | src/lib/elementary/elm_photo_legacy.h | 72 |
3 files changed, 130 insertions, 108 deletions
diff --git a/src/lib/elementary/elm_photo.c b/src/lib/elementary/elm_photo.c index c8ffc74a93..803e07cdd6 100644 --- a/src/lib/elementary/elm_photo.c +++ b/src/lib/elementary/elm_photo.c @@ -328,93 +328,99 @@ _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) +static void +_elm_photo_class_constructor(Eo_Class *klass) { - sd->size = (size > 0) ? size : 0; - - elm_image_prescale_set(sd->icon, sd->size); - - _sizing_eval(obj); + evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass); } -EOLIAN static int -_elm_photo_size_get(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd) +EAPI Eina_Bool +elm_photo_file_set(Eo *obj, const char *file) { - return sd->size; + return efl_file_set((Eo *) obj, file, NULL); } -EOLIAN static void -_elm_photo_fill_inside_set(Eo *obj, Elm_Photo_Data *sd, Eina_Bool fill) +/* Legacy deprecated functions */ +EAPI void +elm_photo_editable_set(Evas_Object *obj, Eina_Bool edit) { - elm_image_fill_outside_set(sd->icon, !fill); - sd->fill_inside = !!fill; - - _sizing_eval(obj); + ELM_PHOTO_CHECK(obj); + ELM_PHOTO_DATA_GET(obj, sd); + elm_image_editable_set(sd->icon, edit); } -EOLIAN static Eina_Bool -_elm_photo_fill_inside_get(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd) +EAPI Eina_Bool +elm_photo_editable_get(const Evas_Object *obj) { - return sd->fill_inside; + ELM_PHOTO_CHECK(obj) EINA_FALSE; + ELM_PHOTO_DATA_GET(obj, sd); + return elm_image_editable_get(sd->icon); } -EOLIAN static void -_elm_photo_evas_draggable_interface_drag_target_set(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, Eina_Bool set) +EAPI void +elm_photo_size_set(Evas_Object *obj, int size) { - elm_image_editable_set(sd->icon, set); -} + ELM_PHOTO_CHECK(obj); + ELM_PHOTO_DATA_GET(obj, sd); + sd->size = (size > 0) ? size : 0; -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); + elm_image_prescale_set(sd->icon, sd->size); + + _sizing_eval(obj); } -EOLIAN static void -_elm_photo_thumb_set(const Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, const char *file, const char *group) +EAPI int +elm_photo_size_get(const Evas_Object *obj) { - eina_stringshare_replace(&sd->thumb.file.path, file); - eina_stringshare_replace(&sd->thumb.file.key, group); - - elm_icon_thumb_set(sd->icon, file, group); + ELM_PHOTO_CHECK(obj) 0; + ELM_PHOTO_DATA_GET(obj, sd); + return sd->size; } -EOLIAN static void -_elm_photo_aspect_fixed_set(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd, Eina_Bool fixed) +EAPI void +elm_photo_fill_inside_set(Evas_Object *obj, Eina_Bool fill) { - elm_image_aspect_fixed_set(sd->icon, fixed); + 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); } -EOLIAN static Eina_Bool -_elm_photo_aspect_fixed_get(Eo *obj EINA_UNUSED, Elm_Photo_Data *sd) +EAPI Eina_Bool +elm_photo_fill_inside_get(const Evas_Object *obj) { - return elm_image_aspect_fixed_get(sd->icon); + ELM_PHOTO_CHECK(obj) EINA_FALSE; + ELM_PHOTO_DATA_GET(obj, sd); + return sd->fill_inside; } -static void -_elm_photo_class_constructor(Eo_Class *klass) +EAPI void +elm_photo_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed) { - evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass); + ELM_PHOTO_CHECK(obj); + ELM_PHOTO_DATA_GET(obj, sd); + elm_image_aspect_fixed_set(sd->icon, fixed); } EAPI Eina_Bool -elm_photo_file_set(Eo *obj, const char *file) +elm_photo_aspect_fixed_get(const Evas_Object *obj) { - return efl_file_set((Eo *) obj, file, NULL); + ELM_PHOTO_CHECK(obj) EINA_FALSE; + ELM_PHOTO_DATA_GET(obj, sd); + return elm_image_aspect_fixed_get(sd->icon); } -/* Legacy deprecated functions */ EAPI void -elm_photo_editable_set(Evas_Object *obj, Eina_Bool edit) +elm_photo_thumb_set(Evas_Object *obj, const char *file, const char *group) { - evas_draggable_interface_drag_target_set(obj, edit); -} + 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); -EAPI Eina_Bool -elm_photo_editable_get(const Evas_Object *obj) -{ - return evas_draggable_interface_drag_target_get(obj); + elm_icon_thumb_set(sd->icon, file, group); } #include "elm_photo.eo.c" diff --git a/src/lib/elementary/elm_photo.eo b/src/lib/elementary/elm_photo.eo index 68c1faeeac..f08e8e807d 100644 --- a/src/lib/elementary/elm_photo.eo +++ b/src/lib/elementary/elm_photo.eo @@ -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; } diff --git a/src/lib/elementary/elm_photo_legacy.h b/src/lib/elementary/elm_photo_legacy.h index 116c0be2d5..36005de149 100644 --- a/src/lib/elementary/elm_photo_legacy.h +++ b/src/lib/elementary/elm_photo_legacy.h @@ -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" |