]> git.tdb.fi Git - r2c2.git/blob - source/libr2c2/trackattachment.h
1572f619db1ede100ea9cfa8e22d4298ba9a2edc
[r2c2.git] / source / libr2c2 / trackattachment.h
1 #ifndef LIBR2C2_TRACKATTACHMENT_H_
2 #define LIBR2C2_TRACKATTACHMENT_H_
3
4 #include "object.h"
5 #include "track.h"
6 #include "trackiter.h"
7
8 namespace R2C2 {
9
10 class TrackAttachment: public Object, public sigc::trackable
11 {
12 protected:
13         TrackIter track;
14         float offset;
15
16         TrackAttachment(Layout &);
17 public:
18         virtual ~TrackAttachment();
19
20         const TrackIter &get_track_iter() const { return track; }
21         Track *get_track() const { return track.track(); }
22         unsigned get_entry() const { return track.entry(); }
23         float get_offset() const { return offset; }
24         float get_offset_from_endpoint(unsigned) const;
25 protected:
26         void attach_to(const TrackIter &, float);
27         void attach_to_closest(float);
28         float find_offset(const TrackIter &, const Vector &);
29
30 public:
31         virtual Track *get_parent() const { return track.track(); }
32
33 private:
34         void object_removed(Object &);
35 };
36
37 } // namespace R2C2
38
39 #endif