]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/tbarbase.cpp
First step at moving the print (dialog) native
[wxWidgets.git] / src / common / tbarbase.cpp
index e3b306923cf3f71559441da1725ee18a923c41b1..0bd33adcafb9e289f214803f6e626c7dbd16204e 100644 (file)
@@ -385,7 +385,10 @@ void wxToolBarBase::UnToggleRadioGroup(wxToolBarToolBase *tool)
         if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO )
             break;
 
-        tool->Toggle(false);
+        if ( tool->Toggle(false) )
+        {
+            DoToggleTool(tool, false);
+        }
 
         nodeNext = nodeNext->GetNext();
     }
@@ -398,7 +401,10 @@ void wxToolBarBase::UnToggleRadioGroup(wxToolBarToolBase *tool)
         if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO )
             break;
 
-        tool->Toggle(false);
+        if ( tool->Toggle(false) )
+        {
+            DoToggleTool(tool, false);
+        }
 
         nodePrev = nodePrev->GetPrevious();
     }
@@ -417,6 +423,14 @@ bool wxToolBarBase::Realize()
 wxToolBarBase::~wxToolBarBase()
 {
     WX_CLEAR_LIST(wxToolBarToolsList, m_tools);
+
+    // notify the frame that it doesn't have a tool bar any longer to avoid
+    // dangling pointers
+    wxFrameBase *frame = wxDynamicCast(GetParent(), wxFrameBase);
+    if ( frame && frame->GetToolBar() == this )
+    {
+        frame->SetToolBar(NULL);
+    }
 }
 
 // ----------------------------------------------------------------------------
@@ -605,8 +619,10 @@ void wxToolBarBase::OnMouseEnter(int id)
     wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);
     if( frame )
     {
-        wxToolBarToolBase* tool = id == wxID_ANY ? (wxToolBarToolBase*)0 : FindById(id);
-        wxString help = tool ? tool->GetLongHelp() : wxString();
+        wxString help;
+        wxToolBarToolBase* tool = id == wxID_ANY ? (wxToolBarToolBase*)NULL : FindById(id);
+        if(tool)
+            help = tool->GetLongHelp();
         frame->DoGiveHelp( help, id != wxID_ANY );
     }