Guiliani  Version 2.4 revision 5970 (build 3)
CGUIRichText Class Reference

Text implementation which supports rich text. More...

#include <GUIRichText.h>

Inheritance diagram for CGUIRichText:

Classes

class  CRichTextFragment
 One fragment of a rich text. More...
 

Public Member Functions

 CGUIRichText (const CGUIObject *const pParentObject, const eC_String &kText, const eC_Value &vXPos=eC_FromInt(0), const eC_Value &vYPos=eC_FromInt(0), const eC_Bool &bSingleLine=true)
 
 CGUIRichText (const CGUIObject *const pParentObject, const eC_String *const pkText, const eC_Value &vXPos=eC_FromInt(0), const eC_Value &vYPos=eC_FromInt(0), const eC_Bool &bSingleLine=true)
 
 CGUIRichText (const CGUIObject *const pParentObject, const TextResource_t &eTextID, const eC_Value &vXPos=eC_FromInt(0), const eC_Value &vYPos=eC_FromInt(0), const eC_Bool &bSingleLine=true)
 
 CGUIRichText (const CGUIRichText &kTextToBeCopied)
 
virtual ~CGUIRichText ()
 
virtual CGUIRichTextClone () const
 
void EnablePreformatting (const eC_Bool &bPreformatText)
 
const eC_String & GetFormatTagBold () const
 
const eC_String & GetFormatTagClosing () const
 
const eC_String & GetFormatTagColor () const
 
const eC_String & GetFormatTagFinished () const
 
const eC_String & GetFormatTagItalic () const
 
const eC_String & GetFormatTagLineBreak () const
 
const eC_String & GetFormatTagListItem () const
 
const eC_String & GetFormatTagNoBreak () const
 
const eC_String & GetFormatTagOpening () const
 
const eC_String & GetFormatTagOrderedList () const
 
const eC_String & GetFormatTagUnderlined () const
 
const eC_String & GetFormatTagUnorderedList () const
 
virtual void GetRequiredOrgTextSpace (eC_Value &vTextWidth, eC_Value &vTextHeight)
 
eC_Bool IsTextPreformatted ()
 
CGUIRichTextoperator= (const CGUIRichText &kSource)
 
virtual void PrintText ()
 
virtual void SetFont (const FontResource_t &eFontID)
 
void SetFormatTagBold (const eC_String &kTag)
 
void SetFormatTagClosing (const eC_String &kTag)
 
void SetFormatTagColor (const eC_String &kTag)
 
void SetFormatTagFinished (const eC_String &kTag)
 
void SetFormatTagItalic (const eC_String &kTag)
 
void SetFormatTagLineBreak (const eC_String &kTag)
 
void SetFormatTagListItem (const eC_String &kTag)
 
void SetFormatTagNoBreak (const eC_String &kTag)
 
void SetFormatTagOpening (const eC_String &kTag)
 
void SetFormatTagOrderedList (const eC_String &kTag)
 
void SetFormatTagUnderlined (const eC_String &kTag)
 
void SetFormatTagUnorderedList (const eC_String &kTag)
 
virtual void SetRichFonts (const FontResource_t &eFontNormal=DUMMY_FONT, const FontResource_t &eFontBold=DUMMY_FONT, const FontResource_t &eFontItalic=DUMMY_FONT, const FontResource_t &eFontBoldItalic=DUMMY_FONT)
 
virtual void SetTextColor (const eC_UInt &uiTextColorStandard, const eC_UInt &uiTextColorHighlighted, const eC_UInt &uiTextColorGrayedOut, const eC_UInt &uiTextColorPressed)
 
virtual void SetTextID (const TextResource_t &eTextID)
 
virtual void SetTextString (const eC_String &kTextString)
 
- Public Member Functions inherited from CGUIText
 CGUIText (const CGUIObject *const pParentObject, 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 pParentObject, 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 pParentObject, 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.
 
void FitHeightToContainedText ()
 
void GetAdjustment (eC_Value &vXAdjustment, eC_Value &vYAdjustment) const
 
eC_Bool GetAutoSize () const
 
const CGUIObjectGetContainingObject () 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 eC_Value GetRequiredTextHeightForWidth (eC_Value vAvailableWidth=0)
 
virtual void GetRequiredTextSpace (eC_Value &vTextWidth, eC_Value &vTextHeight)
 
const CGUIRectGetSpecificClipRect () 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
 
CGUITextoperator= (const CGUIText &kSource)
 
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 pParent)
 
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 SetSpecificClipRect (const CGUIRect &kRect)
 
void SetTextAlignmentProperty (const GlobalProperty_t &eTextAlignmentProperty)
 
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 SetTextSingleLine (const eC_Bool &bSingleLine)
 
void SetTextString (const eC_String *pkTextString)
 
virtual void SetTextWidth (const eC_Value &vTextWidth)
 
- Public Member Functions inherited from CGUIColorPropertyObserver
 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 ()
 
void RemoveColorProperty (const eC_UInt &uiIndex)
 
void SetColorProperty (const eC_UInt &uiIndex, const eC_UInt &uiColorValue)
 
void SetColorProperty (const eC_UInt &uiIndex, const GlobalProperty_t &eColorProperty)
 
void SetColorProperty (const eC_UInt &uiIndex, const ColorValue_t &kColorValue)
 
- Public Member Functions inherited from CGUIObserver
 CGUIObserver ()
 Default constructor.
 
virtual ~CGUIObserver ()
 Default destructor. Notifies all subjects of destruction.
 
const eC_TListDoubleLinked< CGUISubject * > & GetSubjectList () const
 
virtual void OnNotification (const eC_String &kMessage)
 
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)
 
void SetAutoDelete (const eC_Bool bAutoDelete)
 
- Public Member Functions inherited from CGUIStreamableObject
const eC_String & GetXMLTag () const
 
void SetXMLTag (const eC_String &kXMLTag)
 

Protected Types

enum  ListType_t { LT_ORDERED, LT_UNORDERED, LT_NONE }
 List type.
 
typedef eC_TListDoubleLinked< CRichTextFragmentRichTextFragmentList
 A rich text fragment list is a double-linked list of rich text fragments.
 
- Protected Types inherited from CGUIText
typedef eC_TListDoubleLinked< ExtendedString_tExtendedStringList_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

void AdaptText ()
 
void FitFragmentWithEllipsis (CRichTextFragment &TextFragment, eC_Value vMaxWidth)
 
void OnNotification ()
 
void ParseTextToRich ()
 
void PreformatText ()
 
void PreparePrintForFragment (const CRichTextFragment &Fragment)
 
virtual void ReadFromStream ()
 
void SplitFragment (CRichTextFragment &FirstTextFragment, CRichTextFragment &SecondTextFragment, eC_Value vMaxWidth, eC_UInt uiCharOffsetFromStart)
 
virtual void WriteToStream (const eC_Bool bWriteTextType=false)
 
- Protected Member Functions inherited from CGUIText
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 GetPrintLineAbsXPos (const eC_Value vWidth)
 
virtual eC_Value GetPrintLineAbsXPos (const eC_UInt uiLine)
 
virtual eC_Value GetPrintLineAbsXPos ()
 
eC_Value GetRequiredTextHeight () const
 
eC_Value GetRequiredTextWidth () const
 
virtual eC_Value GetVerStartAbsYPos ()
 
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().
 
- Protected Member Functions inherited from CGUIObserver
virtual void AddSubject (CGUISubject *pSubjectToAdd)
 
virtual void RemoveSubject (CGUISubject *pSubjectToRemove)
 
- Protected Member Functions inherited from CGUIStreamableObject
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_bPreformatText
 Controls whether PreformatText() is called.
 
FontResource_t m_eFontBold
 font resource: bold
 
FontResource_t m_eFontBoldItalic
 font resource: bold italic
 
FontResource_t m_eFontItalic
 font resource: italic
 
eC_TArray< eC_Value > m_kLineWidths
 Width of each line of text (required for X-Alignments)
 
RichTextFragmentList m_kOriginalRichTextFragments
 Original list of all Text-fragments within this text.
 
RichTextFragmentList m_kRichTextFragments
 
eC_String m_kTagBold
 Format tag: bold.
 
eC_String m_kTagClosing
 Format tag: closing.
 
eC_String m_kTagColor
 Format tag: color.
 
eC_String m_kTagFinished
 Format tag: finished.
 
eC_String m_kTagItalic
 Format tag: italic.
 
eC_String m_kTagLineBreak
 Format tag: line break.
 
eC_String m_kTagListItem
 Format tag: list item.
 
eC_String m_kTagNoBreak
 Format tag: no break.
 
eC_String m_kTagOpening
 Format tag: opening.
 
eC_String m_kTagOrderedList
 Format tag: ordered list.
 
eC_String m_kTagUnderlined
 Format tag: underlined.
 
eC_String m_kTagUnorderedList
 Format tag: unordered list.
 
eC_String m_kUnorderedListSign
 The unordered list sign.
 
eC_Value m_vListIndentation
 Default list indentation.
 
eC_Value m_vSpaceWidth
 Width of a space to avoid calling RequiredSpace() too often.
 
eC_Value m_vUnorderedListSignWidth
 Width of the unordered list sign.
 
- Protected Attributes inherited from CGUIText
eC_Bool m_bAdaptText
 
eC_Bool m_bSingleLine
 Indicates whether this text is single- or multi-line.
 
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
 
HorAligned_t m_eHorAligned
 Horizontal alignment.
 
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.
 
VerAligned_t m_eVerAligned
 Vertical alignment.
 
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 CGUIObjectm_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.
 

Additional Inherited Members

- Public Types inherited from CGUIText
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...
 
- Static Public Member Functions inherited from CGUIText
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 inherited from CGUIText
static const eC_Char XMLTAG_TEXT_COLOR_GRAYEDOUT [] = "TextColorGrayedOut"
 xml-tag for grayedout-color
 
static const eC_Char XMLTAG_TEXT_COLOR_HIGHLIGHTED [] = "TextColorHighlighted"
 xml-tag for highlighted-color
 
static const eC_Char XMLTAG_TEXT_COLOR_PRESSED [] = "TextColorPressed"
 xml-tag for pressed-color
 
static const eC_Char XMLTAG_TEXT_COLOR_PROPERTY_FLAGS [] = "ColorPropertyFlags"
 XML tag to be used when writing text colors into a stream. More...
 
static const eC_Char XMLTAG_TEXT_COLOR_STANDARD [] = "TextColorStandard"
 xml-tag for standard-color
 
static const eC_Char XMLTAG_TEXTID [] = "TextID"
 XML tag to be used when writing a text ID into a stream.
 
static const eC_Char XMLTAG_TEXTTYPEID [] = "TextTypeID"
 XML tag to be used when writing a text type ID into a stream.
 
- Static Public Attributes inherited from CGUIStreamableObject
static const eC_Char XMLTAG_CLASSVERSION [] = "ClassVersion"
 
- Static Protected Attributes inherited from CGUIText
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.
 

Detailed Description

Text implementation which supports rich text.

Text implementation which supports rich text (bold, italic, underlined, color...) via tags embedded in the supplied text string. It is recommended to only use rich text where necessary, since it requires significantly more performance that Guiliani's plain standard texts. Prior to using the rich text object you need to supply it with one font each for "bold", "italic" and "bold-italic". Otherwise, the text's default font identifier will be used instead.

Format tags must be embedded in the following syntax (equal to normal HTML syntax):

<[FORMAT_TAG1]><[FORMAT_TAG2]>[STRING TO OUTPUT]</[FORMAT_TAG1]></[FORMAT_TAG2]>

The following format tags are supported:

"<colorFFFFFF55>some string</colorFFFFFF55>" Sets the color used for printing the given string. Color format is AARRGGBB.

"<b>some string</b>" Prints the given string using the bold-font.

"<i>some string</i>" Prints the given string using the italic-font.

"<u>some string</u>" Prints the given string using the underlined-font.

"<nobr>some string</nobr>" Avoids line breaking the string.

Example:

// Create a textfield
CGUIBaseTextField* pTextField = new CGUIBaseTextField(this, 10, 300, 250, 40, "", false);
// A demo string including rich text formatting
eC_String kRichText("This is a <colorFFFFFF55>text</colorFFFFFF55> which shall Wg demonstrate the use of <b>rich Wg text</b> features within <i><colorFFFF0000>Guiliani</colorFFFF0000></i>.");
// Create richtext object
CGUIRichText* pRichText = new CGUIRichText(this, kRichText);
// Supply fonts for each format tag
FontResource_t FontNormal = GETRESMANAGER.RegisterDynamicFont("DejaVuSerifCondensed.ttf", 15, CFntWrap::FNT_NORMAL, true);
GETRESMANAGER.RequestFontResource(FontNormal);
FontResource_t FontBold = GETRESMANAGER.RegisterDynamicFont("DejaVuSerifCondensed-Bold.ttf", 17, CFntWrap::FNT_BOLD, true);
GETRESMANAGER.RequestFontResource(FontBold);
FontResource_t FontItalic = GETRESMANAGER.RegisterDynamicFont("DejaVuSerifCondensed-Italic.ttf", 15, CFntWrap::FNT_ITALIC, true);
GETRESMANAGER.RequestFontResource(FontItalic);
FontResource_t FontBoldItalic = GETRESMANAGER.RegisterDynamicFont("DejaVuSerifCondensed-BoldItalic.ttf", 15, static_cast<CFntWrap::GUIFont_t>(CFntWrap::FNT_BOLD | CFntWrap::FNT_ITALIC), true);
GETRESMANAGER.RequestFontResource(FontBoldItalic);
pRichText->SetRichFonts(FontNormal, FontBold, FontItalic, FontBoldItalic);
// Associate richtext with text field
pTextField->SetText(pRichText);
pRichText->SetTextWidth(pTextField->GetWidth());
pRichText->SetTextHeight(pTextField->GetHeight());
pRichText->SetTextSingleLine(false);

Constructor & Destructor Documentation

◆ CGUIRichText() [1/4]

CGUIRichText::CGUIRichText ( const CGUIObject *const  pParentObject,
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 rich text. By default, the text width and height are set to the width and height of the parent object minus the relative positions.

Parameters
pParentObjectPointer to object containing the text.
kTextReference of text string.
vXPosX position of text relative to the parent.
vYPosY position of text relative to the parent.
bSingleLinetrue: text is always displayed in a single line, false: lines can be wrapped.

◆ CGUIRichText() [2/4]

CGUIRichText::CGUIRichText ( const CGUIObject *const  pParentObject,
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 rich text. By default, the text width and height are set to the width and height of the parent object minus the relative positions.

Parameters
pParentObjectPointer to object containing the text.
pkTextPointer of text string.
vXPosX position of text relative to the parent.
vYPosY position of text relative to the parent.
bSingleLinetrue: text is always displayed in a single line, false: lines can be wrapped.

◆ CGUIRichText() [3/4]

CGUIRichText::CGUIRichText ( const CGUIObject *const  pParentObject,
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 rich text. By default, the text width and height are set to the width and height of the parent object minus the relative positions.

Parameters
pParentObjectPointer to object containing the text.
eTextIDID of the internationalised text.
vXPosX position of text relative to the parent.
vYPosY position of text relative to the parent.
bSingleLinetrue: text is always displayed in a single line, false: lines can be wrapped.

◆ CGUIRichText() [4/4]

CGUIRichText::CGUIRichText ( const CGUIRichText kTextToBeCopied)

Copy constructor.

Parameters
kTextToBeCopiedThe rich text object to be copied.

◆ ~CGUIRichText()

CGUIRichText::~CGUIRichText ( )
virtual

Destructor

Member Function Documentation

◆ AdaptText()

void CGUIRichText::AdaptText ( )
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 from CGUIText.

◆ Clone()

CGUIRichText * CGUIRichText::Clone ( ) const
virtual

Clones the instance of the GUIRichText object.

Returns
Pointer to the cloned GUIRichText object.

Reimplemented from CGUIText.

◆ EnablePreformatting()

void CGUIRichText::EnablePreformatting ( const eC_Bool &  bPreformatText)
inline

Enables the preformatting of the text by removing useless spaces, truncating leading and ending spaces and removing the line breaks.

Parameters
bPreformatTexttrue to enable preformatting.

◆ FitFragmentWithEllipsis()

void CGUIRichText::FitFragmentWithEllipsis ( CRichTextFragment TextFragment,
eC_Value  vMaxWidth 
)
protected

Truncates a Text-fragment, so that it will fit into the supplied horizontal space. If the fragment fits completely into the available space, nothing will be done. If it does not, it will be truncated using ellipsis.

Parameters
TextFragmentText fragment which will be adapted.
vMaxWidthAvailable width which must not be exceeded

◆ GetFormatTagBold()

const eC_String& CGUIRichText::GetFormatTagBold ( ) const
inline

Returns the indicator string for the bold tag.

Returns
Indicator string.

◆ GetFormatTagClosing()

const eC_String& CGUIRichText::GetFormatTagClosing ( ) const
inline

Returns the indicator string for the tag closing sign.

Returns
Indicator string.

◆ GetFormatTagColor()

const eC_String& CGUIRichText::GetFormatTagColor ( ) const
inline

Returns the indicator string for the color tag.

Returns
Indicator string.

◆ GetFormatTagFinished()

const eC_String& CGUIRichText::GetFormatTagFinished ( ) const
inline

Returns the indicator string for the tag finished sign.

Returns
Indicator string.

◆ GetFormatTagItalic()

const eC_String& CGUIRichText::GetFormatTagItalic ( ) const
inline

Returns the indicator string for the italic tag.

Returns
Indicator string.

◆ GetFormatTagLineBreak()

const eC_String& CGUIRichText::GetFormatTagLineBreak ( ) const
inline

Returns the indicator string for the force line break tag.

Returns
Indicator string.

◆ GetFormatTagListItem()

const eC_String& CGUIRichText::GetFormatTagListItem ( ) const
inline

Returns the indicator string for the list item tag.

Returns
Indicator string.

◆ GetFormatTagNoBreak()

const eC_String& CGUIRichText::GetFormatTagNoBreak ( ) const
inline

Returns the indicator string for the no line break tag.

Returns
Indicator string.

◆ GetFormatTagOpening()

const eC_String& CGUIRichText::GetFormatTagOpening ( ) const
inline

Returns the indicator string for the tag opening sign.

Returns
Indicator string.

◆ GetFormatTagOrderedList()

const eC_String& CGUIRichText::GetFormatTagOrderedList ( ) const
inline

Returns the indicator string for the ordered list tag.

Returns
Indicator string.

◆ GetFormatTagUnderlined()

const eC_String& CGUIRichText::GetFormatTagUnderlined ( ) const
inline

Returns the indicator string for the underlined tag.

Returns
Indicator string.

◆ GetFormatTagUnorderedList()

const eC_String& CGUIRichText::GetFormatTagUnorderedList ( ) const
inline

Returns the indicator string for the unordered list tag.

Returns
Indicator string.

◆ GetRequiredOrgTextSpace()

void CGUIRichText::GetRequiredOrgTextSpace ( eC_Value &  vTextWidth,
eC_Value &  vTextHeight 
)
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.

Parameters
[out]vTextWidthThe required text width.
[out]vTextHeightThe required text height.

Reimplemented from CGUIText.

◆ IsTextPreformatted()

eC_Bool CGUIRichText::IsTextPreformatted ( )
inline

Indicates if preformatting is enabled or not.

Returns
True if preformatting of the text is enabled

◆ OnNotification()

void CGUIRichText::OnNotification ( )
protectedvirtual

Check if the text colors are updated and parse the text again if necessary.

Reimplemented from CGUIText.

◆ operator=()

CGUIRichText & CGUIRichText::operator= ( const CGUIRichText kSource)

Copies the base attributes from a source object. This rich 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.

Parameters
kSourceThe source object whose attributes are copied.
Returns
Where to assign to

◆ ParseTextToRich()

void CGUIRichText::ParseTextToRich ( )
protected

Parses the text for rich text tags and formats it accordingly. Please refer to the class documentation for a description of the supported rich text tags.

◆ PreformatText()

void CGUIRichText::PreformatText ( )
protected

Removes line breaks, trims blanks at the beginning and end and combines repeated blanks.

◆ PreparePrintForFragment()

void CGUIRichText::PreparePrintForFragment ( const CRichTextFragment Fragment)
protected

Sets the font and all accompanying attributes of a text fragment. This needs to be called prior to any RequiredSpace() calls

Parameters
Fragment

◆ PrintText()

void CGUIRichText::PrintText ( )
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 from CGUIText.

◆ ReadFromStream()

void CGUIRichText::ReadFromStream ( )
protectedvirtual

Reads attributes from the streaming file. Only for use with GUIFactoryManager.

See also
CGUIObject::ReadFromStream()

Reimplemented from CGUIText.

◆ SetFont()

virtual void CGUIRichText::SetFont ( const FontResource_t eFontID)
inlinevirtual

Sets all fonts (Normal, Bold, Italic, BoldItalic) to the given FontID

Parameters
eFontIDID for all internal fonts

Reimplemented from CGUIText.

◆ SetFormatTagBold()

void CGUIRichText::SetFormatTagBold ( const eC_String &  kTag)
inline

Sets the indicator string for the bold tag.

Parameters
kTagString to set.

◆ SetFormatTagClosing()

void CGUIRichText::SetFormatTagClosing ( const eC_String &  kTag)
inline

Sets the string for tag closing sign (e.g. ">")

Parameters
kTagString to set.

◆ SetFormatTagColor()

void CGUIRichText::SetFormatTagColor ( const eC_String &  kTag)
inline

Sets the indicator string for the color tag.

Parameters
kTagString to set.

◆ SetFormatTagFinished()

void CGUIRichText::SetFormatTagFinished ( const eC_String &  kTag)
inline

Sets the string for tag finished sign (e.g. "/")

Parameters
kTagString to set.

◆ SetFormatTagItalic()

void CGUIRichText::SetFormatTagItalic ( const eC_String &  kTag)
inline

Sets the indicator string for the italic tag.

Parameters
kTagString to set.

◆ SetFormatTagLineBreak()

void CGUIRichText::SetFormatTagLineBreak ( const eC_String &  kTag)
inline

Sets the indicator string for the forced line break tag.

Parameters
kTagString to set.

◆ SetFormatTagListItem()

void CGUIRichText::SetFormatTagListItem ( const eC_String &  kTag)
inline

Sets the indicator string for the list item tag.

Parameters
kTagString to set.

◆ SetFormatTagNoBreak()

void CGUIRichText::SetFormatTagNoBreak ( const eC_String &  kTag)
inline

Sets the indicator string for the no line break tag.

Parameters
kTagString to set.

◆ SetFormatTagOpening()

void CGUIRichText::SetFormatTagOpening ( const eC_String &  kTag)
inline

Sets the string for tag opening sign (e.g. "<")

Parameters
kTagString to set.

◆ SetFormatTagOrderedList()

void CGUIRichText::SetFormatTagOrderedList ( const eC_String &  kTag)
inline

Sets the indicator string for the ordered list tag.

Parameters
kTagString to set.

◆ SetFormatTagUnderlined()

void CGUIRichText::SetFormatTagUnderlined ( const eC_String &  kTag)
inline

Sets the indicator string for the underlined tag.

Parameters
kTagString to set.

◆ SetFormatTagUnorderedList()

void CGUIRichText::SetFormatTagUnorderedList ( const eC_String &  kTag)
inline

Sets the indicator string for the unordered list tag.

Parameters
kTagString to set.

◆ SetRichFonts()

void CGUIRichText::SetRichFonts ( const FontResource_t eFontNormal = DUMMY_FONT,
const FontResource_t eFontBold = DUMMY_FONT,
const FontResource_t eFontItalic = DUMMY_FONT,
const FontResource_t eFontBoldItalic = DUMMY_FONT 
)
virtual

Sets the font resources which will be used for rich text formatting

Parameters
eFontNormalNormal font
eFontBoldBold font
eFontItalicItalic font
eFontBoldItalicBold italic font

◆ SetTextColor()

void CGUIRichText::SetTextColor ( const eC_UInt &  uiTextColorStandard,
const eC_UInt &  uiTextColorHighlighted,
const eC_UInt &  uiTextColorGrayedOut,
const eC_UInt &  uiTextColorPressed 
)
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.

Parameters
uiTextColorStandardStandard Text color in ARGB coding (e.g. 0xFFFFFFFF).
uiTextColorHighlightedText color in ARGB coding used if the parent object is highlighted.
uiTextColorGrayedOutText color in ARGB coding used if the parent object is grayed out.
uiTextColorPressedText color in ARGB coding used if the parent object is pressed.

Reimplemented from CGUIText.

◆ SetTextID()

void CGUIRichText::SetTextID ( const TextResource_t eTextID)
virtual

Sets the text ID.

Parameters
eTextIDThe ID of the text to assign to this object.

Reimplemented from CGUIText.

◆ SetTextString()

void CGUIRichText::SetTextString ( const eC_String &  kTextString)
virtual

Sets the string text to be represented by this object.

Parameters
kTextStringThe string to be assigned to this object.

Reimplemented from CGUIText.

◆ SplitFragment()

void CGUIRichText::SplitFragment ( CRichTextFragment FirstTextFragment,
CRichTextFragment SecondTextFragment,
eC_Value  vMaxWidth,
eC_UInt  uiCharOffsetFromStart 
)
protected

Checks if a text-fragment fits completely into the given horizontal space. If not, the fragment will be split into two separate fragments, where the first one optimally uses the available space, while the second one contains the remaining text portion.

Parameters
FirstTextFragmentText fragment whose length will be checked, and which will be split up if necessary
SecondTextFragmentThis will contain any remaining text of FirstTextFragment, which did not fit into the given space.
vMaxWidthAvailable width for First text fragment. It will be split when exceeding this width.
uiCharOffsetFromStartOffset in characters from beginning of the entire text

◆ WriteToStream()

void CGUIRichText::WriteToStream ( const eC_Bool  bWriteTextType = false)
protectedvirtual

Called by the framework when writing streaming files. When deriving a new text class in an application, re-implement this method.

Parameters
bWriteTextTypeIndicates 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 CGUIText.

Member Data Documentation

◆ m_kRichTextFragments

RichTextFragmentList CGUIRichText::m_kRichTextFragments
protected

List of all Text-fragments within this text. This list will be overwritten on every AdaptText() call.


The documentation for this class was generated from the following files: