This represents a single line of text to be rendered by a TextLayer. More...
#include <textline.h>
Public Types | |
typedef std::list< Character * > | CharacterContainer |
Basic container type for Character storage by this class. | |
typedef CharacterContainer::iterator | CharacterIterator |
Iterator type for Character instances stored by this class. | |
typedef std::pair< CharacterIterator, CharacterIterator > | CharacterIteratorPair |
An std::pair storing two CharacterIterators, usually for expressing a range. | |
typedef CharacterContainer::const_iterator | ConstCharacterIterator |
Const Iterator type for Character instances stored by this class. | |
typedef std::pair< Character *, Vector2 > | OffsetResultPair |
An std::pair storing a Character and it's offset position (relative to the parent layer). | |
typedef CharacterContainer::reverse_iterator | ReverseCharacterIterator |
Reverse Iterator type for Character instances stored by this class. | |
typedef CharacterContainer::const_reverse_iterator | ReverseConstCharacterIterator |
Const Reverse Iterator type for Character instances stored by this class. | |
Public Member Functions | |
TextLine (TextLayer *ParentLayer) | |
Class constructor. More... | |
virtual | ~TextLine () |
Class destructor. | |
Boole | AppendCharacter (Character *ToAdd, const Real MaxWidth) |
Adds a Character to the end of this TextLine. More... | |
Boole | AppendCharacters (CharacterContainer &ToAdd, const Real MaxWidth) |
Adds a series of Characters to the end of this TextLine. More... | |
Boole | AppendCharacters (CharacterIteratorPair Pair, const Real MaxWidth) |
Adds a series of Characters to the end of this TextLine. More... | |
virtual Boole | AppendCharacters (CharacterIterator First, CharacterIterator Last, const Real MaxWidth)=0 |
Adds a series of Characters to the end of this TextLine. More... | |
CharacterIterator | AppendFittingCharacters (CharacterContainer &ToAdd, const Real MaxWidth) |
Adds as many Characters in a range as will fit to this TextLine. More... | |
CharacterIterator | AppendFittingCharacters (CharacterIteratorPair Pair, const Real MaxWidth) |
Adds as many Characters in a range as will fit to this TextLine. More... | |
virtual CharacterIterator | AppendFittingCharacters (CharacterIterator First, CharacterIterator Last, const Real MaxWidth)=0 |
Adds as many Characters in a range as will fit to this TextLine. More... | |
CharacterIterator | BeginCharacter () |
Gets an iterator to the first Character. More... | |
ConstCharacterIterator | BeginCharacter () const |
Gets a const iterator to the first Character. More... | |
CharacterIterator | EndCharacter () |
Gets an iterator to one passed the last Character. More... | |
ConstCharacterIterator | EndCharacter () const |
Gets an iterator to one passed the last Character. More... | |
UI::LinearAlignment | GetAlignment () const |
Gets the current alignment for the text in this line of text. More... | |
OffsetResultPair | GetCharacterAndCursorPositionAtOffset (const Real &Offset) const |
Gets the character at the provided offset as well as the nearest valid position the cursor can take. More... | |
Character * | GetCharacterAtIndex (const UInt32 &Index) |
Gets the character in this textline at the specified index. More... | |
Character * | GetCharacterAtOffset (const Real &Offset) |
Gets the character in this textline at the specified offset. More... | |
Real | GetClosestCursorPosition (const Real &Offset) |
Gets the closest valid cursor position to the offset provided. More... | |
Real | GetCurrentLength () const |
Calculates the current length of this text line. More... | |
virtual Real | GetCursorStartPosition () const =0 |
Gets the offset position of the cursor based on the text order of the layer this text line belongs to. More... | |
virtual CharacterIterator | GetFirstCharacter ()=0 |
Gets the first character in this TextLine. More... | |
Integer | GetIndexAtOffset (const Real &Offset) const |
Gets the index of the character at the provided offset. More... | |
virtual CharacterIterator | GetLastCharacter ()=0 |
Gets the last character in this TextLine. More... | |
Real | GetLeftMostCursorPosition () const |
Gets the offset position of the left-most part of this TextLine. More... | |
Real | GetLineHeight () const |
Gets the size of this TextLine on the Y axis. More... | |
virtual CharacterIterator | GetNextCharacter (CharacterIterator Current)=0 |
Gets an iterator to the next Character. More... | |
UInt32 | GetNumCharacters () const |
Gets the number of characters in this TextLine. More... | |
Real | GetOffsetAtIndex (const Integer &Index) const |
Gets the Offset position of the character at the specified index. More... | |
Real | GetPositionOffset () const |
Gets the offset on the Y axis from the parent layer. More... | |
Real | GetRightMostCursorPosition () const |
Gets the offset position of the right-most part of this TextLine. More... | |
void | RemoveAllCharacters () |
Removes all characters from this TextLine. | |
virtual void | RemoveFirstCharacter ()=0 |
Removes the character at the start of this TextLine. | |
virtual void | RemoveLastCharacter ()=0 |
Removes the character at the end of this TextLine. | |
void | SetAlignment (const UI::LinearAlignment Align) |
Sets the current alignment for the text in this line of text. More... | |
void | SetPositionOffset (const Real &Offset) |
Sets the offset on the Y axis from the parent layer. More... | |
Protected Member Functions | |
virtual void | AppendToBack (Character *ToAppend)=0 |
Adds a character such that it becomes the last in the sequence. More... | |
virtual void | AppendToBack (CharacterIterator First, CharacterIterator Last)=0 |
Adds a series of characters to the end of this line. More... | |
virtual Character * | GetSecondFromLastCharacter () const =0 |
Gets the character before the last character. More... | |
virtual void | RecalculateOffsets ()=0 |
Recalculates the offset for every character in this line. More... | |
Protected Attributes | |
UI::LinearAlignment | Alignment |
The alignment of the text on the X axis in this line. More... | |
CharacterContainer | Characters |
Vector containing all the characters belonging to this TextLine. More... | |
Real | CurrLength |
The current length of this TextLine. More... | |
TextLayer * | Parent |
The parent layer this text line belongs to. More... | |
Real | PositionOffset |
The offset in pixels from the parent layer on the Y axis. More... | |
Real | TallestHeight |
The size of the largest glyph on the Y axis. More... | |
This represents a single line of text to be rendered by a TextLayer.
While many of the utilities of the TextLine class are exposed in public interfaces, it is important to note that this class as a whole is not intended to be used directly by game programmers. These interfaces are available for those that need that level of control but it should be noted that manual manipulation of this class may disrupt the behaviors of not only this class but it's parent layer as well. Query methods are, of course, safe from this.
Definition at line 59 of file textline.h.
Mezzanine::UI::TextLine::TextLine | ( | TextLayer * | ParentLayer | ) |
Class constructor.
Definition at line 57 of file textline.cpp.
Adds a Character to the end of this TextLine.
ToAdd | The Character to be added. |
MaxWidth | The maximum line width to assume for all text lines that are to be populated. |
Definition at line 237 of file textline.cpp.
Boole Mezzanine::UI::TextLine::AppendCharacters | ( | TextLine::CharacterContainer & | ToAdd, |
const Real | MaxWidth | ||
) |
Adds a series of Characters to the end of this TextLine.
ToAdd | A container storing all Characters to attempt to add. |
MaxWidth | The maximum line width to assume for all text lines that are to be populated. |
Definition at line 254 of file textline.cpp.
Boole Mezzanine::UI::TextLine::AppendCharacters | ( | TextLine::CharacterIteratorPair | Pair, |
const Real | MaxWidth | ||
) |
Adds a series of Characters to the end of this TextLine.
Pair | An std::pair containing iterators to both the first and last Characters in a sequence to attempt to append. |
MaxWidth | The maximum line width to assume for all text lines that are to be populated. |
Definition at line 257 of file textline.cpp.
|
pure virtual |
Adds a series of Characters to the end of this TextLine.
First | Iterator to the first Character in the series to be added. |
Last | Iterator to one passed the last Character in the series to be added. |
MaxWidth | The maximum line width to assume for all text lines that are to be populated. |
Implemented in Mezzanine::UI::RightToLeftTextLine, and Mezzanine::UI::LeftToRightTextLine.
TextLine::CharacterIterator Mezzanine::UI::TextLine::AppendFittingCharacters | ( | TextLine::CharacterContainer & | ToAdd, |
const Real | MaxWidth | ||
) |
Adds as many Characters in a range as will fit to this TextLine.
ToAdd | A container storing all Characters to attempt to add. |
MaxWidth | The maximum line width to assume for all text lines that are to be populated. |
Definition at line 260 of file textline.cpp.
TextLine::CharacterIterator Mezzanine::UI::TextLine::AppendFittingCharacters | ( | TextLine::CharacterIteratorPair | Pair, |
const Real | MaxWidth | ||
) |
Adds as many Characters in a range as will fit to this TextLine.
Pair | An std::pair containing iterators to both the first and last Characters in a sequence to attempt to append. |
MaxWidth | The maximum line width to assume for all text lines that are to be populated. |
Definition at line 263 of file textline.cpp.
|
pure virtual |
Adds as many Characters in a range as will fit to this TextLine.
First | Iterator to the first Character in the series to be added. |
Last | Iterator to one passed the last Character in the series to be added. |
MaxWidth | The maximum line width to assume for all text lines that are to be populated. |
Implemented in Mezzanine::UI::RightToLeftTextLine, and Mezzanine::UI::LeftToRightTextLine.
|
protectedpure virtual |
Adds a character such that it becomes the last in the sequence.
ToAppend | The character to be appended. |
Implemented in Mezzanine::UI::RightToLeftTextLine, and Mezzanine::UI::LeftToRightTextLine.
|
protectedpure virtual |
Adds a series of characters to the end of this line.
First | The first Character in a range to be appended. |
Last | The last Character in a range to be appended. |
Implemented in Mezzanine::UI::RightToLeftTextLine, and Mezzanine::UI::LeftToRightTextLine.
TextLine::CharacterIterator Mezzanine::UI::TextLine::BeginCharacter | ( | ) |
Gets an iterator to the first Character.
Definition at line 318 of file textline.cpp.
TextLine::ConstCharacterIterator Mezzanine::UI::TextLine::BeginCharacter | ( | ) | const |
Gets a const iterator to the first Character.
Definition at line 324 of file textline.cpp.
TextLine::CharacterIterator Mezzanine::UI::TextLine::EndCharacter | ( | ) |
Gets an iterator to one passed the last Character.
Definition at line 321 of file textline.cpp.
TextLine::ConstCharacterIterator Mezzanine::UI::TextLine::EndCharacter | ( | ) | const |
Gets an iterator to one passed the last Character.
Definition at line 327 of file textline.cpp.
UI::LinearAlignment Mezzanine::UI::TextLine::GetAlignment | ( | ) | const |
Gets the current alignment for the text in this line of text.
Definition at line 78 of file textline.cpp.
TextLine::OffsetResultPair Mezzanine::UI::TextLine::GetCharacterAndCursorPositionAtOffset | ( | const Real & | Offset | ) | const |
Gets the character at the provided offset as well as the nearest valid position the cursor can take.
Offset | The offset from the left side of this TextLine to use when finding the result. |
Definition at line 83 of file textline.cpp.
Gets the character in this textline at the specified index.
Index | The index of the character to retrieve. |
Definition at line 266 of file textline.cpp.
Gets the character in this textline at the specified offset.
Offset | The offset from the parent position to use when checking characters. |
Definition at line 282 of file textline.cpp.
Gets the closest valid cursor position to the offset provided.
Offset | The offset from the left side of the TextLine. |
Definition at line 193 of file textline.cpp.
Real Mezzanine::UI::TextLine::GetCurrentLength | ( | ) | const |
Calculates the current length of this text line.
Definition at line 228 of file textline.cpp.
|
pure virtual |
Gets the offset position of the cursor based on the text order of the layer this text line belongs to.
Implemented in Mezzanine::UI::RightToLeftTextLine, and Mezzanine::UI::LeftToRightTextLine.
|
pure virtual |
Gets the first character in this TextLine.
Implemented in Mezzanine::UI::RightToLeftTextLine, and Mezzanine::UI::LeftToRightTextLine.
Gets the index of the character at the provided offset.
Offset | The offset from the left side of this TextLine to use when finding the result. |
Definition at line 119 of file textline.cpp.
|
pure virtual |
Gets the last character in this TextLine.
Implemented in Mezzanine::UI::RightToLeftTextLine, and Mezzanine::UI::LeftToRightTextLine.
Real Mezzanine::UI::TextLine::GetLeftMostCursorPosition | ( | ) | const |
Gets the offset position of the left-most part of this TextLine.
Definition at line 169 of file textline.cpp.
Real Mezzanine::UI::TextLine::GetLineHeight | ( | ) | const |
Gets the size of this TextLine on the Y axis.
Definition at line 231 of file textline.cpp.
|
pure virtual |
Gets an iterator to the next Character.
Current | An iterator to a valid Character. |
Implemented in Mezzanine::UI::RightToLeftTextLine, and Mezzanine::UI::LeftToRightTextLine.
UInt32 Mezzanine::UI::TextLine::GetNumCharacters | ( | ) | const |
Gets the number of characters in this TextLine.
Definition at line 304 of file textline.cpp.
Gets the Offset position of the character at the specified index.
Index | The index of the character in this line to get the offset of. |
Definition at line 146 of file textline.cpp.
Real Mezzanine::UI::TextLine::GetPositionOffset | ( | ) | const |
Gets the offset on the Y axis from the parent layer.
Definition at line 225 of file textline.cpp.
Real Mezzanine::UI::TextLine::GetRightMostCursorPosition | ( | ) | const |
Gets the offset position of the right-most part of this TextLine.
Definition at line 181 of file textline.cpp.
|
protectedpure virtual |
Gets the character before the last character.
Implemented in Mezzanine::UI::RightToLeftTextLine, and Mezzanine::UI::LeftToRightTextLine.
|
protectedpure virtual |
Recalculates the offset for every character in this line.
Implemented in Mezzanine::UI::RightToLeftTextLine, and Mezzanine::UI::LeftToRightTextLine.
void Mezzanine::UI::TextLine::SetAlignment | ( | const UI::LinearAlignment | Align | ) |
Sets the current alignment for the text in this line of text.
Align | The enum value representing the horizontal alignment to be set. |
Definition at line 70 of file textline.cpp.
void Mezzanine::UI::TextLine::SetPositionOffset | ( | const Real & | Offset | ) |
Sets the offset on the Y axis from the parent layer.
Offset | The offset in pixels from the top of the parent layer to be this TextLines position. |
Definition at line 222 of file textline.cpp.
|
protected |
The alignment of the text on the X axis in this line.
Definition at line 94 of file textline.h.
|
protected |
Vector containing all the characters belonging to this TextLine.
Definition at line 79 of file textline.h.
|
protected |
The current length of this TextLine.
Definition at line 85 of file textline.h.
|
protected |
The parent layer this text line belongs to.
Definition at line 82 of file textline.h.
|
protected |
The offset in pixels from the parent layer on the Y axis.
Definition at line 91 of file textline.h.
|
protected |
The size of the largest glyph on the Y axis.
Definition at line 88 of file textline.h.