#include <Pt/Forms/SizePolicy.h>

Constraint used when measuring a control. More...

Public Types

enum  Mode {
  Any = 0,
  Preferred = 1,
  Maximum = 2,
  Fixed = 3
}
 Constraint applied to one axis. More...
 

Public Member Functions

 SizePolicy ()
 Creates a policy with unconstrained axes.
 
 SizePolicy (Mode horizontal, Mode vertical)
 Creates a policy with horizontal and vertical modes.
 
Mode horizontal () const
 Returns the horizontal mode.
 
void setHorizontal (Mode m)
 Sets the horizontal mode to m.
 
Mode vertical () const
 Returns the vertical mode.
 
void setVertical (Mode m)
 Sets the vertical mode to m.
 
void setMode (Mode horizontal, Mode vertical)
 Sets both modes to horizontal and vertical.
 
const Gfx::SizeFsize () const
 Returns the size hint.
 
void setSize (const Gfx::SizeF &hint)
 Sets the size hint to hint.
 
void setSize (double w, double h)
 Sets the size hint to w by h.
 
double width () const
 Returns the width hint.
 
void setWidth (double w)
 Sets the width hint to w.
 
double height () const
 Returns the height hint.
 
void setHeight (double h)
 Sets the height hint to h.
 
bool operator== (const SizePolicy &s) const
 Returns true when both policies compare equal.
 
bool operator!= (const SizePolicy &s) const
 Returns true when the policies differ.
 

Detailed Description

A SizePolicy has a horizontal mode, a vertical mode, and an optional size hint. Control::measure() combines the parent policy with the control's own policy.

Member Enumeration Documentation

◆ Mode

enum Mode
Enumerator
Any 

The axis is not constrained by this policy.

Preferred 

The axis uses the preferred size.

Maximum 

The axis is capped by the policy size.

Fixed 

The axis uses the policy size.