return true;
}
-wxToolBarToolBase::~wxToolBarToolBase()
+#if WXWIN_COMPATIBILITY_2_2
+
+const wxBitmap& wxToolBarToolBase::GetBitmap1() const
+{
+ return GetNormalBitmap();
+}
+
+const wxBitmap& wxToolBarToolBase::GetBitmap2() const
+{
+ return GetDisabledBitmap();
+}
+
+void wxToolBarToolBase::SetBitmap1(const wxBitmap& bmp)
+{
+ SetNormalBitmap(bmp);
+}
+
+void wxToolBarToolBase::SetBitmap2(const wxBitmap& bmp)
{
+ SetDisabledBitmap(bmp);
}
+#endif // WXWIN_COMPATIBILITY_2_2
+
// ----------------------------------------------------------------------------
// wxToolBarBase adding/deleting items
// ----------------------------------------------------------------------------
if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO )
break;
- tool->Toggle(false);
+ if ( tool->Toggle(false) )
+ {
+ DoToggleTool(tool, false);
+ }
nodeNext = nodeNext->GetNext();
}
if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO )
break;
- tool->Toggle(false);
+ if ( tool->Toggle(false) )
+ {
+ DoToggleTool(tool, false);
+ }
nodePrev = nodePrev->GetPrevious();
}
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);
+ }
}
// ----------------------------------------------------------------------------
wxString wxToolBarBase::GetToolShortHelp(int id) const
{
wxToolBarToolBase *tool = FindById(id);
- wxCHECK_MSG( tool, _T(""), _T("no such tool") );
+ wxCHECK_MSG( tool, wxEmptyString, _T("no such tool") );
return tool->GetShortHelp();
}
wxString wxToolBarBase::GetToolLongHelp(int id) const
{
wxToolBarToolBase *tool = FindById(id);
- wxCHECK_MSG( tool, _T(""), _T("no such tool") );
+ wxCHECK_MSG( tool, wxEmptyString, _T("no such tool") );
return tool->GetLongHelp();
}
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 );
}