18 #ifndef FLOWCANVAS_MODULE_HPP
19 #define FLOWCANVAS_MODULE_HPP
23 #include <boost/shared_ptr.hpp>
24 #include <libgnomecanvasmm.h>
28 namespace FlowCanvas {
41 const std::string&
name,
44 bool show_title =
true,
52 inline boost::shared_ptr<Port>
get_port(
const std::string& name)
const;
54 void add_port(boost::shared_ptr<Port> port);
56 boost::shared_ptr<Port>
port_at(
double x,
double y);
64 virtual void move(
double dx,
double dy);
65 virtual void move_to(
double x,
double y);
67 virtual void set_name(
const std::string& n);
80 void set_icon(
const Glib::RefPtr<Gdk::Pixbuf>& icon);
100 void embed(Gtk::Container* widget);
126 struct PortComparator {
127 explicit PortComparator(
const std::string& name) :
_name(name) {}
128 inline bool operator()(
const boost::shared_ptr<Port> port)
129 {
return (port && port->name() ==
_name); }
130 const std::string&
_name;
133 void embed_size_request(Gtk::Requisition* req,
bool force);
142 inline boost::shared_ptr<Port>
145 PortComparator comp(port_name);
146 PortVector::const_iterator i = std::find_if(
_ports.begin(),
_ports.end(), comp);
147 return (i !=
_ports.end()) ? *i : boost::shared_ptr<Port>();
153 #endif // FLOWCANVAS_MODULE_HPP