18 #ifndef FLOWCANVAS_CANVAS_HPP
19 #define FLOWCANVAS_CANVAS_HPP
24 #include <boost/enable_shared_from_this.hpp>
25 #include <boost/utility.hpp>
27 #include <libgnomecanvasmm.h>
38 namespace FlowCanvas {
59 ,
public boost::enable_shared_from_this<Canvas>
60 ,
public Gnome::Canvas::CanvasAA
68 void add_item(boost::shared_ptr<Item> i);
71 boost::shared_ptr<Connection>
73 boost::shared_ptr<Connectable> head)
const;
76 boost::shared_ptr<Connectable> head,
81 boost::shared_ptr<Connection>
remove_connection(boost::shared_ptr<Connectable> tail,
82 boost::shared_ptr<Connectable> head);
98 bool locked()
const {
return _locked; }
105 virtual void arrange(
bool use_length_hints=
false,
bool center=
true);
109 double width()
const {
return _width; }
110 double height()
const {
return _height; }
112 void resize(
double width,
double height);
130 virtual void connect(boost::shared_ptr<Connectable> ,
131 boost::shared_ptr<Connectable> ) {}
135 boost::shared_ptr<Connectable> ) {}
151 bool port_event(GdkEvent* event, boost::weak_ptr<Port> port);
153 GVNodes layout_dot(
bool use_length_hints,
const std::string& filename);
156 bool are_connected(boost::shared_ptr<const Connectable> tail,
157 boost::shared_ptr<const Connectable> head);
159 void select_port(boost::shared_ptr<Port> p,
bool unique =
false);
160 void select_port_toggle(boost::shared_ptr<Port> p,
int mod_state);
161 void unselect_port(boost::shared_ptr<Port> p);
162 void selection_joined_with(boost::shared_ptr<Port> port);
163 void join_selection();
165 boost::shared_ptr<Port> get_port_at(
double x,
double y);
167 bool scroll_drag_handler(GdkEvent* event);
168 bool select_drag_handler(GdkEvent* event);
169 bool connection_drag_handler(GdkEvent* event);
171 void ports_joined(boost::shared_ptr<Port> port1, boost::shared_ptr<Port> port2);
172 bool animate_selected();
174 void move_contents_to_internal(
double x,
double y,
double min_x,
double min_y);
176 void on_parent_changed(Gtk::Widget* old_parent);
177 sigc::connection _parent_event_connection;
179 typedef std::list< boost::shared_ptr<Port> > SelectedPorts;
181 SelectedPorts _selected_ports;
182 boost::shared_ptr<Port> _connect_port;
183 boost::shared_ptr<Port> _last_selected_port;
185 Gnome::Canvas::Rect _base_rect;
186 Gnome::Canvas::Rect* _select_rect;
187 ArtVpathDash* _select_dash;
193 enum DragState { NOT_DRAGGING, CONNECTION, SCROLL, SELECT };
194 DragState _drag_state;
198 bool _remove_objects :1;
205 #endif // FLOWCANVAS_CANVAS_HPP