#include <libsswf.h>
Inheritance diagram for sswf::TagEditText:
Public Types | |
EDIT_TEXT_ALIGNMENT_CENTER = 2 | |
Defines the centered alignment. | |
EDIT_TEXT_ALIGNMENT_JUSTIFY = 3 | |
Defines the justified alignment. | |
EDIT_TEXT_ALIGNMENT_LEFT = 0 | |
Defines the left alignment. | |
EDIT_TEXT_ALIGNMENT_RIGHT = 1 | |
Defines the right alignment. | |
enum | edit_text_alignment_t { EDIT_TEXT_ALIGNMENT_LEFT = 0, EDIT_TEXT_ALIGNMENT_RIGHT = 1, EDIT_TEXT_ALIGNMENT_CENTER = 2, EDIT_TEXT_ALIGNMENT_JUSTIFY = 3 } |
Defines the different possible alignment. More... | |
Public Member Functions | |
void | AddUsedString (const char *string) |
Add a string that will be used with that edit text box. | |
virtual ErrorManager::error_code_t | Save (Data &data) |
Save an edit text box in a Data buffer. | |
void | SetAlign (edit_text_alignment_t align) |
Set the alignment for the text. | |
void | SetAutoSize (bool status=true) |
Automatically resizing the edit text box. | |
void | SetBorder (bool status=true) |
Mark whether a border should be rendered. | |
void | SetBounds (const SRectangle &bounds) |
Set the bounds of the edit text. | |
void | SetColor (Color &color) |
The color used to render the font. | |
void | SetFont (const TagFont *font, long height) |
Set the font to use to render the glyphs. | |
void | SetHTML (bool status=true) |
Defines the box as using HTML or plain text. | |
void | SetIndent (long indent) |
Set the identation of the first line of text. | |
void | SetLeading (long leading) |
Set the identation of the first line of text. | |
void | SetMargins (long left, long right) |
Defines the side margin. | |
void | SetMaxLength (long length) |
Set the maximum length of the text in number of characters. | |
void | SetMultiline (bool status=true) |
Set the multiline flag to the specified status. | |
void | SetNoSelect (bool status=true) |
Set whether the user can select the text. | |
void | SetOutline (bool status=true) |
Set whether an outline should be rendered. | |
void | SetPassword (bool status=true) |
Set the password flag. | |
void | SetReadOnly (bool status=true) |
Mark the edit text box as read-only. | |
void | SetText (const char *text) |
Set the text to be rendered on screen. | |
void | SetUsedGlyphs (const char *lists) |
Mark a set of glyphs as in use. | |
void | SetVariableName (const char *name) |
Set the name of the variable. | |
void | SetWordWrap (bool status=true) |
Set whether words should wrap. | |
TagEditText (TagBase *parent) | |
Initializes the object. | |
virtual swf_type_t | TypeFlags (void) const |
Returns the type of an edit text box. | |
Private Member Functions | |
virtual ErrorManager::error_code_t | PreSave (void) |
Check that the edit text box can be saved and in which version. | |
Private Attributes | |
edit_text_alignment_t | f_align |
bool | f_autosize |
bool | f_border |
SRectangle | f_bounds |
Color | f_color |
const TagFont * | f_font |
unsigned short | f_font_height |
bool | f_has_color |
bool | f_html |
long | f_indent |
long | f_leading |
long | f_left_margin |
long | f_max_length |
bool | f_multiline |
bool | f_no_select |
bool | f_outline |
bool | f_password |
bool | f_readonly |
long | f_right_margin |
char * | f_text |
sswf_ucs4_t * | f_used_glyphs |
sswf_ucs4_t * | f_used_strings |
char * | f_var_name |
bool | f_word_wrap |
One important feature is the use of embedded fonts. In that case, you probably want to mark the edit text with a set of glyphs which need to be included (or "*" for all the glyphs of the font.)
This enumaration defines the list of possible alignment in an edit text box.
TagEditText::TagEditText | ( | TagBase * | parent | ) |
The constructor ensures that all the variables are set to their default.
[in] | parent | The parent must be a TagHeader |
void TagEditText::AddUsedString | ( | const char * | string | ) |
This function is used to tell the edit text box that it will need to be able to display the specified string.
This can be used to obtimize the number of glyphs included in your movie. If your edit text box cannot be edited by an end user, then it is sufficient to only save the glyphs that will at some point be used and forget about the others (especially to save some space in your file.)
For instance, if you have a set of action scripts testing different values and setting the edit text to pre-defined strings such as "Running", "Stopped", "Waiting" and "Paused" then you do not need to save the 'z' letter for instance.
Calling this function multiple times cumulates the strings.
[in] | string | A string to add to the list of strings in use |
ErrorManager::error_code_t TagEditText::PreSave | ( | void | ) | [private, virtual] |
The function checks whether a font was defined for the edit text. If so, it marks all the glyphs in use according to those specified via the TagEditText::SetUsedGlyphs() and TagEditText::AddUsedString() function calls.
Errors are generated if a required glyph does not exist in the corresponding font.
Reimplemented from sswf::TagBase.
ErrorManager::error_code_t TagEditText::Save | ( | Data & | data | ) | [virtual] |
This function saves an edit text box in the specified Data buffer.
[in] | data | The Data buffer where the edit text box is saved |
Implements sswf::TagBase.
void TagEditText::SetAlign | ( | edit_text_alignment_t | align | ) |
This function sets the alignment for the text drawn in the edit text box.
The alignment can be set to one of these:
[in] | align | The alignment to use |
void TagEditText::SetAutoSize | ( | bool | status = true |
) |
This function defines whether the box should be automatically resized or the size is defined statically.
[in] | status | If true, the box will resize itself around the defined text |
void TagEditText::SetBorder | ( | bool | status = true |
) |
This function requests that a border be drawn around the edit text box.
Note that the border color is usually black, and the background is always white.
[in] | status | If true, draw a background and edge |
void TagEditText::SetBounds | ( | const SRectangle & | bounds | ) |
This function takes a rectangle representing the bounds of the edit text in the output.
[in] | bounds | The bounds of the edit text box. |
void TagEditText::SetColor | ( | Color & | color | ) |
This function is used to set the color to use to render the font.
Note that you can later use the font as a mask over pretty much any other drawings giving an effect that looks like colorful fonts.
[in] | color | The color to use to draw the font |
void TagEditText::SetFont | ( | const TagFont * | font, | |
long | height | |||
) |
This function defines the font to use with the edit text box and the height we want the font to be rendered at.
[in] | font | The font tag used to render this edit text box. |
[in] | height | The height to use to draw the characters. |
void TagEditText::SetHTML | ( | bool | status = true |
) |
The text in the edit text box can be set to Plain Text (the default) or HTML.
When set to HTML, a few tags are understood:
[in] | status | If set to true, the text in the box is expected to be HTML. |
void TagEditText::SetIndent | ( | long | indent | ) |
This alue represents the identation of the first line of text in a paragraph.
[in] | indent | The identation of the text |
void TagEditText::SetLeading | ( | long | leading | ) |
This alue represents the number of pixels (in TWIPS) to skip vertically between lines of text.
[in] | leading | The space between lines. |
void TagEditText::SetMargins | ( | long | left, | |
long | right | |||
) |
This function defines the left and right margin for the text to be rendered in the box.
The margins are useful if you request a border and/or edge to be rendered.
[in] | left | The width of the margin on the left side |
[in] | right | The width of the margin on the right side |
void TagEditText::SetMaxLength | ( | long | length | ) |
If the text is editable, to avoid letting people type as much as they want, use this function and set the limit you want. It is wise to always do so.
[in] | length | The maximum length a user can type |
void TagEditText::SetMultiline | ( | bool | status = true |
) |
This function changes the behavior of the edit text box whenever strings longer than what can be rendered are used in an edit text.
void TagEditText::SetNoSelect | ( | bool | status = true |
) |
This function is used to mark the text in the edit text box as selectable or not. In general, an edit text box used for a label should be marked unselectable and read-only.
[in] | status | The new status for the no-select flag. |
void TagEditText::SetOutline | ( | bool | status = true |
) |
This flag defines whether an embedded font should be used.
[in] | status | Set to true to use a system default font |
void TagEditText::SetPassword | ( | bool | status = true |
) |
By default, an edit text box is expected to be used for other purposes than passwords. But it can be useful, once in a while, to let people login. For that purpose, you can use this function.
The result of setting this flag to true is that the edit text box only renders asterisks,
[in] | status | If true, the edit text box only displays asterisks. |
void TagEditText::SetReadOnly | ( | bool | status = true |
) |
This function marks the edit text box as read-only. This means it can be used to display a string and the user has to right to change its content.
[in] | status | The new status for the read-only flag. |
void TagEditText::SetText | ( | const char * | text | ) |
This function sets the text that will be rendered on the screen.
The glyphs of the default text are automatically marked as required for this animation.
void TagEditText::SetUsedGlyphs | ( | const char * | used_glyphs | ) |
This function can be used to mark a set of glyphs as in use.
The special string "*" or a NULL pointer will request the function to mark all the glyphs as being in use.
The special character - (dash/minus) is used to define a range unless it is found at the very beginning or the very end of the string. For instance, to include all the upper case latin 1 letters, one can use "A-Z".
The use of this function is not cumulative. Calling it again overwrites the previous glyphs in use.
void TagEditText::SetVariableName | ( | const char * | name | ) |
This function is used to mark this edit text box with a name. This name can later be used in action scripts to read and set the text of the edit text box.
[in] | name | The name of the variable |
void TagEditText::SetWordWrap | ( | bool | status = true |
) |
This function is used to change the word wrap status.
By default an edit text box is set to have its text wrap.
[in] | status | Set to true to get words to wrap, false otherwise |
TagBase::swf_type_t TagEditText::TypeFlags | ( | void | ) | const [virtual] |
This function returns the type of an edit text box.
An edit text box is a definition and a reference.
Implements sswf::TagBase.
bool sswf::TagEditText::f_autosize [private] |
bool sswf::TagEditText::f_border [private] |
SRectangle sswf::TagEditText::f_bounds [private] |
Color sswf::TagEditText::f_color [private] |
const TagFont* sswf::TagEditText::f_font [private] |
unsigned short sswf::TagEditText::f_font_height [private] |
bool sswf::TagEditText::f_has_color [private] |
bool sswf::TagEditText::f_html [private] |
long sswf::TagEditText::f_indent [private] |
long sswf::TagEditText::f_leading [private] |
long sswf::TagEditText::f_left_margin [private] |
long sswf::TagEditText::f_max_length [private] |
bool sswf::TagEditText::f_multiline [private] |
bool sswf::TagEditText::f_no_select [private] |
bool sswf::TagEditText::f_outline [private] |
bool sswf::TagEditText::f_password [private] |
bool sswf::TagEditText::f_readonly [private] |
long sswf::TagEditText::f_right_margin [private] |
char* sswf::TagEditText::f_text [private] |
sswf_ucs4_t* sswf::TagEditText::f_used_glyphs [private] |
sswf_ucs4_t* sswf::TagEditText::f_used_strings [private] |
char* sswf::TagEditText::f_var_name [private] |
bool sswf::TagEditText::f_word_wrap [private] |