FlowCanvas 0.5.1
/usr/src/RPM/BUILD/libflowcanvas-0.5.1/flowcanvas/Connectable.hpp
Go to the documentation of this file.
00001 /* This file is part of FlowCanvas.
00002  * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
00003  * 
00004  * FlowCanvas is free software; you can redistribute it and/or modify it under the
00005  * terms of the GNU General Public License as published by the Free Software
00006  * Foundation; either version 2 of the License, or (at your option) any later
00007  * version.
00008  * 
00009  * FlowCanvas is distributed in the hope that it will be useful, but WITHOUT ANY
00010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for details.
00012  * 
00013  * You should have received a copy of the GNU General Public License along
00014  * with this program; if not, write to the Free Software Foundation, Inc.,
00015  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
00016  */
00017 
00018 #ifndef FLOWCANVAS_CONNECTABLE_HPP
00019 #define FLOWCANVAS_CONNECTABLE_HPP
00020 
00021 #include <boost/shared_ptr.hpp>
00022 
00023 namespace FlowCanvas {
00024 
00025 class Connection;
00026 
00027 
00028 class Connectable {
00029 public:
00030     virtual ~Connectable() {}
00031 
00032     virtual Gnome::Art::Point src_connection_point() = 0;
00033     virtual Gnome::Art::Point dst_connection_point(const Gnome::Art::Point& src) = 0;
00034     
00035     virtual void add_connection(boost::shared_ptr<Connection> c);
00036     virtual void remove_connection(boost::shared_ptr<Connection> c);
00037 
00038     virtual void move_connections();
00039     virtual void raise_connections();
00040 
00041     bool is_connected_to(boost::shared_ptr<Connectable> other);
00042     
00043     typedef std::list< boost::weak_ptr<Connection> > Connections;
00044     Connections& connections() { return _connections; }
00045 
00046 protected:
00047 
00048     Connections _connections; 
00049 };
00050 
00051 
00052 } // namespace FlowCanvas
00053 
00054 #endif // FLOWCANVAS_CONNECTABLE_HPP