The BGridLayout class a BLayout subclass that arranges the items it holds in a grid. More...
Inherits BTwoDimensionalLayout.
Public Member Functions | |
BGridLayout (BMessage *from) | |
Archive constructor. | |
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. | |
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 (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 bool | AddItem (int32 index, BLayoutItem *item) |
BGridLayout::AddItem(BLayoutItem*) | |
virtual BLayoutItem * | AddView (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 BLayoutItem * | AddView (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 . | |
virtual BLayoutItem * | AddView (int32 index, BView *child) |
BGridLayout::AddView(BView*) | |
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. | |
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. | |
float | HorizontalSpacing () const |
Returns the spacing between columns for this layout. | |
BLayoutItem * | ItemAt (int32 column, int32 row) const |
Get a pointer to the item at the requested cell in the grid. | |
float | MaxColumnWidth (int32 column) const |
Returns the maximum width for column. | |
float | MaxRowHeight (int32 row) const |
Returns the maximum height for row. | |
float | MinColumnWidth (int32 column) const |
Returns the minimum width for column. | |
float | MinRowHeight (int row) const |
Returns the minimum height for row. | |
virtual status_t | Perform (perform_code d, void *arg) |
Perform some action (Internal method defined for binary compatibility purposes). | |
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. | |
void | SetHorizontalSpacing (float spacing) |
Set the spacing between columns for this layout. | |
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 of 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. | |
float | VerticalSpacing () const |
Returns the spacing between rows for this layout. | |
Public Member Functions inherited from BTwoDimensionalLayout | |
BTwoDimensionalLayout () | |
Create an empty layout. | |
BTwoDimensionalLayout (BMessage *from) | |
Unarchive constructor. | |
virtual | ~BTwoDimensionalLayout () |
Destructor. | |
void | AlignLayoutWith (BTwoDimensionalLayout *other, orientation orientation) |
Align the BLayoutItem's in the specified orientation within two or more BTwoDimensionalLayout's. | |
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. | |
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. | |
virtual status_t | Perform (perform_code d, void *arg) |
Perform some action (Internal method defined for binary compatibility purposes). | |
virtual void | SetFrame (BRect frame) |
Set the bounding frame of this item. | |
void | SetInsets (float horizontal, float vertical) |
Set the insets for this layout. | |
void | SetInsets (float insets) |
Set the insets for this layout. | |
void | SetInsets (float left, float top, float right, float bottom) |
Set the insets for this layout. | |
Public Member Functions inherited from BAbstractLayout | |
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 BRect | Frame () |
Return the bounding frame of this item. | |
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. | |
virtual BSize | MaxSize () |
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 () |
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. | |
virtual void | SetVisible (bool visible) |
Set the local visibility of this item. | |
BAbstractLayout () | |
Construct a BAbstractLayout. | |
BAbstractLayout (BMessage *from) | |
Archive constructor. | |
Public Member Functions inherited from BLayout | |
BLayout () | |
Default constructor. | |
BLayout (BMessage *archive) | |
Archive constructor. | |
virtual | ~BLayout () |
Destructor, deletes all BLayoutItem's that this layout manages, and detaches from this BLayout's owner view if there is one. | |
virtual status_t | Perform (perform_code d, void *arg) |
Perform some action (Internal method defined for binary compatibility purposes). | |
BView * | Owner () const |
Returns the Owner of this layout, i.e. the view this layout manages. | |
BView * | TargetView () const |
Returns the target view of this layout. | |
virtual BView * | View () |
Returns the same BView* as BLayout::Owner(), this method is inherited from BLayoutItem. | |
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 BLayoutItem * | RemoveItem (int32 index) |
Remove the BLayoutItem at index. | |
BLayoutItem * | ItemAt (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. | |
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. | |
BLayoutContext * | LayoutContext () const |
Returns the BLayoutContext this BLayout is currently operating in, or NULL . | |
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. | |
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. | |
Public Member Functions inherited from BLayoutItem | |
BLayoutItem (BMessage *from) | |
Archive constructor. | |
virtual status_t | Archive (BMessage *into, bool deep=true) const |
Archive the object into a BMessage. | |
BLayout * | Layout () const |
Returns the BLayout this BLayoutItem resides in. | |
virtual status_t | Perform (perform_code d, void *arg) |
Perform some action (Internal method defined for binary compatibility purposes). | |
bool | RemoveSelf () |
Remove this layout item from the BLayout it is a part of. | |
virtual BView * | View () |
Return the BView this item is representing, or NULL if it does not represent any view. | |
void | SetExplicitSize (BSize size) |
Set the explicity size to size. | |
void | AlignInFrame (BRect frame) |
Position this BLayoutItem within frame, given the value returned by Alignment(), and the size constraints for this item. | |
void * | LayoutData () const |
Retrieve arbitrary data attached to this BLayoutItem. | |
void | SetLayoutData (void *data) |
Attach arbitrary data to this BLayoutItem. | |
Public Member Functions inherited from BArchivable | |
BArchivable () | |
Constructor. Does nothing. | |
BArchivable (BMessage *from) | |
Constructor. Does important behind-the-scenes work in the unarchiving process. | |
virtual | ~BArchivable () |
Destructor. Does nothing. | |
virtual status_t | AllArchived (BMessage *archive) const |
Method relating to the use of BArchiver . | |
virtual status_t | AllUnarchived (const BMessage *archive) |
Method relating to the use of BUnarchiver . | |
virtual status_t | Archive (BMessage *into, bool deep=true) const |
Archive the object into a BMessage. | |
virtual status_t | Perform (perform_code d, void *arg) |
Perform some action (Internal method defined for binary compatibility purposes). | |
Static Public Member Functions | |
static BArchivable * | Instantiate (BMessage *from) |
Instantiate the layout from the message from. | |
Static Public Member Functions inherited from BArchivable | |
static BArchivable * | Instantiate (BMessage *archive) |
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 | GetColumnRowConstraints (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. | |
Protected Member Functions inherited from BTwoDimensionalLayout | |
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 | DoLayout () |
Implemented by derived classes to position and resize the items in 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 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) |
BSize | AddInsets (BSize size) |
Add the size to all the insets for this layout. | |
void | AddInsets (float *minHeight, float *maxHeight, float *preferredHeight) |
Add to the insets, and store the modified values. | |
BSize | SubtractInsets (BSize size) |
Substract the size from all the insets for this layout. | |
virtual void | PrepareItems (orientation orientation) |
Prepare the BLayoutItem in this BTwoDimensionalLayout subclass for layout within a certain orientation. | |
Protected Member Functions inherited from BAbstractLayout | |
virtual status_t | AllArchived (BMessage *archive) 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 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) |
virtual void | OwnerChanged (BView *was) |
Hook method called when this layout is attached to a BView. | |
Protected Member Functions inherited from BLayout | |
virtual status_t | AllArchived (BMessage *archive) const |
Method relating to the use of BArchiver . | |
void | VisibilityChanged (bool show) |
Method to be called by derived classes in their SetVisible() implementation. Calls AncestorVisibilityChanged() on the items in this BLayout. | |
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. | |
virtual status_t | AllArchived (BMessage *into) const |
Method relating to the use of BArchiver . | |
virtual status_t | AllUnarchived (const BMessage *from) |
Method relating to the use of BUnarchiver . | |
Hook methods |
Additional Inherited Members | |
Protected Attributes inherited from BTwoDimensionalLayout | |
float | fLeftInset |
The current left inset for this layout. | |
float | fRightInset |
The current right inset for this layout. | |
float | fTopInset |
The current top inset for this layout. | |
float | fBottomInset |
The current bottom inset for this layout. | |
float | fHSpacing |
the current horizontal spacing between columns for this layout. | |
float | fVSpacing |
The current vertical spacing between rows for this layout. | |
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.
BGridLayout::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::BGridLayout | ( | BMessage * | from | ) |
|
virtual |
Destructor method.
Standard Destructor.
|
virtual |
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.
Reimplemented from BLayout.
|
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.
|
virtual |
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.
Reimplemented from BLayout.
|
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.
|
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.
Reimplemented from BTwoDimensionalLayout.
Unarchives the BLayoutItem's for this layout, calling ItemUnarchived() for each one.
Reimplemented from BTwoDimensionalLayout.
Archives this layout into archive. If deep is true, also archives the items in this layout, calling ItemArchived() for each one.
Reimplemented from BTwoDimensionalLayout.
float BGridLayout::ColumnWeight | ( | int32 | column | ) | const |
Returns the weight for the specified column.
int32 BGridLayout::CountColumns | ( | ) | const |
Returns the number of active columns in this layout.
int32 BGridLayout::CountRows | ( | ) | const |
Returns the number of active rows in this layout.
|
protectedvirtual |
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.
|
protectedvirtual |
Tell the base class what column and row a BLayoutItem is in as well as how many columns and rows it covers.
Implements BTwoDimensionalLayout.
|
protectedvirtual |
Tests whether or not this BTwoDimensionalLayout contains any BLayoutItem's spanning more than one column.
The BTwoDimensionalLayout implementation returns false.
Reimplemented from BTwoDimensionalLayout.
|
protectedvirtual |
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.
|
static |
Instantiate the layout from the message from.
|
protectedvirtual |
Get the number of columns in the BTwoDimensionalLayout.
Implements BTwoDimensionalLayout.
|
protectedvirtual |
Get the number of rows in the BTwoDimensionalLayout.
Implements BTwoDimensionalLayout.
|
protectedvirtual |
Hook method called when item is added to this layout.
item | The BLayoutItem that is being added. |
atIndex | The index of the BLayoutItem. |
true
on succcess, false if item will not be added.Reimplemented from BAbstractLayout.
|
protectedvirtual |
Hook for derived classes to add data specific to item to the into BMessage. item resides at index.
Reimplemented from BTwoDimensionalLayout.
BLayoutItem * BGridLayout::ItemAt | ( | int32 | column, |
int32 | row | ||
) | const |
Get a pointer to the item at the requested cell in the grid.
column | The column, starting with 0 for the leftmost column. Note that the value should be 0 or higher. |
row | The row, starting with 0 for the topmost row. Note that the value should be 0 or higher. |
NULL
if there is no item.
|
protectedvirtual |
Hook method called when item is removed from this layout.
item | The BLayoutItem being removed. |
fromIndex | The 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.
Reimplemented from BAbstractLayout.
|
protectedvirtual |
Hook for derived classes to retrieve data specific to item from the from BMessage. item resides at index.
Reimplemented from BTwoDimensionalLayout.
float BGridLayout::MaxColumnWidth | ( | int32 | column | ) | const |
Returns the maximum width for column.
column | The column to get the maximum width of. |
float BGridLayout::MaxRowHeight | ( | int32 | row | ) | const |
Returns the maximum height for row.
float BGridLayout::MinColumnWidth | ( | int32 | column | ) | const |
Returns the minimum width for column.
column | The column to get the minimum width of. |
float BGridLayout::MinRowHeight | ( | int | row | ) | const |
Returns the minimum height for row.
|
virtual |
Perform some action (Internal method defined for binary compatibility purposes).
Reimplemented from BTwoDimensionalLayout.
float BGridLayout::RowWeight | ( | int32 | row | ) | const |
Returns the weight of the specified row.
void BGridLayout::SetColumnWeight | ( | int32 | column, |
float | weight | ||
) |
Set the weight for column to weight.
column | The column to set. |
weight | The weight to set. |
void BGridLayout::SetHorizontalSpacing | ( | float | spacing | ) |
Set the spacing between columns for this layout.
spacing | The number of pixels of spacing to set. |
void BGridLayout::SetMaxColumnWidth | ( | int32 | column, |
float | width | ||
) |
Sets the maximum width for column to width.
column | The column to set the maximum width of. |
width | The width to set. |
void BGridLayout::SetMaxRowHeight | ( | int32 | row, |
float | height | ||
) |
Sets the maximum height for row to width.
void BGridLayout::SetMinColumnWidth | ( | int32 | column, |
float | width | ||
) |
Sets the minimum width for column to width.
column | The column to set the minimum width of. |
width | The width to set. |
void BGridLayout::SetMinRowHeight | ( | int32 | row, |
float | height | ||
) |
Sets the minimum height for row to width.
void BGridLayout::SetRowWeight | ( | int32 | row, |
float | weight | ||
) |
Set the weight of row to weight.
row | The row number. |
weight | The weight to set. |
void BGridLayout::SetSpacing | ( | float | horizontal, |
float | vertical | ||
) |
Set the spacing between columns and rows for this layout.
horizontal | The number of horizontal pixels of spacing to set. |
vertical | The number of vertical pixels of spacing to set. |
void BGridLayout::SetVerticalSpacing | ( | float | spacing | ) |
Set the spacing between rows for this layout.
spacing | The number of pixels of spacing to set. |
float BGridLayout::VerticalSpacing | ( | ) | const |
Returns the spacing between rows for this layout.