X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/308bb56fd8cdebc4145155c096167562dddb9824..26364344e58ae9c384965ff25c6920a75c55184e:/src/msw/tbar95.cpp?ds=sidebyside diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index c5d3aaa39e..28f96b3f93 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -350,6 +350,7 @@ wxSize wxToolBar::DoGetBestSize() const // 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 @@ -1210,11 +1211,14 @@ void wxToolBar::OnMouseEvent(wxMouseEvent& event) 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 {