Class UiLayouter
Generic tools and utilities for layouting ILayoutItem objects for automatic positioning and sizing. For the recommended ui system implementation that uses this layouter, see UiSystem and specifically Element.
public static class UiLayouter
- Inheritance
-
UiLayouter
- Inherited Members
Methods
GetChildren<T>(ILayoutItem, Func<T, bool>, bool, bool)
Returns all of the given layout item's children of the given type that match the given condition. Optionally, the entire tree of children (grandchildren) can be searched.
public static IEnumerable<T> GetChildren<T>(ILayoutItem item, Func<T, bool> condition = null, bool regardGrandchildren = false, bool ignoreFalseGrandchildren = false) where T : class, ILayoutItem
Parameters
itemILayoutItemThe item whose children to retrieve.
conditionFunc<T, bool>The condition to match
regardGrandchildrenboolIf this value is true, children of children of the item are also searched
ignoreFalseGrandchildrenboolIf this value is true, children for which the condition does not match will not have their children searched
Returns
- IEnumerable<T>
All children that match the condition
Type Parameters
TThe type of children to search for
GetLowestChild<T>(T, Func<T, bool>, bool)
Returns the given layout item's lowest child layout item (in terms of y position) that matches the given condition.
public static T GetLowestChild<T>(T item, Func<T, bool> condition = null, bool total = false) where T : class, ILayoutItem
Parameters
itemTThe item whose lowest child to retrieve.
conditionFunc<T, bool>The condition to match
totalboolWhether to evaluate based on the child's GetTotalCoveredArea(bool), rather than its UnscrolledArea.
Returns
- T
The lowest layout item, or null if no such layout item exists
Type Parameters
T
GetLowestOlderSibling<T>(T, Func<T, bool>, bool)
Returns the given layout item's lowest sibling that is also older (lower in its parent's Children list) than the given layout item that also matches the given condition. The returned layout item's Parent will always be equal to the given layout item's Parent.
public static T GetLowestOlderSibling<T>(T item, Func<T, bool> condition = null, bool total = false) where T : class, ILayoutItem
Parameters
itemTThe item whose lowest older sibling to retrieve.
conditionFunc<T, bool>The condition to match
totalboolWhether to evaluate based on the child's GetTotalCoveredArea(bool), rather than its UnscrolledArea.
Returns
- T
The lowest older sibling of the given layout item, or null if no such layout item exists
Type Parameters
T
GetOlderSibling<T>(T, Func<T, bool>)
Returns the given layout item's first older sibling that matches the given condition. The returned layout item's Parent will always be equal to the given layout item's Parent.
public static T GetOlderSibling<T>(T item, Func<T, bool> condition = null) where T : class, ILayoutItem
Parameters
Returns
- T
The older sibling, or null if no such layout item exists
Type Parameters
T
GetRightmostChild<T>(T, Func<T, bool>, bool)
Returns the given layout item's rightmost child (in terms of x position) that matches the given condition.
public static T GetRightmostChild<T>(T item, Func<T, bool> condition = null, bool total = false) where T : class, ILayoutItem
Parameters
itemTThe item whose rightmost child to retrieve.
conditionFunc<T, bool>The condition to match
totalboolWhether to evaluate based on the child's GetTotalCoveredArea(bool), rather than its UnscrolledArea.
Returns
- T
The rightmost layout item, or null if no such layout item exists
Type Parameters
T
Layout<T>(T, ref int, float)
Lays out the given item based on the information specified in its ILayoutItem interface.
public static void Layout<T>(T item, ref int layoutRecursionTracker, float epsilon = 0) where T : class, ILayoutItem
Parameters
itemTThe item to lay out.
layoutRecursionTrackerintA reference to a field in the
itemthat is used by the layouter to track recursion counts across Layout<T>(T, ref int, float) calls.epsilonfloatAn epsilon value used in layout item size, position and resulting area calculations to mitigate floating point rounding inaccuracies.
Type Parameters
T