Add wxSizerFlags::Cent{er,re}{Vertical,Horizontal}().

Provide CentreVertical() and CentreHorizontal() methods in wxSizerFlags which
are useful for 2D sizers (for 1D ones just Centre() can be used anyhow).
This commit is contained in:
Vadim Zeitlin 2015-04-04 18:39:44 +02:00
parent 7e865daa26
commit 233a7fe77b
2 changed files with 44 additions and 0 deletions

View File

@ -78,6 +78,12 @@ public:
wxSizerFlags& Centre() { return Align(wxALIGN_CENTRE); }
wxSizerFlags& Center() { return Centre(); }
wxSizerFlags& CentreVertical() { return Align(wxALIGN_CENTRE_VERTICAL); }
wxSizerFlags& CenterVertical() { return CentreVertical(); }
wxSizerFlags& CentreHorizontal() { return Align(wxALIGN_CENTRE_HORIZONTAL); }
wxSizerFlags& CenterHorizontal() { return CentreHorizontal(); }
wxSizerFlags& Top()
{
m_flags &= ~(wxALIGN_BOTTOM | wxALIGN_CENTRE_VERTICAL);

View File

@ -1393,6 +1393,44 @@ public:
*/
wxSizerFlags& Centre();
/**
Same as CentreHorizontal().
@since 3.1.0
*/
wxSizerFlags& CenterHorizontal();
/**
Same as CentreVertical().
@since 3.1.0
*/
wxSizerFlags& CenterVertical();
/**
Center an item only in horizontal direction.
This is mostly useful for 2D sizers as for the 1D ones it is shorter to
just use Centre() as the alignment is only used in one direction with
them anyhow. For 2D sizers, centering an item in one direction is quite
different from centering it in both directions however.
@see CentreVertical()
@since 3.1.0
*/
wxSizerFlags& CentreHorizontal();
/**
Center an item only in vertical direction.
The remarks in CentreHorizontal() documentation also apply to this
function.
@since 3.1.0
*/
wxSizerFlags& CentreVertical();
/**
Sets the border in the given @a direction having twice the default
border size.