Elm_image: remove no_scale and resizable property.

elm image add new API to deal with scale type.
if we use scale type for elm_image, we don't need to use no_scale and resizable property
This commit is contained in:
Ji-Youn Park 2016-04-11 20:03:25 +08:30
parent 7b4c23489d
commit 810ebb5db8
3 changed files with 100 additions and 59 deletions

View File

@ -1167,35 +1167,6 @@ _elm_image_efl_gfx_view_view_size_get(Eo *obj EINA_UNUSED, Elm_Image_Data *sd, i
if (h) *h = th;
}
EOLIAN static void
_elm_image_no_scale_set(Eo *obj, Elm_Image_Data *sd, Eina_Bool no_scale)
{
sd->no_scale = no_scale;
_elm_image_sizing_eval(obj);
}
EOLIAN static Eina_Bool
_elm_image_no_scale_get(Eo *obj EINA_UNUSED, Elm_Image_Data *sd)
{
return sd->no_scale;
}
EOLIAN static void
_elm_image_resizable_set(Eo *obj, Elm_Image_Data *sd, Eina_Bool up, Eina_Bool down)
{
sd->resize_up = !!up;
sd->resize_down = !!down;
_elm_image_sizing_eval(obj);
}
EOLIAN static void
_elm_image_resizable_get(Eo *obj EINA_UNUSED, Elm_Image_Data *sd, Eina_Bool *size_up, Eina_Bool *size_down)
{
if (size_up) *size_up = sd->resize_up;
if (size_down) *size_down = sd->resize_down;
}
EAPI void
elm_image_prescale_set(Evas_Object *obj,
@ -1782,4 +1753,42 @@ elm_image_sizing_eval(Evas_Object *obj)
_elm_image_sizing_eval(obj);
}
EAPI void
elm_image_no_scale_set(Evas_Object *obj, Eina_Bool no_scale)
{
ELM_IMAGE_CHECK(obj);
ELM_IMAGE_DATA_GET(obj, sd);
sd->no_scale = no_scale;
_elm_image_sizing_eval(obj);
}
EAPI Eina_Bool
elm_image_no_scale_get(const Evas_Object *obj)
{
ELM_IMAGE_CHECK(obj) EINA_FALSE;
ELM_IMAGE_DATA_GET(obj, sd);
return sd->no_scale;
}
EAPI void
elm_image_resizable_set(Evas_Object *obj, Eina_Bool up, Eina_Bool down)
{
ELM_IMAGE_CHECK(obj);
ELM_IMAGE_DATA_GET(obj, sd);
sd->resize_up = !!up;
sd->resize_down = !!down;
_elm_image_sizing_eval(obj);
}
EAPI void
elm_image_resizable_get(const Evas_Object *obj, Eina_Bool *size_up, Eina_Bool *size_down)
{
ELM_IMAGE_CHECK(obj);
ELM_IMAGE_DATA_GET(obj, sd);
if (size_up) *size_up = sd->resize_up;
if (size_down) *size_down = sd->resize_down;
}
#include "elm_image.eo.c"

View File

@ -27,21 +27,6 @@ class Elm.Image (Elm.Widget, Evas.Clickable_Interface, Evas.Draggable_Interface,
{
eo_prefix: elm_obj_image;
methods {
@property no_scale {
[[Control scaling behaviour of this object.
This function disables scaling of the elm_image widget through the
function elm_object_scale_set(). However, this does not affect the widget
size/resize in any way. For that effect, take a look at
@.resizable and @Elm.Widget.scale]]
set {
}
get {
}
values {
no_scale: bool; [[$true if the object is not scalable, $false otherwise. Default is $false.]]
}
}
@property fill_inside {
[[Control the resize method for the object's internal image when maintaining a given aspect ratio.
@ -79,21 +64,6 @@ class Elm.Image (Elm.Widget, Evas.Clickable_Interface, Evas.Draggable_Interface,
fixed: bool; [[$true if the image should retain the aspect, $false otherwise.]]
}
}
@property resizable {
[[Control if the object is (up/down) resizable.
This function limits the image resize ability. If $size_up is set to
$false, the object can't have its height or width resized to a value
higher than the original image size. Same is valid for $size_down.]]
set {
}
get {
}
values {
up: bool; [[A bool to set if the object is resizable up. Default is $true.]]
down: bool; [[A bool to set if the object is resizable down. Default is $true.]]
}
}
}
implements {
class.constructor;

View File

@ -503,4 +503,66 @@ EAPI Eina_Bool elm_image_resize_up_get(const Evas_Object *obj);
*/
EAPI void elm_image_sizing_eval(Evas_Object *obj);
/**
* @brief Control if the object is (up/down) resizable.
*
* This function limits the image resize ability. If @c size_up is set to
* @c false, the object can't have its height or width resized to a value
* higher than the original image size. Same is valid for @c size_down.
*
* @param[in] up A bool to set if the object is resizable up. Default is
* @c true.
* @param[in] down A bool to set if the object is resizable down. Default is
* @c true.
*
* @ingroup Elm_Image
*/
EAPI void elm_image_resizable_set(Evas_Object *obj, Eina_Bool up, Eina_Bool down);
/**
* @brief Control if the object is (up/down) resizable.
*
* This function limits the image resize ability. If @c size_up is set to
* @c false, the object can't have its height or width resized to a value
* higher than the original image size. Same is valid for @c size_down.
*
* @param[out] up A bool to set if the object is resizable up. Default is
* @c true.
* @param[out] down A bool to set if the object is resizable down. Default is
* @c true.
*
* @ingroup Elm_Image
*/
EAPI void elm_image_resizable_get(const Evas_Object *obj, Eina_Bool *up, Eina_Bool *down);
/**
* @brief Control scaling behaviour of this object.
*
* This function disables scaling of the elm_image widget through the function
* elm_object_scale_set(). However, this does not affect the widget size/resize
* in any way. For that effect, take a look at @ref elm_image_resizable_get and
* @ref elm_widget_scale_get
*
* @param[in] no_scale @c true if the object is not scalable, @c false
* otherwise. Default is @c false.
*
* @ingroup Elm_Image
*/
EAPI void elm_image_no_scale_set(Evas_Object *obj, Eina_Bool no_scale);
/**
* @brief Control scaling behaviour of this object.
*
* This function disables scaling of the elm_image widget through the function
* elm_object_scale_set(). However, this does not affect the widget size/resize
* in any way. For that effect, take a look at @ref elm_image_resizable_get and
* @ref elm_widget_scale_get
*
* @return @c true if the object is not scalable, @c false otherwise. Default
* is @c false.
*
* @ingroup Elm_Image
*/
EAPI Eina_Bool elm_image_no_scale_get(const Evas_Object *obj);
#include "elm_image.eo.legacy.h"