7 #ifndef __MYGUI_TEXT_VIEW_H__
8 #define __MYGUI_TEXT_VIEW_H__
65 space_point = _space_point;
71 void clear() { rollback =
false; }
72 bool empty()
const {
return !rollback; }
97 mFontHeight = _height;
100 static const char convert_colour[64] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0,
101 0, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0,
102 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
103 0, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0
125 for (; index!=end; ++index)
127 Char character = *index;
142 line_info.
width = width;
143 line_info.
count = count;
144 mLength += line_info.
count + 1;
147 if (result.
width < width)
148 result.
width = width;
152 mLineInfo.push_back(line_info);
161 else if (character == L
'#')
165 if (index == end) { --index;
continue; }
169 if (character != L
'#')
172 uint32 colour = convert_colour[(character-48) & 0x3F];
175 for (
char i=0; i<5; i++)
178 if (index == end) { --index;
continue; }
180 colour += convert_colour[ ((*index) - 48) & 0x3F ];
195 roll_back.
set(line_info.
simbols.size(), index, count, width);
199 roll_back.
set(line_info.
simbols.size(), index, count, width);
202 int char_width = info->
width;
203 if (font_height != _height)
205 char_width = char_width * _height / font_height;
206 if (!char_width) char_width = 1;
211 && (width + char_width) > _maxheight
212 && !roll_back.
empty())
221 line_info.
width = width;
222 line_info.
count = count;
223 mLength += line_info.
count + 1;
226 if (result.
width < width)
227 result.
width = width;
231 mLineInfo.push_back(line_info);
245 line_info.
width = width;
246 line_info.
count = count;
247 mLength += line_info.
count;
249 mLineInfo.push_back(line_info);
251 if (result.
width < width)
252 result.
width = width;
255 for (VectorLineInfo::iterator line=mLineInfo.begin(); line!=mLineInfo.end(); ++line)
258 line->offset = result.
width - line->width;
260 line->offset = (result.
width - line->width) / 2;
268 const int height = mFontHeight;
272 for (VectorLineInfo::const_iterator line=mLineInfo.begin(); line!=mLineInfo.end(); ++line)
275 bool lastline = !(line + 1 != mLineInfo.end());
278 if (top + height > _value.
top || lastline)
281 int left = line->offset;
285 for (VectorCharInfo::const_iterator sim=line->simbols.begin(); sim!=line->simbols.end(); ++sim)
290 if ((left + (sim->getWidth() / 2)) > _value.
left)
294 left += sim->getWidth();
305 result += line->count + 1;
314 if (_position >= mLength + 1) _position = mLength;
319 for (VectorLineInfo::const_iterator line=mLineInfo.begin(); line!=mLineInfo.end(); ++line)
322 if (position + line->count >= _position)
324 for (VectorCharInfo::const_iterator sim=line->simbols.begin(); sim!=line->simbols.end(); ++sim)
329 if (position == _position)
333 left += sim->getWidth();
337 position += line->count + 1;
358 #endif // __MYGUI_TEXT_VIEW_H__