Fix from Jed Burgess that correctly untoggles radio toolbar items when
another one in the same group is selected. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29296 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
f31d9916c2
commit
214b94848a
@ -385,7 +385,10 @@ void wxToolBarBase::UnToggleRadioGroup(wxToolBarToolBase *tool)
|
|||||||
if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO )
|
if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
tool->Toggle(false);
|
if ( tool->Toggle(false) )
|
||||||
|
{
|
||||||
|
DoToggleTool(tool, false);
|
||||||
|
}
|
||||||
|
|
||||||
nodeNext = nodeNext->GetNext();
|
nodeNext = nodeNext->GetNext();
|
||||||
}
|
}
|
||||||
@ -398,7 +401,10 @@ void wxToolBarBase::UnToggleRadioGroup(wxToolBarToolBase *tool)
|
|||||||
if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO )
|
if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
tool->Toggle(false);
|
if ( tool->Toggle(false) )
|
||||||
|
{
|
||||||
|
DoToggleTool(tool, false);
|
||||||
|
}
|
||||||
|
|
||||||
nodePrev = nodePrev->GetPrevious();
|
nodePrev = nodePrev->GetPrevious();
|
||||||
}
|
}
|
||||||
|
@ -123,10 +123,9 @@ static pascal OSStatus wxMacToolBarToolControlEventHandler( EventHandlerCallRef
|
|||||||
wxToolBarTool* tbartool = (wxToolBarTool*)data ;
|
wxToolBarTool* tbartool = (wxToolBarTool*)data ;
|
||||||
if ( tbartool->CanBeToggled() )
|
if ( tbartool->CanBeToggled() )
|
||||||
{
|
{
|
||||||
tbartool->Toggle( GetControl32BitValue( (ControlRef) tbartool->GetControlHandle() ) ) ;
|
((wxToolBar*)tbartool->GetToolBar())->ToggleTool(tbartool->GetId(), GetControl32BitValue((ControlRef)tbartool->GetControlHandle()));
|
||||||
}
|
}
|
||||||
((wxToolBar*)tbartool->GetToolBar())->OnLeftClick( tbartool->GetId() , tbartool -> IsToggled() ) ;
|
((wxToolBar*)tbartool->GetToolBar())->OnLeftClick( tbartool->GetId() , tbartool -> IsToggled() ) ;
|
||||||
|
|
||||||
result = noErr;
|
result = noErr;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
@ -349,12 +348,32 @@ bool wxToolBar::Realize()
|
|||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool lastWasRadio = FALSE;
|
||||||
node = m_tools.GetFirst();
|
node = m_tools.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
|
wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
|
||||||
wxSize cursize = tool->GetSize() ;
|
wxSize cursize = tool->GetSize() ;
|
||||||
|
|
||||||
|
bool isRadio = FALSE;
|
||||||
|
|
||||||
|
if ( tool->IsButton() && tool->GetKind() == wxITEM_RADIO )
|
||||||
|
{
|
||||||
|
if ( !lastWasRadio )
|
||||||
|
{
|
||||||
|
if (tool->Toggle(true))
|
||||||
|
{
|
||||||
|
DoToggleTool(tool, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
isRadio = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isRadio = FALSE;
|
||||||
|
}
|
||||||
|
lastWasRadio = isRadio;
|
||||||
|
|
||||||
// for the moment we just do a single row/column alignement
|
// for the moment we just do a single row/column alignement
|
||||||
if ( x + cursize.x > maxWidth )
|
if ( x + cursize.x > maxWidth )
|
||||||
maxWidth = x + cursize.x ;
|
maxWidth = x + cursize.x ;
|
||||||
|
Loading…
Reference in New Issue
Block a user