]> git.tdb.fi Git - r2c2.git/blob - selection.h
a3d8b307c9c7e27dda9804531e711ae9db58bfba
[r2c2.git] / selection.h
1 /* $Id$
2
3 This file is part of R²C²
4 Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef SELECTION_H_
9 #define SELECTION_H_
10
11 #include <set>
12 #include <sigc++/sigc++.h>
13 #include "3d/track.h"
14
15 class Selection
16 {
17 public:
18         sigc::signal<void> signal_changed;
19
20 private:
21         std::set<R2C2::Track *> tracks;
22
23 public:
24         const std::set<R2C2::Track *> &get_tracks() const { return tracks; }
25         R2C2::Track *get_track() const;
26         unsigned size() const { return tracks.size(); }
27         bool empty() const { return tracks.empty(); }
28
29         void clear();
30
31         template<typename Iter>
32         void replace(Iter begin, Iter end)
33         {
34                 tracks.clear();
35                 tracks.insert(begin, end);
36                 signal_changed.emit();
37         }
38
39         void add_track(R2C2::Track *);
40         void remove_track(R2C2::Track *);
41         void toggle_track(R2C2::Track *);
42
43         void select_more();
44         void select_linked();
45         void select_blocks();
46 };
47
48 #endif