41 #ifndef _uitextline_cpp
42 #define _uitextline_cpp
44 #include "UI/textline.h"
45 #include "UI/textlayer.h"
46 #include "UI/quadrenderable.h"
89 if( Offset < (*CharIt)->GetLengthOffset() )
97 while( CharIt != this->
Characters.end() && Offset < (*CharIt)->GetLengthOffset() )
103 if( CharIt == (--this->
Characters.end()) && Offset > (*CharIt)->GetLengthOffset() + (*CharIt)->GetCharacterSize().X )
112 Real CharXPos = (*CharIt)->GetLengthOffset();
113 Real CharXSize = (*CharIt)->GetCharacterSize().X;
115 Ret.first = (*CharIt);
116 Ret.second.X = ( CharXPos + (CharXSize * 0.5) < Offset ? CharXPos + CharXSize : CharXPos );
126 if( Offset < (*CharIt)->GetLengthOffset() )
130 while( CharIt != this->
Characters.end() && Offset < (*CharIt)->GetLengthOffset() )
140 Real CharXPos = (*CharIt)->GetLengthOffset();
141 Real CharXSize = (*CharIt)->GetCharacterSize().X;
142 return ( CharXPos + (CharXSize * 0.5) < Offset ? RetIndex : ++RetIndex );
147 if( Index < 0 || Index > this->
Characters.size() )
150 return (*Last)->GetLengthOffset() + (*Last)->GetCharacterSize().X;
155 while( CharIt != this->
Characters.end() && IndexCount < Index )
161 return (*CharIt)->GetLengthOffset();
170 case UI::LA_TopLeft:
return 0;
break;
171 case UI::LA_BottomRight:
return MaxWidth -
CurrLength;
break;
172 case UI::LA_Center:
return (MaxWidth * 0.5) - (CurrLength * 0.5);
break;
181 case UI::LA_TopLeft:
return CurrLength;
break;
182 case UI::LA_BottomRight:
return MaxWidth;
break;
183 case UI::LA_Center:
return (MaxWidth * 0.5) + (
CurrLength * 0.5);
break;
191 if( Position < (*CharIt)->GetLengthOffset() )
194 while( CharIt != this->
Characters.end() && Position < (*CharIt)->GetLengthOffset() )
196 if( (*CharIt)->IsNewLine() )
203 Real CharXPos = (*CharIt)->GetLengthOffset();
204 Real CharXSize = (*CharIt)->GetCharacterSize().X;
207 if( CharIt == (--(this->
Characters.end())) && Position > CharXPos + CharXSize )
210 return ( Position < CharXPos + (CharXSize * 0.5) ? CharXPos : CharXPos + CharXSize );
268 while( CharIt != this->
Characters.end() && Count < Index )
280 if( Offset < (*CharIt)->GetLengthOffset() )
283 while( CharIt != this->
Characters.end() && Offset < (*CharIt)->GetLengthOffset() )
285 if( (*CharIt)->IsNewLine() )
292 if( CharIt == (--(this->
Characters.end())) && Offset > (*CharIt)->GetLengthOffset() + (*CharIt)->GetCharacterSize().X )
347 CursorPosition += (*CharIt)->GetCharacterAdvance( Previous != NULL ? Previous->
GetCharGlyph() : NULL );
348 Previous = (*CharIt);
380 Real Tallest = 0, SequenceLength = 0;
387 Tallest = std::max(Tallest,(*CharIt)->GetLineHeight());
393 this->CurrLength = AddedLength;
416 for( ; CharIt != Last ; ++CharIt )
420 if( AddedLength <= MaxWidth )
474 { this->
Alignment = UI::LA_BottomRight; }
492 (*CharIt)->SetLengthOffset(CursorPosition);
493 Previous = (*CharIt);
525 Real Tallest = 0, SequenceLength = 0;
538 Tallest = std::max(Tallest,(*CharIt)->GetLineHeight());
544 this->CurrLength = AddedLength;
573 for( ; CharIt != FirstCopy ; --CharIt )
577 if( AddedLength <= MaxWidth )
607 if( *Current != this->
Characters.front() )
return --Copy;