Public Member Functions | List of all members
SizePolicy Class Reference

The SizePolicy class is a layout attribute describing horizontal and vertical resizing policy. More...

#include <SizePolicy.h>

Public Member Functions

 SizePolicy ()
 Constructs a SizePolicy with SP_Fixed for both horizontal and vertical and a 0 Stretch Factor. More...
 
 SizePolicy (SizePolicyType horizontal, SizePolicyType vertical)
 Constructs a SizePolicy with the given horizontal and vertical values and a 0 Stretch Factor. More...
 
SizePolicyType GetHorizontal () const
 Gets the horizontal SizePolicyType. More...
 
SizePolicyType GetVertical () const
 Gets the vertical SizePolicyType. More...
 
bool IsNone () const
 Determines if both the horizontal and vertical SizePolicyTypes are SP_None. More...
 
void SetHorizontal (SizePolicyType horizontal)
 Sets the horizontal SizePolicyType. More...
 
void SetVertical (SizePolicyType vertical)
 Sets the vertical SizePolicyType. More...
 
LayoutOrientations GetExpandingOrientations () const
 Returns whether the associated item can make use of more space than GetDesiredSize(). More...
 
bool CanGrowHorizontally () const
 Determines if the associated item can grow horizontally. More...
 
bool CanGrowVertically () const
 Determines if the associated item can grow vertically. More...
 
bool CanShrinkHorizontally () const
 Determines if the associated item can shrink horizontally. More...
 
bool CanShrinkVertically () const
 Determines if the associated item can shrink vertically. More...
 
void SetHeightForWidth (bool b)
 Sets whether or not the associated item has a specific height for a given width. More...
 
bool HasHeightForWidth () const
 Determines whether or not the associated item has a specific height for a given width. More...
 
bool operator== (const SizePolicy &s) const
 Operator overload for == (equality test) More...
 
bool operator!= (const SizePolicy &s) const
 Operator overload for != (not equal test) More...
 
int GetHorizontalStretch () const
 Gets the horizontal stretch factor. More...
 
int GetVerticalStretch () const
 Gets the vertical stretch factor. More...
 
void SetHorizontalStretch (int s)
 Sets the horizontal stretch factor. More...
 
void SetVerticalStretch (int s)
 Sets the vertical stretch factor. More...
 
void Transpose ()
 Transposes the horizontal and vertical SizePolicyTypes and Stretch Factors. More...
 

Detailed Description

The SizePolicy class is a layout attribute describing horizontal and vertical resizing policy.

The size policy of a control is an expression of its willingness to be resized in various ways and affects how the control is treated by the layout engine. Each control returns a SizePolicy that describes the horizontal and vertical resizing policy it prefers when being laid out. You can change this for a specific control by calling the LayoutControl::SetSizePolicy method.

SizePolicy contains two independent SizePolicyType values and two stretch factors; one describes the control's horizontal size policy, and the other describes its vertical size policy. It also contains a flag to indicate whether the height and width of its preferred size are related.

The horizontal and vertical policies can be set in the constructor, and altered using the SetHorizontal() and SetVertical() methods. The stretch factors can be set using the SetHorizontalStretch() and SetVerticalStretch() functions. The flag indicating whether the control's recommended size is width-dependent (such as a menu bar or a word-wrapping label) can be set using the SetHeightForWidth() method.

The current size policies and stretch factors be may retrieved using the GetHorizontal(), GetVertical(), GetHorizontalStretch() and GetVerticalStretch() methods. Alternatively, use the Transpose() method to swap the horizontal and vertical policies and stretches. The HasHeightForWidth() method returns the current status of the flag indicating the recommended size dependencies.

Use the GetExpandingOrientations() method to determine whether the associated control can make use of more space than its GetDesiredSize() method indicates, as well as find out in which directions it can expand.

Constructor & Destructor Documentation

Constructs a SizePolicy with SP_Fixed for both horizontal and vertical and a 0 Stretch Factor.

SizePolicy ( SizePolicyType  horizontal,
SizePolicyType  vertical 
)

Constructs a SizePolicy with the given horizontal and vertical values and a 0 Stretch Factor.

Parameters
[in]horizontalthe horizontal SizePolicyType
[in]verticalthe vertical SizePolicyType

Member Function Documentation

bool CanGrowHorizontally ( ) const

Determines if the associated item can grow horizontally.

bool CanGrowVertically ( ) const

Determines if the associated item can grow vertically.

bool CanShrinkHorizontally ( ) const

Determines if the associated item can shrink horizontally.

bool CanShrinkVertically ( ) const

Determines if the associated item can shrink vertically.

LayoutOrientations GetExpandingOrientations ( ) const

Returns whether the associated item can make use of more space than GetDesiredSize().

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

SizePolicyType GetHorizontal ( ) const

Gets the horizontal SizePolicyType.

int GetHorizontalStretch ( ) const

Gets the horizontal stretch factor.

SizePolicyType GetVertical ( ) const

Gets the vertical SizePolicyType.

int GetVerticalStretch ( ) const

Gets the vertical stretch factor.

bool HasHeightForWidth ( ) const

Determines whether or not the associated item has a specific height for a given width.

bool IsNone ( ) const

Determines if both the horizontal and vertical SizePolicyTypes are SP_None.

bool operator!= ( const SizePolicy s) const

Operator overload for != (not equal test)

bool operator== ( const SizePolicy s) const

Operator overload for == (equality test)

void SetHeightForWidth ( bool  b)

Sets whether or not the associated item has a specific height for a given width.

void SetHorizontal ( SizePolicyType  horizontal)

Sets the horizontal SizePolicyType.

Parameters
[in]horizontalthe horizontal SizePolicyType
void SetHorizontalStretch ( int  s)

Sets the horizontal stretch factor.

void SetVertical ( SizePolicyType  vertical)

Sets the vertical SizePolicyType.

Parameters
[in]verticalthe vertical SizePolicyType
void SetVerticalStretch ( int  s)

Sets the vertical stretch factor.

void Transpose ( )

Transposes the horizontal and vertical SizePolicyTypes and Stretch Factors.


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

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