18 #ifndef FLOWCANVAS_ITEM_HPP
19 #define FLOWCANVAS_ITEM_HPP
26 #include <boost/enable_shared_from_this.hpp>
27 #include <boost/shared_ptr.hpp>
29 #include <libgnomecanvasmm.h>
33 namespace FlowCanvas {
42 class Item :
public Gnome::Canvas::Group
43 ,
public boost::enable_shared_from_this<Item>
47 const std::string&
name,
61 virtual void move(
double dx,
double dy) = 0;
63 virtual void zoom(
double z) {}
70 _menu->popup(button, activate_time);
90 bool is_within(
const Gnome::Canvas::Rect& rect)
const;
124 virtual void on_drag(
double dx,
double dy);
126 virtual void on_click(GdkEventButton* ev);
149 typedef std::list<boost::shared_ptr<Item> >
ItemList;
157 return (x > property_x() && x < property_x() +
_width
158 && y > property_y() && y < property_y() +
_height);
165 const double x1 = rect.property_x1();
166 const double y1 = rect.property_y1();
167 const double x2 = rect.property_x2();
168 const double y2 = rect.property_y2();
170 if (x1 < x2 && y1 < y2) {
171 return (property_x() > x1
173 && property_x() +
width() < x2
174 && property_y() +
height() < y2);
175 }
else if (x2 < x1 && y2 < y1) {
176 return (property_x() > x2
178 && property_x() +
width() < x1
179 && property_y() +
height() < y1);
180 }
else if (x1 < x2 && y2 < y1) {
181 return (property_x() > x1
183 && property_x() +
width() < x2
184 && property_y() +
height() < y1);
185 }
else if (x2 < x1 && y1 < y2) {
186 return (property_x() > x2
188 && property_x() +
width() < x1
189 && property_y() +
height() < y2);
197 #endif // FLOWCANVAS_ITEM_HPP