X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/214b94848a50b224aa3b2101b21149ae82e3706f..0281278534339322516fa6133ed4df925c2156be:/src/common/tbarbase.cpp diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp index 69f106b9ee..e9b2c110ec 100644 --- a/src/common/tbarbase.cpp +++ b/src/common/tbarbase.cpp @@ -114,10 +114,30 @@ bool wxToolBarToolBase::SetLongHelp(const wxString& help) 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 // ---------------------------------------------------------------------------- @@ -423,6 +443,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); + } } // ---------------------------------------------------------------------------- @@ -611,8 +639,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 ); }