No real changes, just add wxSizerItem::AddBorderToSize() helper.

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
This commit is contained in:
Vadim Zeitlin
2012-08-15 23:34:22 +00:00
parent 054fdb68eb
commit 465de0be70
2 changed files with 22 additions and 12 deletions

View File

@@ -436,6 +436,10 @@ protected:
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
{

View File

@@ -207,6 +207,23 @@ void wxSizerItem::DoSetSpacer(const wxSize& size)
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,
@@ -397,18 +414,7 @@ wxSize wxSizerItem::CalcMin()
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);
}