From d04ff8d69ba49ff2ba22917a9b4e131525d4da51 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Thu, 30 Jun 2016 14:23:42 +0900 Subject: [PATCH] evas object: Move display_mode to Efl.Gfx.Size.Hint --- src/lib/efl/interfaces/efl_gfx_size_hint.eo | 17 ++++++++++++++++- src/lib/efl/interfaces/efl_gfx_types.eot | 11 +++++++++++ src/lib/elementary/elm_widget.eo | 2 +- src/lib/evas/Evas_Common.h | 7 +++++++ src/lib/evas/Evas_Legacy.h | 25 +++++++++++++++++++++++++ src/lib/evas/canvas/efl_canvas_object.eo | 24 ++---------------------- src/lib/evas/canvas/evas_object_main.c | 16 ++++++++++++++-- src/lib/evas/canvas/evas_types.eot | 10 ---------- 8 files changed, 76 insertions(+), 36 deletions(-) diff --git a/src/lib/efl/interfaces/efl_gfx_size_hint.eo b/src/lib/efl/interfaces/efl_gfx_size_hint.eo index 88cc3b0..2363479 100644 --- a/src/lib/efl/interfaces/efl_gfx_size_hint.eo +++ b/src/lib/efl/interfaces/efl_gfx_size_hint.eo @@ -244,7 +244,22 @@ interface Efl.Gfx.Size.Hint #EVAS_HINT_FILL, to use as vertical alignment hint.]] } } - /* FIXME: Also add hint_display_mode? */ + @property hint_display_mode { + [[A hint for an object's display mode. + + These are hints on the display mode $obj. This is not a size + enforcement in any way, it's just a hint that can be used + whenever appropriate. This mode can be used object's display + mode like commpress or expand. + + This is not a size enforcement in any way, it's just a hint + that can be used whenever appropriate. Very few widgets implement + support for this hint for now. + ]] + values { + dispmode: Efl.Gfx.Size.Hint.Mode; [[Display mode hint.]] + } + } } events { change,size,hints; [[Object size hints changed.]] diff --git a/src/lib/efl/interfaces/efl_gfx_types.eot b/src/lib/efl/interfaces/efl_gfx_types.eot index 3a70a62..04a7e93 100644 --- a/src/lib/efl/interfaces/efl_gfx_types.eot +++ b/src/lib/efl/interfaces/efl_gfx_types.eot @@ -188,3 +188,14 @@ enum Efl.Image.Load.Error corrupt_file = 5, [[File corrupt (but was detected as a known format)]] unknown_format = 6 [[File is not a known format]] } + +enum Efl.Gfx.Size.Hint.Mode { + [[Display mode size hint.]] + none = 0, [[Default mode]] + compress = 1, [[Use this mode when you want to give compress display mode + hint to an object]] + expand = 2, [[Use this mode when you want to give expand display mode hint + to an object]] + dont_change = 3 [[Use this mode when an object should not change its display + mode]] +} diff --git a/src/lib/elementary/elm_widget.eo b/src/lib/elementary/elm_widget.eo index 423aea3..57c5674 100644 --- a/src/lib/elementary/elm_widget.eo +++ b/src/lib/elementary/elm_widget.eo @@ -278,7 +278,7 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible, Elm.Inter set { } values { - dispmode: Evas.Display_Mode; + dispmode: Efl.Gfx.Size.Hint.Mode; } } @property on_show_region_hook { diff --git a/src/lib/evas/Evas_Common.h b/src/lib/evas/Evas_Common.h index 07b7517..46b9f56 100644 --- a/src/lib/evas/Evas_Common.h +++ b/src/lib/evas/Evas_Common.h @@ -364,6 +364,13 @@ typedef Efl_Gfx_Size_Hint_Aspect Evas_Aspect_Control; /**< Aspect type #define EVAS_ASPECT_CONTROL_VERTICAL EFL_GFX_SIZE_HINT_ASPECT_VERTICAL #define EVAS_ASPECT_CONTROL_BOTH EFL_GFX_SIZE_HINT_ASPECT_BOTH +typedef Efl_Gfx_Size_Hint_Mode Evas_Display_Mode; + +#define EVAS_DISPLAY_MODE_NONE EFL_GFX_SIZE_HINT_MODE_NONE +#define EVAS_DISPLAY_MODE_COMPRESS EFL_GFX_SIZE_HINT_MODE_COMPRESS +#define EVAS_DISPLAY_MODE_EXPAND EFL_GFX_SIZE_HINT_MODE_EXPAND +#define EVAS_DISPLAY_MODE_DONT_CHANGE EFL_GFX_SIZE_HINT_MODE_DONT_CHANGE + typedef Efl_Text_Bidirectional_Type Evas_BiDi_Direction; #define EVAS_BIDI_DIRECTION_NATURAL EFL_TEXT_BIDIRECTIONAL_TYPE_NATURAL diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h index 982a29b..052406e 100644 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h @@ -1210,6 +1210,31 @@ EAPI void evas_object_size_hint_aspect_set(Evas_Object *obj, Evas_Aspect_Control EAPI void evas_object_size_hint_aspect_get(const Evas_Object *obj, Evas_Aspect_Control *aspect, Evas_Coord *w, Evas_Coord *h); /** + * @brief Sets the hints for an object's disply mode, + * + * This is not a size enforcement in any way, it's just a hint that can be used + * whenever appropriate. + * + * @param[in] dispmode Display mode hint. + * + * @ingroup Evas_Object + */ +EAPI void evas_object_size_hint_display_mode_set(Evas_Object *obj, Evas_Display_Mode dispmode); + +/** + * @brief Retrieves the hints for an object's display mode + * + * These are hints on the display mode @c obj. This is not a size enforcement + * in any way, it's just a hint that can be used whenever appropriate. This + * mode can be used object's display mode like commpress or expand. + * + * @return Display mode hint. + * + * @ingroup Evas_Objects + */ +EAPI Evas_Display_Mode evas_object_size_hint_display_mode_get(const Evas_Object *obj); + +/** * * Sets the layer of its canvas that the given object will be part of. * diff --git a/src/lib/evas/canvas/efl_canvas_object.eo b/src/lib/evas/canvas/efl_canvas_object.eo index 90d3c34..61a5ecd 100644 --- a/src/lib/evas/canvas/efl_canvas_object.eo +++ b/src/lib/evas/canvas/efl_canvas_object.eo @@ -404,28 +404,6 @@ abstract Efl.Canvas.Object (Eo.Base, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator, parent: Efl.Canvas.Object; [[The parent smart object of $obj or $null.]] } } - /* FIXME: is this really necessary? */ - @property size_hint_display_mode { - get { - [[Retrieves the hints for an object's display mode - - These are hints on the display mode $obj. This is not a size - enforcement in any way, it's just a hint that can be used - whenever appropriate. This mode can be used object's display - mode like commpress or expand. - ]] - } - set { - [[Sets the hints for an object's disply mode, - - This is not a size enforcement in any way, it's just a hint - that can be used whenever appropriate. - ]] - } - values { - dispmode: Evas.Display_Mode; [[Display mode hint.]] - } - } @property paragraph_direction { [[This handles text paragraph direction of the given object. Even if the given object is not textblock or text, its smart child @@ -603,6 +581,8 @@ abstract Efl.Canvas.Object (Eo.Base, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator, Efl.Gfx.Size.Hint.hint_align.set; Efl.Gfx.Size.Hint.hint_align.get; Efl.Gfx.Size.Hint.hint_combined_min.get; + Efl.Gfx.Size.Hint.hint_display_mode.set; + Efl.Gfx.Size.Hint.hint_display_mode.get; Efl.Gfx.Size.Hint.hint_restricted_min.set; Efl.Gfx.Size.Hint.hint_restricted_min.get; Efl.Gfx.Size.Hint.hint_min.set; diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c index 0008a23..ec5b310 100644 --- a/src/lib/evas/canvas/evas_object_main.c +++ b/src/lib/evas/canvas/evas_object_main.c @@ -1094,7 +1094,7 @@ _evas_object_size_hint_alloc(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protec } EOLIAN static Evas_Display_Mode -_efl_canvas_object_size_hint_display_mode_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj) +_efl_canvas_object_efl_gfx_size_hint_hint_display_mode_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj) { if (!obj) return EVAS_DISPLAY_MODE_NONE; if ((!obj->size_hints) || obj->delete_me) @@ -1103,7 +1103,7 @@ _efl_canvas_object_size_hint_display_mode_get(Eo *eo_obj EINA_UNUSED, Evas_Objec } EOLIAN static void -_efl_canvas_object_size_hint_display_mode_set(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Evas_Display_Mode dispmode) +_efl_canvas_object_efl_gfx_size_hint_hint_display_mode_set(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Evas_Display_Mode dispmode) { if (!obj) return; if (obj->delete_me) return; @@ -2288,4 +2288,16 @@ evas_object_evas_get(const Eo *eo_obj) return eo_provider_find((Eo *) eo_obj, EVAS_CANVAS_CLASS); } +EAPI void +evas_object_size_hint_display_mode_set(Evas_Object *obj, Evas_Display_Mode dispmode) +{ + efl_gfx_size_hint_display_mode_set(obj, dispmode); +} + +EAPI Evas_Display_Mode +evas_object_size_hint_display_mode_get(const Evas_Object *obj) +{ + return efl_gfx_size_hint_display_mode_get(obj); +} + #include "canvas/efl_canvas_object.eo.c" diff --git a/src/lib/evas/canvas/evas_types.eot b/src/lib/evas/canvas/evas_types.eot index b545f69..039eeee 100644 --- a/src/lib/evas/canvas/evas_types.eot +++ b/src/lib/evas/canvas/evas_types.eot @@ -4,16 +4,6 @@ struct @extern Evas.Video_Surface; /* FIXME: The structure is full of the unsupp type Evas.Modifier_Mask: ullong; [[An Evas modifier mask type]] type Evas.Coord: int; [[A type for coordinates]] -enum Evas.Display_Mode { - none = 0, [[Default mode]] - compress = 1, [[Use this mode when you want to give compress display mode - hint to an object]] - expand = 2, [[Use this mode when you want to give expand display mode hint - to an object]] - dont_change = 3 [[Use this mode when an object should not change its display - mode]] -} - enum Evas.Text_Style_Type { [[Types of styles to be applied on text objects. The EVAS_TEXT_STYLE_SHADOW_DIRECTION_* ones are to be ORed together with -- 2.7.4