QSDK 1.1 Documentation
Main Page | Modules | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

Q::TextLayer Struct Reference
[User Interface]

On screen text. More...

#include <Q/q.h>

Inheritance diagram for Q::TextLayer:

Q::Layer Q::ObjectBase List of all members.

Public Member Functions

 TextLayer ()
 ~TextLayer ()
Maths::Color4b color () const
Text text () const
Font font () const
unsigned int pointSize () const
Font::textJustification justification () const
Utils::Result setColor (Maths::Color4b c)
Utils::Result setText (const char *s)
Utils::Result setPointSize (unsigned int pointSize)
Utils::Result setJustification (Font::textJustification j)

Static Public Member Functions

TextLayer create (const Screen &, const char *s, const Font &font, unsigned int pointSize, float margin, Font::textJustification justification, const Maths::Vec2f &center, const Maths::Vec2f &alignment, const Maths::Color4b &color, bool isAlwaysTop=false)
ClassType classType ()
TextLayer cast (const ObjectBase &obj)

Detailed Description

On screen text.

A TextLayer renders a text string with a given size and color. The background of the text is transparent. The layer can contain multiple lines of text simply by including newline characters in the string. The text can be left, right or center justified within its extent rectangle. The extent rectangle for a text layer is not set explicitly - it is calculated by measuring the extent of the given string when rendered in the text font.

If alwaysTop is set true, the layer is treated in a special way by the screen. It will always be rendered last (i.e. appear on top). The alwaysTop layer will receive a copy of all mouse and keyboard events after they have been sent to the layer(s) that has(have) the mouse and keyboard focus (except MouseFocus and KeyboardFocus events).


Constructor & Destructor Documentation

Q::TextLayer::TextLayer  ) 
 

Create a null text layer handle.

Q::TextLayer::~TextLayer  ) 
 

Destroy the layer, removing it from its parent screen.


Member Function Documentation

TextLayer Q::TextLayer::cast const ObjectBase obj  )  [static]
 

If the object referenced by obj is a textlayer, then return a suitable reference to the object.

ClassType Q::TextLayer::classType  )  [static]
 

Return the type of this class.

Maths::Color4b Q::TextLayer::color  )  const
 

Return the color of the layer.

TextLayer Q::TextLayer::create const Screen ,
const char *  s,
const Font font,
unsigned int  pointSize,
float  margin,
Font::textJustification  justification,
const Maths::Vec2f center,
const Maths::Vec2f alignment,
const Maths::Color4b color,
bool  isAlwaysTop = false
[static]
 

Create a text layer with the given dimensions and position. The specified font is used to render the text. The text displayed by the layer is determined by s and color. The value of pointSize is the height of an individual character of text in the screen's virtual coordinate system. Note that the layer takes a copy of the text pointed to by s. The text inside the layer is offset from the edge of the layer by the margin.

Parameters:
justification The justification to use for the text. This has most meaning for multi-line text, as a single line of text will define the layer extent and so there is no justification to be done.
center The center of the layer. It determines the location of the rectangle in the screen's virtual coordinate system.
alignment The alignment of the layer. It determines the location of the origin of the layer's local coordinate system. An alignment of (0,0) places the origin at the bottom left of the layer and an alignment of (1,1) places it at the top right.
isAlwaysTop If true, the layer is treated in a special way by the screen. It will always be rendered last (i.e. appear on top).

Font Q::TextLayer::font  )  const
 

Return the font used to render the text.

Font::textJustification Q::TextLayer::justification  )  const
 

Return the justification of the text.

unsigned int Q::TextLayer::pointSize  )  const
 

Return the point size of the text.

Utils::Result Q::TextLayer::setColor Maths::Color4b  c  ) 
 

Set the color of the layer.

Utils::Result Q::TextLayer::setJustification Font::textJustification  j  ) 
 

Set the justification of the text.

Utils::Result Q::TextLayer::setPointSize unsigned int  pointSize  ) 
 

Set the point size of the text.

Utils::Result Q::TextLayer::setText const char *  s  ) 
 

Set the text contents of the layer.

Text Q::TextLayer::text  )  const
 

Return the text contents of the layer.

Return to QSDK documentation Contents page. Contact details for support, information and fault-reporting.
Qube Software Limited © 2000-2004