00001 /* This file is part of FlowCanvas. 00002 * Copyright (C) 2007-2009 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 virtual Gnome::Art::Point connection_point_vector(double dx, double dy) = 0; 00035 00036 virtual void add_connection(boost::shared_ptr<Connection> c); 00037 virtual void remove_connection(boost::shared_ptr<Connection> c); 00038 00039 virtual void move_connections(); 00040 virtual void raise_connections(); 00041 00042 bool is_connected_to(boost::shared_ptr<Connectable> other); 00043 00044 typedef std::list< boost::weak_ptr<Connection> > Connections; 00045 Connections& connections() { return _connections; } 00046 00047 protected: 00048 00049 Connections _connections; 00050 }; 00051 00052 00053 } // namespace FlowCanvas 00054 00055 #endif // FLOWCANVAS_CONNECTABLE_HPP