Avoid claling FindToolByPositionWithPacking() needlessly

This is a micro-optimization after the previous commit: don't call
FindToolByPositionWithPacking() at all rather than calling it and then
ignoring its result if wxAUI_TB_NO_TOOLTIPS style is set.

This commit is best viewed ignoring whitespace.
This commit is contained in:
Vadim Zeitlin
2020-09-20 18:18:36 +02:00
parent 932b9ca62f
commit 466f72a16c

View File

@@ -2874,9 +2874,11 @@ void wxAuiToolBar::OnMotion(wxMouseEvent& evt)
SetHoverItem(hitItem); SetHoverItem(hitItem);
// tooltips handling // tooltips handling
if ( !HasFlag(wxAUI_TB_NO_TOOLTIPS) )
{
wxAuiToolBarItem* packingHitItem; wxAuiToolBarItem* packingHitItem;
packingHitItem = FindToolByPositionWithPacking(evt.GetX(), evt.GetY()); packingHitItem = FindToolByPositionWithPacking(evt.GetX(), evt.GetY());
if ( !HasFlag(wxAUI_TB_NO_TOOLTIPS) && packingHitItem ) if ( packingHitItem )
{ {
if (packingHitItem != m_tipItem) if (packingHitItem != m_tipItem)
{ {
@@ -2893,6 +2895,7 @@ void wxAuiToolBar::OnMotion(wxMouseEvent& evt)
UnsetToolTip(); UnsetToolTip();
m_tipItem = NULL; m_tipItem = NULL;
} }
}
// figure out the dropdown button state (are we hovering or pressing it?) // figure out the dropdown button state (are we hovering or pressing it?)
RefreshOverflowState(); RefreshOverflowState();