class TrackSelection

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

Full nameTSE3::App::TrackSelection
Definition#include <TrackSelection.h>
InheritsTSE3::Listener (unknown) [public ], TSE3::Listener (unknown) [public ], TSE3::Notifier (unknown) [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods


Detailed Description

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 . 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::attachTo(ps);

See also: TSE3

 TrackSelection ()

TrackSelection

The TrackSelection begins with no Track selected.

 ~TrackSelection ()

~TrackSelection

 TrackSelection (const TrackSelection &)

TrackSelection

void  select (TSE3::Track *track, bool add)

select

Selects a TSE3::Track.

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

Parameters:
trackThe Track to select
addWhether to add the TSE3::Track to the selection (true) or to replace the current selection (false).

void  deselect (TSE3::Track *track)

deselect

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

Parameters:
trackThe Track to deselect

void  clear ()

clear

Clears the entire selection.

void  selectAll (TSE3::Song *song)

selectAll

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

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

void  invert (TSE3::Song *song)

invert

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:
songTSE3::Song whose TSE3::Track objects are all to be inverted

TrackSelection & operator= (const TrackSelection &)

operator=

Copy TrackSelection contents.

size_t  size ()

size

[const]

Returns how many TSE3::Track objects are selected.

Returns: No of selected TSE3::Track objects

bool  isSelected (TSE3::Track *track)

isSelected

[const]

Returns whether a particular TSE3::Track is selected.

Parameters:
trackThe TSE3::Track to run selection test on

Returns: Whether the TSE3::Track is selected

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

iterator_t

Track * front ()

front

[const]

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

Returns: First selected TSE3::Track

Track * back ()

back

[const]

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

Returns: Last selected TSE3::Track

iterator_t  begin ()

begin

[const]

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

Returns: Iterator pointing to first selected TSE3::Track

iterator_t  end ()

end

[const]

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

Returns: Iterator pointing to last selected TSE3::Track

void  Track_Reparented (Track *)

Track_Reparented

[virtual]

void  Notifier_Deleted (Track *)

Notifier_Deleted

[virtual]

void  PartSelection_Selected (PartSelection *, TSE3::Part *, bool)

PartSelection_Selected

[virtual]