papyrus logo

text.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 PAPYRUSTEXT_H
00021 #define PAPYRUSTEXT_H
00022 
00023 #include <string>
00024 
00025 #include <papyrus/shape.h>
00026 
00050 namespace Papyrus
00051 {
00052 
00061   class Text : public Shape
00062   {
00063     protected:
00064       Text (
00065           const Glib::ustring& id,
00066           const Glib::ustring& text,
00067           double size,
00068           const Glib::ustring& family,
00069           Cairo::FontSlant slant,
00070           Cairo::FontWeight weight,
00071           Fill::pointer fill,
00072           Stroke::pointer stroke
00073       );
00074 
00075     public:
00076       PAPYRUS_DRAWABLE(Text);
00077 
00078       static Text::pointer create ( const Glib::ustring& text = Glib::ustring(),
00079                                     double size = 12.0,
00080                                     const Glib::ustring& family = Glib::ustring(),
00081                                     Cairo::FontSlant slant = Cairo::FONT_SLANT_NORMAL,
00082                                     Cairo::FontWeight weight = Cairo::FONT_WEIGHT_NORMAL,
00083                                     Fill::pointer fill=Fill::pointer(),
00084                                     Stroke::pointer stroke=Stroke::pointer()
00085                                   );
00086 
00087       static Text::pointer create ( const Glib::ustring& id,
00088                                     const Glib::ustring& text = Glib::ustring(),
00089                                     double size = 12.0,
00090                                     const Glib::ustring& family = Glib::ustring(),
00091                                     Cairo::FontSlant slant = Cairo::FONT_SLANT_NORMAL,
00092                                     Cairo::FontWeight weight = Cairo::FONT_WEIGHT_NORMAL,
00093                                     Fill::pointer fill=Fill::pointer(),
00094                                     Stroke::pointer stroke=Stroke::pointer()
00095                                   );
00096 
00097       virtual ~Text();
00098 
00099       const Glib::ustring& font_family();
00100 
00101       Cairo::FontSlant font_slant();
00102 
00103       Cairo::FontWeight font_weight();
00104 
00105       void set_font_face ( const Glib::ustring& family,
00106                            Cairo::FontSlant slant,
00107                            Cairo::FontWeight weight
00108                          );
00109 
00110       const Cairo::FontOptions& font_options();
00111 
00112       void set_font_options ( const Cairo::FontOptions& font_options );
00113 
00114       double size();
00115 
00116       void set_size ( double );
00117 
00118       Glib::ustring text() const;
00119 
00120       void set_text ( const Glib::ustring );
00121 
00122       virtual void draw_shape ( Context& cairo ) const;
00123 
00124       sigc::signal<void> signal_text();
00125 
00126       sigc::signal<void> signal_font();
00127 
00128     protected:
00129       Glib::ustring m_text;
00130       double m_size;
00131       Glib::ustring m_family;
00132       Cairo::FontSlant m_slant;
00133       Cairo::FontWeight m_weight;
00134       Cairo::FontOptions m_font_options;
00135 
00136       sigc::signal<void> m_signal_text;
00137 
00138       sigc::signal<void> m_signal_font;
00139 
00140   };
00141 
00142 }
00143 
00144 #endif

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