Fix wxRibbon tooltips: show them only once and not over dropdown
Don't update wxRibbonToolBar and wxRibbonButtonBar tooltips each time the mouse was moved, this was inconsistent with the standard tooltips behaviour and resulted in flicker. Also don't show tooltips at all over a dropdown, as they partially covered and, again, such behaviour is very non-standard. Closes https://github.com/wxWidgets/wxWidgets/pull/2162
This commit is contained in:
committed by
Vadim Zeitlin
parent
b980e2e859
commit
ca4acfdffa
@@ -1298,7 +1298,9 @@ void wxRibbonButtonBar::OnMouseMove(wxMouseEvent& evt)
|
||||
}
|
||||
if(tooltipButton)
|
||||
{
|
||||
SetToolTip(tooltipButton->base->help_string);
|
||||
if (tooltipButton != m_hovered_button &&
|
||||
!(tooltipButton->size & wxRIBBON_BUTTONBAR_BUTTON_DROPDOWN_ACTIVE))
|
||||
SetToolTip(tooltipButton->base->help_string);
|
||||
}
|
||||
#else
|
||||
wxUnusedVar(tooltipButton);
|
||||
@@ -1372,9 +1374,14 @@ void wxRibbonButtonBar::OnMouseDown(wxMouseEvent& evt)
|
||||
cursor -= btn_rect.GetTopLeft();
|
||||
long state = 0;
|
||||
if(size.normal_region.Contains(cursor))
|
||||
{
|
||||
state = wxRIBBON_BUTTONBAR_BUTTON_NORMAL_ACTIVE;
|
||||
}
|
||||
else if(size.dropdown_region.Contains(cursor))
|
||||
{
|
||||
state = wxRIBBON_BUTTONBAR_BUTTON_DROPDOWN_ACTIVE;
|
||||
UnsetToolTip();
|
||||
}
|
||||
instance.base->state |= state;
|
||||
Refresh(false);
|
||||
break;
|
||||
|
@@ -1078,7 +1078,9 @@ void wxRibbonToolBar::OnMouseMove(wxMouseEvent& evt)
|
||||
#if wxUSE_TOOLTIPS
|
||||
if(new_hover)
|
||||
{
|
||||
SetToolTip(new_hover->help_string);
|
||||
if (new_hover != m_hover_tool &&
|
||||
!(new_hover->state & wxRIBBON_TOOLBAR_TOOL_DROPDOWN_ACTIVE))
|
||||
SetToolTip(new_hover->help_string);
|
||||
}
|
||||
else if(GetToolTip())
|
||||
{
|
||||
@@ -1088,10 +1090,10 @@ void wxRibbonToolBar::OnMouseMove(wxMouseEvent& evt)
|
||||
|
||||
if(new_hover && new_hover->state & wxRIBBON_TOOLBAR_TOOL_DISABLED)
|
||||
{
|
||||
m_hover_tool = new_hover;
|
||||
new_hover = NULL; // A disabled tool can not be hilighted
|
||||
}
|
||||
|
||||
if(new_hover != m_hover_tool)
|
||||
else if(new_hover != m_hover_tool)
|
||||
{
|
||||
if(m_hover_tool)
|
||||
{
|
||||
@@ -1143,6 +1145,7 @@ void wxRibbonToolBar::OnMouseDown(wxMouseEvent& evt)
|
||||
m_active_tool = m_hover_tool;
|
||||
m_active_tool->state |=
|
||||
(m_active_tool->state & wxRIBBON_TOOLBAR_TOOL_HOVER_MASK) << 2;
|
||||
UnsetToolTip();
|
||||
Refresh(false);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user