Use new CanBeToggled function inside wxAuiToolBar where appropriate

This commit is contained in:
Ian McInerney
2020-08-21 23:29:08 +01:00
parent afbb334a26
commit c0bfaf4104

View File

@@ -1546,7 +1546,7 @@ void wxAuiToolBar::ToggleTool(int tool_id, bool state)
{ {
wxAuiToolBarItem* tool = FindTool(tool_id); wxAuiToolBarItem* tool = FindTool(tool_id);
if (tool && (tool->m_kind == wxITEM_CHECK || tool->m_kind == wxITEM_RADIO)) if ( tool && tool->CanBeToggled() )
{ {
if (tool->m_kind == wxITEM_RADIO) if (tool->m_kind == wxITEM_RADIO)
{ {
@@ -1587,13 +1587,8 @@ bool wxAuiToolBar::GetToolToggled(int tool_id) const
{ {
wxAuiToolBarItem* tool = FindTool(tool_id); wxAuiToolBarItem* tool = FindTool(tool_id);
if (tool) if ( tool && tool->CanBeToggled() )
{
if ( (tool->m_kind != wxITEM_CHECK) && (tool->m_kind != wxITEM_RADIO) )
return false;
return (tool->m_state & wxAUI_BUTTON_STATE_CHECKED) ? true : false; return (tool->m_state & wxAUI_BUTTON_STATE_CHECKED) ? true : false;
}
return false; return false;
} }