Main Page   Class Hierarchy   Compound List   File List   Compound Members  

KrTextBox Class Reference

Defines an area of the screen to be used to display text. More...

#include <textbox.h>

Inheritance diagram for KrTextBox::

KrImNode List of all members.

Public Methods

 KrTextBox (KrFontResource *resource, int width, int height, int lineSpacing, Alignment alignment=LEFT)
 Create a box that contains text. More...

KrFontResourceFontResource ()
 Get the resource for this TextBox.

int Width () const
 Size, untransformed, of this box:.

int Height () const
 Size, untransformed, of this box:.

int NumLines () const
 Number of lines of text in this text box.

int GetLineY (int lineNum) const
 Get the y offset to a given line.

void SetText16 (const U16 *text, int lineNum)
 Set the text of a given linenumber, in 16 bit characters.

const U16 * GetText16 (int lineNum) const
 Get the text of a given linenumber, in 16 bit characters.

const GlDynArray< U16 > & GetText16Array (int lineNum) const
 A slightly faster way to get the 16 bit text.

void SetTextChar (const std::string &text, int lineNum)
 Set the text of a given linenumber, in 8 bit characters.

void GetTextChar (std::string *buffer, int lineNum)
 Get the text of a given linenumber, in 8 bit characters.

int GetLineLength (int lineNum=0)
 Return the length of the line, without counting the terminator.

virtual KrImNodeClone ()
 Return a copy if this object, not in a Tree(). More...

virtual KrTextBox * ToTextBox ()
 Return a pointer if this is a text box.


Detailed Description

Defines an area of the screen to be used to display text.

Created from a font resource.

Note that this is a container class; it does not draw. It will create sprites -- as children -- for the letters of text. The sprites will be fully managed by the text box and should not be changed by the client.

If hit testing, it may be necessary to check the Parent's parent to see if it is a text box.


Constructor & Destructor Documentation

KrTextBox::KrTextBox KrFontResource   resource,
int    width,
int    height,
int    lineSpacing,
Alignment    alignment = LEFT
 

Create a box that contains text.

Parameters:
resource  A pointer to the font to use.
width  Width of the text box.
height  Height of the text box.
lineSpacing  Pixels of padding between each line.
alignment  LEFT, RIGHT, or CENTER justification.


Member Function Documentation

virtual KrImNode* KrTextBox::Clone   [virtual]
 

Return a copy if this object, not in a Tree().

It is return untransformed. In the case of a sprite, the action and frame will be set to the current value.

Reimplemented from KrImNode.


The documentation for this class was generated from the following file:
Generated on Mon Sep 15 12:01:11 2003 for Kyra by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001