00001 #ifndef _MultilineString_h
00002 #define _MultilineString_h
00003
00004
00005 #include "MatrixStyle.h"
00006
00016 class MultilineString
00017 {
00018 public:
00019
00020
00025 MultilineString(const wxTextAttr& style = wxTextAttr());
00026
00027
00028
00031 MultilineString& operator<<(const wxString& text);
00032
00035 MultilineString& operator<<(const BaseMatrix& X);
00036
00039 MultilineString& operator<<(const GeneralMatrix& matrix);
00040
00041
00042
00045 void Append(const wxString& text);
00046
00052 void Append(const wxString& text, const wxTextAttr& style);
00053
00062 void Append(const GeneralMatrix& matrix,
00063 const MatrixStyle& style,
00064 const wxString& upperIndex = wxT(""));
00065
00068 void Print(wxTextCtrl* pTextCtrl) const;
00069
00072 wxString ToString() const;
00073
00076 void Clear();
00077
00081 void Flush(wxTextCtrl* pTargetCtrl);
00082
00088 void AddToDefaultStyle(const wxTextAttr& style);
00089
00090
00093 const wxTextAttr& DefaultStyle() const;
00094
00095
00096 void Dump() const;
00097
00098 private:
00099
00101 class TextStyleRange
00102 {
00103 public:
00104 TextStyleRange(unsigned first, unsigned length, const wxTextAttr& style)
00105 : mFirst(first), mLength(length), mStyle(style) { }
00106
00107 unsigned mFirst;
00108 unsigned mLength;
00109 wxTextAttr mStyle;
00110 };
00111
00112 typedef vector<TextStyleRange> TextStyleRanges;
00113 typedef vector<TextStyleRanges> TextStyleRows;
00114
00119 void Allocate(unsigned rowCount);
00120
00122 unsigned FirstRow(unsigned rowCount) const;
00123
00124 wxArrayString mStrings;
00125 unsigned mLength;
00126
00127 TextStyleRows mTextStyles;
00128
00129 wxTextAttr mDefaultStyle;
00130 };
00131
00132 #endif