Made to Order Software Corporation Logo

libsswf: sswf::TagButton Class Reference

Create an active area. More...

#include <libsswf.h>

Inheritance diagram for sswf::TagButton:

:TagBaseID :TagScalingGrid :TagBase :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 ParseTag (swf_tag_t tag, const Data &data)
 Parse data from a file into a Button tag.
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:

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.

[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.

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

References f_actions.

bool TagButton::AddEvent ( Event event  ) 

This function adds the specified event to the TagButton object.

An event is a set of flags determining the event triggers and a set of actions to execute when it happens.

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!)

If you add actions using SetAction() or Actions(), then they will be prepended to the first event that has the Event::CONDITION_POINTER_RELEASE_INSIDE flag turned on. If no event has that flag set, then these actions are appended at the end of the list with that condition.
[in] event The event to add to this TagPlace object
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.

References sswf::Event::Events(), f_events, sswf::Vectors::Set(), and SSWF_EVENT_CONDITIONS.

Referenced by ParseTag().

ErrorManager::error_code_t TagButton::ParseTag ( swf_tag_t  tag,
const Data data 
) [private, virtual]

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

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

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.

[in] action The action to append; it is copied in the array

References sswf::Action::Duplicate(), f_actions, sswf::MemoryManager::MemAttach(), and sswf::Vectors::Set().

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.

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

References f_menu.

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.

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.
[in] state The state to add to this button object
true when the state is added

References sswf::ErrorManager::ERROR_CODE_BAD_STATE_FLAGS, f_states, sswf::State::GetFlags(), sswf::MemoryManager::MemAttach(), sswf::TagBase::OnError(), and sswf::Vectors::Set().

Referenced by ParseTag().

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

A button is of type:


A set of SWF_TYPE_... flags

Implements sswf::TagBase.


Member Data Documentation

bool sswf::TagButton::f_menu [private]

Referenced by ParseTag(), PreSave(), Save(), and SetMenu().

Referenced by ParseTag(), PreSave(), and Save().

The documentation for this class was generated from the following files:

Generated on Wed Mar 18 15:13:59 2009 for libsswf by  doxygen 1.5.5