papyrus logo

rectangle.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This file is part of the papyrus library.                             *
00006  *                                                                         *
00007  *   papyrus is free software; you can redistribute it and/or modify       *
00008  *   it under the terms of the GNU Lesser General Public License           *
00009  *   version 3.0 as published by the Free Software Foundation.             *
00010  *                                                                         *
00011  *   papyrus is distributed in the hope that it will be useful,            *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Lesser General Public License version 3.0 for more details.       *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Lesser General Public      *
00017  *   License along with the papyrus library. If not, see                   *
00018  *   <http://www.gnu.org/licenses/>.                                       *
00019  ***************************************************************************/
00020 #ifndef PAPYRUSRECTANGLE_H
00021 #define PAPYRUSRECTANGLE_H
00022 
00023 #include <papyrus/shape.h>
00024 
00045 namespace Papyrus
00046 {
00047 
00055   class Rectangle : public Shape
00056   {
00057     protected:
00058 
00059       Rectangle ( const Glib::ustring& id,
00060                   double x,
00061                   double y,
00062                   double w,
00063                   double h,
00064                   Fill::pointer fill,
00065                   Stroke::pointer stroke
00066                 );
00067 
00068       Rectangle( const AttributeValueMap& avmap );
00069 
00070     public:
00071       PAPYRUS_DRAWABLE(Rectangle);
00072 
00073       static Rectangle::pointer create ( double x,
00074                                          double y,
00075                                          double w,
00076                                          double h,
00077                                          Fill::pointer fill = Fill::pointer(),
00078                                          Stroke::pointer stroke=Stroke::pointer() );
00079 
00081       static Rectangle::pointer create ( double w=0.0,
00082                                          double h=0.0,
00083                                          Fill::pointer fill = Fill::pointer(),
00084                                          Stroke::pointer stroke=Stroke::pointer() );
00085 
00086       static Rectangle::pointer create ( const Glib::ustring& id,
00087                                          double x,
00088                                          double y,
00089                                          double w,
00090                                          double h,
00091                                          Fill::pointer fill = Fill::pointer(),
00092                                          Stroke::pointer stroke=Stroke::pointer() );
00093 
00094       static Rectangle::pointer create ( const Glib::ustring& id,
00095                                          double w,
00096                                          double h,
00097                                          Fill::pointer fill = Fill::pointer(),
00098                                          Stroke::pointer stroke=Stroke::pointer() );
00099 
00100       static Rectangle::pointer create( const AttributeValueMap& avmap );
00101 
00102       virtual ~Rectangle();
00103 
00104       virtual void set( const AttributeValueMap& avmap );
00105 
00107       double width();
00108 
00110       double height();
00111 
00113       void xywh ( double& x, double& y, double& w, double& h );
00114 
00116       void set_width ( double w );
00117 
00119       void set_height ( double h );
00120 
00125       void set_xywh ( double x, double y, double w, double h );
00126 
00127       void set_xywh ( const Region& r );
00128 
00130       double corner_radius();
00131       
00133       void set_corner_radius( double r );
00134 
00142       void unset_corner_radius();
00143 
00145       virtual void draw_shape ( Context& cairo ) const;
00146 
00147       virtual Glib::ustring svg(unsigned depth=0);
00148 
00150       sigc::signal<void> signal_size();
00151 
00152     protected:
00153 
00154       double m_width, m_height;
00155 
00156       double m_corner_radius;
00157 
00158       sigc::signal<void> m_signal_size;
00159 
00161       virtual Region calculate_extents(const Matrix& m = Matrix::Identity, ExtentsPerformance ep = EXTENTS_QUICK) const;
00162 
00163   };
00164 
00165 }
00166 
00167 #endif

Generated on Fri Apr 16 12:40:11 2010 for papyrus by doxygen 1.6.1