Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

TSE3::App::TrackSelection Class Reference

Support class for selecting one or more Track object. More...

#include <TrackSelection.h>

Inheritance diagram for TSE3::App::TrackSelection:

Inheritance graph
[legend]
Collaboration diagram for TSE3::App::TrackSelection:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::vector< TSE3::Track
* >::const_iterator 
iterator_t

Public Member Functions

 TrackSelection ()
 ~TrackSelection ()
 TrackSelection (const TrackSelection &)
void select (TSE3::Track *track, bool add)
void deselect (TSE3::Track *track)
void clear ()
void selectAll (TSE3::Song *song)
void invert (TSE3::Song *song)
TrackSelectionoperator= (const TrackSelection &)
size_t size () const
bool isSelected (TSE3::Track *track) const
Trackfront () const
Trackback () const
iterator_t begin () const
iterator_t end () const
virtual void Track_Reparented (Track *)
virtual void Notifier_Deleted (Track *)
virtual void PartSelection_Selected (PartSelection *, TSE3::Part *, bool)

Detailed Description

Support class for selecting one or more Track object.

The TrackSelection class allows an Application to provide the facility to 'select' one or more TSE3::Track in a TSE3::Song. These TSE3::Track objects must be held in a TSE3::Song. As soon as a TSE3::Track is removed from a TSE3::Song, it is removed from the selection.

This behviour is useful when using the command history system in the TSE3::Cmd namespace where undoing a TSE3::Track add, for example, may cause a selected Track to be removed from the TSE3::Song.

Internally, the Tracks are held in an STL vector of type <Track*>. In order to get access to the contents of this vector, access is provided to it's iterator.

If you are using the iterators and performing any operations that may affect the TrackSelection (i.e. removing a TSE3::Track from it's TSE3::Track and reinserting it elsewhere) then you will invalidate the iterator.

A method of avoiding this would be to, rather than iterate over each Track, to remove a Track from the head of the list, work on it, and place it into a second TrackSelection. Do this for each Track in the TrackSelection, and when finished, copy the new TrackSelection into the old one.

Interaction with PartSelection
You may want to use this selection utility in connection with the PartSelection class to ensure that the user has only selected one type of object at any time.

To facilitate this, the TrackSelection is a PartSelectionListener. You can attach it to a PartSelection object, and whenever the PartSelection has a TSE3::Part selected the TrackSelection will be cleared.

You will need to use an attach like this:

TrackSelection ts; PartSelection *ps = somePartSelection(); ts.TSE3::Listener<TSE3::App::PartSelectionListener>::attachTo(ps);

Author:
Pete Goodliffe
Version:
1.00
See also:
TSE3


Member Typedef Documentation

typedef std::vector<TSE3::Track*>::const_iterator TSE3::App::TrackSelection::iterator_t
 


Constructor & Destructor Documentation

TSE3::App::TrackSelection::TrackSelection  ) 
 

The TrackSelection begins with no Track selected.

TSE3::App::TrackSelection::~TrackSelection  ) 
 

TSE3::App::TrackSelection::TrackSelection const TrackSelection  ) 
 


Member Function Documentation

void TSE3::App::TrackSelection::select TSE3::Track track,
bool  add
 

Selects a TSE3::Track.

If the TSE3::Track is not in a TSE3::Song, it will not be selected.

Parameters:
track The Track to select
add Whether to add the TSE3::Track to the selection (true) or to replace the current selection (false).

void TSE3::App::TrackSelection::deselect TSE3::Track track  ) 
 

Deselects a Track. If the Track is not selected, then nothing will happen.

Parameters:
track The Track to deselect

void TSE3::App::TrackSelection::clear  ) 
 

Clears the entire selection.

void TSE3::App::TrackSelection::selectAll TSE3::Song song  ) 
 

Selects all the TSE3::Track objects in the given TSE3::Song (this 'should' include any Tracks alreadys selected!).

Parameters:
song TSE3::Song whose TSE3::Track objects are all to be selected

void TSE3::App::TrackSelection::invert TSE3::Song song  ) 
 

Inverts the selection for all the TSE3::Track objects in the given TSE3::Song (i.e. all selected Tracks are deselected and all deselected Tracks are selected).

Parameters:
song TSE3::Song whose TSE3::Track objects are all to be inverted

TrackSelection& TSE3::App::TrackSelection::operator= const TrackSelection  ) 
 

Copy TrackSelection contents.

size_t TSE3::App::TrackSelection::size  )  const [inline]
 

Returns how many TSE3::Track objects are selected.

Returns:
No of selected TSE3::Track objects

bool TSE3::App::TrackSelection::isSelected TSE3::Track track  )  const
 

Returns whether a particular TSE3::Track is selected.

Parameters:
track The TSE3::Track to run selection test on
Returns:
Whether the TSE3::Track is selected

Track* TSE3::App::TrackSelection::front  )  const [inline]
 

Returns the first item in the TrackSelection, or zero if there are no selected Tracks.

Returns:
First selected TSE3::Track

Track* TSE3::App::TrackSelection::back  )  const [inline]
 

Returns the last item in the TrackSelection, or zero if there are no selected Tracks.

Returns:
Last selected TSE3::Track

iterator_t TSE3::App::TrackSelection::begin  )  const [inline]
 

Returns an iterator pointing to the first TSE3::Track in this selection.

Returns:
Iterator pointing to first selected TSE3::Track

iterator_t TSE3::App::TrackSelection::end  )  const [inline]
 

Returns an iterator pointing to the last TSE3::Track in this selection.

Returns:
Iterator pointing to last selected TSE3::Track

virtual void TSE3::App::TrackSelection::Track_Reparented Track  )  [virtual]
 

Reimplemented from TSE3::TrackListener.

virtual void TSE3::App::TrackSelection::Notifier_Deleted Track  )  [virtual]
 

virtual void TSE3::App::TrackSelection::PartSelection_Selected PartSelection ,
TSE3::Part ,
bool 
[virtual]
 


The documentation for this class was generated from the following file:
Generated on Wed May 25 14:47:30 2005 for TSE3 by doxygen 1.3.2