Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * geom_drawing_area.h - A Gtk::DrawingArea for objects of the Fawkes 00004 * geometry library 00005 * 00006 * Created: Wed Oct 08 18:35:19 2008 00007 * Copyright 2008 Daniel Beck 00008 * 00009 ****************************************************************************/ 00010 00011 /* This program is free software; you can redistribute it and/or modify 00012 * it under the terms of the GNU General Public License as published by 00013 * the Free Software Foundation; either version 2 of the License, or 00014 * (at your option) any later version. A runtime exception applies to 00015 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00016 * 00017 * This program is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU Library General Public License for more details. 00021 * 00022 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 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 } // end namespace fawkes 00091 00092 #endif /* __GEOMETRY_GEOM_DRAWING_AREA_H_ */