save the current status text for each pane inside wxStatusBarPane: native controls now store the (eventually) ellipsized version of the string; remove code for managing the status strings currently inside the [native|generic] control; add ellipsization support under wxMSW; now that all SetFieldsCount() implementation rrely on wxStatusBarBase::SetFieldsCount document how it behaves when adding new panes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58786 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2009-02-09 00:33:19 +00:00
parent 4879f2120c
commit 0cd159592e
11 changed files with 117 additions and 90 deletions

View File

@@ -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