sswf::TagButton Class Reference

Create an active area. More...

#include <libsswf.h>

Inheritance diagram for sswf::TagButton:

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

Public Member Functions

VectorsActions (void)
 Returns a reference to the actions array.
bool AddEvent (Event *event)
 Add the specified event to the button tag.
virtual ErrorManager::error_code_t Save (Data &data)
 Saves a button in the Data buffer.
void SetAction (const Action &action)
 Append an action to the button.
void SetMenu (bool menu=true)
 Set the menu flag.
bool SetState (const State &state)
 Add a state to a button object.
 TagButton (TagBase *parent)
 Initializes a button tag object.
virtual swf_type_t TypeFlags (void) const
 The flags representing the button tag type.

Private Member Functions

virtual ErrorManager::error_code_t PreSave (void)
 Check that a button can be saved.

Private Attributes

Vectors f_actions
Vectors f_events
bool f_menu
bool f_save_button2
Vectors f_states

Detailed Description

A TagButton is used to create an area which reacts to mouse clicks, tabs and the spacebar. When marked as a menu, it can also react to arrow keys.

To fully create a button, one can add actions (what happens when the user clicks on the button), events (what happens, in more details, when the user clicks) and different states (what happens when the mouse moves over and clicks on the button or not.)

See also:
sswf::TagScalingGrid

SWF Alexis' Reference—Define Button

SWF Alexis' Reference—swf_tag


Constructor & Destructor Documentation

TagButton::TagButton ( TagBase parent  ) 

This function initializes the button tag with an empty list of actions and states.

Parameters:
[in] parent The TagHeader where the button is added


Member Function Documentation

Vectors & TagButton::Actions ( void   ) 

This function returns a Vector reference to the internal array of actions.

This can be used to save the actions in any order as you need.

Returns:
The reference to the actions array
See also:
TagButton::SetAction(const Action& action)

bool TagButton::AddEvent ( Event event  ) 

This function adds the specified event to the TagButton object.

An event is a set of flags which determine when the event is triggered and a set of actions to execute then.

As many events as you need can be added. However, the first event matching has its ActionScript executed and then the process stops (to be confirmed!)

Parameters:
[in] event The event to add to this TagPlace object
Returns:
This function returns true if the event is accepted as is. If the event has flags which are not compatible with the TagButton tag, then the function returns false and the event is not added.

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

This function traverse the list of events and actions to determine the minimum version and make sure that the events are valid.

Returns:
An error_code_t error or ERROR_CODE_NONE

Reimplemented from sswf::TagBase.

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

This function saves the button in the specified data buffer.

It can save button version 1 and 2.

The function will generate an error if it detects an invalid event (i.e. an event with all flags set at zero or invalid flags set.) If no event has the hit test bit set, an error is generated, but the save goes on.

Parameters:
[in] data The data buffer where the button is saved

Implements sswf::TagBase.

void TagButton::SetAction ( const Action action  ) 

This function adds one action at the end of the list of actions of the button. If you want to manage the list better, use the Actions() function to get access to the array of actions.

The input action is copied and thus it can be modified on return.

Parameters:
[in] action The action to append; it is copied in the array
Returns:
TagButton::Actions(void)

void TagButton::SetMenu ( bool  menu = true  ) 

This function is used to set the menu flag of the button.

A button with the menu flag turned on can be used to select an entry as if it were a menu.

Parameters:
[in] menu The new state of the menu flag (true or false)

bool TagButton::SetState ( const State state  ) 

This function adds a state to a button object.

Multiple states with the same flags can be added to the same button. In that case, they all become active at the time the states are satisfied.

Bug:
If you create a state and omit to set a valid set of flags (i.e. not zero and only the 4 allowed flags) then this function fails.
Parameters:
[in] state The state to add to this button object
Returns:
true when the state is added

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

A button is of type:

SWF_TYPE_DEFINE SWF_TYPE_REFERENCE SWF_TYPE_SCRIPT SWF_TYPE_HAS_ID

Returns:
A set of SWF_TYPE_... flags

Implements sswf::TagBase.


Member Data Documentation

Vectors sswf::TagButton::f_actions [private]

Vectors sswf::TagButton::f_events [private]

bool sswf::TagButton::f_menu [private]

bool sswf::TagButton::f_save_button2 [private]

Vectors sswf::TagButton::f_states [private]


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