git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59605
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
{
wxAuiToolBarItem* tool = FindTool(tool_id);
{
wxAuiToolBarItem* tool = FindTool(tool_id);
+ if (tool && (tool->kind == wxITEM_CHECK || tool->kind == wxITEM_RADIO))
- if (tool->kind != wxITEM_CHECK)
- return;
-
- if (state == true)
+ if (tool->kind == wxITEM_RADIO)
+ {
+ int i, idx, count;
+ idx = GetToolIndex(tool_id);
+ count = (int)m_items.GetCount();
+
+ if (idx >= 0 && idx < count)
+ {
+ for (i = idx; 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--)
+ {
+ if (m_items[i].kind != wxITEM_RADIO)
+ break;
+ m_items[i].state &= ~wxAUI_BUTTON_STATE_CHECKED;
+ }
+ }
+
tool->state |= wxAUI_BUTTON_STATE_CHECKED;
tool->state |= wxAUI_BUTTON_STATE_CHECKED;
- else
- tool->state &= ~wxAUI_BUTTON_STATE_CHECKED;
+ }
+ else if (tool->kind == wxITEM_CHECK)
+ {
+ if (state == true)
+ tool->state |= wxAUI_BUTTON_STATE_CHECKED;
+ else
+ tool->state &= ~wxAUI_BUTTON_STATE_CHECKED;
+ }
- if (tool->kind != wxITEM_CHECK)
+ if ( (tool->kind != wxITEM_CHECK) && (tool->kind != wxITEM_RADIO) )
return false;
return (tool->state & wxAUI_BUTTON_STATE_CHECKED) ? true : false;
return false;
return (tool->state & wxAUI_BUTTON_STATE_CHECKED) ? true : false;
case wxITEM_CHECK:
case wxITEM_NORMAL:
case wxITEM_CHECK:
case wxITEM_NORMAL:
{
wxSize size = m_art->GetToolSize(dc, this, item);
sizer_item = sizer->Add(size.x + (m_tool_border_padding*2),
{
wxSize size = m_art->GetToolSize(dc, this, item);
sizer_item = sizer->Add(size.x + (m_tool_border_padding*2),
// draw a toggle button
m_art->DrawButton(dc, this, item, item_rect);
}
// draw a toggle button
m_art->DrawButton(dc, this, item, item_rect);
}
+ else if (item.kind == wxITEM_RADIO)
+ {
+ // draw a toggle button
+ m_art->DrawButton(dc, this, item, item_rect);
+ }
else if (item.kind == wxITEM_CONTROL)
{
// draw the control's label
else if (item.kind == wxITEM_CONTROL)
{
// draw the control's label
- if (hit_item->kind == wxITEM_CHECK)
+ if (hit_item->kind == wxITEM_CHECK || hit_item->kind == wxITEM_RADIO)
toggle = true;
ToggleTool(m_action_item->id, toggle);
toggle = true;
ToggleTool(m_action_item->id, toggle);
+
+ // repaint immediately
+ Refresh(false);
+ Update();
+
wxCommandEvent e(wxEVT_COMMAND_MENU_SELECTED, m_action_item->id);
e.SetEventObject(this);
GetEventHandler()->ProcessEvent(e);
wxCommandEvent e(wxEVT_COMMAND_MENU_SELECTED, m_action_item->id);
e.SetEventObject(this);
GetEventHandler()->ProcessEvent(e);