The LayoutControl class is the abstract base class of all user interface elements for layout manager purposes. More...
#include <LayoutControl.h>
Public Member Functions | |
virtual void | Move (const BPoint &)=0 |
The Move method is called by the LayoutManager to move the control to a new point. More... | |
virtual void | Move (int x, int y) |
virtual void | Resize (const BSize &)=0 |
The Resize method is called by the LayoutManager to resize the control. More... | |
virtual void | Resize (int w, int h) |
virtual void | ShowIfNotHidden ()=0 |
The ShowIfNotHidden method is called by the LayoutManager to show the control. More... | |
virtual BSize | GetDesiredSize () const |
Returns the recommended size for the control. More... | |
virtual BSize | GetDesiredMinimumSize () const |
Returns the recommended minimum size for the control. More... | |
virtual BSize | GetMinimumSize () const |
Returns the Control's minimum size for layout management. More... | |
virtual int | GetMinimumWidth () const |
Returns the Control's minimum width for layout management. More... | |
virtual int | GetMinimumHeight () const |
Returns the Control's minimum height for layout management. More... | |
void | SetMinimumSize (const BSize &minSize) |
Sets the Control's minimum size for layout management. More... | |
void | SetMinimumSize (int minWidth, int minHeight) |
Sets the Control's minimum size for layout management. More... | |
void | SetMinimumWidth (int minWidth) |
Sets the Control's minimum width for layout management. More... | |
void | SetMinimumHeight (int minHeight) |
Sets the Control's minimum height for layout management. More... | |
virtual BSize | GetMaximumSize () const |
Returns the Control's maximum size in pixels. More... | |
virtual int | GetMaximumWidth () const |
Returns the Control's maximum width. More... | |
virtual int | GetMaximumHeight () const |
Returns the Control's maximum height. More... | |
void | SetMaximumSize (const BSize &maxSize) |
Sets the Control's maximum size for layout management. More... | |
void | SetMaximumSize (int maxWidth, int maxHeight) |
Sets the Control's maximum size for layout management. More... | |
void | SetMaximumWidth (int maxWidth) |
Sets the Control's maximum width for layout management. More... | |
void | SetMaximumHeight (int maxHeight) |
Sets the Control's maximum height for layout management. More... | |
virtual int | GetHeightForWidth (int width) const |
Returns the preferred height for this control, given a certain width. More... | |
LayoutControl * | GetParentControl () const |
Returns the parent control of this control. More... | |
void | SetParentControl (LayoutControl *parentCtl) |
Sets the parent control of this control. More... | |
virtual BPoint | GetPosition () const |
Gets the position of the control within its parent control. More... | |
virtual int | GetX () const |
Gets the X position of the control within its parent control. More... | |
virtual int | GetY () const |
Gets the Y position of the control within its parent control. More... | |
virtual BSize | GetSize () const |
Gets the size of the control. More... | |
virtual int | GetWidth () const |
Gets the width of the control. More... | |
virtual int | GetHeight () const |
Gets the height of the control. More... | |
void | SetSize (const BSize &size) |
Sets the current size of the control. More... | |
virtual BRect | GetRect () const |
Gets the internal geometry of the control. More... | |
virtual BRect | GetContentsRect () const |
Returns the area inside the control's margins. More... | |
void | SetFixedSize (const BSize &size) |
Sets both the minimum and maximum sizes of the control to 'size', thereby preventing it from ever growing or shrinking. More... | |
void | SetFixedSize (int width, int height) |
Sets both the minimum and maximum sizes of the control to the given width and height, thereby preventing it from ever growing or shrinking. More... | |
virtual SizePolicyR | GetSizePolicy () const |
Gets the SizePolicy, which is a layout attribute describing horizontal and vertical resizing policy. More... | |
void | SetSizePolicy (SizePolicy sp) |
Sets the SizePolicy, which is a layout attribute describing horizontal and vertical resizing policy. More... | |
void | SetSizePolicy (SizePolicyType horizontal, SizePolicyType vertical) |
Sets the SizePolicy, which is a layout attribute describing horizontal and vertical resizing policy. More... | |
virtual LayoutManager * | GetLayout () const |
Gets the LayoutManager controlling the size and position of the contents of this control. More... | |
void | SetLayout (LayoutManager *layout) |
Sets the LayoutManager controlling the size and position of the contents of this control. More... | |
virtual LayoutManager * | GetParentLayout () const |
Gets the LayoutManager controlling the size and position of this control. More... | |
void | SetParentLayout (LayoutManager *layout) |
Sets the LayoutManager controlling the size and position of this control. More... | |
Margins | GetMargins () const |
Gets the Margins property, which defines the four margins around the control's rectangle. More... | |
void | GetMargins (int *left, int *top, int *right, int *bottom) const |
Gets the Margins values independently. More... | |
int | GetLeftMargin () const |
Gets the left margin. More... | |
int | GetRightMargin () const |
Gets the right margin. More... | |
int | GetTopMargin () const |
Gets the top margin. More... | |
int | GetBottomMargin () const |
Gets the bottom margin. More... | |
int | GetMargin (LayoutMargin lm) const |
Gets the appropriate margin, based on the given LayoutMargin. More... | |
void | SetMargin (int margin) |
Sets the Margins property, which defines the four margins around the control's rectangle. More... | |
void | SetMargins (const Margins &margins) |
Sets the Margins property, which defines the four margins around the control's rectangle. More... | |
void | SetMargins (int left, int top, int right, int bottom) |
Sets the Margins property, which defines the four margins around the control's rectangle. More... | |
virtual int | GetSpacing (LayoutSpacing pm) const |
Gets the Spacing property, which defines the distance between controls in a layout. More... | |
virtual BRect | GetGeometry () const |
Gets the Geometry property, which defines the rectangle within the parent control. More... | |
virtual void | SetGeometry (const BRect &rect) |
Sets the Geometry property, which defines the rectangle within the parent control. More... | |
void | SetGeometry (int x, int y, int w, int h) |
Sets the Geometry property, which defines the rectangle within the parent control. More... | |
void | UpdateGeometry () |
Notifies the layout system that this LayoutControl has changed and may need to change geometry. More... | |
void | UpdateGeometry (bool forceUpdate) |
Notifies the layout system that this LayoutControl has changed and may need to change geometry. More... | |
virtual void | Invalidate () |
Invalidates the layout item then updates it. More... | |
virtual void | SetDirty () |
Invalidates the layout item without updating it. More... | |
virtual bool | IsEnabled () const |
Determines if the LayoutControl is enabled. More... | |
void | SetEnabled (bool) |
Sets whether the LayoutControl is enabled. More... | |
virtual bool | IsHidden () const |
Determines if the LayoutControl is hidden. More... | |
void | SetHidden (bool) |
Sets whether the LayoutControl is hidden. More... | |
virtual bool | IsVisible () const |
Determines if the LayoutControl is visible. More... | |
void | SetVisible (bool) |
Sets whether the LayoutControl is visible. More... | |
bool | IsLaidOut () const |
Determines if the LayoutControl is laid out. More... | |
void | SetLaidOut (bool) |
Sets whether the LayoutControl is laid out. More... | |
virtual bool | IsWindow () const |
Determines if the LayoutControl is a Window. More... | |
void | SetIsWindow (bool) |
Sets whether the LayoutControl is a Window. More... | |
virtual bool | UseTrueRect () const |
Determines if the LayoutManager should use the parent control's geometry when resizing this control. More... | |
void | SetUseTrueRect (bool) |
Sets whether the LayoutManager should use the parent control's geometry when resizing this control. More... | |
bool | WasResized () const |
Determines if the LayoutControl has been resized. More... | |
LayoutItem * | GetLayoutItem () const |
Gets the LayoutItem associated with this LayoutControl. More... | |
![]() | |
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) | |
RefCounted & | operator= (RefCounted const &rhs) |
UInt32 | GetRefCount () const |
Additional Inherited Members | |
![]() | |
virtual | ~RefCounted () |
![]() | |
virtual | ~IRefCounted () |
void * | operator new (size_t size) |
void | operator delete (void *rawMemory, size_t size) |
The LayoutControl class is the abstract base class of all user interface elements for layout manager purposes.
UI technologies such as MDL and MFC should subclass LayoutControl as wrapper classes for their control and window types.
Subclasses must implement the following methods:
Most subclasses will override the following methods:
Some subclasses will override the following method(s):
Those subclasses wishing to recommend a certain height for a given width should call SizePolicy::SetHeightForWidth (true) and should override the following method:
int GetBottomMargin | ( | ) | const |
Gets the bottom margin.
|
virtual |
Returns the area inside the control's margins.
|
virtual |
Returns the recommended minimum size for the control.
If the value of this property is an invalid size, no minimum size is recommended.
The default implementation returns an invalid size. If there is no layout for this control, it returns the layout's minimum size.
LayoutManager will never resize a control to a size smaller than the recommended minimum size unless the minimum size is set or the size policy is set to SP_Ignore. If minimum size is set, the minimum recommended size will be ignored.
Reimplemented in GuiSplitterHandle, GuiLayoutTabPageList, GuiLayoutContainerPanel, and GuiLayoutControl.
|
virtual |
Returns the recommended size for the control.
If the value of this property is an invalid size, no size is recommended. The default implementation returns an invalid size. If there is no layout for this control, it returns the layout's preferred size.
Reimplemented in GuiLayoutSeparator, SplitterHandle, and GuiLayoutControl.
|
virtual |
Gets the Geometry property, which defines the rectangle within the parent control.
|
virtual |
Gets the height of the control.
|
virtual |
Returns the preferred height for this control, given a certain width.
If this control has a layout, the default implementation returns the layout's preferred height. If there is no layout, the default implementation returns -1 indicating that the preferred height does not depend on the width.
[in] | width | The width for which to retrieve the preferred height. |
Reimplemented in GuiLayoutTabPageList, GuiLayoutContainerPanel, and GuiLayoutLabel.
|
virtual |
Gets the LayoutManager controlling the size and position of the contents of this control.
LayoutItem* GetLayoutItem | ( | ) | const |
Gets the LayoutItem associated with this LayoutControl.
int GetLeftMargin | ( | ) | const |
Gets the left margin.
int GetMargin | ( | LayoutMargin | lm | ) | const |
Gets the appropriate margin, based on the given LayoutMargin.
[in] | lm | The LayoutMargin setting controlling which margin is retrieved |
Margins GetMargins | ( | ) | const |
Gets the Margins property, which defines the four margins around the control's rectangle.
void GetMargins | ( | int * | left, |
int * | top, | ||
int * | right, | ||
int * | bottom | ||
) | const |
Gets the Margins values independently.
[out] | left | Receives the left margin |
[out] | top | Receives the top margin |
[out] | right | Receives the right margin |
[out] | bottom | Receives the bottom margin |
|
virtual |
Returns the Control's maximum height.
|
virtual |
Returns the Control's maximum size in pixels.
The control cannot be resized to a larger size than the maximum control size.
By default, this property contains a size in which both width and height have values of LCONTROL_MAX_SIZE.
Reimplemented in GuiLayoutTabPageList, and GuiLayoutContainerPanel.
|
virtual |
Returns the Control's maximum width.
|
virtual |
Returns the Control's minimum height for layout management.
|
virtual |
Returns the Control's minimum size for layout management.
The control cannot be resized to a smaller size than the minimum control size. The control's size is forced to the minimum size if the current size is smaller.
The minimum size returned by this function will override the minimum size defined by LayoutManager. In order to unset the minimum size, use a value of {BSize(0, 0)}.
By default, this property contains a size with zero width and height.
Reimplemented in GuiSplitterHandle, GuiLayoutTabPageList, GuiLayoutContainerPanel, and GuiLayoutControl.
|
virtual |
Returns the Control's minimum width for layout management.
LayoutControl* GetParentControl | ( | ) | const |
Returns the parent control of this control.
|
virtual |
Gets the LayoutManager controlling the size and position of this control.
|
virtual |
Gets the position of the control within its parent control.
|
virtual |
Gets the internal geometry of the control.
int GetRightMargin | ( | ) | const |
Gets the right margin.
|
virtual |
Gets the size of the control.
|
virtual |
Gets the SizePolicy, which is a layout attribute describing horizontal and vertical resizing policy.
|
virtual |
Gets the Spacing property, which defines the distance between controls in a layout.
int GetTopMargin | ( | ) | const |
Gets the top margin.
|
virtual |
Gets the width of the control.
|
virtual |
Gets the X position of the control within its parent control.
|
virtual |
Gets the Y position of the control within its parent control.
|
virtual |
Invalidates the layout item then updates it.
|
virtual |
Determines if the LayoutControl is enabled.
|
virtual |
Determines if the LayoutControl is hidden.
bool IsLaidOut | ( | ) | const |
Determines if the LayoutControl is laid out.
|
virtual |
Determines if the LayoutControl is visible.
|
virtual |
Determines if the LayoutControl is a Window.
|
pure virtual |
The Move method is called by the LayoutManager to move the control to a new point.
The BPoint& version of this method must be overridden by a subclass.
Implemented in GuiSplitterHandle, GuiLayoutTabPageList, GuiLayoutContainerPanel, GuiLayoutLabel, GuiLayoutControl, and GuiLayoutHelper.
|
virtual |
|
pure virtual |
The Resize method is called by the LayoutManager to resize the control.
The BSize& version of this method must be overridden by a subclass.
Implemented in GuiSplitterHandle, GuiLayoutTabPageList, GuiLayoutContainerPanel, GuiLayoutLabel, GuiLayoutControl, and GuiLayoutHelper.
|
virtual |
|
virtual |
Invalidates the layout item without updating it.
void SetEnabled | ( | bool | ) |
Sets whether the LayoutControl is enabled.
void SetFixedSize | ( | const BSize & | size | ) |
Sets both the minimum and maximum sizes of the control to 'size', thereby preventing it from ever growing or shrinking.
This will override the default size constraints set by LayoutManager. To remove constraints, set the size to LCONTROL_MAX_SIZE. Alternatively, if you want the control to have a fixed size based on its contents, you can call LayoutManager::SetSizeConstraint(LayoutManager::SetFixedSize);
[in] | size | The new fixed size of the control |
void SetFixedSize | ( | int | width, |
int | height | ||
) |
Sets both the minimum and maximum sizes of the control to the given width and height, thereby preventing it from ever growing or shrinking.
[in] | width | The new fixed width of the control |
[in] | height | The new fixed height of the control |
|
virtual |
Sets the Geometry property, which defines the rectangle within the parent control.
[in] | rect | The new rectangle defining the bounds of the control |
Reimplemented in GuiSplitterHandle, GuiLayoutTabPageList, GuiLayoutContainerPanel, GuiLayoutLabel, GuiLayoutControl, and GuiLayoutHelper.
void SetGeometry | ( | int | x, |
int | y, | ||
int | w, | ||
int | h | ||
) |
Sets the Geometry property, which defines the rectangle within the parent control.
[in] | x | The origin X of the rectangle defining the bounds of the control |
[in] | y | The origin Y of the rectangle defining the bounds of the control |
[in] | w | The width of the rectangle defining the bounds of the control |
[in] | h | The height of the rectangle defining the bounds of the control |
void SetHidden | ( | bool | ) |
Sets whether the LayoutControl is hidden.
void SetIsWindow | ( | bool | ) |
Sets whether the LayoutControl is a Window.
void SetLaidOut | ( | bool | ) |
Sets whether the LayoutControl is laid out.
void SetLayout | ( | LayoutManager * | layout | ) |
Sets the LayoutManager controlling the size and position of the contents of this control.
void SetMargin | ( | int | margin | ) |
Sets the Margins property, which defines the four margins around the control's rectangle.
[in] | margin | Value used to set all four margins around the control's rectangle |
void SetMargins | ( | const Margins & | margins | ) |
Sets the Margins property, which defines the four margins around the control's rectangle.
[in] | margins | Contains the four margins around the control's rectangle |
void SetMargins | ( | int | left, |
int | top, | ||
int | right, | ||
int | bottom | ||
) |
Sets the Margins property, which defines the four margins around the control's rectangle.
[in] | left | The left margin |
[in] | top | The top margin |
[in] | right | The right margin |
[in] | bottom | The bottom margin |
void SetMaximumHeight | ( | int | maxHeight | ) |
Sets the Control's maximum height for layout management.
[in] | maxHeight | the new maximum height of the control |
void SetMaximumSize | ( | const BSize & | maxSize | ) |
Sets the Control's maximum size for layout management.
[in] | maxSize | the new maximum size of the control |
void SetMaximumSize | ( | int | maxWidth, |
int | maxHeight | ||
) |
Sets the Control's maximum size for layout management.
[in] | maxWidth | the new maximum width of the control |
[in] | maxHeight | the new maximum height of the control |
void SetMaximumWidth | ( | int | maxWidth | ) |
Sets the Control's maximum width for layout management.
[in] | maxWidth | the new maximum width of the control |
void SetMinimumHeight | ( | int | minHeight | ) |
Sets the Control's minimum height for layout management.
[in] | minHeight | the new minimum height of the control |
void SetMinimumSize | ( | const BSize & | minSize | ) |
Sets the Control's minimum size for layout management.
[in] | minSize | the new minimum size of the control |
void SetMinimumSize | ( | int | minWidth, |
int | minHeight | ||
) |
Sets the Control's minimum size for layout management.
[in] | minWidth | the new minimum width of the control |
[in] | minHeight | the new minimum height of the control |
void SetMinimumWidth | ( | int | minWidth | ) |
Sets the Control's minimum width for layout management.
[in] | minWidth | the new minimum width of the control |
void SetParentControl | ( | LayoutControl * | parentCtl | ) |
Sets the parent control of this control.
[in] | parentCtl | The new parent control of this control |
void SetParentLayout | ( | LayoutManager * | layout | ) |
Sets the LayoutManager controlling the size and position of this control.
void SetSize | ( | const BSize & | size | ) |
Sets the current size of the control.
[in] | size | The new size of the control |
void SetSizePolicy | ( | SizePolicy | sp | ) |
Sets the SizePolicy, which is a layout attribute describing horizontal and vertical resizing policy.
[in] | sp | The horizontal and vertical size policies |
void SetSizePolicy | ( | SizePolicyType | horizontal, |
SizePolicyType | vertical | ||
) |
Sets the SizePolicy, which is a layout attribute describing horizontal and vertical resizing policy.
[in] | horizontal | The horizontal size policy |
[in] | vertical | The vertical size policy |
void SetUseTrueRect | ( | bool | ) |
Sets whether the LayoutManager should use the parent control's geometry when resizing this control.
void SetVisible | ( | bool | ) |
Sets whether the LayoutControl is visible.
|
pure virtual |
The ShowIfNotHidden method is called by the LayoutManager to show the control.
This method must be overridden by a subclass.
Implemented in GuiSplitterHandle, GuiLayoutTabPageList, GuiLayoutContainerPanel, GuiLayoutLabel, GuiLayoutControl, and GuiLayoutHelper.
void UpdateGeometry | ( | ) |
Notifies the layout system that this LayoutControl has changed and may need to change geometry.
Call this function if the GetDesiredSize () or GetSizePolicy () have changed.
For explicitly hidden controls, UpdateGeometry () is a no-op. The layout system will be notified as soon as the LayoutControl is shown.
void UpdateGeometry | ( | bool | forceUpdate | ) |
Notifies the layout system that this LayoutControl has changed and may need to change geometry.
|
virtual |
Determines if the LayoutManager should use the parent control's geometry when resizing this control.
bool WasResized | ( | ) | const |
Determines if the LayoutControl has been resized.