Public Member Functions | Static Public Member Functions | Protected Member Functions

The BGridLayout class a BLayout subclass that arranges the items it holds in a grid. More...

Inheritance diagram for BGridLayout:
BTwoDimensionalLayout BAbstractLayout BLayout BLayoutItem BArchivable

List of all members.

Public Member Functions

 BGridLayout (float horizontal=B_USE_DEFAULT_SPACING, float vertical=B_USE_DEFAULT_SPACING)
 Create a BGridLayout with horizontal space between columns and vertical space between rows.
 BGridLayout (BMessage *from)
 Archive constructor.
virtual ~BGridLayout ()
 Destructor method.
virtual bool AddItem (BLayoutItem *item)
 Adds item to this layout in the first empty cell available, or in a new column in the first row if there are no emtpy cells.
virtual bool AddItem (int32 index, BLayoutItem *item)
 BGridLayout::AddItem(BLayoutItem*)
virtual bool AddItem (BLayoutItem *item, int32 column, int32 row, int32 columnCount=1, int32 rowCount=1)
 Adds item to this layout at column and row. item may also occupy additional cells if columnCount or rowCount are greater than 1.
virtual BLayoutItemAddView (BView *child)
 Adds child to this layout in the first empty cell available, or in a new column in the first row if there are no emtpy cells.
virtual BLayoutItemAddView (int32 index, BView *child)
 BGridLayout::AddView(BView*)
virtual BLayoutItemAddView (BView *child, int32 column, int32 row, int32 columnCount=1, int32 rowCount=1)
 Adds child to this layout at column and row. child may also occupy additional cells if columnCount or rowCount are greater than 1.
void AlignLayoutWith (BTwoDimensionalLayout *other, enum orientation orientation)
 Align the BLayoutItem's in the specified orientation within two or more BTwoDimensionalLayout's.
virtual BAlignment Alignment ()
virtual status_t Archive (BMessage *into, bool deep=true) const
 Archives this layout into archive. If deep is true, also archives the items in this layout, calling ItemArchived() for each one.
virtual BAlignment BaseAlignment ()
 Method to be implemented in derived classes return the preferred alignment for this BAbstractLayout.
virtual BSize BaseMaxSize ()
 Method to be implemented in derived classes return the maximum size constraint for this BAbstractLayout.
virtual BSize BaseMinSize ()
 Method to be implemented in derived classes return the minimum size constraint for this BAbstractLayout.
virtual BSize BasePreferredSize ()
 Method to be implemented in derived classes return the preferred size constraint for this BAbstractLayout.
float ColumnWeight (int32 column) const
 Returns the weight for the specified column.
int32 CountColumns () const
 Returns the number of active columns in this layout.
int32 CountRows () const
 Returns the number of active rows in this layout.
virtual BRect Frame ()
 Return the bounding frame of this item.
virtual void GetHeightForWidth (float width, float *min, float *max, float *preferred)
 Get this BLayoutItem's height constraints for a given width.
void GetInsets (float *left, float *top, float *right, float *bottom) const
 Get the insets for the BTwoDimensionalLayout (in pixels).
virtual bool HasHeightForWidth ()
 Returns whether or not this BLayoutItem's height constraints are dependent on its width.
float HorizontalSpacing () const
 Returns the spacing between columns for this layout.
virtual bool IsVisible ()
 Return the current local visibility of this item. If an item is not visible, it will not be given space by the BLayout it resides in.
BLayoutLayout () const
 Returns the BLayout this BLayoutItem resides in.
float MaxColumnWidth (int32 column) const
 Returns the maximum width for column.
float MaxRowHeight (int32 row) const
 Returns the maximum height for row.
virtual BSize MaxSize ()
float MinColumnWidth (int32 column) const
 Returns the minimum width for column.
float MinRowHeight (int row) const
 Returns the minimum height for row.
virtual BSize MinSize ()
virtual status_t Perform (perform_code d, void *arg)
 Perform some action (Internal method defined for binary compatibility purposes).
virtual BSize PreferredSize ()
float RowWeight (int32 row) const
 Returns the weight of the specified row.
void SetColumnWeight (int32 column, float weight)
 Set the weight for column to weight.
virtual void SetExplicitAlignment (BAlignment alignment)
 Set this item's explicit alignment, to be used in Alignment().
virtual void SetExplicitMaxSize (BSize size)
 Set this item's explicit max size, to be used in MaxSize().
virtual void SetExplicitMinSize (BSize size)
 Set this item's explicit min size, to be used in MinSize().
virtual void SetExplicitPreferredSize (BSize size)
 Set this item's explicit preferred size, to be used in PreferredSize().
virtual void SetFrame (BRect frame)
 Set the bounding frame of this item.
void SetHorizontalSpacing (float spacing)
 Set the spacing between columns for this layout.
void SetInsets (float left, float top, float right, float bottom)
 Set the insets for this BTwoDimensionalLayout (in pixels).
void SetMaxColumnWidth (int32 column, float width)
 Sets the maximum width for column to width.
void SetMaxRowHeight (int32 row, float height)
 Sets the maximum height for row to width.
void SetMinColumnWidth (int32 column, float width)
 Sets the minimum width for column to width.
void SetMinRowHeight (int32 row, float height)
 Sets the minimum height for row to width.
void SetRowWeight (int32 row, float weight)
 Set the weight for row to weight.
void SetSpacing (float horizontal, float vertical)
 Set the spacing between columns and rows for this layout.
void SetVerticalSpacing (float spacing)
 Set the spacing between rows for this layout.
virtual void SetVisible (bool visible)
 Set the local visibility of this item.
float VerticalSpacing () const
 Returns the spacing between rows for this layout.
BView targeting and attachment information.
BViewOwner () const
 Returns the Owner of this layout, i.e. the view this layout manages.
BViewTargetView () const
 Returns the target view of this layout.
virtual BViewView ()
 Returns the same BView* as BLayout::Owner(), this method is inherited from BLayoutItem.
Adding, removing, counting and accessing BLayout children
virtual bool RemoveView (BView *child)
 Removes and deletes all BLayoutItem representing a BView from this layout.
virtual bool RemoveItem (BLayoutItem *item)
 Removes a BLayoutItem from this layout, and also removes the view it represents from this BLayout's target view.
virtual BLayoutItemRemoveItem (int32 index)
 Remove the BLayoutItem at index.
BLayoutItemItemAt (int32 index) const
 Get the BLayoutItem at index. Returns NULL if index is out of bounds.
int32 CountItems () const
 Get the number of BLayoutItem s in this layout.
int32 IndexOfItem (const BLayoutItem *item) const
 Get the index of a BLayoutItem in this layout.
int32 IndexOfView (BView *child) const
 Get the index of child in this layout.
Methods triggering or related to laying out this BLayout.
virtual void Relayout (bool immediate=false)
 Request this BLayout to reposition and resize its items as required.
void LayoutItems (bool force=false)
 If there is no layout currently ongoing, and force is false, creates a new BLayoutContext and calls the DoLayout() method of this BLayout and any BLayout s nested in this BLayout.
Utility methods for BLayout subclasses

Utility methods for the BLayout class to attach and retrieve arbitrary data for a BLayoutItem.

void * LayoutData () const
 Retrieve arbitrary data attached to this BLayoutItem.
void SetLayoutData (void *data)
 Attach arbitrary data to this BLayoutItem.
Getting and setting the current on-screen positioning of a BLayoutItem.
void AlignInFrame (BRect frame)
 Position this BLayoutItem within frame, given the value returned by Alignment(), and the size constraints for this item.

Static Public Member Functions

static BArchivableInstantiate (BMessage *from)
 Static member to restore objects from messages.

Protected Member Functions

virtual status_t AllArchived (BMessage *into) const
 Method relating to the use of BArchiver.
virtual status_t AllUnarchived (const BMessage *from)
 Unarchives the BLayoutItem's for this layout, calling ItemUnarchived() for each one.
virtual void AncestorVisibilityChanged (bool shown)
 Hook method inherited from BLayoutItem, classes derived from BLayout must include the BLayout version of this method in their implementation.
virtual void AttachedToLayout ()
 Hook method inherited from BLayoutItem, classes derived from BLayout must include the BLayout version of this method in their implementation.
virtual void DetachedFromLayout (BLayout *layout)
 Hook method inherited from BLayoutItem, classes derived from BLayout must include the BLayout version of this method in their implementation.
virtual void DoLayout ()
 Implemented by derived classes to position and resize the items in this layout.
virtual void GetColumnRowConstraints (enum orientation orientation, int32 index, ColumnRowConstraints *constraints)
 Fill in the ColumnRowConstraints for a certain column or row in the BTwoDimensionalLayout.
virtual void GetItemDimensions (BLayoutItem *item, Dimensions *dimensions)
 Tell the base class what column and row a BLayoutItem is in as well as how many columns and rows it covers.
virtual bool HasMultiColumnItems ()
 Tests whether or not this BTwoDimensionalLayout contains any BLayoutItem's spanning more than one column.
virtual bool HasMultiRowItems ()
 Tests whether or not this BTwoDimensionalLayout contains any BLayoutItem's spanning more than one row.
virtual int32 InternalCountColumns ()
 Get the number of columns in the BTwoDimensionalLayout.
virtual int32 InternalCountRows ()
 Get the number of rows in the BTwoDimensionalLayout.
virtual bool ItemAdded (BLayoutItem *item, int32 atIndex)
 Hook method called when item is added to this layout.
virtual status_t ItemArchived (BMessage *into, BLayoutItem *item, int32 index) const
 Hook for derived classes to add data specific to item to the into BMessage. item resides at index.
virtual void ItemRemoved (BLayoutItem *item, int32 fromIndex)
 Hook method called when item is removed from this layout.
virtual status_t ItemUnarchived (const BMessage *from, BLayoutItem *item, int32 index)
 Hook for derived classes to retrieve data specific to item from the from BMessage. item resides at index.
virtual void LayoutInvalidated (bool children=false)
 Hook called from InvalidateLayout().
virtual void OwnerChanged (BView *was)
 Hook method called when this layout is attached to a BView.
BTwoDimensionalLayout Hook methods

These methods are called automatically as needed during layout, and provide the BTwoDimensionalLayout class with the necessary information to properly layout the BLayoutItem in this BTwoDimensionalLayout.

virtual void PrepareItems (enum orientation orientation)
 Prepare the BLayoutItem in this BTwoDimensionalLayout subclass for layout within a certain orientation.

Subclass helpers.

These methods are meant to ease the development of BLayout subclasses.

bool AncestorsVisible () const
 Get the visibility of the ancestors of this layout.
BRect LayoutArea ()
 Returns the on-screen area this layout has received to lay out its items in.
void VisibilityChanged (bool show)
 Method to be called by derived classes in their SetVisible() implementation. Calls AncestorVisibilityChanged() on the items in this BLayout.

Invalidation and state mutators and accessors.

virtual void InvalidateLayout (bool children=false)
 Invalidate this layout and any cached data this layout has relating to positioning and sizing of its items.
void RequireLayout ()
 Flag this layout as stale, i.e. any cached data may still be valid, but the items need to be repositioned or resized.
bool IsValid ()
 Returns whether this layout has been invalidated (via BLayout::InvalidateLayout()) and has not yet been validated (by doing a layout, or by its ResetLayoutInvalidation() method.
void EnableLayoutInvalidation ()
 Re-enable layout invalidation after a call to DisableLayoutInvalidation().
void DisableLayoutInvalidation ()
 Disable layout invalidation notifications, i.e. calls to this object's InvalidateLayout() method.
void ResetLayoutInvalidation ()
 Reset layout invalidation, causing InvalidateLayout calls to proceed again. This method should be called once any cached data has been validated, or updated to valid values.

Detailed Description

The BGridLayout class a BLayout subclass that arranges the items it holds in a grid.

Each item in a BGridLayout receives a rectangular area which can span more than a single row or column. The indexing of columns and rows is zero based, starting in the top-left.

Warning:
This class is not yet finalized, if you use it in your software assume that it will break some time in the future.

Constructor & Destructor Documentation

BGridLayout::BGridLayout ( BMessage from)

Archive constructor.

Parameters:
fromThe message to build the BGridLayout from.
BGridLayout::~BGridLayout ( ) [virtual]

Destructor method.

Standard Destructor.


Member Function Documentation

BLayoutItem * BGridLayout::AddItem ( BLayoutItem item,
int32  column,
int32  row,
int32  columnCount = 1,
int32  rowCount = 1 
) [virtual]

Adds item to this layout at column and row. item may also occupy additional cells if columnCount or rowCount are greater than 1.

Fails and returns NULL if the requested area is occupied, or if internal memory allocations fail.

BLayoutItem * BGridLayout::AddView ( BView child,
int32  column,
int32  row,
int32  columnCount = 1,
int32  rowCount = 1 
) [virtual]

Adds child to this layout at column and row. child may also occupy additional cells if columnCount or rowCount are greater than 1.

Fails and returns NULL if the requested area is occupied, or if internal memory allocations fail.

void BTwoDimensionalLayout::AlignLayoutWith ( BTwoDimensionalLayout other,
enum orientation orientation   
) [inherited]

Align the BLayoutItem's in the specified orientation within two or more BTwoDimensionalLayout's.

When two (or more) BTwoDimensionalLayout's are aligned within a certain orientation, then the BLayoutItem's within those BTwoDimensionalLayout's will have identical widths or heights (depending on how the BTwoDimensionalLayout's are aligned.)

If you align two BGroupLayout's horizontally for example, then the BLayoutItem at index 0 in both BGroupLayout's will be given the same horizontal area. The same is true for the BLayoutItem at index 1, 2, etc. Not all BTwoDimensionalLayout's have to have an item at each index for the alignment to proceed.

Parameters:
otherThe BTwoDimensionalLayout to be aligned with.
orientationThe orientation on which to be aligned.
BAlignment BAbstractLayout::Alignment ( ) [virtual, inherited]

Returns the requested alignment for this item.

The value returned from this method is used in BLayoutItem::AlignInFrame(), which BLayouts use to position and resize items. In a vertical BGroupLayout, for example, although each item recieves the same horizontal area, each item can use that area differently, aligning to the left, right or center for example.

The return value for this method is composed (using BLayoutUtils::ComposeAlignment()) from the values returned by BaseAlignment() and ExplicitAlignment()

Implements BLayoutItem.

virtual status_t BGridLayout::AllArchived ( BMessage into) const [protected, virtual]

Method relating to the use of BArchiver.

This hook function is called once the first BArchiver that was created in an archiving session is either destroyed, or has its Finish() method called. Implementations of this method can be used, in conjunction with BArchiver::IsArchived(), to reference objects in your archive that you do not own, depending on whether or not those objects were archived by their owners. Implementations of this method should call the implementation of their parent class, the same as for the Archive() method.

Warning:
To guarantee that your AllArchived() method will be called during archival, you must create a BArchiver object in your Archive() implementation.
You should archive any objects you own in your Archive() method implementation, and NOT your AllArchived() method.
See also:
BArchiver BArchiver::Finish()

Reimplemented from BTwoDimensionalLayout.

bool BLayout::AncestorsVisible ( ) const [inherited]

Get the visibility of the ancestors of this layout.

If a BLayout is connected to a BView, this will always return true. If a BLayout is nested in another layout (it was passed to AddItem()), then this will reflect the visibility of this BLayout's parent layout. If any layout is hidden (by BLayout::SetVisible()) between this layout and its target BView's layout, then this method will return false.

float BGridLayout::ColumnWeight ( int32  column) const

Returns the weight for the specified column.

Returns:
The column weight as a float.
int32 BGridLayout::CountColumns ( ) const

Returns the number of active columns in this layout.

Returns:
The number of active columns in the layout.
int32 BGridLayout::CountRows ( ) const

Returns the number of active rows in this layout.

Returns:
the number of active rows in the layout.
virtual void BAbstractLayout::DetachedFromLayout ( BLayout layout) [protected, virtual, inherited]

Hook method inherited from BLayoutItem, classes derived from BLayout must include the BLayout version of this method in their implementation.

Parameters:
layoutThe BLayout that this BLayout was detached from.

Reimplemented from BLayout.

virtual BRect BAbstractLayout::Frame ( ) [virtual, inherited]

Return the bounding frame of this item.

The returned BRect is in the coordinate system of the target view of the BLayout this item belongs to.

Implements BLayoutItem.

virtual void BGridLayout::GetColumnRowConstraints ( enum orientation orientation  ,
int32  index,
ColumnRowConstraints constraints 
) [protected, virtual]

Fill in the ColumnRowConstraints for a certain column or row in the BTwoDimensionalLayout.

This method is used to communicate the size constraints and weight for a given row/column in the BTwoDimensionalLayout.

Implements BTwoDimensionalLayout.

virtual void BTwoDimensionalLayout::GetHeightForWidth ( float  width,
float *  min,
float *  max,
float *  preferred 
) [virtual, inherited]

Get this BLayoutItem's height constraints for a given width.

If a BLayoutItem does not have height for width constraints (HasHeightForWidth() returns false) it does not need to implement this method.

Note:
It is prudent to compare min, max, preferred to NULL before dereferencing them.

Reimplemented from BLayoutItem.

void BTwoDimensionalLayout::GetInsets ( float *  left,
float *  top,
float *  right,
float *  bottom 
) const [inherited]

Get the insets for the BTwoDimensionalLayout (in pixels).

Passing NULL for any parameter is not an error, those parameters will be ignored.

See also:
BTwoDimensionalLayout::SetInsets();
virtual bool BTwoDimensionalLayout::HasHeightForWidth ( ) [virtual, inherited]

Returns whether or not this BLayoutItem's height constraints are dependent on its width.

Note:
By default, this method returns false.

Reimplemented from BLayoutItem.

virtual bool BGridLayout::HasMultiColumnItems ( ) [protected, virtual]

Tests whether or not this BTwoDimensionalLayout contains any BLayoutItem's spanning more than one column.

The BTwoDimensionalLayout implementation returns false.

Reimplemented from BTwoDimensionalLayout.

virtual bool BGridLayout::HasMultiRowItems ( ) [protected, virtual]

Tests whether or not this BTwoDimensionalLayout contains any BLayoutItem's spanning more than one row.

The BTwoDimensionalLayout implementation returns false.

Reimplemented from BTwoDimensionalLayout.

float BGridLayout::HorizontalSpacing ( ) const

Returns the spacing between columns for this layout.

Returns:
The spacing between columns for the layout.
int32 BLayout::IndexOfItem ( const BLayoutItem item) const [inherited]

Get the index of a BLayoutItem in this layout.

Parameters:
itemThe BLayoutItem whose index you want.
Return values:
-1item was not found in this BLayout.
int32 BLayout::IndexOfView ( BView child) const [inherited]

Get the index of child in this layout.

Note:
This finds the index of views added through BLayout::AddView(), not the index of an item which represents child that was added through BLayout::AddItem().
static BArchivable* BGridLayout::Instantiate ( BMessage archive) [static]

Static member to restore objects from messages.

You should always check that the archive argument actually corresponds to your class. The automatic functions, such as instantiate_object() and BUnarchiver::InstantiateObject() will not choose the wrong class but manual calls to this member might be faulty. You can verify that archive stores an object of your calss with the validate_instantiation() function.

Parameters:
archiveThe message with the data of the object to restore.
Return values:
Youshould return a pointer to the object you create with archive, or NULL if unarchival fails.
Warning:
The default implementation will always return NULL. Even though it is possible to store plain BArchivable objects, it is impossible to restore them.
See also:
instantiate_object(BMessage *from)
BUnarchiver::InstantiateObject()

Reimplemented from BArchivable.

virtual int32 BGridLayout::InternalCountColumns ( ) [protected, virtual]

Get the number of columns in the BTwoDimensionalLayout.

Returns:
The number of columns in the BTwoDimensionalLayout.

Implements BTwoDimensionalLayout.

virtual int32 BGridLayout::InternalCountRows ( ) [protected, virtual]

Get the number of rows in the BTwoDimensionalLayout.

Returns:
The number of rows in the BTwoDimensionalLayout.

Implements BTwoDimensionalLayout.

void BLayout::InvalidateLayout ( bool  children = false) [virtual, inherited]

Invalidate this layout and any cached data this layout has relating to positioning and sizing of its items.

Invalidating a BLayout also invalidates the view it is connected to (if there is one) and the BLayout this layout (or this BLayout's view) resides in.

Although this method is virtual, you should not override it, override the BLayout::LayoutInvalidated() hook instead.

This method should be called whenever the layout becomes invalid. This might happen if the size constraints of an item in this layout change, this layout is given more or less space than it previously had, or an object in this layout has had its InvalidateLayout() method called.

See also:
BView::InvalidateLayout(), BLayoutItem::InvalidateLayout(), BLayout::LayoutInvalidated()

Reimplemented from BLayoutItem.

virtual bool BAbstractLayout::IsVisible ( ) [virtual, inherited]

Return the current local visibility of this item. If an item is not visible, it will not be given space by the BLayout it resides in.

A simple implementation would return the last thing passed to SetVisible(). A more complex implementation may deal with a BView that could be hidden in any number of ways.

Implements BLayoutItem.

virtual bool BGridLayout::ItemAdded ( BLayoutItem item,
int32  atIndex 
) [protected, virtual]

Hook method called when item is added to this layout.

Parameters:
itemThe BLayoutItem that is being added.
atIndexThe index of the BLayoutItem.
Return values:
truesuccess
falsefailure, item will not be added.
Note:
This is a good time to allocate data for a BLayoutItem and attach it to item via BLayoutItem::SetLayoutData().

Reimplemented from BAbstractLayout.

virtual status_t BGridLayout::ItemArchived ( BMessage into,
BLayoutItem item,
int32  index 
) const [protected, virtual]

Hook for derived classes to add data specific to item to the into BMessage. item resides at index.

Note:
The same archive is passed to BLayout::ItemArchived() for all items, so any data added for each item will be stored in an array.

Reimplemented from BTwoDimensionalLayout.

virtual void BGridLayout::ItemRemoved ( BLayoutItem item,
int32  fromIndex 
) [protected, virtual]

Hook method called when item is removed from this layout.

Parameters:
itemThe BLayoutItem being removed.
fromIndexThe index where item used to reside.

When this hook is called, item is not yet completely removed. It can no longer be accessed with LayoutItemAt(), nor does it contribute to the value of CountItems(), but the item has not yet had its ItemDetached() hook called.

Note:
This is a good time to delete the data you've attached to item via BLayoutItem::SetLayoutData().

Reimplemented from BAbstractLayout.

virtual status_t BGridLayout::ItemUnarchived ( const BMessage from,
BLayoutItem item,
int32  index 
) [protected, virtual]

Hook for derived classes to retrieve data specific to item from the from BMessage. item resides at index.

Note:
The same archive is passed to BLayout::ItemArchived() for all items, so any data added for each item will be stored in an array. You should pass index to the BMessage methods you will be using in this method.

Reimplemented from BTwoDimensionalLayout.

BRect BLayout::LayoutArea ( ) [inherited]

Returns the on-screen area this layout has received to lay out its items in.

The return value is in the coordinate space of this BLayout's target view. If this BLayout is attached directly to a BView, then LayoutArea().LeftTop() == B_ORIGIN .

void * BLayoutItem::LayoutData ( ) const [inherited]

Retrieve arbitrary data attached to this BLayoutItem.

Note:
This method should only be called by a BLayout subclass.
virtual void BTwoDimensionalLayout::LayoutInvalidated ( bool  children = false) [protected, virtual, inherited]

Hook called from InvalidateLayout().

Override this method to clean out an cached layout info. It is good practice to recreate such info only on demand, eg when MinSize() or friends are called.

If children is true, then you should invalidate any information on child objects as well, and propagate the invalidation to them.

Reimplemented from BAbstractLayout.

void BLayout::LayoutItems ( bool  force = false) [inherited]

If there is no layout currently ongoing, and force is false, creates a new BLayoutContext and calls the DoLayout() method of this BLayout and any BLayout s nested in this BLayout.

This method also guarantees that the owner view of this layout (as returned by BLayout::Owner()) performs a layout as well (if it is suitable to do so).

Parameters:
forceForce the LayoutItems.
float BGridLayout::MaxColumnWidth ( int32  column) const

Returns the maximum width for column.

Parameters:
columnThe column to get the maximum width of.
Returns:
The maximum width for column as a float.
BSize BAbstractLayout::MaxSize ( ) [virtual, inherited]

Returns the maximum desirable size for this item.

The return value for this method is composed (using BLayoutUtils::ComposeSize()) from the values returned by BaseMaxSize() and ExplicitMaxSize().

Implements BLayoutItem.

float BGridLayout::MinColumnWidth ( int32  column) const

Returns the minimum width for column.

Parameters:
columnThe column to get the minimum width of.
Returns:
The minimum width for column as a float.
BSize BAbstractLayout::MinSize ( ) [virtual, inherited]

Returns the minimum desirable size for this item.

The return value for this method is composed (using BLayoutUtils::ComposeSize()) from the values returned by BaseMinSize() and ExplicitMinSize().

Implements BLayoutItem.

virtual void BAbstractLayout::OwnerChanged ( BView was) [protected, virtual, inherited]

Hook method called when this layout is attached to a BView.

Parameters:
wasThe previous owner of this BLayout, for new BLayout s, this will be NULL.

Reimplemented from BLayout.

BSize BAbstractLayout::PreferredSize ( ) [virtual, inherited]

Returns the preferred size for this item.

The return value for this method is composed (using BLayoutUtils::ComposeSize()) from the values returned by BasePreferredSize() and ExplicitPreferredSize().

Implements BLayoutItem.

void BTwoDimensionalLayout::PrepareItems ( enum orientation orientation  ) [protected, virtual, inherited]

Prepare the BLayoutItem in this BTwoDimensionalLayout subclass for layout within a certain orientation.

This is a good place to update cache information that will be used in other hook methods, for example.

Reimplemented in BGroupLayout.

void BLayout::Relayout ( bool  immediate = false) [virtual, inherited]

Request this BLayout to reposition and resize its items as required.

If immediate is false, and there is already a request to have the window this layout resides in re-laid-out, then the layout will happen at that time. If immediate is true, and there is no such pending request, nor is this BLayout's parent layout in the process of laying out its items, then this BLayout will now layout its items.

Parameters:
immediateWhether or not to Relayout immediately or wait for pending requests first.

Reimplemented from BLayoutItem.

bool BLayout::RemoveItem ( BLayoutItem item) [virtual, inherited]

Removes a BLayoutItem from this layout, and also removes the view it represents from this BLayout's target view.

Parameters:
itemThe BLayoutItem to be removed
Warning:
item is not deleted, you must delete it manually, or add it to another BLayout.
item->View(), even when it is removed from the target view, is not deleted. If you want it deleted, you must delete it yourself!
Return values:
truesuccess
falsefailure
BLayoutItem * BLayout::RemoveItem ( int32  index) [virtual, inherited]

Remove the BLayoutItem at index.

See also:
RemoveItem(BLayoutItem*)
Returns:
The BLayoutItem that was removed.
bool BLayout::RemoveView ( BView child) [virtual, inherited]

Removes and deletes all BLayoutItem representing a BView from this layout.

Parameters:
childThe BView to be removed.
Return values:
truesuccess
falsefailure
float BGridLayout::RowWeight ( int32  row) const

Returns the weight of the specified row.

Returns:
The weight of the row.
void BGridLayout::SetColumnWeight ( int32  column,
float  weight 
)

Set the weight for column to weight.

Parameters:
columnThe column to set.
weightThe weight to set.
virtual void BTwoDimensionalLayout::SetFrame ( BRect  frame) [virtual, inherited]

Set the bounding frame of this item.

frame is in the coordinate system of the target view of the BLayout that this item belongs to.

Reimplemented from BAbstractLayout.

void BGridLayout::SetHorizontalSpacing ( float  spacing)

Set the spacing between columns for this layout.

Parameters:
spacingThe number of pixels of spacing to set.
void BTwoDimensionalLayout::SetInsets ( float  left,
float  top,
float  right,
float  bottom 
) [inherited]

Set the insets for this BTwoDimensionalLayout (in pixels).

Set the spacing around the edges of this BTwoDimensionalLayout. If you pass B_USE_DEFAULT_SPACING for a certain parameter, that parameter will be replaced with the value returned by BControlLook::DefaultItemSpacing().

See also:
BTwoDimensionalLayout::GetInsets();
void BLayoutItem::SetLayoutData ( void *  data) [inherited]

Attach arbitrary data to this BLayoutItem.

Note:
This method should only be called by a BLayout subclass.
void BGridLayout::SetMaxColumnWidth ( int32  column,
float  width 
)

Sets the maximum width for column to width.

Parameters:
columnThe column to set the maximum width of.
widthThe width to set.
void BGridLayout::SetMinColumnWidth ( int32  column,
float  width 
)

Sets the minimum width for column to width.

Parameters:
columnThe column to set the minimum width of.
widthThe width to set.
void BGridLayout::SetRowWeight ( int32  row,
float  weight 
)

Set the weight for row to weight.

Parameters:
rowThe row number.
weightThe
void BGridLayout::SetSpacing ( float  horizontal,
float  vertical 
)

Set the spacing between columns and rows for this layout.

Parameters:
horizontalThe number of horizontal pixels of spacing to set.
verticalThe number of vertical pixels of spacing to set.
void BGridLayout::SetVerticalSpacing ( float  spacing)

Set the spacing between rows for this layout.

Parameters:
spacingThe number of pixels of spacing to set.
BView * BLayout::TargetView ( ) const [inherited]

Returns the target view of this layout.

The target view of a layout becomes the parent of any BView's in this layout, as well as the BView's returned by BLayoutItem::View() for each BLayoutItem in this layout.

float BGridLayout::VerticalSpacing ( ) const

Returns the spacing between rows for this layout.

Returns:
The spacing between rows for the layout.
void BLayout::VisibilityChanged ( bool  show) [protected, inherited]

Method to be called by derived classes in their SetVisible() implementation. Calls AncestorVisibilityChanged() on the items in this BLayout.

Parameters:
showtrue to show, false to hide.

The Haiku Book pre-R1 - BGridLayout Class Reference
Generated on Wed Jun 19 2013 by Doxygen 1.7.5.1