]> git.saurik.com Git - wxWidgets.git/commitdiff
Patch from OSAF that maintains radio button selection if Realize is recalled.
authorRobin Dunn <robin@alldunn.com>
Mon, 4 Apr 2005 23:08:02 +0000 (23:08 +0000)
committerRobin Dunn <robin@alldunn.com>
Mon, 4 Apr 2005 23:08:02 +0000 (23:08 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33335 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/tbar95.cpp

index 491dafd1782210bc57fff5ffd518a82c72be21ee..7ea83bd343b65db73824bd93083091830e1092d1 100644 (file)
@@ -875,7 +875,30 @@ bool wxToolBar::Realize()
                             // radio items
                             button.fsState |= TBSTATE_CHECKED;
 
                             // radio items
                             button.fsState |= TBSTATE_CHECKED;
 
-                            tool->Toggle(true);
+                            if (tool->Toggle(true))
+                            {
+                                DoToggleTool(tool, true);
+                            }
+                        }
+                        else if (tool->IsToggled())
+                        {
+                            wxToolBarToolsList::compatibility_iterator nodePrev = node->GetPrevious();
+                            int prevIndex = i - 1;
+                            while ( nodePrev )
+                            {
+                                TBBUTTON& prevButton = buttons[prevIndex];
+                                wxToolBarToolBase *tool = nodePrev->GetData();
+                                if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO )
+                                    break;
+                                
+                                if ( tool->Toggle(false) )
+                                {
+                                    DoToggleTool(tool, false);
+                                }
+                                prevButton.fsState = TBSTATE_ENABLED;
+                                nodePrev = nodePrev->GetPrevious();
+                                prevIndex--;
+                            }                            
                         }
 
                         isRadio = true;
                         }
 
                         isRadio = true;