Reset the checked state of the first radio item in wxAuiToolBar too.

Fix the condition of the loop in wxAuiToolBar::ToggleTool() to also uncheck
the item with index 0 that was always excluded before because of "i > 0" check
in the loop.

Also exclude the item being turned on itself from the loops, it's useless to
reset its checked state only to turn it on again below.

Closes #11110.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67742 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2011-05-14 14:18:09 +00:00
parent a4e5e0b90c
commit 587151f730

View File

@ -1535,13 +1535,13 @@ void wxAuiToolBar::ToggleTool(int tool_id, bool state)
if (idx >= 0 && idx < count)
{
for (i = idx; i < count; ++i)
for (i = idx + 1; i < count; ++i)
{
if (m_items[i].kind != wxITEM_RADIO)
break;
m_items[i].state &= ~wxAUI_BUTTON_STATE_CHECKED;
}
for (i = idx; i > 0; i--)
for (i = idx - 1; i >= 0; i--)
{
if (m_items[i].kind != wxITEM_RADIO)
break;