From 76088133dca88d89718791fc3caccc7ef694fa40 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Tue, 8 Aug 2017 20:37:41 +0900 Subject: [PATCH] naviframe: Override resize_object_set This is a first step into allowing me to removing the sub_obj argument. Make elm_widget resize_object a protected property. See also D265 Ref T5363 --- src/lib/elementary/elc_naviframe.c | 20 ++++++++++++++++++++ src/lib/elementary/elm_naviframe.eo | 1 + src/lib/elementary/elm_widget.eo | 26 +++++++++++++++++--------- 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/src/lib/elementary/elc_naviframe.c b/src/lib/elementary/elc_naviframe.c index 3cc642ad31..7e518cf959 100644 --- a/src/lib/elementary/elc_naviframe.c +++ b/src/lib/elementary/elc_naviframe.c @@ -5,6 +5,7 @@ #define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED #define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED #define ELM_WIDGET_ITEM_PROTECTED +#define ELM_WIDGET_PROTECTED #include #include "elm_priv.h" @@ -57,6 +58,25 @@ static const Elm_Action key_actions[] = { {NULL, NULL} }; +EOLIAN static void +_elm_naviframe_elm_widget_resize_object_set(Eo *obj, Elm_Naviframe_Data *pd EINA_UNUSED, + Efl_Canvas_Object *sobj, Eina_Bool sub_obj) +{ + if (!sobj || !efl_finalized_get(obj)) goto super; + EINA_SAFETY_ON_TRUE_RETURN(sub_obj); + ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); + + if (wd->resize_obj == sobj) return; + + // Detach the previous page as resize object to avoid any modifications to + // it by the widget implementation. This preserves clip, smart membership, + // focus, etc... + wd->resize_obj = NULL; + +super: + elm_obj_widget_resize_object_set(efl_super(obj, MY_CLASS), sobj, EINA_TRUE); +} + static void _resize_object_reset(Evas_Object *obj, Elm_Naviframe_Item_Data *it) { diff --git a/src/lib/elementary/elm_naviframe.eo b/src/lib/elementary/elm_naviframe.eo index 811be7d39d..18974b2749 100644 --- a/src/lib/elementary/elm_naviframe.eo +++ b/src/lib/elementary/elm_naviframe.eo @@ -154,6 +154,7 @@ class Elm.Naviframe (Efl.Ui.Layout, Elm.Interface.Atspi_Widget_Action) Elm.Widget.widget_event; Efl.Canvas.Layout_Signal.signal_emit; Elm.Interface.Atspi_Widget_Action.elm_actions { get; } + Elm.Widget.resize_object { set; } Efl.Part.part; } events { diff --git a/src/lib/elementary/elm_widget.eo b/src/lib/elementary/elm_widget.eo index cb7e25b8f8..45aa9c0b37 100644 --- a/src/lib/elementary/elm_widget.eo +++ b/src/lib/elementary/elm_widget.eo @@ -39,6 +39,23 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible, event_prefix: elm_widget; data: Elm_Widget_Smart_Data; methods { + @property resize_object @protected { + [[This is the internal canvas object managed by a widget. + + This property is protected as it is meant for widget implementations + only, to set and access the internal canvas object. Do use this + function unless you're implementing a widget. + ]] + set { + [[Sets the new resize object for this widget.]] + } + values { + sobj: Efl.Canvas.Object @nullable; + [[A canvas object (often a $Efl.Canvas.Layout object).]] + sub_obj: bool; [[$true if sub object exists, $false otherwise]] + } + } + @property focus { [[Focus property]] values { @@ -241,15 +258,6 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible, rotation: int; [[Orientation]] } } - @property resize_object { - [[Resize object property]] - set { - } - values { - sobj: Efl.Canvas.Object @nullable; [[Object]] - sub_obj: bool; [[$true if sub object exists, $false otherwise]] - } - } @property domain_translatable_part_text { [[Domain translatable text part property]] set {