Sizer
 All Classes Files Functions Variables Enumerations Enumerator Pages
Public Member Functions | Protected Attributes | List of all members
ISizer Class Referenceabstract

Abstract interface for Sizers. More...

#include <Sizer.h>

Inheritance diagram for ISizer:
BoxSizer EmptySizer FlowSizer GridSizer GroupboxSizer HAlignSizer OverlapSizer VAlignSizer WindowSizer

Public Member Functions

virtual void OnCalcSizes ()=0
 
virtual void OnRectChanged (int x, int y, int w, int h)=0
 
virtual size_t GetItemCount ()
 
virtual ISizerGetItem (size_t i)
 
void CalcSizes ()
 
SizerSize GetMinSize ()
 
void Move (int x, int y, int w, int h)
 
void Move (const SizerPoint &p, const SizerSize &s)
 
void Move (const SizerRect &r)
 
SizerRect GetRect () const
 
void WmSize (UINT type, int cx, int cy)
 
void WmGetMinMaxInfo (HWND window, MINMAXINFO *mmi)
 

Protected Attributes

bool dirty
 
SizerRect rect
 
SizerSize minimumSize
 

Detailed Description

Abstract interface for Sizers.

This class handles the stuff that must be done for every sizer. For example, delegating CalcSizes() calls to the items of a sizer. A new class just needs to override OnCalcSizes() and OnRectChanged() to be usable.

Member Function Documentation

void ISizer::CalcSizes ( )

Starts size calculation if the sizer is dirty.

Note
This function is Nullpointer-safe.
virtual ISizer* ISizer::GetItem ( size_t  i)
inlinevirtual
Parameters
iIndex of the sizer item to get. GetItemCount() returns the maximum for this index.

Reimplemented in FlowSizer, GridSizer, VAlignSizer, HAlignSizer, BoxSizer, OverlapSizer, and GroupboxSizer.

virtual size_t ISizer::GetItemCount ( )
inlinevirtual
Returns
Number of sizer items contained by this sizer. Used in conjunction with GetItem().

Reimplemented in FlowSizer, GridSizer, VAlignSizer, HAlignSizer, BoxSizer, OverlapSizer, and GroupboxSizer.

SizerSize ISizer::GetMinSize ( )
Returns
The minimum size that this sizer would like to have.
Note
This function is Nullpointer-safe.
SizerRect ISizer::GetRect ( ) const

Read-only access to current rect of the sizer.

Note
This function is Nullpointer-safe.
void ISizer::Move ( int  x,
int  y,
int  w,
int  h 
)

Moves the sizer and all its items.

Note
This function is Nullpointer-safe.
void ISizer::Move ( const SizerPoint p,
const SizerSize s 
)
inline
See Also
Move
void ISizer::Move ( const SizerRect r)
inline
See Also
Move
virtual void ISizer::OnCalcSizes ( )
pure virtual

Calculates sizes, but does not move the sizer in any way.

Note
ISizer::minimumSize should be calculated here, because that's the place where it makes sense.

Implemented in FlowSizer, GridSizer, VAlignSizer, HAlignSizer, BoxSizer, OverlapSizer, GroupboxSizer, WindowSizer, and EmptySizer.

virtual void ISizer::OnRectChanged ( int  x,
int  y,
int  w,
int  h 
)
pure virtual

Moves the sizer and all children.

This function will always be called, even if the sizer is not dirty.

Implemented in FlowSizer, GridSizer, VAlignSizer, HAlignSizer, BoxSizer, OverlapSizer, GroupboxSizer, WindowSizer, and EmptySizer.

void ISizer::WmGetMinMaxInfo ( HWND  window,
MINMAXINFO *  mmi 
)
inline

Handle the WM_GETMINMAXINFO message.

void ISizer::WmSize ( UINT  type,
int  cx,
int  cy 
)
inline

Handle the WM_SIZE message.

Member Data Documentation

bool ISizer::dirty
protected

CalcSizes() only does its work if the dirty flag is set. Subclasses should set the dirty flag when a parameter changes, e.g. a new sizer was added to a container, padding was changed, horizontal alignment was changed, etc.

SizerSize ISizer::minimumSize
protected

Minimum size as calculated in OnCalcSizes(). This is needed for the layout algorithm.

SizerRect ISizer::rect
protected

Current rect of the sizer. This is mainly used in Move() to check if the size of the sizer has changed.

Note
This value is updated by ISizer, so there is no need for subclasses to change it.

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