Subtitle rearrangements.
[dcpomatic.git] / src / wx / timeline_content_view.h
1 /*
2     Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #ifndef DCPOMATIC_TIMELINE_CONTENT_VIEW_H
21 #define DCPOMATIC_TIMELINE_CONTENT_VIEW_H
22
23 #include "timeline_view.h"
24 #include <wx/wx.h>
25 #include <boost/signals2.hpp>
26
27 class Content;
28
29 /** @class TimelineContentView
30  *  @brief Parent class for views of pieces of content.
31  */
32 class TimelineContentView : public TimelineView
33 {
34 public:
35         TimelineContentView (Timeline& tl, boost::shared_ptr<Content> c);
36
37         dcpomatic::Rect<int> bbox () const;
38
39         void set_selected (bool s);
40         bool selected () const;
41         boost::shared_ptr<Content> content () const;
42         void set_track (int t);
43         void unset_track ();
44         boost::optional<int> track () const;
45
46         virtual bool active () const = 0;
47         virtual wxColour background_colour () const = 0;
48         virtual wxColour foreground_colour () const = 0;
49
50 protected:
51
52         boost::weak_ptr<Content> _content;
53
54 private:
55
56         void do_paint (wxGraphicsContext* gc, std::list<dcpomatic::Rect<int> > overlaps);
57         int y_pos (int t) const;
58         void content_changed (int p);
59
60         boost::optional<int> _track;
61         bool _selected;
62
63         boost::signals2::scoped_connection _content_connection;
64 };
65
66 typedef std::vector<boost::shared_ptr<TimelineContentView> > TimelineContentViewList;
67
68 #endif