Ardour  9.0-pre0-582-g084a23a80d
gtk2_ardour/selectable.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2016 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2008-2009 David Robillard <d@drobilla.net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #pragma once
21 #include <list>
22 
23 #include <sigc++/signal.h>
24 
25 #include "temporal/timeline.h"
26 
27 class Selection;
28 
29 class Selectable : public virtual sigc::trackable
30 {
31 public:
33  _selected = false;
34  }
35 
36  virtual ~Selectable() {}
37 
38  virtual void set_selected (bool yn) {
39  if (yn != _selected) {
40  _selected = yn;
41  }
42  }
43 
44  virtual bool selected() const {
45  return _selected;
46  }
47 
48 protected:
49  bool _selected;
50 };
51 
53 {
54  public:
56  virtual ~SelectableOwner() {}
57 
58  void get_selectables (Temporal::timepos_t const & start, Temporal::timepos_t const & end, double x, double y, std::list<Selectable*>& sl, bool within = false) {
59  _get_selectables (start, end, x, y, sl, within);
60  }
61 
62  virtual void _get_selectables (Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, std::list<Selectable*>&, bool within) = 0;
63  virtual void get_inverted_selectables (Selection&, std::list<Selectable *>& results) = 0;
64 };
virtual void _get_selectables(Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, std::list< Selectable * > &, bool within)=0
virtual void get_inverted_selectables(Selection &, std::list< Selectable * > &results)=0
void get_selectables(Temporal::timepos_t const &start, Temporal::timepos_t const &end, double x, double y, std::list< Selectable * > &sl, bool within=false)
virtual bool selected() const
virtual void set_selected(bool yn)
Lists of selected things.
PBD::PropertyDescriptor< timepos_t > start