Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

vrvis::SelectAction< SelectableT > Class Template Reference

Basic Action that goes through a list of certain Selectables for unique selection. More...

#include <SelectAction.hpp>

Inheritance diagram for vrvis::SelectAction< SelectableT >:

vrvis::DigitalAction vrvis::Action List of all members.

Public Member Functions

 SelectAction (const std::vector< SelectableT * > &crSelectableVec)
 Constructor that takes an STL vector of SelectableT pointers.
 ~SelectAction (void)
 Destructor.
SelectableT * getSelected (void)
 Get the currently selected SelectableT.
virtual void activate (void)
 Selects nothing but the first SelectableT.
virtual void deactivate (void)
 Deselects all SelectableT objects in queue.
virtual void execute (const gadget::Digital::State cButtonState)
 Upon button release, selects the next SelectableT in queue.

Detailed Description

template<class SelectableT = Selectable>
class vrvis::SelectAction< SelectableT >

This Action enables the user on button release to go through a given vector of Selectables and by doing this select them one at a time (in a radio-button like manner).
Note:
This class is templated to be able to create a SelectAction that uses a specific kind of Selectable, i.e. one distinct subclass of the Selectable interface. However, the default template argument is Selectable, so by default you can switch through all kinds of Selectables.

Example:
       std::vector<Selectable*> selectableVec;
       std::vector<Layer*>      layerVec;

       // ... fill vectors here ...

       // Create instance of default SelectAction<Selectable>.
       SelectAction* pSA1 = new SelectAction(selectableVec);

       // Create instance of specific SelectAction<Layer>.
       SelectAction<Layer>* pSA2 = new SelectAction<Layer>(layerVec);
Warning:
This class shows undefined behavior and most probably crashes if instantiated with a template argument that is not a Selectable.

See also:
Selectable


Constructor & Destructor Documentation

template<class SelectableT>
vrvis::SelectAction< SelectableT >::SelectAction const std::vector< SelectableT * > &  crSelectableVec  )  [inline]
 

Constructs a SelectAction object that operates on the given Selectables.

Parameters:
[in] crSelectableVec STL vector of SelectableT pointers to be added to the queue.

template<class SelectableT>
vrvis::SelectAction< SelectableT >::~SelectAction void   )  [inline]
 

Destructor.


Member Function Documentation

template<class SelectableT>
void vrvis::SelectAction< SelectableT >::activate void   )  [inline, virtual]
 

On activation of this SelectAction all contained Selectables but the first one in queue are deselected.

Reimplemented from vrvis::Action.

template<class SelectableT>
void vrvis::SelectAction< SelectableT >::deactivate void   )  [inline, virtual]
 

On deactivation of this SelectAction all contained Selectables in queue are deselected.

Reimplemented from vrvis::Action.

template<class SelectableT>
void vrvis::SelectAction< SelectableT >::execute const gadget::Digital::State  cButtonState  )  [inline, virtual]
 

Rotates the queue of SelectableT objects on button release and selects nothing but the (new) first one.

Parameters:
[in] cButtonState Button state of the connected digital device.

Implements vrvis::DigitalAction.

template<class SelectableT>
SelectableT * vrvis::SelectAction< SelectableT >::getSelected void   )  [inline]
 

Get the currently selected SelectableT object.

Returns:
Pointer to the currently selected SelectableT.


The documentation for this class was generated from the following files:
Generated on Tue Sep 21 07:31:11 2004 for VRVis by doxygen 1.3.8