Public Member Functions | List of all members
LayoutControl Class Referenceabstract

The LayoutControl class is the abstract base class of all user interface elements for layout manager purposes. More...

#include <LayoutControl.h>

Inheritance diagram for LayoutControl:
RefCounted< IRefCounted > IRefCounted GuiLayoutControl GuiLayoutHelper SplitterHandle GuiLayoutContainerPanel GuiLayoutLabel GuiLayoutSeparator GuiLayoutTabPageList GuiSplitterHandle

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...
 
LayoutControlGetParentControl () 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 LayoutManagerGetLayout () 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 LayoutManagerGetParentLayout () 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...
 
LayoutItemGetLayoutItem () const
 Gets the LayoutItem associated with this LayoutControl. 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
 

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 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:

Member Function Documentation

int GetBottomMargin ( ) const

Gets the bottom margin.

virtual BRect GetContentsRect ( ) const
virtual

Returns the area inside the control's margins.

virtual BSize GetDesiredMinimumSize ( ) const
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 BSize GetDesiredSize ( ) const
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 BRect GetGeometry ( ) const
virtual

Gets the Geometry property, which defines the rectangle within the parent control.

virtual int GetHeight ( ) const
virtual

Gets the height of the control.

virtual int GetHeightForWidth ( int  width) const
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.

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

Reimplemented in GuiLayoutTabPageList, GuiLayoutContainerPanel, and GuiLayoutLabel.

virtual LayoutManager* GetLayout ( ) const
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.

Parameters
[in]lmThe 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.

Parameters
[out]leftReceives the left margin
[out]topReceives the top margin
[out]rightReceives the right margin
[out]bottomReceives the bottom margin
virtual int GetMaximumHeight ( ) const
virtual

Returns the Control's maximum height.

virtual BSize GetMaximumSize ( ) const
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 int GetMaximumWidth ( ) const
virtual

Returns the Control's maximum width.

virtual int GetMinimumHeight ( ) const
virtual

Returns the Control's minimum height for layout management.

virtual BSize GetMinimumSize ( ) const
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 int GetMinimumWidth ( ) const
virtual

Returns the Control's minimum width for layout management.

LayoutControl* GetParentControl ( ) const

Returns the parent control of this control.

virtual LayoutManager* GetParentLayout ( ) const
virtual

Gets the LayoutManager controlling the size and position of this control.

virtual BPoint GetPosition ( ) const
virtual

Gets the position of the control within its parent control.

virtual BRect GetRect ( ) const
virtual

Gets the internal geometry of the control.

int GetRightMargin ( ) const

Gets the right margin.

virtual BSize GetSize ( ) const
virtual

Gets the size of the control.

virtual SizePolicyR GetSizePolicy ( ) const
virtual

Gets the SizePolicy, which is a layout attribute describing horizontal and vertical resizing policy.

virtual int GetSpacing ( LayoutSpacing  pm) const
virtual

Gets the Spacing property, which defines the distance between controls in a layout.

int GetTopMargin ( ) const

Gets the top margin.

virtual int GetWidth ( ) const
virtual

Gets the width of the control.

virtual int GetX ( ) const
virtual

Gets the X position of the control within its parent control.

virtual int GetY ( ) const
virtual

Gets the Y position of the control within its parent control.

virtual void Invalidate ( )
virtual

Invalidates the layout item then updates it.

virtual bool IsEnabled ( ) const
virtual

Determines if the LayoutControl is enabled.

virtual bool IsHidden ( ) const
virtual

Determines if the LayoutControl is hidden.

bool IsLaidOut ( ) const

Determines if the LayoutControl is laid out.

virtual bool IsVisible ( ) const
virtual

Determines if the LayoutControl is visible.

virtual bool IsWindow ( ) const
virtual

Determines if the LayoutControl is a Window.

virtual void Move ( const BPoint )
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 void Move ( int  x,
int  y 
)
virtual
virtual void Resize ( const BSize )
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 void Resize ( int  w,
int  h 
)
virtual
virtual void SetDirty ( )
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);

Parameters
[in]sizeThe 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.

Parameters
[in]widthThe new fixed width of the control
[in]heightThe new fixed height of the control
virtual void SetGeometry ( const BRect rect)
virtual

Sets the Geometry property, which defines the rectangle within the parent control.

Parameters
[in]rectThe 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.

Parameters
[in]xThe origin X of the rectangle defining the bounds of the control
[in]yThe origin Y of the rectangle defining the bounds of the control
[in]wThe width of the rectangle defining the bounds of the control
[in]hThe 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.

Parameters
[in]marginValue 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.

Parameters
[in]marginsContains 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.

Parameters
[in]leftThe left margin
[in]topThe top margin
[in]rightThe right margin
[in]bottomThe bottom margin
void SetMaximumHeight ( int  maxHeight)

Sets the Control's maximum height for layout management.

Parameters
[in]maxHeightthe new maximum height of the control
void SetMaximumSize ( const BSize maxSize)

Sets the Control's maximum size for layout management.

Parameters
[in]maxSizethe new maximum size of the control
void SetMaximumSize ( int  maxWidth,
int  maxHeight 
)

Sets the Control's maximum size for layout management.

Parameters
[in]maxWidththe new maximum width of the control
[in]maxHeightthe new maximum height of the control
void SetMaximumWidth ( int  maxWidth)

Sets the Control's maximum width for layout management.

Parameters
[in]maxWidththe new maximum width of the control
void SetMinimumHeight ( int  minHeight)

Sets the Control's minimum height for layout management.

Parameters
[in]minHeightthe new minimum height of the control
void SetMinimumSize ( const BSize minSize)

Sets the Control's minimum size for layout management.

Parameters
[in]minSizethe new minimum size of the control
void SetMinimumSize ( int  minWidth,
int  minHeight 
)

Sets the Control's minimum size for layout management.

Parameters
[in]minWidththe new minimum width of the control
[in]minHeightthe new minimum height of the control
void SetMinimumWidth ( int  minWidth)

Sets the Control's minimum width for layout management.

Parameters
[in]minWidththe new minimum width of the control
void SetParentControl ( LayoutControl parentCtl)

Sets the parent control of this control.

Parameters
[in]parentCtlThe 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.

Remarks
Note: LayoutManager::ItemSizeDoLayout() should be called after calling SetSize() to update the layout.
Parameters
[in]sizeThe new size of the control
void SetSizePolicy ( SizePolicy  sp)

Sets the SizePolicy, which is a layout attribute describing horizontal and vertical resizing policy.

Parameters
[in]spThe 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.

Parameters
[in]horizontalThe horizontal size policy
[in]verticalThe 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.

virtual void ShowIfNotHidden ( )
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 bool UseTrueRect ( ) const
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.


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

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