Ardour  9.0-pre0-582-g084a23a80d
line_set.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Carl Hetherington <carl@carlh.net>
3  * Copyright (C) 2013-2014 Paul Davis <paul@linuxaudiosystems.com>
4  * Copyright (C) 2015-2017 Robin Gareus <robin@gareus.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #ifndef __CANVAS_LINESET_H__
22 #define __CANVAS_LINESET_H__
23 
24 #include <vector>
25 
26 #include "canvas/item.h"
27 #include "canvas/visibility.h"
28 
29 namespace ArdourCanvas {
30 
31 class LIBCANVAS_API LineSet : public Item
32 {
33 public:
34  enum Orientation {
37  };
38 
41 
42  void compute_bounding_box () const;
43  void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
44 
45  bool covers (Duple const &) const;
46 
48  Distance extent() const { return _extent; }
49 
50  void begin_add ();
51  void end_add ();
52 
53  struct ResetRAII {
54  ResetRAII (LineSet& l) : lines (l) { lines.clear(); lines.begin_add(); }
55  ~ResetRAII () { lines.end_add (); }
57  };
58 
60  void clear ();
61 
62  struct Line {
63  Line (Coord p, Distance width_, Gtkmm2ext::Color color_) : pos (p), width (width_), color (color_) {}
64 
68  };
69 
70 private:
71  std::vector<Line> _lines;
74 };
75 
76 }
77 
78 #endif /* __CANVAS_LINESET_H__ */
#define LIBCANVAS_API
bool covers(Duple const &) const
Orientation _orientation
Definition: line_set.h:73
void set_extent(Distance)
std::vector< Line > _lines
Definition: line_set.h:71
void render(Rect const &area, Cairo::RefPtr< Cairo::Context >) const
Distance extent() const
Definition: line_set.h:48
LineSet(Item *, Orientation o=Vertical)
void compute_bounding_box() const
LineSet(Canvas *, Orientation o=Vertical)
void add_coord(Coord, Distance, Gtkmm2ext::Color)
PBD::PropertyDescriptor< uint32_t > color
uint32_t Color
Definition: colors.h:33
Line(Coord p, Distance width_, Gtkmm2ext::Color color_)
Definition: line_set.h:63
Gtkmm2ext::Color color
Definition: line_set.h:67
gint width
Definition: xcursors.h:1