Class for handling a text. More...
#include <GUIText.h>
Classes | |
class | ExtendedString_t |
Class containing a text, its width and its height. More... | |
Public Types | |
enum | HorAligned_t { H_LEFT , H_CENTERED , H_RIGHT , H_PROPERTY } |
Possible horizontal alignments. More... | |
enum | TextColorTypeFlags_t { TEXT_COLOR_STANDARD_IS_PROPERTY = 1 , TEXT_COLOR_HIGHLIGHTED_IS_PROPERTY = 2 , TEXT_COLOR_GRAYED_OUT_IS_PROPERTY = 4 , TEXT_COLOR_PRESSED_IS_PROPERTY = 8 } |
Enumeration indicating if a property or a color value is used for each text color. | |
enum | VerAligned_t { V_TOP , V_CENTERED , V_BOTTOM } |
Possible vertical alignments. More... | |
Public Member Functions | |
CGUIText (const CGUIObject *const pkParentObject, const eC_String &kText, const eC_Value &vXPos=eC_FromInt(0), const eC_Value &vYPos=eC_FromInt(0), const eC_Bool &bSingleLine=true) | |
CGUIText (const CGUIObject *const pkParentObject, const eC_String *const pkText, const eC_Value &vXPos=eC_FromInt(0), const eC_Value &vYPos=eC_FromInt(0), const eC_Bool &bSingleLine=true) | |
CGUIText (const CGUIObject *const pkParentObject, const TextResource_t &eTextID, const eC_Value &vXPos=eC_FromInt(0), const eC_Value &vYPos=eC_FromInt(0), const eC_Bool &bSingleLine=true) | |
CGUIText (const CGUIText &kTextToBeCopied) | |
virtual | ~CGUIText () |
Destructor. | |
virtual CGUIText * | Clone () const |
void | FitHeightToContainedText () |
void | GetAdjustment (eC_Value &vXAdjustment, eC_Value &vYAdjustment) const |
eC_Bool | GetAutoSize () const |
const CGUIObject * | GetContainingObject () const |
FontResource_t | GetFont () const |
eC_Int | GetFontSize () const |
eC_Float | GetFontSpacing () const |
HorAligned_t | GetHorAlign () const |
virtual eC_Value | GetLineSpacing () const |
eC_UInt | GetNumberOfLines () |
virtual eC_Value | GetRelXPos () const |
virtual eC_Value | GetRelYPos () const |
virtual void | GetRequiredOrgTextSpace (eC_Value &vTextWidth, eC_Value &vTextHeight) |
virtual eC_Value | GetRequiredTextHeightForWidth (eC_Value vAvailableWidth=0) |
virtual void | GetRequiredTextSpace (eC_Value &vTextWidth, eC_Value &vTextHeight) |
CGUICommonEnums::Rotation_t | GetRotation () const |
const CGUIRect & | GetSpecificClipRect () const |
const eC_String * | GetText () const |
void | GetTextColor (eC_UInt &uiTextColorStandard, eC_UInt &uiTextColorHighlighted, eC_UInt &uiTextColorGrayedOut, eC_UInt &uiTextColorPressed) const |
void | GetTextColor (GlobalProperty_t &eTextColorStandard, GlobalProperty_t &eTextColorHighlighted, GlobalProperty_t &eTextColorGrayedOut, GlobalProperty_t &eTextColorPressed) const |
eC_UInt | GetTextColorGrayedOut () const |
eC_UInt | GetTextColorHighlighted () const |
eC_UInt | GetTextColorPressed () const |
eC_UInt | GetTextColorStandard () const |
virtual eC_Value | GetTextHeight () const |
TextResource_t | GetTextID () const |
virtual eC_Value | GetTextWidth () const |
VerAligned_t | GetVerAlign () const |
void | InvalidateArea () |
eC_Bool | IsBidi () const |
eC_Bool | IsTextCut () |
eC_Bool | IsTextID () const |
eC_Bool | IsTextSingleLine () const |
CGUIText & | operator= (const CGUIText &kSource) |
virtual void | PrintText () |
virtual void | ReadFromStream () |
void | SetAdjustment (const eC_Value &vXAdjustment, const eC_Value &vYAdjustment) |
void | SetAligned (const VerAligned_t &eVerAligned=V_TOP, const HorAligned_t &eHorAligned=H_LEFT) |
void | SetAlignedHorizontal (const HorAligned_t &eHorAligned=H_LEFT) |
void | SetAlignedVertical (const VerAligned_t &eVerAligned=V_TOP) |
void | SetAutoSize (const eC_Bool &bAutoSize) |
void | SetContainingObject (const CGUIObject *const pkParent) |
virtual void | SetFont (const FontResource_t &eFontID) |
void | SetFontSpacing (const eC_Float &fFontSpacing) |
virtual void | SetLineSpacing (const eC_Value vLineSpacing) |
void | SetRelRect (const CGUIRect &kRect) |
virtual void | SetRelXPos (const eC_Value &vRelXPos) |
virtual void | SetRelYPos (const eC_Value &vRelYPos) |
void | SetRotation (const CGUICommonEnums::Rotation_t eRotation) |
void | SetSpecificClipRect (const CGUIRect &kRect) |
void | SetTextAlignmentProperty (const GlobalProperty_t &eTextAlignmentProperty) |
virtual void | SetTextColor (const eC_UInt &uiTextColorStandard, const eC_UInt &uiTextColorHighlighted, const eC_UInt &uiTextColorGrayedOut, const eC_UInt &uiTextColorPressed) |
virtual void | SetTextColor (const GlobalProperty_t &eTextColorStandard, const GlobalProperty_t &eTextColorHighlighted, const GlobalProperty_t &eTextColorGrayedOut, const GlobalProperty_t &eTextColorPressed) |
void | SetTextColorGrayedOut (const eC_UInt &uiTextColorGrayedOut) |
void | SetTextColorGrayedOut (const GlobalProperty_t &eTextColorPropertyGrayedOut) |
void | SetTextColorHighlighted (const eC_UInt &uiTextColorHighlighted) |
void | SetTextColorHighlighted (const GlobalProperty_t &eTextColorPropertyHighlighted) |
void | SetTextColorPressed (const eC_UInt &uiTextColorPressed) |
void | SetTextColorPressed (const GlobalProperty_t &eTextColorPropertyPressed) |
void | SetTextColorStandard (const eC_UInt &uiTextColorStandard) |
void | SetTextColorStandard (const GlobalProperty_t &eTextColorPropertyStandard) |
virtual void | SetTextHeight (const eC_Value &vTextHeight) |
virtual void | SetTextID (const TextResource_t &eTextID) |
virtual void | SetTextSingleLine (const eC_Bool &bSingleLine) |
virtual void | SetTextString (const eC_String &kTextString) |
void | SetTextString (const eC_String *pkTextString) |
virtual void | SetTextWidth (const eC_Value &vTextWidth) |
virtual void | WriteToStream (const eC_Bool bWriteTextType=false) |
![]() | |
CGUIColorPropertyObserver () | |
default-constructor | |
~CGUIColorPropertyObserver () | |
destructor | |
eC_UInt | AddColorProperty (const eC_Bool &bColorIsProperty, const eC_UInt &uiColorValue, const GlobalProperty_t &eColorProperty) |
void | AddColorProperty (const eC_UInt &uiIndex, const eC_Bool &bColorIsProperty, const eC_UInt &uiColorValue, const GlobalProperty_t &eColorProperty) |
ColorValue_t | GetColorProperty (const eC_UInt &uiIndex) const |
eC_UInt | GetColorValue (const eC_UInt &uiIndex) const |
virtual void | OnColorPropertyChange () |
virtual void | OnNotification () |
Called by CGUISubject whenever an observed object triggers an update. More... | |
void | RemoveColorProperty (const eC_UInt &uiIndex) |
void | SetColorProperty (const eC_UInt &uiIndex, const ColorValue_t &kColorValue) |
void | SetColorProperty (const eC_UInt &uiIndex, const eC_UInt &uiColorValue) |
void | SetColorProperty (const eC_UInt &uiIndex, const GlobalProperty_t &eColorProperty) |
![]() | |
CGUIObserver () | |
Default constructor. | |
virtual | ~CGUIObserver () |
Default destructor. Notifies all subjects of destruction. | |
const eC_TListDoubleLinked< CGUISubject * > & | GetSubjectList () const |
virtual void | OnNotification () |
Called by CGUISubject whenever an observed object triggers an update. More... | |
virtual void | OnNotification (const CGUIObject *const pkUpdatedObject) |
virtual void | OnNotification (const CGUIValue &kObservedValue, const CGUIObject *const pkUpdatedObject, const eC_UInt uiX=0, const eC_UInt uiY=0) |
virtual void | OnNotification (const eC_String &kMessage) |
void | SetAutoDelete (const eC_Bool bAutoDelete) |
![]() | |
const eC_String & | GetXMLTag () const |
virtual void | ReadFromStream () |
void | SetXMLTag (const eC_String &kXMLTag) |
virtual void | WriteToStream (const eC_Bool bWriteClassID=false) |
Static Public Member Functions | |
static eC_String | GetEllipsisString () |
static eC_String | GetHyphenString () |
static void | SetEllipsisString (const eC_String &kEllipsis) |
static void | SetHyphenString (const eC_String &kHyphen) |
Static Public Attributes | |
static const eC_Char | XMLTAG_TEXT_COLOR_GRAYEDOUT [] |
xml-tag for grayedout-color | |
static const eC_Char | XMLTAG_TEXT_COLOR_HIGHLIGHTED [] |
xml-tag for highlighted-color | |
static const eC_Char | XMLTAG_TEXT_COLOR_PRESSED [] |
xml-tag for pressed-color | |
static const eC_Char | XMLTAG_TEXT_COLOR_PROPERTY_FLAGS [] |
XML tag to be used when writing text colors into a stream. More... | |
static const eC_Char | XMLTAG_TEXT_COLOR_STANDARD [] |
xml-tag for standard-color | |
static const eC_Char | XMLTAG_TEXTID [] |
XML tag to be used when writing a text ID into a stream. | |
static const eC_Char | XMLTAG_TEXTTYPEID [] |
XML tag to be used when writing a text type ID into a stream. | |
![]() | |
static const eC_Char | XMLTAG_CLASSVERSION [] |
Protected Types | |
typedef eC_TListDoubleLinked< ExtendedString_t > | ExtendedStringList_t |
The extended string list is a double-linked list of extended strings. | |
typedef eC_TListDoubleLinked< eC_UInt > | UIntList |
Double linked List of unsigned integers. | |
Protected Member Functions | |
virtual void | AdaptText () |
virtual void | CollectHyphenationMarks (eC_String &rkStr, eC_UInt uiOffset) |
eC_Bool | ContainsHyphenationMarks (const eC_String &kStr) const |
void | CreateLocalTextCopy () |
virtual void | FitString (ExtendedString_t &rkResultStrData, const eC_String &rkStrToAnalyse, eC_String &rkRestStr, eC_UInt &uiOffset) |
virtual eC_Value | GetHorStartAbsXPos () |
virtual eC_Value | GetPrintLineAbsXPos () |
virtual eC_Value | GetPrintLineAbsXPos (const eC_UInt uiLine) |
virtual eC_Value | GetPrintLineAbsXPos (const eC_Value &vWidth, const eC_Value &vHeight) |
virtual eC_Value | GetPrintLineAbsYPos () |
virtual eC_Value | GetPrintLineAbsYPos (const eC_UInt uiLine) |
virtual eC_Value | GetPrintLineAbsYPos (const eC_Value &vWidth, const eC_Value &vHeight) |
eC_Value | GetRequiredTextHeight () const |
eC_Value | GetRequiredTextWidth () const |
virtual eC_Value | GetVerStartAbsYPos () |
virtual void | OnNotification () |
eC_Bool | PrepareClipRect () |
virtual void | PreparePrint () |
void | ReadFontColors (const eC_UInt uiVersion) |
void | SetRequiredTextHeight (eC_Value vRequiredTextHeight) |
void | SetRequiredTextWidth (eC_Value vRequiredTextWidth) |
void | SetTextCut (const eC_Bool bIsCut) |
void | WriteFontColors () |
Helper function for WriteStream(). | |
![]() | |
virtual void | AddSubject (CGUISubject *pSubjectToAdd) |
virtual void | RemoveSubject (CGUISubject *pSubjectToRemove) |
![]() | |
eC_UInt | ReadStreamingHeader (const eC_UInt &uiClassVersion, const eC_UInt &uiClassMinVersion=0) const |
void | WriteStreamingFooter (const eC_Bool &bWriteClassID) const |
void | WriteStreamingHeader (const eC_Bool &bWriteClassID, const eC_Char *const pkClassIDTag, const eC_Int &iClassID, const eC_UInt &uiClassVersion) const |
Protected Attributes | |
eC_Bool | m_bAdaptText |
eC_Bool | m_bSingleLine |
Indicates whether this text is single- or multi-line. | |
eC_Bool | m_bTextCut |
Indicates whether the text is cut and has an appended ellipsis. | |
eC_Bool | m_bTextIDLocalCopy |
eC_Bool | m_bTextIsBiDi |
Indicates whether the text is a BiDi-text. | |
eC_Bool | m_bUseEllipsis |
use ellipsis if text is too long | |
FontResource_t | m_eFont |
Font ID for this text object. | |
HorAligned_t | m_eHorAligned |
Horizontal alignment. | |
CGUICommonEnums::Rotation_t | m_eRotation |
rotation for the text | |
GlobalProperty_t | m_eTextAlignmentProperty |
Property used for the text color for alignment. By default, this value is DUMMY_PROPERTY, i.e. a fixed alignment is used. | |
TextResource_t | m_eTextID |
VerAligned_t | m_eVerAligned |
Vertical alignment. | |
eC_Float | m_fFontSpacing |
Font spacing for the text object. | |
UIntList | m_kHyphens |
List of hyphen positions in the original text. | |
ExtendedStringList_t | m_kListStringsExtended |
List of strings to be printed, and their cached width and height. | |
const CGUIObject * | m_pkParentObject |
The object containing (and printing) this text. | |
eC_String * | m_pkText |
eC_Value | m_vLineHeight |
The height of one text line with this text's font. | |
eC_Value | m_vLineSpacing |
The line spacing factor. | |
eC_Value | m_vRelXPos |
X position of this text's printing area relative to the parent object. | |
eC_Value | m_vRelYPos |
Y position of this text's printing area relative to the parent object. | |
eC_Value | m_vRequiredOrgTextHeight |
eC_Value | m_vRequiredOrgTextWidth |
eC_Value | m_vTextHeight |
Height of this text's printing area. | |
eC_Value | m_vTextWidth |
Width of this text's printing area. | |
eC_Value | m_vXAdjustment |
Printing adjustment for m_vRelXPos. | |
eC_Value | m_vYAdjustment |
Printing adjustment for m_vRelYPos. | |
Static Protected Attributes | |
static const ExtendedString_t | ms_ckEmptyExtendedString |
An empty Extended String. | |
static const eC_String | ms_ckEmptyString |
An empty string. | |
static const eC_String | ms_ckSingleSpace |
A single space character for text size calculations. | |
Class for handling a text.
Objects of this class represent texts but are no CGUIObject instances. They are instead assigned to a "parent" GUI object that has to take care of printing the text in its DoDraw implementation when needed. Controls (CGUIObjects) that want to display text should use CGUIText. For an example of how to print a simple text somewhere in your GUI, have a look at CGUIBaseTextField.
Each text object has basic attributes like font, text color and so on. It also has an area in which the text is aligned. This area is positioned relative to its containing ("parent") GUI object and can be adjusted by calling the methods SetRelXPos(), SetRelYPos(), SetTextWidth() and SetTextHeight(). The horizontal and vertical alignment can be set by calling SetAligned().
Clipping is done at the borders of the assigned containing CGUIObject but no extra clipping is done for the area in which the text is aligned. The area in which the text is aligned does only matter for formatting and positioning the text (line wrapping, cutting with ellipsis, position offset from containing object) but not for clipping. Therefore, if part of CGUIText's area is outside of CGUIObject's area and text is placed into this part then part of the text will be invisible because of clipping CGUIObject. That is, the text graphics belong to the graphics of the assigned containing CGUIObject in the same way as all other graphic of that GUI object.
A text is either a single-line or multi-line text (set either at construction time or later by calling SetTextSingleLine()). A single line text always shows only one line of text, whereas in multi-line mode the text may be wrapped at blank characters to achieve optimum line width usage. To further optimise line width usage, it is possible to enter "soft hyphenation" markers ("\-") in texts. These markers are not printed but enable multi-line texts to break words into pieces and insert hyphens in these places.
To print the character sequence backslash minus ("\-"), another backspace has to be prefixed to escape the special meaning, like this: "\\-".
To force linebreaks, enter ccLinebreak characters into the text.
In both single and multi-line texts, the text is cut off if it is too long to be displayed in its CGUIText area and an ellipsis ("...") is appended at the end. Certainly the ellipsis will be inside CGUIText's area.
Objects of this class can represent two different kinds of text: ID texts and string texts. An ID text is represented by a valid TextResource_t ID that is used to access the text in CGUILocalisationHandler whereas string texts manage an independent string on their own. Each text object internally has a text ID but only ID texts have a valid one; for string texts, the ID is invalid (TEXT_START_TAG). To determine what kind of text an object is, call IsTextID(). A CGUIText object can change its type during its lifetime if SetTextString() or SetTextID() is called.
Example:
CGUIText::CGUIText | ( | const CGUIObject *const | pkParentObject, |
const eC_String & | kText, | ||
const eC_Value & | vXPos = eC_FromInt(0) , |
||
const eC_Value & | vYPos = eC_FromInt(0) , |
||
const eC_Bool & | bSingleLine = true |
||
) |
Constructs a string text. By default, the text width and height are set to the width and height of the parent object minus the relative positions.
pkParentObject | Pointer to object containing the text. |
kText | Reference of text string. |
vXPos | X position of text relative to the parent. |
vYPos | Y position of text relative to the parent. |
bSingleLine | true: text is always displayed in a single line, false: lines can be wrapped. |
CGUIText::CGUIText | ( | const CGUIObject *const | pkParentObject, |
const eC_String *const | pkText, | ||
const eC_Value & | vXPos = eC_FromInt(0) , |
||
const eC_Value & | vYPos = eC_FromInt(0) , |
||
const eC_Bool & | bSingleLine = true |
||
) |
Constructs a string text. By default, the text width and height are set to the width and height of the parent object minus the relative positions.
pkParentObject | Pointer to object containing the text. |
pkText | Pointer of text string. |
vXPos | X position of text relative to the parent. |
vYPos | Y position of text relative to the parent. |
bSingleLine | true: text is always displayed in a single line, false: lines can be wrapped. |
CGUIText::CGUIText | ( | const CGUIObject *const | pkParentObject, |
const TextResource_t & | eTextID, | ||
const eC_Value & | vXPos = eC_FromInt(0) , |
||
const eC_Value & | vYPos = eC_FromInt(0) , |
||
const eC_Bool & | bSingleLine = true |
||
) |
Constructs an ID text. By default, the text width and height are set to the width and height of the parent object minus the relative positions.
pkParentObject | Pointer to object containing the text. |
eTextID | ID of the internationalised text. |
vXPos | X position of text relative to the parent. |
vYPos | Y position of text relative to the parent. |
bSingleLine | true: text is always displayed in a single line, false: lines can be wrapped. |
CGUIText::CGUIText | ( | const CGUIText & | kTextToBeCopied | ) |
Copy constructor.
kTextToBeCopied | The text object to be copied. |
|
protectedvirtual |
Adapt the text to the given width of the text field. The only adaptation made is replacing some trailing part of the last text line by Ellipsis characters. No font attribute, like font size, is changed. The function also removes HyphenationMarks from a single line text and calculates the required text width and height. For multi line texts this method breaks the original text into a list of strings at positions indicated by the user. It then calls CreateStringList() for further processing. This method only performs calculations if m_bAdaptText is set to true. Therefore, any method that changes attributes related to the text layout (including font settings, area size and so on) should set this flag to true instead of calling this method directly. It is called in as few places as possible.
Reimplemented in CGUIRichText, and CGUIScrollingText.
|
virtual |
Clones the instance of the GUIText object.
Reimplemented in CGUIEditableText, CGUIRichText, and CGUIScrollingText.
|
protectedvirtual |
Removes hyphenation marks from a string and stores their positions in a list. It goes through the string, removes every hyphenation mark and adds its position (adjusted with the offset) to the list.
[in,out] | rkStr | The string to be searched for hyphenation marks. When this method returns, all of them are removed. |
[in] | uiOffset | Offset of rkStr in this text's string. |
|
protected |
Checks a string for non-escaped hyphenation marks.
kStr | The string to be checked for hyphenation marks. |
|
protected |
This creates a copy of a TextID which is stored in the localisation handler, for local modifications. The copy is stored in m:pkText. If a local copy already exists, this will do nothing.
void CGUIText::FitHeightToContainedText | ( | ) |
Resizes the GUIText's height so that the contained text will be fully visible and not truncated. The text's width will be left untouched.
|
protectedvirtual |
Fits a string to the area width of this text object. The goal of this method is to cut as few characters as possible from the string while using as much of the area width of this text object as possible.
This method returns not only the result (fitting ExtendedString) but also the string that was cut off to make it available for further processing.
The algorithm starts by searching for a fitting word boundary (blank characters). Starting from the beginning of the found word, it tries adjusting the width character by character. It then applies hyphenation and adjusts the result strings.
[out] | rkResultStrData | The result of the analysis is stored here. |
[in] | rkStrToAnalyse | The string that is to be analysed. |
[out] | rkRestStr | Returns the string that did not fit and was cut off of pkStrToAnalyse. |
[in,out] | uiOffset | The absolute offset (position) of pkStrToAnalyse in the original text represented by this object. Required for finding the correct hyphenation points. When this method returns, this value is updated to reflect the offset of pkRestStr for further processing. |
|
inline |
Returns adjustment values. These values are only used by PrintText(). The values are added to the current relative x and y positions, but only for printing. A common use case for this feature is a button that displays its text one or two pixels displaced while the button is pressed down.
vXAdjustment | The adjustment in X direction. |
vYAdjustment | The adjustment in Y direction. |
eC_Bool CGUIText::GetAutoSize | ( | ) | const |
Get autosize of control
|
inline |
Get the object which contains the text.
|
inlinestatic |
Returns the marker which will be append if a text has to be cut-off because of insufficient space.
|
inline |
Retrieves the font.
eC_Int CGUIText::GetFontSize | ( | ) | const |
Retrieves the font size of set font.
|
inline |
Retrieves the font spacing (space between two letters).
|
inline |
Retrieves the horizontal alignment.
|
protectedvirtual |
Get the absolute horizontal position at which the first line of the text begins. Takes the alignment into account.
|
inlinestatic |
Returns the hyphen string which will be used on cutting strings.
|
inlinevirtual |
Returns the current line spacing factor.
eC_UInt CGUIText::GetNumberOfLines | ( | ) |
Returns the number of lines in this text.
|
protectedvirtual |
Get the absolute horizontal position at which the internal text should be printed with regard to the active horizontal alignment. Calls GetPrintLineAbsXPos with the cached width of the internal string.
|
protectedvirtual |
Get the absolute horizontal position at which a line of a multi-line text should be printed, with regard to the active horizontal alignment. Calls GetPrintLineAbsXPos with the cached width of the given line of text.
uiLine | Index of the line of text which is to be printed. |
|
protectedvirtual |
Get the absolute horizontal position at which the text with the given width should be printed, with regard to the active horizontal alignment.
vWidth | width of the text to be printed. |
vHeight | height of the text to be printed. |
|
protectedvirtual |
Get the absolute vertical position at which the internal text should be printed with regard to the active vertical alignment. Calls GetPrintLineAbsYPos with the cached width of the internal string.
|
protectedvirtual |
Get the absolute vertical position at which a line of a multi-line text should be printed, with regard to the active vertical alignment. Calls GetPrintLineAbsYPos with the cached width of the given line of text.
uiLine | Index of the line of text which is to be printed. |
|
protectedvirtual |
Get the absolute vertical position at which the text with the given width should be printed, with regard to the active vertical alignment.
vWidth | width of the text to be printed. |
vHeight | height of the text to be printed. |
|
inlinevirtual |
Returns the relative x position to the parent object.
Reimplemented in CGUIScrollingText.
|
inlinevirtual |
Returns the relative y position to the parent object.
Reimplemented in CGUIScrollingText.
|
virtual |
Get the required space for the text. Calculates the space required for printing the original text string in a single line. No line breaks or hyphenation markers are taken into account.
[out] | vTextWidth | The required text width. |
[out] | vTextHeight | The required text height. |
Reimplemented in CGUIRichText.
|
inlineprotected |
Returns the required text height.
|
virtual |
Get the required height for the complete, uncut text for a given width. If the text is a multi-line text, the required height for the wrapped text is returned. If the text is single-line, height for the single line is returned.
[in] | vAvailableWidth | The available width for the text. By default, the current width is used. |
|
virtual |
Get the required space for the text. If the text is a multi-line text, the required space for the wrapped text is returned. If the text is single-line, the width of the whole text is returned. Note that the returned width will also include potential ellipsis in case the text got truncated.
[out] | vTextWidth | The required text width. |
[out] | vTextHeight | The required text height. |
|
inlineprotected |
Returns the required text width.
CGUICommonEnums::Rotation_t CGUIText::GetRotation | ( | ) | const |
Get current rotation of text
|
inline |
Get the currently set specific cliprect.
const eC_String * CGUIText::GetText | ( | ) | const |
Retrieves the text. The text is returned as an eC_String* and can be NULL.
void CGUIText::GetTextColor | ( | eC_UInt & | uiTextColorStandard, |
eC_UInt & | uiTextColorHighlighted, | ||
eC_UInt & | uiTextColorGrayedOut, | ||
eC_UInt & | uiTextColorPressed | ||
) | const |
Retrieves the text color.
uiTextColorStandard | Standard Text color in ARGB coding (e.g. 0xFFFFFFFF). |
uiTextColorHighlighted | Text color in ARGB coding if the parent object is highlighted. |
uiTextColorGrayedOut | Text color in ARGB coding if the parent object is grayed out. |
uiTextColorPressed | Text color in ARGB coding if the parent object is pressed. |
void CGUIText::GetTextColor | ( | GlobalProperty_t & | eTextColorStandard, |
GlobalProperty_t & | eTextColorHighlighted, | ||
GlobalProperty_t & | eTextColorGrayedOut, | ||
GlobalProperty_t & | eTextColorPressed | ||
) | const |
Retrieves the text color.
eTextColorStandard | Standard Text color as property (e.g. 0xFFFFFFFF). |
eTextColorHighlighted | Text color as property if the parent object is highlighted. |
eTextColorGrayedOut | Text color as property if the parent object is grayed out. |
eTextColorPressed | Text color as property if the parent object is pressed. |
eC_UInt CGUIText::GetTextColorGrayedOut | ( | ) | const |
Returns the currently used color for grayedout-state
eC_UInt CGUIText::GetTextColorHighlighted | ( | ) | const |
Returns the currently used color for highlighted-state
eC_UInt CGUIText::GetTextColorPressed | ( | ) | const |
Returns the currently used color for pressed-state
eC_UInt CGUIText::GetTextColorStandard | ( | ) | const |
Returns the currently used color for standard-state
|
inlinevirtual |
Get the height of the text area.
Reimplemented in CGUIScrollingText.
|
inline |
Retrieves the TextID represented by this object.
|
inlinevirtual |
Get the width of the text area.
Reimplemented in CGUIScrollingText.
|
inline |
Retrieves the vertical alignment.
|
protectedvirtual |
Get the absolute vertical position at which the first line of the text begins. Takes the alignment into account.
void CGUIText::InvalidateArea | ( | ) |
Invalidates the area of the text to be printed. Note that InvalidateArea has to be called before and after changing the text of this object! Example:
eC_Bool CGUIText::IsBidi | ( | ) | const |
Checks if the currently set text contains any BiDi-characters.
|
inline |
Determine whether the text is cut and an ellipsis (...) is appended.
eC_Bool CGUIText::IsTextID | ( | ) | const |
Checks whether this text object is an ID text or a string text.
|
inline |
Determines whether this text is single- or multi-line.
|
protectedvirtual |
Observe the localisation handler and the property handler. If the text behind an ID is changed in the localisation handler and this text is an ID text, this function will be called. If a color property which is used by this text is changed, the property handler calls this function.
Reimplemented from CGUIColorPropertyObserver.
Reimplemented in CGUIRichText.
Copies the base attributes from a source object. This text object will have the same containing object as the source. If you want to set another containing object, you should use SetContainingObject() to set it.
kSource | The source object whose attributes are copied. |
|
protected |
Prepare the clipping rectangle for text printing. This will set the clipping rectangle to the intersecting rectangle of the text's specific clipping rectangle with the GUI's currently set clipping rectangle.
|
protectedvirtual |
Prepare to print the text. This function may only be used in PrintText. It prepares the graphics wrapper state with the correct font, color etc.
Reimplemented in CGUIScrollingText.
|
virtual |
Prints the text. This function may only be called from the DoDraw() implementation of the text's containing GUI object as it uses absolute positioning.
Reimplemented in CGUIEditableText, CGUIRichText, and CGUIScrollingText.
|
protected |
Helper function for ReadFromStream().
uiVersion |
|
virtual |
Reads attributes from the streaming file. Only for use with GUIFactoryManager.
Reimplemented from CGUIStreamableObject.
Reimplemented in CGUIEditableText, CGUIRichText, and CGUIScrollingText.
|
inline |
Set positional adjustment values. These values are only used by PrintText(). The values are added to the current relative x and y positions, but only for printing. A common use case for this feature is a button that displays its text one or two pixels displaced while the button is pressed down.
vXAdjustment | The adjustment in X direction. |
vYAdjustment | The adjustment in Y direction. |
void CGUIText::SetAligned | ( | const VerAligned_t & | eVerAligned = V_TOP , |
const HorAligned_t & | eHorAligned = H_LEFT |
||
) |
Sets the text alignment.
eVerAligned | Vertical alignment |
eHorAligned | Horizontal alignment |
void CGUIText::SetAlignedHorizontal | ( | const HorAligned_t & | eHorAligned = H_LEFT | ) |
Sets horizontal alignment.
eHorAligned | Horizontal alignment |
void CGUIText::SetAlignedVertical | ( | const VerAligned_t & | eVerAligned = V_TOP | ) |
Sets vertical alignment.
eVerAligned | Vertical alignment |
void CGUIText::SetAutoSize | ( | const eC_Bool & | bAutoSize | ) |
Set autosizing of control.
bAutoSize | ture if active |
|
inline |
Sets the object which contains the text. This method just changes the internal pointer to the containing object without re-calculating the text layout. If necessary, adjust the text positioning and area size manually.
pkParent | The object which contains the text. |
|
inlinestatic |
Sets the marker which will be append if a text has to be cut-off because of insufficient space.
kEllipsis | String to be append on cut-off texts. |
|
virtual |
Sets the font.
eFontID | The identifier of the font to set. |
Reimplemented in CGUIEditableText, and CGUIRichText.
void CGUIText::SetFontSpacing | ( | const eC_Float & | fFontSpacing | ) |
Sets the font spacing (space between letters).
fFontSpacing | Font spacing in subpixels (1.0 subpixels equals 1 pixel). |
|
inlinestatic |
Sets the hyphen string which will be used on cutting strings.
kHyphen | Hyphen string to use. |
|
virtual |
Sets the line spacing factor (default line spacing factor is 1). Valid values are in the range of 0-100.
vLineSpacing | The line spacing factor. |
|
inline |
Sets the relative rectangle for this text
kRect | Rectangle relative to containing object which is available for the text |
|
inlinevirtual |
Sets relative x position to the parent object. The effect depends on the alignment. If the text is left aligned, this value is used relative to the left border of the parent object, if it is right aligned, relative to the right border of the parent object. If the text is centered, changing this value has no effect. Attention: the text width will not be re-adjusted by this method. If required, please set it by using SetTextWidth().
vRelXPos | Relative x position. |
Reimplemented in CGUIScrollingText.
|
inlinevirtual |
Sets relative y position to the parent object. The effect depends on the alignment. If the text is top aligned, this value is used relative to the top border of the parent object, if it is bottom aligned, relative to the bottom border of the parent object. If the text is centered, changing this has no effect. Attention: the text height will not be re-adjusted by this method. If required, please set it by using SetTextHeight().
vRelYPos | Relative y position. |
Reimplemented in CGUIScrollingText.
|
inlineprotected |
Sets the required text height.
vRequiredTextHeight | Required text height to set. |
|
inlineprotected |
Sets the required text width.
vRequiredTextWidth | Required text width to set. |
void CGUIText::SetRotation | ( | const CGUICommonEnums::Rotation_t | eRotation | ) |
set rotation of text
eRotation | rotation |
|
inline |
Set a clip rect that different from the relative text position and text dimension. Setting a rectangle of width or height of zero will disable the specific clip rect and default to clipping against the containing object.
kRect | The rect (in coordinates relative to the containing object) that shall be used for clipping the text. |
void CGUIText::SetTextAlignmentProperty | ( | const GlobalProperty_t & | eTextAlignmentProperty | ) |
Set a global alignment property
eTextAlignmentProperty | The id of the property. |
|
virtual |
Sets the color of the text. The colors are used when printing the text. The state of the containing CGUIObject determines which color is used.
uiTextColorStandard | Standard Text color in ARGB coding (e.g. 0xFFFFFFFF). |
uiTextColorHighlighted | Text color in ARGB coding used if the parent object is highlighted. |
uiTextColorGrayedOut | Text color in ARGB coding used if the parent object is grayed out. |
uiTextColorPressed | Text color in ARGB coding used if the parent object is pressed. |
Reimplemented in CGUIRichText.
|
virtual |
Sets the color of the text. The colors are used when printing the text. The state of the containing CGUIObject determines which color is used.
eTextColorStandard | Standard Text color as property (e.g. 0xFFFFFFFF). |
eTextColorHighlighted | Text color as property used if the parent object is highlighted. |
eTextColorGrayedOut | Text color as property used if the parent object is grayed out. |
eTextColorPressed | Text color as property used if the parent object is pressed. |
void CGUIText::SetTextColorGrayedOut | ( | const eC_UInt & | uiTextColorGrayedOut | ) |
Sets the grayed out color of the text. The colors are used when printing the text. The state of the containing CGUIObject determines which color is used.
uiTextColorGrayedOut | Text color in ARGB coding used if the parent object is grayed out. |
void CGUIText::SetTextColorGrayedOut | ( | const GlobalProperty_t & | eTextColorPropertyGrayedOut | ) |
Set a global color property as grayed out color.
eTextColorPropertyGrayedOut | The id of the property. |
void CGUIText::SetTextColorHighlighted | ( | const eC_UInt & | uiTextColorHighlighted | ) |
Sets the highlighted color of the text. The colors are used when printing the text. The state of the containing CGUIObject determines which color is used.
uiTextColorHighlighted | Text color in ARGB coding used if the parent object is highlighted. |
void CGUIText::SetTextColorHighlighted | ( | const GlobalProperty_t & | eTextColorPropertyHighlighted | ) |
Set a global color property as highlighted color.
eTextColorPropertyHighlighted | The id of the property. |
void CGUIText::SetTextColorPressed | ( | const eC_UInt & | uiTextColorPressed | ) |
Sets the pressed color of the text. The colors are used when printing the text. The state of the containing CGUIObject determines which color is used.
uiTextColorPressed | Text color in ARGB coding used if the parent object is pressed. |
void CGUIText::SetTextColorPressed | ( | const GlobalProperty_t & | eTextColorPropertyPressed | ) |
Set a global color property as pressed color.
eTextColorPropertyPressed | The id of the property. |
void CGUIText::SetTextColorStandard | ( | const eC_UInt & | uiTextColorStandard | ) |
Sets the standard color of the text. The colors are used when printing the text. The state of the containing CGUIObject determines which color is used.
uiTextColorStandard | Standard Text color in ARGB coding (e.g. 0xFFFFFFFF). |
void CGUIText::SetTextColorStandard | ( | const GlobalProperty_t & | eTextColorPropertyStandard | ) |
Set a global color property as standard color.
eTextColorPropertyStandard | The id of the property. |
|
inlineprotected |
Sets the internal flagindicating thwther this text has been truncated.
bIsCut | True means that the string was truncated, False means that it was not truncated |
|
virtual |
Sets the text height.
vTextHeight | The height assigned to the text. |
Reimplemented in CGUIScrollingText.
|
virtual |
Sets the text ID.
eTextID | The ID of the text to assign to this object. |
Reimplemented in CGUIRichText.
|
virtual |
Sets the text line wrapping mode (single or multi-line).
bSingleLine | true: single line; false: multi-line. |
|
virtual |
Sets the string text to be represented by this object.
kTextString | The string to be assigned to this object. |
Reimplemented in CGUIRichText, and CGUIEditableText.
void CGUIText::SetTextString | ( | const eC_String * | pkTextString | ) |
Sets the string text to be represented by this object.
pkTextString | The string to be assigned to this object. |
|
virtual |
Sets the text width.
vTextWidth | The width assigned to the text. |
Reimplemented in CGUIScrollingText.
|
virtual |
Called by the framework when writing streaming files. When deriving a new text class in an application, re-implement this method.
bWriteTextType | Indicates whether the ID needs to be written. If the framework calls this method, it passes true here. The base class implementation has to be called with false (default). If called with true, the first two tags written must be this text's XML name tag (see GetXMLTag()) and its text type ID. After all attributes are written, the name tag has to be written again as a closing tag (preceded by a slash). |
Reimplemented from CGUIStreamableObject.
Reimplemented in CGUIEditableText, CGUIRichText, and CGUIScrollingText.
|
protected |
Flag to keep track of whether AdaptText() needs to perform calculations upon its next call. Every method that changes text attributes that can potentially lead to a change in the text layout should set this flag to true. AdaptText() resets it.
|
protected |
Set to True if this text is an ID text but m_pkText points to a local copy instead to the string in the localisation handler. This happens if the string contains hyphenation marks.
|
protected |
The ID of the text. If this text is constructed with an ID or changed later (by calling SetTextID()) the ID is stored here. If this text is constructed with a string or changed later by calling SetTextString() this ID is set to TEXT_START_TAG, indicating that it is invalid.
|
protected |
This contains the text string if it is a string literal, or a locally modified copy of a string in the Localisation handler. For instances of CGUIText which are referencing an unmodified TextResource in the localisation handler, this is NULL. A TextID will for instance be stored in a local copy if it is truncated or was word-wrapped.
|
protected |
The required height of this text's original (not wrapped) string as calculated by the most recent call to AdaptText().
|
protected |
The required width of this text's original (not wrapped) string as calculated by the most recent call to AdaptText().
|
static |
XML tag to be used when writing text colors into a stream.
xml-tag of color-properties