41 #ifndef _uitextlayer_h
42 #define _uitextlayer_h
44 #include "UI/renderlayer.h"
45 #include "UI/character.h"
94 SM_ScreenRelative = 1,
95 SM_ParentRelative = 2,
149 virtual void RedrawImpl(
Boole Force);
152 virtual void RecalculateOffsets();
156 virtual void PopulateTextLinesImpl(
const Real MaxWidth) = 0;
161 virtual CharIndexPair GetIndexAtOffsetImpl(
const Vector2& Position) = 0;
166 virtual CharOffsetPair GetOffsetAtIndexImpl(
const Integer Index) = 0;
195 virtual Boole SetMarkupParser(
const String& ParserName);
205 virtual Real GetTotalHeight()
const;
209 virtual Real GetMaxLineWidth()
const;
212 virtual Real GetDesiredLineHeight()
const;
222 virtual CharIndexPair GetIndexAtOffset(
const Vector2& Offset);
228 virtual CharOffsetPair GetOffsetAtIndex(
const Integer Index);
235 virtual void SetText(
const String& Text);
238 virtual String GetText()
const;
241 virtual void SetTextColour(
const ColourValue& Colour);
249 virtual void SetManualTextScale(
const Vector2& Scale);
252 virtual const Vector2& GetManualTextScale()
const;
270 virtual Real GetAutoTextScalar()
const;
277 virtual void SetDefaultFont(
FontData* NewFont);
283 virtual void SetDefaultFont(
const String& FontName);
290 virtual void SetDefaultFont(
const String& FontName,
const String& Atlas);
303 virtual void SetActiveHighlightBackgroundColour(
const ColourValue& Colour);
306 virtual const ColourValue& GetActiveHighlightBackgroundColour()
const;
311 virtual void SetInactiveHighlightBackgroundColour(
const ColourValue& Colour);
314 virtual const ColourValue& GetInactiveHighlightBackgroundColour()
const;
317 virtual void Highlight();
320 virtual void Highlight(
const Integer Index);
324 virtual void Highlight(
const Integer StartIndex,
const Integer EndIndex);
327 virtual Integer GetHighlightStart()
const;
330 virtual Integer GetHighlightEnd()
const;
332 virtual void ClearHighlights();
351 virtual void SetCursorEnabled(
Boole Enable);
354 virtual Boole GetCursorEnabled()
const;
371 virtual TextLine* GetTextLineAtOffset(
const Real& Offset);
374 virtual Whole GetNumTextLines()
const;
378 virtual void PopulateTextLines(
const Real MaxWidth);
380 virtual void ClearAllTextLines();
382 virtual void DestroyAllTextLines();
398 virtual TextLineIterator BeginTextLine();
401 virtual TextLineIterator EndTextLine();
404 virtual ConstTextLineIterator BeginTextLine()
const;
407 virtual ConstTextLineIterator EndTextLine()
const;
427 virtual CharacterIterator GetCharacterIteratorAtIndex(
const Integer Index);
431 virtual ConstCharacterIterator GetCharacterIteratorAtIndex(
const Integer Index)
const;
434 virtual Whole GetNumCharacters()
const;
469 virtual Integer DestroyAllCharacters();
473 CharacterIterator BeginCharacter();
476 CharacterIterator EndCharacter();
479 ConstCharacterIterator BeginCharacter()
const;
482 ConstCharacterIterator EndCharacter()
const;
488 virtual void ProtoSerialize(
XML::Node& ParentNode)
const;
490 virtual void ProtoSerializeProperties(
XML::Node& SelfRoot)
const;
493 virtual void ProtoSerializeCursor(
XML::Node& SelfRoot)
const;
496 virtual void ProtoSerializeText(
XML::Node& SelfRoot)
const;
499 virtual void ProtoDeSerialize(
const XML::Node& SelfRoot);
501 virtual void ProtoDeSerializeProperties(
const XML::Node& SelfRoot);
504 virtual void ProtoDeSerializeCursor(
const XML::Node& SelfRoot);
507 virtual void ProtoDeSerializeText(
const XML::Node& SelfRoot);
510 virtual String GetDerivedSerializableName()
const;
512 static String GetSerializableName();
UI::LinearAlignment VerticalAlign
The alignment TextLines will have.
std::pair< Boole, Vector2 > CharOffsetPair
An std::pair type used as a return for index-offset conversions.
This class represents a collection of Glyphs in a common visual style.
This is a helper class that facilitates operations with collections of tokens generated from Markup P...
bool Boole
Generally acts a single bit, true or false.
CharacterContainer Characters
Container with all this layers Characters.
MarkupParser * MUParser
The parser to use when converting raw strings to renderable characters.
int Integer
A datatype used to represent any integer close to.
TextOrdering
This enum describes the direction of advancing characters or lines along the X axis.
This is a simple class for holding 4 reals representing the colour any give object or lightsource can...
Real MaxLineWidth
The maximum width of textlines generated by this layer in pixels.
TextLineContainer::iterator TextLineIterator
Iterator type for TextLine instances stored by this class.
Integer HighlightStart
The index of the character at the start of the highlight sequence.
This class stores common data for determining the look of a Character.
ColourValue ActiveHLColour
The colour of the highlight when this layer belongs to a focused widget.
This represents a single line of text to be rendered by a TextLayer.
Integer HighlightEnd
The index of the character at the end of the highlight sequence.
Real AutoCharScaling
The auto-scaling height the text is to be in relative units.
CharacterContainer::const_reverse_iterator ConstReverseCharacterIterator
Const Reverse Iterator type for Character instances stored by this class.
std::pair< Boole, Integer > CharIndexPair
An std::pair type used as a return for index-offset conversions.
float Real
A Datatype used to represent a real floating point number.
LinearAlignment
Used by various UI classes to determine the alignment of their child objects, such as text in text li...
char Char8
A datatype to represent one character.
CharacterContainer::reverse_iterator ReverseCharacterIterator
Reverse Iterator type for Character instances stored by this class.
ScalingMode
An enum used to describe how the text generated by this layer will be automatically scaled...
A light-weight handle for manipulating nodes in DOM tree.
This class creates and encapsultes a character that can be used in text renders.
uint32_t UInt32
An 32-bit unsigned integer.
This is used to represent a point on a 2 dimentional area, such as a screen.
CharacterTraits DefaultCharTraits
Default set of traits all characters generated inside this layer are to have.
Class for encapsulating the functionality of the text cursor/carat navigation in text layers...
std::vector< TextLine * > TextLineContainer
Basic container type for the storate of TextLine instances by this class.
CharacterContainer::const_iterator ConstCharacterIterator
Const Iterator type for Character instances stored by this class.
The bulk of the engine components go in this namspace.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
Vector2 ManualCharScaling
The scaling to apply to all characters in this layer.
TextLineContainer TextLines
Container with all this layers TextLines.
This is a base class for the parsing of markup texts contained in text layers.
This represents a nestable quad for an object in a GUI layout.
ScalingMode AutoCharScalingMode
The auto-scaling mode that is to be used on text generated by this textlayer.
std::pair< CharacterIterator, CharacterIterator > CharacterIteratorPair
An std::pair type storing two character iterators, usually used to express a range.
UI::TextOrdering HorizontalOrder
The order text will have in TextLines.
TextLineContainer::const_iterator ConstTextLineIterator
Const Iterator type for TextLine instances stored by this class.
TextCursor * Cursor
The cursor to be used for insert and manipulation operations.
TokenString * TextTokens
The actual text parsed into tokens used for generating characters.
std::string String
A datatype used to a series of characters.
This is a base class for render layers that render text.
ColourValue InactiveHLColour
The colour of the highlight when this layer belongs to a widget not being focused.
This is the base class for the types of layers that can be added to a renderable. ...
std::list< Character * > CharacterContainer
Basic container type for the storage of Character instances by this class.
CharacterContainer::iterator CharacterIterator
Iterator type for Character instances stored by this class.