X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c34d2f356ba024fdcf0d29f231e35c894186e8b0..43c5b6e808f083617eb42cb48e77366844f8fb5c:/src/generic/statusbr.cpp?ds=inline diff --git a/src/generic/statusbr.cpp b/src/generic/statusbr.cpp index e78c18d216..1264843946 100644 --- a/src/generic/statusbr.cpp +++ b/src/generic/statusbr.cpp @@ -119,21 +119,9 @@ void wxStatusBarGeneric::SetFieldsCount(int number, const int *widths) { wxASSERT_MSG( number >= 0, _T("negative number of fields in wxStatusBar?") ); - // enlarge the m_statusStrings array if needed: - for (size_t i = m_panes.GetCount(); i < (size_t)number; ++i) - m_statusStrings.Add( wxEmptyString ); - - // shrink the m_statusStrings array if needed: - for (int j = (int)m_panes.GetCount() - 1; j >= number; --j) - m_statusStrings.RemoveAt(j); - - // forget the old cached pixel widths - m_widthsAbs.Empty(); - + // this will result in a call to SetStatusWidths() and thus an update to our + // m_widthsAbs cache wxStatusBarBase::SetFieldsCount(number, widths); - - wxASSERT_MSG( m_panes.GetCount() == m_statusStrings.GetCount(), - _T("This really should never happen, can we do away with m_panes.GetCount() here?") ); } void wxStatusBarGeneric::SetStatusText(const wxString& text, int number) @@ -141,10 +129,10 @@ void wxStatusBarGeneric::SetStatusText(const wxString& text, int number) wxCHECK_RET( (number >= 0) && ((size_t)number < m_panes.GetCount()), _T("invalid status bar field index") ); - wxString oldText = m_statusStrings[number]; + wxString oldText = GetStatusText(number); if (oldText != text) { - m_statusStrings[number] = text; + wxStatusBarBase::SetStatusText(text, number); wxRect rect; GetFieldRect(number, rect); @@ -158,23 +146,17 @@ void wxStatusBarGeneric::SetStatusText(const wxString& text, int number) } } -wxString wxStatusBarGeneric::GetStatusText(int n) const -{ - wxCHECK_MSG( (n >= 0) && ((size_t)n < m_panes.GetCount()), wxEmptyString, - _T("invalid status bar field index") ); - - return m_statusStrings[n]; -} - void wxStatusBarGeneric::SetStatusWidths(int n, const int widths_field[]) { // only set status widths when n == number of statuswindows wxCHECK_RET( (size_t)n == m_panes.GetCount(), _T("status bar field count mismatch") ); - // forget the old cached pixel widths - m_widthsAbs.Empty(); - wxStatusBarBase::SetStatusWidths(n, widths_field); + + // update cache + int width; + GetClientSize(&width, &m_lastClientHeight); + m_widthsAbs = CalculateAbsWidths(width); } bool wxStatusBarGeneric::ShowsSizeGrip() const @@ -243,7 +225,7 @@ void wxStatusBarGeneric::DrawField(wxDC& dc, int i, int textHeight) if (rect.GetWidth() <= 0) return; // happens when the status bar is shrinked in a very small area! - int style = m_panes[i].nStyle; + int style = m_panes[i].GetStyle(); if (style != wxSB_FLAT) { // Draw border