From 322db80259e0ee6145cd3bfb0b461a99f5d21ddc Mon Sep 17 00:00:00 2001 From: "everLEEst(SangHyeon Lee)" Date: Fri, 17 Jan 2025 20:16:48 +0900 Subject: [PATCH] [NUI] Add internal RequestLayout and OnReqeustLayout virtual method. When owner class modified and layout need to be changed, RequestLayout will be called, but there are no way to notify and perform specific actions on derived Layouts. Now RequestLayout intenrally pass the requester item and invoke OnRequestLayout method. Use this virtual function by overriding will solve this request. --- .../src/public/Layouting/LayoutItem.cs | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Tizen.NUI/src/public/Layouting/LayoutItem.cs b/src/Tizen.NUI/src/public/Layouting/LayoutItem.cs index b512e849d71..391269de6ad 100755 --- a/src/Tizen.NUI/src/public/Layouting/LayoutItem.cs +++ b/src/Tizen.NUI/src/public/Layouting/LayoutItem.cs @@ -346,6 +346,16 @@ public ILayoutParent GetParent() /// /// 6 public void RequestLayout() + { + RequestLayout(this); + } + + /// + /// Internal method for request that this layout is re-laid out.
+ /// This will make this layout and all it's parent layouts dirty.
+ /// LayoutItem who request the layout. + ///
+ internal void RequestLayout(LayoutItem requsted) { flags = flags | LayoutFlags.ForceLayout; if (parent == null) @@ -361,10 +371,10 @@ public void RequestLayout() LayoutGroup layoutGroup = parent as LayoutGroup; if (layoutGroup != null && !layoutGroup.LayoutRequested) { - layoutGroup.RequestLayout(); + layoutGroup.RequestLayout(this); } } - + OnRequestLayout(requsted); } /// @@ -541,6 +551,13 @@ protected virtual void OnLayout(bool changed, LayoutLength left, LayoutLength to internal virtual void OnLayoutIndependentChildren(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom) { } + /// + /// Virtual method called when this Layout is requested layout by LayoutItem. + /// LayoutItem who request the layout. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual void OnRequestLayout(LayoutItem requested) {} + /// /// Virtual method to allow derived classes to remove any children before it is removed from /// its parent.