## wxSizerFlags

Normally, when you add an item to a sizer via wxSizer::Add, you have to specify a lot of flags and parameters which can be unwieldy. This is where wxSizerFlags comes in: it allows you to specify all parameters using the named methods instead. For example, instead of

        sizer->Add(ctrl, 0, wxEXPAND | wxBORDER, 10);

you can now write

        sizer->Add(ctrl, wxSizerFlags().Expand().Border(10));

This is more readable and also allows you to create wxSizerFlags objects which can be reused for several sizer items.

        wxSizerFlags flagsExpand(1);
        flagsExpand.Expand().Border(10);

        sizer->Add(ctrl1, flagsExpand);
        sizer->Add(ctrl2, flagsExpand);

Note that by specification, all methods of wxSizerFlags return the wxSizerFlags object itself to allowing chaining multiple methods calls like in the examples above.

wxSizerFlags::wxSizerFlags
wxSizerFlags::Align
wxSizerFlags::Border
wxSizerFlags::Center
wxSizerFlags::Centre
wxSizerFlags::DoubleBorder
wxSizerFlags::DoubleHorzBorder
wxSizerFlags::Expand
wxSizerFlags::GetDefaultBorder
wxSizerFlags::Left
wxSizerFlags::FixedMinSize
wxSizerFlags::Proportion
wxSizerFlags::ReserveSpaceEvenIfHidden
wxSizerFlags::Right
wxSizerFlags::Shaped
wxSizerFlags::TripleBorder

### wxSizerFlags::wxSizerFlags

wxSizerFlags(int proportion = 0)

Creates the wxSizer with the proportion specified by proportion.

### wxSizerFlags::Align

wxSizerFlags& Align(int align = 0)

Sets the alignment of this wxSizerFlags to align.

Note that if this method is not called, the wxSizerFlags has no specified alignment.

See also

Left,
Right,
Centre

### wxSizerFlags::Border

wxSizerFlags& Border(int direction, int borderinpixels)

wxSizerFlags& Border(int direction = wxALL)

Sets the wxSizerFlags to have a border of a number of pixels specified by borderinpixels with the directions specified by direction.

In the overloaded version without borderinpixels parameter, the border of default size, as returned by GetDefaultBorder, is used.

### wxSizerFlags::Center

wxSizerFlags& Center()

Sets the object of the wxSizerFlags to center itself in the area it is given.

### wxSizerFlags::Centre

wxSizerFlags& Centre()

wxSizerFlags::Center for people with the other dialect of english.

### wxSizerFlags::DoubleBorder

wxSizerFlags& DoubleBorder(int direction = wxALL)

Sets the border in the given direction having twice the default border size.

### wxSizerFlags::DoubleHorzBorder

wxSizerFlags& DoubleHorzBorder()

Sets the border in left and right directions having twice the default border size.

### wxSizerFlags::Expand

wxSizerFlags& Expand()

Sets the object of the wxSizerFlags to expand to fill as much area as it can.

### wxSizerFlags::GetDefaultBorder

static int GetDefaultBorder()

Returns the border used by default in Border method.

### wxSizerFlags::Left

wxSizerFlags& Left()

Aligns the object to the left, shortcut for `Align(wxALIGN_LEFT)`

See also

Align

### wxSizerFlags::FixedMinSize

wxSizerFlags& FixedMinSize()

Set the `wxFIXED_MINSIZE` flag which indicates that the initial size of the window should be also set as its minimal size.

### wxSizerFlags::Proportion

wxSizerFlags& Proportion(int proportion = 0)

Sets the proportion of this wxSizerFlags to proportion

### wxSizerFlags::ReserveSpaceEvenIfHidden

wxSizerFlags& ReserveSpaceEvenIfHidden()

Set the `wxRESERVE_SPACE_EVEN_IF_HIDDEN` flag. Normally wxSizers don't allocate space for hidden windows or other items. This flag overrides this behavior so that sufficient space is allocated for the window even if it isn't visible. This makes it possible to dynamically show and hide controls without resizing parent dialog, for example. This function is new since wxWidgets version 2.8.8

### wxSizerFlags::Right

wxSizerFlags& Right()

Aligns the object to the right, shortcut for `Align(wxALIGN_RIGHT)`

See also

Align

### wxSizerFlags::Shaped

wxSizerFlags& Shaped()

Set the `wx_SHAPED` flag which indicates that the elements should always keep the fixed width to height ratio equal to its original value.

### wxSizerFlags::TripleBorder

wxSizerFlags& TripleBorder(int direction = wxALL)

Sets the border in the given direction having thrice the default border size.