Merge branch 'wxRibbon-coord-functions'
Fix wxRibbonToolBar coordinate functions for non-first group: they only worked correctly for the first group before. See https://github.com/wxWidgets/wxWidgets/pull/2152 Closes https://github.com/wxWidgets/wxWidgets/pull/2163
This commit is contained in:
@@ -308,7 +308,8 @@ public:
|
||||
wxRibbonToolBarToolBase* GetToolByPos(size_t pos)const;
|
||||
|
||||
/**
|
||||
Return the opaque pointer for the tool at the given coordinates.
|
||||
Returns the opaque pointer for the tool at the given coordinates,
|
||||
which are relative to the toolbar's parent.
|
||||
|
||||
@return an opaque pointer, NULL if is not found.
|
||||
|
||||
@@ -391,8 +392,8 @@ public:
|
||||
virtual int GetToolPos(int tool_id)const;
|
||||
|
||||
/**
|
||||
Returns the rect in the toolbar, or a default-constructed rect if the tool
|
||||
is not found.
|
||||
Returns the tool's rect with coordinates relative to the toolbar's parent,
|
||||
or a default-constructed rect if the tool is not found.
|
||||
|
||||
@param tool_id
|
||||
ID of the tool in question, as passed to AddTool().
|
||||
|
@@ -439,7 +439,7 @@ wxRibbonToolBarToolBase* wxRibbonToolBar::GetToolByPos(wxCoord x, wxCoord y)cons
|
||||
for ( size_t t = 0; t < tool_count; ++t )
|
||||
{
|
||||
wxRibbonToolBarToolBase* tool = group->tools.Item(t);
|
||||
wxRect rect(tool->position, tool->size);
|
||||
wxRect rect(group->position + tool->position, tool->size);
|
||||
if(rect.Contains(x, y))
|
||||
{
|
||||
return tool;
|
||||
@@ -535,8 +535,7 @@ wxRect wxRibbonToolBar::GetToolRect(int tool_id)const
|
||||
wxRibbonToolBarToolBase* tool = group->tools.Item(t);
|
||||
if (tool->id == tool_id)
|
||||
{
|
||||
wxRect rect(tool->position.x, tool->position.y, tool->size.GetWidth(), tool->size.GetHeight());
|
||||
return rect;
|
||||
return wxRect(group->position + tool->position, tool->size);
|
||||
}
|
||||
++pos;
|
||||
}
|
||||
|
Reference in New Issue
Block a user