mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-03-24 03:13:13 +08:00
Don't duplicate same code twice in wxAuiToolBar::OnRightUp()
For unknown reasons we used exactly the same code for sending event with valid and invalid tool ID instead of just setting a variable containing the tool ID and then using it. Fix this now. No real changes.
This commit is contained in:
@@ -2873,26 +2873,24 @@ void wxAuiToolBar::OnRightUp(wxMouseEvent& evt)
|
||||
wxAuiToolBarItem* hitItem;
|
||||
hitItem = FindToolByPosition(evt.GetX(), evt.GetY());
|
||||
|
||||
int toolId;
|
||||
if (m_actionItem && hitItem == m_actionItem)
|
||||
{
|
||||
wxAuiToolBarEvent e(wxEVT_AUITOOLBAR_RIGHT_CLICK, m_actionItem->m_toolId);
|
||||
e.SetEventObject(this);
|
||||
e.SetToolId(m_actionItem->m_toolId);
|
||||
e.SetClickPoint(m_actionPos);
|
||||
GetEventHandler()->ProcessEvent(e);
|
||||
DoIdleUpdate();
|
||||
toolId = m_actionItem->m_toolId;
|
||||
}
|
||||
else
|
||||
{
|
||||
// right-clicked on the invalid area of the toolbar
|
||||
wxAuiToolBarEvent e(wxEVT_AUITOOLBAR_RIGHT_CLICK, -1);
|
||||
e.SetEventObject(this);
|
||||
e.SetToolId(-1);
|
||||
e.SetClickPoint(m_actionPos);
|
||||
GetEventHandler()->ProcessEvent(e);
|
||||
DoIdleUpdate();
|
||||
toolId = wxNOT_FOUND;
|
||||
}
|
||||
|
||||
wxAuiToolBarEvent e(wxEVT_AUITOOLBAR_RIGHT_CLICK, toolId);
|
||||
e.SetEventObject(this);
|
||||
e.SetToolId(toolId);
|
||||
e.SetClickPoint(m_actionPos);
|
||||
GetEventHandler()->ProcessEvent(e);
|
||||
DoIdleUpdate();
|
||||
|
||||
// reset member variables
|
||||
m_actionPos = wxPoint(-1,-1);
|
||||
m_actionItem = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user