Public Member Functions | Static Public Member Functions | List of all members
FlowLayout Class Reference

The Flow Layout Manager arranges items from left to right and top to bottom. More...

#include <FlowLayout.h>

Inheritance diagram for FlowLayout:
LayoutManager LayoutItem RefCounted< IRefCounted > IRefCounted

Public Member Functions

void AddControl (LayoutControl *ctl, LayoutAlignment alignment=Align_None)
 Adds a control to the FlowLayout Layout Manager. More...
 
void AddLayout (LayoutManager *layout, LayoutAlignment alignment=Align_None)
 Adds a nested child layout to the layout. More...
 
void AddSpacing (int spacing)
 Adds a non-stretchable space item to the layout with a given width. More...
 
void SetHorizontalSpacing (int spacing)
 Sets the horizontal spacing between items in the layout. More...
 
int GetHorizontalSpacing () const
 Returns the horizontal spacing between items in the layout. More...
 
void SetVerticalSpacing (int spacing)
 Sets the vertical spacing between rows in the layout. More...
 
int GetVerticalSpacing () const
 Returns the vertical spacing between rows in the layout. More...
 
int GetLineHeight () const
 Returns the current line height. More...
 
virtual bool HasHeightForWidth () const override
 Returns whether this layout's preferred height depends on its width. More...
 
virtual int GetHeightForWidth (int width) const override
 Returns the preferred height for this layout item, given the width. More...
 
virtual BSize GetMinimumSize () const override
 Returns the minimum size for this layout. More...
 
virtual BSize GetDesiredSize () const override
 Returns the desired size for this layout. More...
 
virtual void SetGeometry (const BRect &rect) override
 Sets the geometry for this layout to the given rectangle. More...
 
virtual size_t Count () const override
 Returns the number of items in this layout. More...
 
virtual LayoutItemItemAt (int index) const override
 Retrieves the item at index in the layout and returns the item. More...
 
virtual LayoutItemTakeAt (int index) override
 Removes the item at index from the layout, and returns the item. More...
 
virtual LayoutOrientations GetExpandingOrientations () const override
 Returns whether this layout item can make use of more space than GetDesiredSize(). More...
 
- Public Member Functions inherited from LayoutManager
virtual void AddItem (LayoutItem *item)=0
 Adds a LayoutItem to this Layout Manager. More...
 
virtual void Invalidate ()
 Resets the layout's rectangle then calls Update() More...
 
virtual void SetDirty ()
 Resets the layout's rectangle. More...
 
virtual int GetSpacing () const
 Gets the spacing between items in the layout. More...
 
virtual void SetSpacing (int spacing)
 Sets the spacing between items in the layout. More...
 
virtual int IndexOf (LayoutControl *ctl) const
 Searches for the control in this layout (not including child layouts). More...
 
virtual int IndexOf (LayoutItem *item) const
 Searches for the LayoutItem in this layout (not including child layouts). More...
 
void WindowSizeDoLayout (const BSize &size)
 Notifies this LayoutManager that the Window size has changed and all child items should be laid out accordingly. More...
 
void VisibleDoLayout ()
 Notifies this LayoutManager that the layout has changed visibility and all child items should be laid out accordingly. More...
 
void ItemSizeDoLayout ()
 Notifies this LayoutManager that a child has changed size and all child items should be laid out accordingly. More...
 
LayoutManagerGetMainLayout ()
 Retrieves the main LayoutManager associated with this Layout Manager. More...
 
LayoutManagerGetSharedSizeGroupBoundary ()
 Retrieves the next Shared Size Group Boundary associated with this Layout Manager. More...
 
LayoutManagerGetParentLayout () const
 Retrieves the parent LayoutManager associated with this Layout Manager. More...
 
void SetParentLayout (LayoutManager *)
 Sets the parent LayoutManager for this Layout Manager. More...
 
LayoutControlGetParentControl () const
 Retrieves the parent LayoutControl associated with this Layout Manager. More...
 
void SetParentControl (LayoutControl *)
 Sets the parent LayoutControl for this Layout Manager. More...
 
int GetMargin () const
 Retrieves the margin for the LayoutManager, but only if all 4 margins are the same. Otherwise, -1 is returned. More...
 
void SetMargin (int margin)
 Sets the 4 margins for the LayoutManager to the same value. More...
 
void SetLayoutMargins (int left, int top, int right, int bottom)
 Sets the 4 margins for the LayoutManager. More...
 
void SetLayoutMargins (const Margins &margins)
 Sets the margins for the LayoutManager. More...
 
void GetLayoutMargins (int *left, int *top, int *right, int *bottom) const
 Gets the 4 margins for the LayoutManager. More...
 
Margins GetLayoutMargins () const
 Gets the 4 margins for the LayoutManager. More...
 
BRect GetContentsRect () const
 Gets the bounding rectangle for the contents in the LayoutManager. More...
 
bool SetAlignment (LayoutControl *ctl, LayoutAlignment alignment)
 Sets the alignment for a child control. More...
 
bool SetAlignment (LayoutManager *layout, LayoutAlignment alignment)
 Sets the alignment for a child layout. More...
 
bool Activate ()
 Invalidates the layout item then updates it. More...
 
void Update ()
 Invalidates the layout item without updating it. More...
 
void RemoveControl (LayoutControl *ctl)
 Removes a child control. More...
 
void RemoveItem (LayoutItem *item)
 Removes a child item. More...
 
int GetTotalHeightForWidth (int width) const
 Retrieves the required height for a given width. More...
 
BSize GetTotalMinimumSize () const
 Retrieves the total minimum size for the layout. More...
 
BSize GetTotalMaximumSize () const
 Retrieves the total maximum size for the layout. More...
 
BSize GetTotalDesiredSize () const
 Retrieves the total desired size for the layout. More...
 
void SetEnabled (bool)
 Sets whether the layout is enabled. More...
 
bool IsEnabled () const
 Determines whether the layout is enabled. More...
 
void SetTopLevel (bool)
 Sets whether the layout is top-level. More...
 
bool IsTopLevel () const
 Determines whether the layout is top-level. More...
 
void SetSharedSizeGroupBoundary (bool)
 Sets whether the layout is a Shared Group Boundary. More...
 
bool IsSharedSizeGroupBoundary () const
 Determines whether the layout is a Shared Group Boundary. More...
 
virtual bool IsEmpty () const override
 Returns whether the layout item is empty. More...
 
virtual bool IsVisible () const override
 Returns whether the layout item is visible. More...
 
virtual BSize GetMaximumSize () const override
 Retrieves the maximum size for this layout item. More...
 
virtual BRect GetGeometry () const override
 Retrieves the geometry for this layout item. More...
 
virtual LayoutManagerGetLayout () override
 If the concrete item is a LayoutManager, it can be retrieved using GetLayout(). More...
 
- Public Member Functions inherited from LayoutItem
virtual BSize GetSize () const
 Returns the geometry's size for this layout item. More...
 
virtual int GetMinimumHeightForWidth (int width) const
 Returns the minimum height for this layout item, given the width. More...
 
virtual LayoutControlGetControl ()
 If the concrete item is a LayoutControl, it can be retrieved using GetControl(). More...
 
LayoutAlignment GetAlignment () const
 Returns the alignment within the layout for this layout item. More...
 
void SetAlignment (LayoutAlignment alignment)
 Sets the alignment within the layout for this layout item. More...
 
- Public Member Functions inherited from RefCounted< IRefCounted >
void * operator new (size_t size)
 
void operator delete (void *rawMemory, size_t size)
 
UInt32 AddRef () const
 
UInt32 Release () const
 
 RefCounted ()
 
 RefCounted (RefCounted const &rhs)
 
RefCountedoperator= (RefCounted const &rhs)
 
UInt32 GetRefCount () const
 

Static Public Member Functions

static FlowLayoutCreate (LayoutControl *parent, int hSpacing=-1, int vSpacing=-1, LayoutDirection layoutDirection=LD_LeftToRight)
 Creates a FlowLayout Layout Manager. More...
 
static FlowLayoutCreate (int hSpacing=-1, int vSpacing=-1, LayoutDirection layoutDirection=LD_LeftToRight)
 Creates a FlowLayout Layout Manager. More...
 

Additional Inherited Members

- Protected Member Functions inherited from RefCounted< IRefCounted >
virtual ~RefCounted ()
 
- Protected Member Functions inherited from IRefCounted
virtual ~IRefCounted ()
 
void * operator new (size_t size)
 
void operator delete (void *rawMemory, size_t size)
 

Detailed Description

The Flow Layout Manager arranges items from left to right and top to bottom.

The items are first laid out horizontally then vertically when each line in the layout runs out of space.

Member Function Documentation

void AddControl ( LayoutControl ctl,
LayoutAlignment  alignment = Align_None 
)

Adds a control to the FlowLayout Layout Manager.

Parameters
[in]ctlThe LayoutControl being added to the layout.
[in]alignmentAlignment of the control within the layout.
void AddLayout ( LayoutManager layout,
LayoutAlignment  alignment = Align_None 
)

Adds a nested child layout to the layout.

Parameters
[in]layoutThe child LayoutManager being added to the layout.
[in]alignmentAlignment of the child layout within the parent layout.
void AddSpacing ( int  spacing)

Adds a non-stretchable space item to the layout with a given width.

Parameters
[in]spacingThe width of space being added to the layout.
virtual size_t Count ( ) const
overridevirtual

Returns the number of items in this layout.

Implements LayoutManager.

static FlowLayout* Create ( LayoutControl parent,
int  hSpacing = -1,
int  vSpacing = -1,
LayoutDirection  layoutDirection = LD_LeftToRight 
)
static

Creates a FlowLayout Layout Manager.

Parameters
[in]parentThe parent LayoutControl
[in]hSpacingHorizontal spacing amount. The default is -1.
[in]vSpacingVertical spacing amount. The default is -1.
[in]layoutDirectionLayout Direction. The default is LD_LeftToRight. (LD_LeftToRight is the only supported direction at this time.)
Returns
A pointer to the new FlowLayout object.
static FlowLayout* Create ( int  hSpacing = -1,
int  vSpacing = -1,
LayoutDirection  layoutDirection = LD_LeftToRight 
)
static

Creates a FlowLayout Layout Manager.

Parameters
[in]hSpacingHorizontal spacing amount. The default is -1.
[in]vSpacingVertical spacing amount. The default is -1.
[in]layoutDirectionLayout Direction. The default is LD_LeftToRight. (LD_LeftToRight is the only supported direction at this time.)
Returns
A pointer to the new FlowLayout object.
virtual BSize GetDesiredSize ( ) const
overridevirtual

Returns the desired size for this layout.

Implements LayoutItem.

virtual LayoutOrientations GetExpandingOrientations ( ) const
overridevirtual

Returns whether this layout item can make use of more space than GetDesiredSize().

A value of LO_Vertical or LO_Horizontal means that it wants to grow in only one dimension, whereas LO_Vertical | LO_Horizontal means that it wants to grow in both dimensions.

Reimplemented from LayoutManager.

virtual int GetHeightForWidth ( int  width) const
overridevirtual

Returns the preferred height for this layout item, given the width.

Parameters
[in]widthThe width for which to retrieve the preferred height.

Reimplemented from LayoutItem.

int GetHorizontalSpacing ( ) const

Returns the horizontal spacing between items in the layout.

int GetLineHeight ( ) const

Returns the current line height.

virtual BSize GetMinimumSize ( ) const
overridevirtual

Returns the minimum size for this layout.

Reimplemented from LayoutManager.

int GetVerticalSpacing ( ) const

Returns the vertical spacing between rows in the layout.

virtual bool HasHeightForWidth ( ) const
overridevirtual

Returns whether this layout's preferred height depends on its width.

For FlowLayout, it returns true.

Reimplemented from LayoutItem.

virtual LayoutItem* ItemAt ( int  index) const
overridevirtual

Retrieves the item at index in the layout and returns the item.

If there is no such item, the function returns NULL.

Parameters
[in]indexThe index of the item to retrieve. Items are numbered consecutively from 0.

Implements LayoutManager.

virtual void SetGeometry ( const BRect rect)
overridevirtual

Sets the geometry for this layout to the given rectangle.

Parameters
[in]rectThe rectangle of the new geometry for the layout.

Reimplemented from LayoutManager.

void SetHorizontalSpacing ( int  spacing)

Sets the horizontal spacing between items in the layout.

Parameters
[in]spacingThe amount of space between items in the layout.
void SetVerticalSpacing ( int  spacing)

Sets the vertical spacing between rows in the layout.

Parameters
[in]spacingThe amount of space between rows in the layout.
virtual LayoutItem* TakeAt ( int  index)
overridevirtual

Removes the item at index from the layout, and returns the item.

If there is no such item, the function does nothing and returns NULL.

Parameters
[in]indexThe index of the item to remove. Items are numbered consecutively from 0.

Implements LayoutManager.


The documentation for this class was generated from the following file:

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.