rectangle.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 PAPYRUSRECTANGLE_H
00020 #define PAPYRUSRECTANGLE_H
00021 
00022 #include <papyrus/shape.h>
00023 
00044 namespace Papyrus {
00045 
00053   class Rectangle : public Shape {
00054     protected:
00055 
00056       Rectangle( double w,
00057                  double h,
00058                  Cairo::RefPtr<Cairo::Pattern> fill
00059                );
00060 
00061       Rectangle( double w,
00062                  double h,
00063                  Cairo::RefPtr<Cairo::Pattern> fill,
00064                  const LineStyle& outline
00065                );
00066 
00067     public:
00068       typedef PapyrusSmartPointer<Rectangle> pointer;
00069 
00071       static Rectangle::pointer create( double w = 0.0,
00072                                         double h = 0.0,
00073                                         Cairo::RefPtr<Cairo::Pattern> fill = Cairo::RefPtr<Cairo::Pattern>()
00074                                       );
00075 
00077       static Rectangle::pointer create( double w,
00078                                         double h,
00079                                         Cairo::RefPtr<Cairo::Pattern> fill,
00080                                         const LineStyle& outline
00081                                       );
00082 
00083       ~Rectangle();
00084 
00086       double width();
00087 
00089       double height();
00090 
00092       void width_height( double& w, double& h );
00093 
00095       void set_width( double w );
00096 
00098       void set_height( double h );
00099 
00101       void set_width_height( double w, double h );
00102 
00107       void set_xywh( double x, double y, double w, double h );
00108 
00110       virtual void draw_shape( Cairo::RefPtr<Cairo::Context> cairo );
00111 
00113       sigc::signal<void> signal_size();
00114 
00115       PAPYRUS_CLASS_NAME("Rectangle");
00116 
00117       PAPYRUS_CLONE_METHOD( Rectangle );
00118 
00119   protected:
00120 
00121       double m_width;
00122 
00123       double m_height;
00124 
00125       virtual void need_redraw();
00126 
00127       sigc::signal<void> m_signal_size;
00128 
00129   };
00130 
00131 }
00132 
00133 #endif

Generated on Sun Mar 11 10:01:28 2007 by  doxygen 1.5.1