arc.h

00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation version 2.1.                *
00008  *                                                                         *
00009  *   This program is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU Lesser General Public      *
00015  *   License along with this library; if not, write to the                 *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA              *
00018  ***************************************************************************/
00019 #ifndef PAPYRUSARC_H
00020 #define PAPYRUSARC_H
00021 
00022 #include <cmath>
00023 
00024 #include <papyrus/shape.h>
00025 
00043 namespace Papyrus
00044 {
00045 
00054   class Arc : public Shape
00055   {
00056     public:
00057       typedef PapyrusSmartPointer<Arc> pointer;
00058 
00060       Arc( double radius = 1.0, double angle_start = 0.0, double angle_end = M_PI / 2.0 );
00061 
00063       static Arc::pointer create( double radius = 1.0, double angle_start = 0.0, double angle_end = M_PI / 2.0 );
00064 
00066       ~Arc();
00067 
00069       double radius();
00070 
00072       void set_radius( double r );
00073 
00075       double start_angle();
00076 
00078       double end_angle();
00079 
00081       void set_angles( double start, double end );
00082 
00084       virtual void draw_shape( Cairo::RefPtr<Cairo::Context> cairo );
00085 
00090       virtual void draw_outline( Cairo::RefPtr<Cairo::Context> cairo );
00091 
00093       sigc::signal<void> signal_radius();
00094 
00096       sigc::signal<void> signal_angle();
00097 
00098       PAPYRUS_CLASS_NAME("Arc");
00099 
00100       PAPYRUS_CLONE_METHOD( Arc );
00101 
00102     protected:
00103 
00104       double m_radius;
00105 
00106       double m_angle_start;
00107 
00108       double m_angle_end;
00109 
00114       virtual void need_redraw();
00115 
00116       void calculate_extents();
00117 
00119       sigc::signal<void> m_signal_radius;
00120 
00122       sigc::signal<void> m_signal_angle;
00123 
00124   };
00125 
00126 }
00127 
00128 #endif

Generated on Sun Jan 7 22:53:57 2007 by  doxygen 1.5.1