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:
@@ -436,6 +436,10 @@ protected:
|
|||||||
void DoSetSizer(wxSizer *sizer);
|
void DoSetSizer(wxSizer *sizer);
|
||||||
void DoSetSpacer(const wxSize& size);
|
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
|
// discriminated union: depending on m_kind one of the fields is valid
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@@ -207,6 +207,23 @@ void wxSizerItem::DoSetSpacer(const wxSize& size)
|
|||||||
SetRatio(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,
|
wxSizerItem::wxSizerItem(int width,
|
||||||
int height,
|
int height,
|
||||||
int proportion,
|
int proportion,
|
||||||
@@ -397,18 +414,7 @@ wxSize wxSizerItem::CalcMin()
|
|||||||
|
|
||||||
wxSize wxSizerItem::GetMinSizeWithBorder() const
|
wxSize wxSizerItem::GetMinSizeWithBorder() const
|
||||||
{
|
{
|
||||||
wxSize ret = m_minSize;
|
return AddBorderToSize(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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user