X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/326a37f1484ae04edd588728526876c4c784405c..0c8b041f147ff9bb6ce38f0e2da1fd82f6484523:/src/common/tbarbase.cpp diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp index 57daadc573..edfff6c1f2 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 // ---------------------------------------------------------------------------- @@ -126,8 +146,10 @@ wxToolBarBase::wxToolBarBase() { // the list owns the pointers m_xMargin = m_yMargin = 0; - m_maxRows = m_maxCols = 0; + m_toolPacking = m_toolSeparation = 0; + m_defaultWidth = 16; + m_defaultHeight = 15; } wxToolBarToolBase *wxToolBarBase::DoAddTool(int id, @@ -423,6 +445,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); + } } // ---------------------------------------------------------------------------- @@ -535,7 +565,7 @@ bool wxToolBarBase::GetToolEnabled(int id) const 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(); } @@ -543,7 +573,7 @@ wxString wxToolBarBase::GetToolShortHelp(int id) const 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(); } @@ -710,8 +740,19 @@ bool wxCreateGreyedImage(const wxImage& in, wxImage& out) { out = in.Copy(); - // assuming the pixels along the edges are of the background color - wxColour bgCol(in.GetRed(0, 0), in.GetGreen(0, 0), in.GetBlue(0, 0)); + unsigned char r, g, b; + if ( in.HasMask() ) + { + in.GetOrFindMaskColour(&r, &g, &b); + } + else // assuming the pixels along the edges are of the background color + { + r = in.GetRed(0, 0); + g = in.GetGreen(0, 0); + b = in.GetBlue(0, 0); + } + + wxColour bgCol(r, g, b); wxColour darkCol = wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW) ; wxColour lightCol = wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT) ;