GG::Font::TextElement Struct Reference

Used to encapsulate a token-like piece of text to be rendered using GG::Font. More...

#include <Font.h>

Inheritance diagram for GG::Font::TextElement:

GG::Font::FormattingTag List of all members.

Public Types

enum  TextElementType {
  OPEN_TAG,
  CLOSE_TAG,
  TEXT,
  WHITESPACE,
  NEWLINE
}

Public Member Functions

 TextElement (bool ws, bool nl)
virtual ~TextElement ()
int Width () const
virtual TextElementType Type () const
virtual int OriginalStringChars () const

Public Attributes

std::string text
std::vector< int > widths
const bool whitespace
const bool newline

Detailed Description

Used to encapsulate a token-like piece of text to be rendered using GG::Font.

Definition at line 112 of file Font.h.


Member Enumeration Documentation

enum GG::Font::TextElement::TextElementType

The types of token-like entities that can be represented by a TextElement.

Enumerator:
OPEN_TAG  An opening text formatting tag (eg "<rgba 0 0 0 255>").
CLOSE_TAG  A closing text formatting tag (eg "</rgba>").
TEXT  Some non-whitespace text (eg "The").
WHITESPACE  Some whitespace text (eg " \n").
NEWLINE  A newline. Newline TextElements represent the newline character when it is encountered in a rendered string, though they do not contain the actual newline character -- their text members are always "").

Definition at line 115 of file Font.h.


Constructor & Destructor Documentation

GG::Font::TextElement::TextElement ( bool  ws,
bool  nl 
)

Ctor. ws indicates that the element contains only whitespace; nl indicates that it is a newline element.

virtual GG::Font::TextElement::~TextElement (  )  [virtual]

Virtual dtor.


Member Function Documentation

int GG::Font::TextElement::Width (  )  const

Returns the width of the element, in pixels.

virtual TextElementType GG::Font::TextElement::Type (  )  const [virtual]

Returns the TextElementType of the element.

Reimplemented in GG::Font::FormattingTag.

virtual int GG::Font::TextElement::OriginalStringChars (  )  const [virtual]

Returns the number of characters in the original string that the element represents.

Reimplemented in GG::Font::FormattingTag.


Member Data Documentation

std::string GG::Font::TextElement::text

The text represented by the element, or the name of the tag, if the element is a FormattingTag.

Definition at line 130 of file Font.h.

std::vector<int> GG::Font::TextElement::widths

The widths of the characters in text.

Definition at line 131 of file Font.h.

const bool GG::Font::TextElement::whitespace

True iff this is a whitespace element.

Definition at line 132 of file Font.h.

const bool GG::Font::TextElement::newline

True iff this is a newline element.

Definition at line 133 of file Font.h.


The documentation for this struct was generated from the following file:
Generated on Wed Mar 26 14:35:42 2008 for GG by  doxygen 1.5.2