Ardour  9.0-pre0-1320-gf48fe3f740
rect_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_RECTSET_H__
22 #define __CANVAS_RECTSET_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 RectSet : public Item
32 {
33 public:
36 
37  void compute_bounding_box () const;
38  void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
39 
40  bool covers (Duple const &) const;
41 
42  void begin_add ();
43  void end_add ();
44 
45  struct ResetRAII {
46  ResetRAII (RectSet& rs) : rects (rs) { rects.clear(); rects.begin_add(); }
47  ~ResetRAII () { rects.end_add (); }
49  };
50 
51  void add_rect (int index, Rect const &, Gtkmm2ext::Color);
52  void clear ();
53 
55  ColoredRectangle (int i, Rect const & ra, Gtkmm2ext::Color color_) : Rect (ra), index (i), color (color_) {}
56  int index;
58  };
59 
60  std::vector<ColoredRectangle> const & rects() const { return _rects; }
61 
62 private:
63  std::vector<ColoredRectangle> _rects;
64 };
65 
66 }
67 
68 #endif /* __CANVAS_RECTSET_H__ */
#define LIBCANVAS_API
std::vector< ColoredRectangle > const & rects() const
Definition: rect_set.h:60
void compute_bounding_box() const
void add_rect(int index, Rect const &, Gtkmm2ext::Color)
std::vector< ColoredRectangle > _rects
Definition: rect_set.h:63
void render(Rect const &area, Cairo::RefPtr< Cairo::Context >) const
bool covers(Duple const &) const
PBD::PropertyDescriptor< uint32_t > color
uint32_t Color
Definition: colors.h:33
ColoredRectangle(int i, Rect const &ra, Gtkmm2ext::Color color_)
Definition: rect_set.h:55