Don't compute unnecessary hint sizes in unsupported direction

For the toolbars locked in one direction there is no need to compute the
hint size in the other one, so don't bother calling RealizeHelper() for
the non-current orientation in this case.

This is just a small optimization.
This commit is contained in:
Vadim Zeitlin 2023-12-25 21:52:01 +01:00
parent 7ea528b280
commit 438e216236

View file

@ -1875,19 +1875,24 @@ bool wxAuiToolBar::Realize()
if (!dc.IsOk())
return false;
// calculate hint sizes for both horizontal and vertical orientations and
// calculate hint sizes for both horizontal and vertical orientations if we
// can use them, i.e. if the toolbar isn't locked into just one of them, and
// store the size appropriate for the current orientation in this variable.
wxSize size;
if (m_orientation == wxHORIZONTAL)
{
m_vertHintSize = RealizeHelper(dc, wxVERTICAL);
if (!HasFlag(wxAUI_TB_HORIZONTAL))
m_vertHintSize = RealizeHelper(dc, wxVERTICAL);
m_horzHintSize = RealizeHelper(dc, wxHORIZONTAL);
size = m_horzHintSize;
}
else
{
m_horzHintSize = RealizeHelper(dc, wxHORIZONTAL);
if (!HasFlag(wxAUI_TB_VERTICAL))
m_horzHintSize = RealizeHelper(dc, wxHORIZONTAL);
m_vertHintSize = RealizeHelper(dc, wxVERTICAL);
size = m_vertHintSize;