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