// maybe an old (< 0x400) Windows version? try to approximate the
// toolbar size ourselves
sizeBest = GetToolSize();
+ sizeBest.y += 2 * ::GetSystemMetrics(SM_CYBORDER); // Add borders
sizeBest.x *= GetToolsCount();
// reverse horz and vertical components if necessary
return;
}
- if (event.RightDown())
+ if ( event.RightDown() )
{
- // For now, we don't have an id. Later we could
- // try finding the tool.
- OnRightClick((int)-1, event.GetX(), event.GetY());
+ // find the tool under the mouse
+ wxCoord x,y;
+ event.GetPosition(&x, &y);
+
+ wxToolBarToolBase *tool = FindToolForPosition(x, y);
+ OnRightClick(tool ? tool->GetId() : -1, x, y);
}
else
{