40 #ifndef _uimultilinetextlayer_cpp
41 #define _uimultilinetextlayer_cpp
43 #include "UI/multilinetextlayer.h"
44 #include "UI/uimanager.h"
45 #include "UI/textline.h"
46 #include "UI/character.h"
73 bool NewLineDetected =
false;
82 if( (*Start)->IsWhiteSpace() ) {
84 while( End != CharEnd )
86 if( (*End)->IsNewLine() )
88 NewLineDetected =
true;
91 }
else if( !(*End)->IsWhiteSpace() ) {
100 if( Result != End || NewLineDetected )
106 while( End != CharEnd )
108 if( (*End)->IsWhiteSpace() )
126 }
while( Start != CharEnd );
137 if( (*End)->IsWhiteSpace() ) {
139 while( Start != CharEnd )
141 if( (*Start)->IsNewLine() )
143 NewLineDetected =
true;
146 }
else if( !(*Start)->IsWhiteSpace() ) {
153 AppendPair.first = Start;
154 AppendPair.second = End;
160 if( Result != Start || NewLineDetected )
166 while( Start != CharEnd )
168 if( (*Start)->IsWhiteSpace() )
174 AppendPair.first = Start;
175 AppendPair.second = End;
191 }
while( CharEnd != CharEnd );
206 if( Offset.
Y < (*LineIt)->GetPositionOffset() - (*LineIt)->GetLineHeight() )
210 while( LineIt !=
TextLines.end() && Offset.
Y < (*LineIt)->GetPositionOffset() )
212 IndexCount +=
static_cast<Integer>( (*LineIt)->GetNumCharacters() );
217 if( LineIt == (--
TextLines.end()) && Offset.
Y > (*LineIt)->GetPositionOffset() )
220 Ret.second = IndexCount + (*LineIt)->GetIndexAtOffset(Offset.
X);
228 if( Index < 0 || Index >= this->
Characters.size() ) {
230 Ret.second.Y = (*Last)->GetPositionOffset();
231 Ret.second.X = (*Last)->GetOffsetAtIndex(-1);
237 while( LineIt != this->
TextLines.end() && IndexCount + (*LineIt)->GetNumCharacters() < Index )
239 IndexCount += (*LineIt)->GetNumCharacters();
242 Ret.second.Y = (*LineIt)->GetPositionOffset();
243 Ret.second.X = (*LineIt)->GetOffsetAtIndex( Index - IndexCount );
259 return RenderLayer::RLT_MultiLineText;
285 return "MultiLineTextLayer";