(consistant with MSW behaviour).
Made m_statusSring a wxArrayString, furthur simplification may
be possible if someone is interested and has the time.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15988
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
void OnSysColourChanged(wxSysColourChangedEvent& event);
protected:
void OnSysColourChanged(wxSysColourChangedEvent& event);
protected:
- wxString * m_statusStrings;
+ wxArrayString m_statusStrings;
int m_borderX;
int m_borderY;
wxFont m_defaultStatusBarFont;
int m_borderX;
int m_borderY;
wxFont m_defaultStatusBarFont;
#endif
// _WX_GENERIC_STATUSBR_H_
#endif
// _WX_GENERIC_STATUSBR_H_
wxStatusBarGeneric::wxStatusBarGeneric()
{
wxStatusBarGeneric::wxStatusBarGeneric()
{
- m_statusStrings = (wxString *) NULL;
m_borderX = wxTHICK_LINE_BORDER;
m_borderY = wxTHICK_LINE_BORDER;
}
m_borderX = wxTHICK_LINE_BORDER;
m_borderY = wxTHICK_LINE_BORDER;
}
# ifdef __WXMSW__
SetFont(wxNullFont);
# endif // MSW
# ifdef __WXMSW__
SetFont(wxNullFont);
# endif // MSW
-
- if ( m_statusStrings )
- delete[] m_statusStrings;
}
bool wxStatusBarGeneric::Create(wxWindow *parent,
}
bool wxStatusBarGeneric::Create(wxWindow *parent,
- wxWindowID id,
- long style,
- const wxString& name)
+ wxWindowID id,
+ long style,
+ const wxString& name)
- m_statusStrings = (wxString *) NULL;
+ // If create is ever meant to be re-entrant over the life of
+ // an object we should:
+ // m_statusStrings.Empty();
+
m_borderX = wxTHICK_LINE_BORDER;
m_borderY = wxTHICK_LINE_BORDER;
m_borderX = wxTHICK_LINE_BORDER;
m_borderY = wxTHICK_LINE_BORDER;
void wxStatusBarGeneric::SetFieldsCount(int number, const int *widths)
{
void wxStatusBarGeneric::SetFieldsCount(int number, const int *widths)
{
- if ( number != m_nFields )
- {
- m_nFields = number;
+ wxASSERT_MSG( number >= 0,
+ _T("Yes, number should be a size_t and less than no fields is silly.") );
- delete[] m_statusStrings;
- m_statusStrings = new wxString[number];
- }
+ // if( number > m_nFields )
+
+ for( int i = m_nFields; i < number; ++i )
+ m_statusStrings.Add( wxEmptyString );
+
+ // if( number < m_nFields )
+
+ for (int i = m_nFields - 1; i >= number; --i)
+ m_statusStrings.Remove(i);
+
+ m_nFields = number;
+
+ wxASSERT_MSG( m_nFields == (int)m_statusStrings.GetCount(),
+ _T("This really should never happen, can we do away with m_nFields here?") );
SetStatusWidths(number, widths);
}
SetStatusWidths(number, widths);
}
}
#endif // wxUSE_STATUSBAR
}
#endif // wxUSE_STATUSBAR