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

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