Skip to content

Commit

Permalink
[NUI] Add internal RequestLayout and OnReqeustLayout virtual method.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
everLEEst committed Feb 6, 2025
1 parent 38a9f6d commit 322db80
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/Tizen.NUI/src/public/Layouting/LayoutItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,16 @@ public ILayoutParent GetParent()
/// </summary>
/// <since_tizen> 6 </since_tizen>
public void RequestLayout()
{
RequestLayout(this);
}

/// <summary>
/// Internal method for request that this layout is re-laid out.<br />
/// This will make this layout and all it's parent layouts dirty.<br />
/// <param name="requested">LayoutItem who request the layout.</param>
/// </summary>
internal void RequestLayout(LayoutItem requsted)
{
flags = flags | LayoutFlags.ForceLayout;
if (parent == null)
Expand All @@ -361,10 +371,10 @@ public void RequestLayout()
LayoutGroup layoutGroup = parent as LayoutGroup;
if (layoutGroup != null && !layoutGroup.LayoutRequested)
{
layoutGroup.RequestLayout();
layoutGroup.RequestLayout(this);
}
}

OnRequestLayout(requsted);
}

/// <summary>
Expand Down Expand Up @@ -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) { }

/// <summary>
/// Virtual method called when this Layout is requested layout by LayoutItem.
/// <param name="requested">LayoutItem who request the layout.</param>
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
protected virtual void OnRequestLayout(LayoutItem requested) {}

/// <summary>
/// Virtual method to allow derived classes to remove any children before it is removed from
/// its parent.
Expand Down

0 comments on commit 322db80

Please sign in to comment.