00001 /* This file is part of FlowCanvas. 00002 * Copyright (C) 2007-2009 David 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 <list> 00022 00023 #include <boost/shared_ptr.hpp> 00024 00025 namespace FlowCanvas { 00026 00027 class Connection; 00028 00029 00032 class Connectable { 00033 public: 00034 virtual ~Connectable() {} 00035 00036 virtual Gnome::Art::Point src_connection_point() = 0; 00037 virtual Gnome::Art::Point dst_connection_point(const Gnome::Art::Point& src) = 0; 00038 virtual Gnome::Art::Point connection_point_vector(double dx, double dy) = 0; 00039 00040 virtual void add_connection(boost::shared_ptr<Connection> c); 00041 virtual void remove_connection(boost::shared_ptr<Connection> c); 00042 00043 virtual void move_connections(); 00044 virtual void raise_connections(); 00045 00046 bool is_connected_to(boost::shared_ptr<Connectable> other); 00047 00048 typedef std::list< boost::weak_ptr<Connection> > Connections; 00049 Connections& connections() { return _connections; } 00050 00051 protected: 00052 Connections _connections; 00053 }; 00054 00055 00056 } // namespace FlowCanvas 00057 00058 #endif // FLOWCANVAS_CONNECTABLE_HPP