28 #ifndef _CEGUIRenderedStringWordWrapper_h_
29 #define _CEGUIRenderedStringWordWrapper_h_
31 #include "CEGUIFormattedRenderedString.h"
32 #include "CEGUIJustifiedRenderedString.h"
33 #include "CEGUIVector.h"
54 void format(
const Size& area_size);
57 size_t getFormattedLineCount()
const;
58 float getHorizontalExtent()
const;
59 float getVerticalExtent()
const;
65 typedef std::vector<FormattedRenderedString*>
LineList;
71 template <> CEGUIEXPORT
96 rstring = *d_renderedString;
101 for (
size_t line = 0; line < rstring.
getLineCount(); ++line)
103 while ((rs_width = rstring.
getPixelSize(line).d_width) > 0)
106 if (rs_width <= area_size.d_width)
110 rstring.
split(line, area_size.d_width, lstring);
112 frs->format(area_size);
113 d_lines.push_back(frs);
119 frs =
new T(*
new RenderedString(rstring));
120 frs->format(area_size);
121 d_lines.push_back(frs);
125 template <
typename T>
126 void RenderedStringWordWrapper<T>::draw(GeometryBuffer& buffer,
127 const Vector2& position,
128 const ColourRect* mod_colours,
129 const Rect* clip_rect)
const
131 Vector2 line_pos(position);
132 typename LineList::const_iterator i = d_lines.begin();
133 for (; i != d_lines.end(); ++i)
135 (*i)->draw(buffer, line_pos, mod_colours, clip_rect);
136 line_pos.d_y += (*i)->getVerticalExtent();
141 template <
typename T>
142 size_t RenderedStringWordWrapper<T>::getFormattedLineCount()
const
144 return d_lines.size();
148 template <
typename T>
149 float RenderedStringWordWrapper<T>::getHorizontalExtent()
const
154 typename LineList::const_iterator i = d_lines.begin();
155 for (; i != d_lines.end(); ++i)
157 const float cur_width = (*i)->getHorizontalExtent();
166 template <
typename T>
167 float RenderedStringWordWrapper<T>::getVerticalExtent()
const
172 typename LineList::const_iterator i = d_lines.begin();
173 for (; i != d_lines.end(); ++i)
174 h += (*i)->getVerticalExtent();
180 template <
typename T>
183 for (
size_t i = 0; i < d_lines.size(); ++i)
200 #endif // end of guard _CEGUIRenderedStringWordWrapper_h_