00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __GEOMETRY_GEOM_DRAWING_AREA_H_
00026 #define __GEOMETRY_GEOM_DRAWING_AREA_H_
00027
00028 #include <gtkmm.h>
00029 #ifdef HAVE_GLADEMM
00030 # include <libglademm/xml.h>
00031 #endif
00032
00033 #include <vector>
00034
00035 namespace fawkes{
00036 class GeomDrawer;
00037 class HomPoint;
00038 class HomVector;
00039 class LineSegment;
00040 class Bezier;
00041 class Spline;
00042 class DrawingManipulator;
00043
00044 class GeomDrawingArea : public Gtk::DrawingArea
00045 {
00046 public:
00047 GeomDrawingArea( float max_x = 5.0,
00048 float max_y = 5.0,
00049 float min_x = -5.0,
00050 float min_y = -5.0 );
00051 #ifdef HAVE_GLADEMM
00052 GeomDrawingArea(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& ref_xml);
00053 #endif
00054 virtual ~GeomDrawingArea();
00055
00056 void clear();
00057
00058 GeomDrawingArea& operator<<(fawkes::HomPoint& p);
00059 GeomDrawingArea& operator<<(const fawkes::HomPoint& p);
00060 GeomDrawingArea& operator<<(std::pair<HomVector, HomPoint> v);
00061 GeomDrawingArea& operator<<(fawkes::LineSegment& l);
00062 GeomDrawingArea& operator<<(fawkes::Bezier& b);
00063 GeomDrawingArea& operator<<(fawkes::Spline& s);
00064 GeomDrawingArea& operator<<(const fawkes::Spline& s);
00065 GeomDrawingArea& operator<<(fawkes::DrawingManipulator* m);
00066
00067 virtual void to_drawing_coords(int window_x, int window_y, float& drawing_x, float& drawing_y);
00068
00069 protected:
00070 virtual void pre_draw(Cairo::RefPtr<Cairo::Context>& context);
00071 virtual void post_draw(Cairo::RefPtr<Cairo::Context>& context);
00072
00073 private:
00074 virtual bool on_expose_event(GdkEventExpose* event);
00075
00076 std::vector<fawkes::GeomDrawer*> m_drawers;
00077 fawkes::DrawingManipulator* m_cur_drawing_manipulator;
00078
00079 float m_max_x;
00080 float m_max_y;
00081 float m_min_x;
00082 float m_min_y;
00083
00084 float m_unit;
00085
00086 int m_window_width;
00087 int m_window_height;
00088 };
00089
00090 }
00091
00092 #endif