Smooth out redrawing of toolbars by not letting wx pointlessly calculate both orientations

Monkey patch

Fix #5705
This commit is contained in:
Marek Roszko
2020-11-05 20:56:14 -05:00
parent 670fc645de
commit 08ca80a2d8
10 changed files with 90 additions and 28 deletions
+51
View File
@@ -699,3 +699,54 @@ void ACTION_TOOLBAR::OnCustomRender(wxDC& aDc, const wxAuiToolBarItem& aItem,
aDc.DrawPolygon( &points );
}
bool ACTION_TOOLBAR::KiRealize()
{
wxClientDC dc( this );
if( !dc.IsOk() )
return false;
// calculate hint sizes for both horizontal and vertical
// in the order that leaves toolbar in correct final state
// however, skip calculating alternate orientations if we dont need them due to window style
bool retval = true;
if( m_orientation == wxHORIZONTAL )
{
if( !( GetWindowStyle() & wxAUI_TB_HORIZONTAL ) )
{
m_vertHintSize = GetSize();
retval = RealizeHelper( dc, false );
}
if( retval && RealizeHelper( dc, true ) )
{
m_horzHintSize = GetSize();
}
else
{
retval = false;
}
}
else
{
if( !( GetWindowStyle() & wxAUI_TB_VERTICAL ) )
{
m_horzHintSize = GetSize();
retval = RealizeHelper( dc, true );
}
if( retval && RealizeHelper( dc, false ) )
{
m_vertHintSize = GetSize();
}
else
{
retval = false;
}
}
Refresh( false );
return retval;
}