]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/toolbar.cpp
wxDrawerWindow - [ 909351 ] Drawer window for OS X Carbon - somewhat heavily modified
[wxWidgets.git] / src / mac / carbon / toolbar.cpp
index 0ae7bed16ee73de01b88d0a755b169988d6dedb7..c200e86f7b1d2514232f7a8467f3a936d6c2e91e 100644 (file)
@@ -123,10 +123,9 @@ static pascal OSStatus wxMacToolBarToolControlEventHandler( EventHandlerCallRef
                 wxToolBarTool* tbartool = (wxToolBarTool*)data ;
                 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() ) ;
-
                 result = noErr; 
             }
             break ;
@@ -212,7 +211,7 @@ void wxToolBarTool::SetPosition(const wxPoint& position)
         GetControlBounds( m_controlHandle , &contrlRect ) ; 
         int former_mac_x = contrlRect.left ;
         int former_mac_y = contrlRect.top ;
-        wxSize sz = GetToolBar()->GetToolSize() ;
+        GetToolBar()->GetToolSize() ;
         
         if ( mac_x != former_mac_x || mac_y != former_mac_y )
         {
@@ -349,12 +348,32 @@ bool wxToolBar::Realize()
         node = node->GetNext();
     }
 
+    bool lastWasRadio = FALSE;
     node = m_tools.GetFirst();
     while (node)
     {
         wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
         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
         if ( x + cursize.x > maxWidth )
             maxWidth = x + cursize.x ;