From 233a7fe77bd9d83a9735ad50c615e1e58e98588c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 4 Apr 2015 18:39:44 +0200 Subject: [PATCH] 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). --- include/wx/sizer.h | 6 ++++++ interface/wx/sizer.h | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/include/wx/sizer.h b/include/wx/sizer.h index f2c560d788..9f66369ce4 100644 --- a/include/wx/sizer.h +++ b/include/wx/sizer.h @@ -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); diff --git a/interface/wx/sizer.h b/interface/wx/sizer.h index d9ecb7acd0..a6e694d2a0 100644 --- a/interface/wx/sizer.h +++ b/interface/wx/sizer.h @@ -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.