sswf::TagText Class Reference

Enter a label (text string) in an SWF file. More...

#include <libsswf.h>

Inheritance diagram for sswf::TagText:

sswf::TagBaseID sswf::TagCSMTextSettings sswf::TagBase sswf::MemoryManager List of all members.

Public Member Functions

void AddColor (Color &color)
 Defines the color in the current setup.
void AddFont (const TagFont *font, long height)
 Set the specified font to the current setup.
void AddOffsets (long x, long y)
 Set the specified offset in the current setup.
ErrorManager::error_code_t AddText (const char *string, long advance=LONG_MIN)
 Add a new text string.
virtual ErrorManager::error_code_t Save (Data &data)
 Save the TagText in a Data buffer.
void SetBounds (const SRectangle &bounds)
 Set the graphical bounds of this text.
void SetMatrix (const Matrix &matrix)
 Set the text matrix.
 TagText (TagBase *parent)
 Initializes a text tag.
virtual swf_type_t TypeFlags (void) const
 Defines the type of a text tag.

Private Types

 TEXT_ENTRY_SETUP
 TEXT_ENTRY_TEXT = 0
enum  text_type_t { TEXT_ENTRY_TEXT = 0, TEXT_ENTRY_SETUP }

Private Member Functions

int DefineText (int start, text_setup_t *s, const TagFont *font, int font_height)
 Internal function to work on text entries.
void NewSetup (void)
virtual ErrorManager::error_code_t PreSave (void)
 Makes the TagText ready for saving.
ErrorManager::error_code_t RecordSetup (void)
 Record one setup in the text array.

Private Attributes

SRectangle f_bounds
Matrix f_matrix
bool f_new_text
Vectors f_records
text_setup_t f_setup
int f_version

Classes

struct  text_define_t
 Structure used to memories the type of definition. More...
struct  text_entry_t
 Structure representing a text entry (an actual string). More...
struct  text_setup_t
 Structure representing a text setup. More...

Detailed Description

This tag is used to have a string of text rendered in the screen.

This is very flexible since each glyph can be rendered pretty much where you want it to be. However, it can be much more tedious to use that an sswf::TagEditText.

See also:
sswf::TagEditText

SWF Alexis' Reference—DefineText

SWF Alexis' Reference—swf_tag


Member Enumeration Documentation

enum sswf::TagText::text_type_t [private]

Enumerator:
TEXT_ENTRY_TEXT 
TEXT_ENTRY_SETUP 


Constructor & Destructor Documentation

TagText::TagText ( TagBase parent  ) 

The constructor initializes the text tag so it looks empty.

Parameters:
[in] parent The sswf::TagHeader this text tag is included in


Member Function Documentation

void TagText::AddColor ( Color color  ) 

This function defines the color of the current setup.

If the color transparency is not solid (255) then the movie version is forced to version 3.

Note:
The setup will be saved only once a string is added. Until then, calling this function multiple times will simply overwrite what the previous call saved.
Parameters:
[in] color The RGBA color for the text.

void TagText::AddFont ( const TagFont font,
long  height 
)

This function is used to declare the font and its height.

Note:
The setup will be saved only once a string is added. Until then, calling this function multiple times will simply overwrite what the previous call saved.
Parameters:
[in] font The font to use to render this text.
[in] height The height used to render this font.

void TagText::AddOffsets ( long  x,
long  y 
)

This function saves the x and y offsets to skip from the current position.

Note:
The setup will be saved only once a string is added. Until then, calling this function multiple times will simply overwrite what the previous call saved.
Parameters:
[in] x The horizontal movement
[in] y The vertical movement

ErrorManager::error_code_t TagText::AddText ( const char *  string,
long  advance = LONG_MIN 
)

This function is used to add a new string to the text tag.

It is possible to specify the exact space to skip between characters. Set the advance parameter to LONG_MIN to avoid that effect and let the system determine the advance size automatically from the font information.

Parameters:
[in] string The string of text to add to this tag
[in] advance The space to skip between characters or LONG_MIN
Returns:
An error or ErrorManager::ERROR_CODE_NONE

int TagText::DefineText ( int  start,
text_setup_t s,
const TagFont font,
int  font_height 
) [private]

This function is used by the PreSave() function to make sure that the text is valid and to initialize the different structures so they are ready to be saved in the output file.

Parameters:
[in] start The start index
[in] s The setup text to manage
[in] font The font used to define this text metrics
[in] font_height The height used to render this font
Returns:
The next index

void sswf::TagText::NewSetup ( void   )  [private]

ErrorManager::error_code_t TagText::PreSave ( void   )  [private, virtual]

This function ensures that the TagText can be saved (is valid).

Returns:
An error code or ErrorManager::ERROR_CODE_NONE

Reimplemented from sswf::TagBase.

ErrorManager::error_code_t TagText::RecordSetup ( void   )  [private]

This function records one setup in the array of text setup and text entries.

Returns:
An error or ErrorManager::ERROR_CODE_NONE

ErrorManager::error_code_t TagText::Save ( Data data  )  [virtual]

This function saves the TagText in the specified Data buffer.

Parameters:
[in] data The Data buffer where the TagText is saved
Returns:
An error code or ErrorManager::ERROR_CODE_NONE

Implements sswf::TagBase.

void TagText::SetBounds ( const SRectangle bounds  ) 

This function is used to define the largest box where the text appears. This is used to know whenever the text object needs to be rerendered on the screen.

The bounds can be larger. If smaller, some parts of the text may not get drawn properly.

Parameters:
[in] bounds The rectangle representing the bounds of this text.

void TagText::SetMatrix ( const Matrix matrix  ) 

This function saves a copy of the specified matrix in the text tag. It is used to position the text, rotate it and scale it.

Parameters:
[in] matrix The text matrix

TagBase::swf_type_t TagText::TypeFlags ( void   )  const [virtual]

This function returns a set of flags defining an text tag.

Returns:
SWF_TYPE_DEFINE, SWF_TYPE_REFERENCE and SWF_TYPE_HAS_ID

Implements sswf::TagBase.


Member Data Documentation

SRectangle sswf::TagText::f_bounds [private]

Matrix sswf::TagText::f_matrix [private]

bool sswf::TagText::f_new_text [private]

Vectors sswf::TagText::f_records [private]

text_setup_t sswf::TagText::f_setup [private]

int sswf::TagText::f_version [private]


The documentation for this class was generated from the following files:
Generated on Tue Jun 26 02:36:46 2007 for libsswf by  doxygen 1.4.7