]> git.saurik.com Git - wxWidgets.git/commitdiff
destroying native and wx controls
authorStefan Csomor <csomor@advancedconcepts.ch>
Tue, 29 Mar 2005 13:09:31 +0000 (13:09 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Tue, 29 Mar 2005 13:09:31 +0000 (13:09 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33149 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/toolbar.cpp

index 718123647d8a6c254eb224e1293507e9fa61a475..5f03590f8fce57c786d85a66cbb60aa98febdf60 100644 (file)
@@ -665,6 +665,23 @@ bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
 
     tool->Detach();
 
+    wxToolBarTool* tl = wx_static_cast( wxToolBarTool* , tool ) ;
+    switch ( tool->GetStyle() )
+    {
+        case wxTOOL_STYLE_CONTROL:
+            tool->GetControl()->Destroy();
+            break;
+
+        case wxTOOL_STYLE_BUTTON:
+        case wxTOOL_STYLE_SEPARATOR:
+            if ( tl->GetControlHandle() )
+            {
+                DisposeControl( (ControlRef) tl->GetControlHandle() ) ;
+                tl->SetControlHandle( (ControlRef) NULL ) ;
+            }
+            break;
+    }
+
     // and finally reposition all the controls after this one
     
     for ( /* node -> first after deleted */ ; node; node = node->GetNext() )