FlowCanvas  0.7.1
Connectable.hpp
Go to the documentation of this file.
1 /* This file is part of FlowCanvas.
2  * Copyright (C) 2007-2009 David Robillard <http://drobilla.net>
3  *
4  * FlowCanvas is free software; you can redistribute it and/or modify it under the
5  * terms of the GNU General Public License as published by the Free Software
6  * Foundation; either version 2 of the License, or (at your option) any later
7  * version.
8  *
9  * FlowCanvas is distributed in the hope that it will be useful, but WITHOUT ANY
10  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16  */
17 
18 #ifndef FLOWCANVAS_CONNECTABLE_HPP
19 #define FLOWCANVAS_CONNECTABLE_HPP
20 
21 #include <list>
22 
23 #include <boost/shared_ptr.hpp>
24 
25 namespace FlowCanvas {
26 
27 class Connection;
28 
29 
32 class Connectable {
33 public:
34  virtual ~Connectable() {}
35 
36  virtual Gnome::Art::Point src_connection_point() = 0;
37  virtual Gnome::Art::Point dst_connection_point(const Gnome::Art::Point& src) = 0;
38  virtual Gnome::Art::Point connection_point_vector(double dx, double dy) = 0;
39 
40  virtual void add_connection(boost::shared_ptr<Connection> c);
41  virtual void remove_connection(boost::shared_ptr<Connection> c);
42 
43  virtual void move_connections();
44  virtual void raise_connections();
45 
46  bool is_connected_to(boost::shared_ptr<Connectable> other);
47 
48  typedef std::list< boost::weak_ptr<Connection> > Connections;
50 
51 protected:
53 };
54 
55 
56 } // namespace FlowCanvas
57 
58 #endif // FLOWCANVAS_CONNECTABLE_HPP