Factor out this function from GetMinSizeWithBorder() as it will be used for
max size too in a next commit.
See #11497.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72344
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
void DoSetSizer(wxSizer *sizer);
void DoSetSpacer(const wxSize& size);
+ // Add the border specified for this item to the given size
+ // if it's != wxDefaultSize, just return wxDefaultSize otherwise.
+ wxSize AddBorderToSize(const wxSize& size) const;
+
// discriminated union: depending on m_kind one of the fields is valid
enum
{
SetRatio(size);
}
+wxSize wxSizerItem::AddBorderToSize(const wxSize& size) const
+{
+ if (size == wxDefaultSize)
+ return size;
+
+ wxSize result = size;
+ if (m_flag & wxWEST)
+ result.x += m_border;
+ if (m_flag & wxEAST)
+ result.x += m_border;
+ if (m_flag & wxNORTH)
+ result.y += m_border;
+ if (m_flag & wxSOUTH)
+ result.y += m_border;
+ return result;
+}
+
wxSizerItem::wxSizerItem(int width,
int height,
int proportion,
wxSize wxSizerItem::GetMinSizeWithBorder() const
{
- wxSize ret = m_minSize;
-
- if (m_flag & wxWEST)
- ret.x += m_border;
- if (m_flag & wxEAST)
- ret.x += m_border;
- if (m_flag & wxNORTH)
- ret.y += m_border;
- if (m_flag & wxSOUTH)
- ret.y += m_border;
-
- return ret;
+ return AddBorderToSize(m_minSize);
}