00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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