Class LayoutItem
Definition
- Assembly:
- Tizen.NUI.dll
Base class for layouts. It is used to layout a View It can be laid out by a LayoutGroup.
public class LayoutItem : IDisposable
- Inheritance
-
objectLayoutItem
- Derived
- Implements
-
System.IDisposable
Constructors
View SourceLayoutItem()
Default constructor of LayoutItem class.
Declaration
public LayoutItem()
Properties
View SourceMargin
Margin for this LayoutItem
Declaration
public Extents Margin { get; set; }
Property Value
Type | Description |
---|---|
Extents |
MeasuredHeight
Get the measured height (without any measurement flags).
This method should be used only during measurement and layout calculations.
Declaration
public MeasuredSize MeasuredHeight { get; set; }
Property Value
Type | Description |
---|---|
MeasuredSize |
MeasuredWidth
Get the measured width (without any measurement flags).
This method should be used only during measurement and layout calculations.
Declaration
public MeasuredSize MeasuredWidth { get; set; }
Property Value
Type | Description |
---|---|
MeasuredSize |
Owner
The View that this Layout has been assigned to.
Declaration
public View Owner { get; set; }
Property Value
Type | Description |
---|---|
View |
Padding
Padding for this LayoutItem
Declaration
public Extents Padding { get; set; }
Property Value
Type | Description |
---|---|
Extents |
SuggestedMinimumHeight
Returns the suggested minimum height that the layout should use.
This returns the maximum of the layout's minimum height and the owner's natural height.
Declaration
public LayoutLength SuggestedMinimumHeight { get; }
Property Value
Type | Description |
---|---|
LayoutLength |
SuggestedMinimumWidth
Returns the suggested minimum width that the layout should use.
This returns the maximum of the layout's minimum width and the owner's natural width.
Declaration
public LayoutLength SuggestedMinimumWidth { get; }
Property Value
Type | Description |
---|---|
LayoutLength |
Methods
View SourceGetDefaultSize(LayoutLength, MeasureSpecification)
Utility to return a default size.
Uses the supplied size if the MeasureSpecification imposed no constraints. Will get larger if allowed by the
MeasureSpecification.
Declaration
public static LayoutLength GetDefaultSize(LayoutLength size, MeasureSpecification measureSpecification)
Parameters
Type | Name | Description |
---|---|---|
LayoutLength | size | Default size for this layout. |
MeasureSpecification | measureSpecification | Constraints imposed by the parent. |
Returns
Type | Description |
---|---|
LayoutLength | The size this layout should be. |
GetParent()
Get the Layouts parent
Declaration
public ILayoutParent GetParent()
Returns
Type | Description |
---|---|
ILayoutParent | Layout parent with an LayoutParent interface |
Layout(LayoutLength, LayoutLength, LayoutLength, LayoutLength)
Assign a size and position to a layout and all of its descendants.
This is the second phase of the layout mechanism. (The first is measuring). In this phase, each parent
calls layout on all of its children to position them. This is typically done using the child
measurements that were stored in the measure pass.
Declaration
public void Layout(LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom)
Parameters
Type | Name | Description |
---|---|---|
LayoutLength | left | Left position, relative to parent. |
LayoutLength | top | Top position, relative to parent. |
LayoutLength | right | Right position, relative to parent. |
LayoutLength | bottom | Bottom position, relative to parent. |
Measure(MeasureSpecification, MeasureSpecification)
This is called to find out how big a layout should be.
The parent supplies constraint information in the width and height parameters.
The actual measurement work of a layout is performed in OnMeasure called by this
method. Therefore, only OnMeasure can and must be overridden by subclasses.
Declaration
public void Measure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
Parameters
Type | Name | Description |
---|---|---|
MeasureSpecification | widthMeasureSpec | Horizontal space requirements as imposed by the parent. |
MeasureSpecification | heightMeasureSpec | Vertical space requirements as imposed by the parent. |
OnAttachedToOwner()
Virtual method called when this Layout is attached to it's owner. Allows derived layouts to take ownership of child Views and connect to any Owner signals required.
Declaration
protected virtual void OnAttachedToOwner()
OnLayout(bool, LayoutLength, LayoutLength, LayoutLength, LayoutLength)
Called from Layout() when this layout should assign a size and position to each of its children.
Derived classes with children should override this method and call Layout() on each of their children.
Declaration
protected virtual void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom)
Parameters
Type | Name | Description |
---|---|---|
bool | changed | This is a new size or position for this layout. |
LayoutLength | left | Left position, relative to parent. |
LayoutLength | top | Top position, relative to parent. |
LayoutLength | right | Right position, relative to parent. |
LayoutLength | bottom | Bottom position, relative to parent. |
OnMeasure(MeasureSpecification, MeasureSpecification)
Measure the layout and its content to determine the measured width and the
measured height.
The base class implementation of measure defaults to the background size,
unless a larger size is allowed by the MeasureSpec. Subclasses should
override to provide better measurements of their content.
If this method is overridden, it is the subclass's responsibility to make sure the
measured height and width are at least the layout's minimum height and width.
Declaration
protected virtual void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
Parameters
Type | Name | Description |
---|---|---|
MeasureSpecification | widthMeasureSpec | horizontal space requirements as imposed by the parent. |
MeasureSpecification | heightMeasureSpec | vertical space requirements as imposed by the parent. |
OnUnparent()
Virtual method to allow derived classes to remove any children before it is removed from its parent.
Declaration
protected virtual void OnUnparent()
RequestLayout()
Request that this layout is re-laid out.
This will make this layout and all it's parent layouts dirty.
Declaration
public void RequestLayout()
ResolveSizeAndState(LayoutLength, MeasureSpecification, StateType)
Utility to reconcile a desired size and state, with constraints imposed by a MeasureSpecification.
Declaration
protected MeasuredSize ResolveSizeAndState(LayoutLength size, MeasureSpecification measureSpecification, MeasuredSize.StateType childMeasuredState)
Parameters
Type | Name | Description |
---|---|---|
LayoutLength | size | How big the layout wants to be. |
MeasureSpecification | measureSpecification | Constraints imposed by the parent. |
MeasuredSize.StateType | childMeasuredState | Size information bit mask for the layout's children. |
Returns
Type | Description |
---|---|
MeasuredSize | A measured size, which may indicate that it is too small. |
SetMeasuredDimensions(MeasuredSize, MeasuredSize)
This method must be called by OnMeasure(MeasureSpec,MeasureSpec) to store the measured width and measured height.
Declaration
protected void SetMeasuredDimensions(MeasuredSize measuredWidth, MeasuredSize measuredHeight)
Parameters
Type | Name | Description |
---|---|---|
MeasuredSize | measuredWidth | The measured width of this layout. |
MeasuredSize | measuredHeight | The measured height of this layout. |