Container

Drawable view with child views.

Header#include "nativeui/container.h"
Namespacenamespace nu
Typeclass (RefCounted)
InheritsView

The Container view is mainly used for two purposes:

Constructors

Container()

Create a new container view.

Class properties

const char* kClassName

The class name of this view.

Methods

SizeF GetPreferredSize() const

Get the minimum size to show all children of the view.

Note that if the view is using a flex-wrap: wrap style, this method might return a extremely wide/high size since it does not know the best width/height to show the children.

Return

SizeF

float GetPreferredHeightForWidth(float width) const

Return the minimum height to show all child of the view for the width.

Parameters

Return

float

float GetPreferredWidthForHeight(float height) const

Return the minimum width to show all child of the view for the height.

Parameters

Return

float

void AddChildView(scoped_refptr<View> view)

Append a child view to the container.

This method will silently fail if the view already has a parent.

Parameters

void AddChildViewAt(scoped_refptr<View> view, int index)

Add a child view to the container at index.

This method will silently fail if the view already has a parent.

Parameters

void RemoveChildView(View* view)

Remove a child view from this container.

This method will silently fail if the view is not a child of the container.

Parameters

int ChildCount() const

Return the count of children in the container.

Return

int

View* ChildAt(int index) const

Return the child view at index.

This method will silently fail if the index is out of range.

Parameters

Return

View*

Events

void on_draw(Container* self, Painter* painter, const RectF& dirty)

Emitted when button the operating system or application requests to draw a portion of the view.

Parameters

Preventable

No.