00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef PAPYRUSSHAPE_H
00020 #define PAPYRUSSHAPE_H
00021
00022 #include <papyrus/enums.h>
00023 #include <papyrus/drawable.h>
00024 #include <papyrus/linestyle.h>
00025
00026 namespace Papyrus
00027 {
00028
00044 class Shape : public Drawable
00045 {
00046 public:
00047 typedef PapyrusSmartPointer<Shape> pointer;
00048
00050 Shape( );
00051
00053 Shape( Cairo::RefPtr<Cairo::Pattern> fill );
00054
00056 Shape( Cairo::RefPtr<Cairo::Pattern> fill, const LineStyle& outline, bool use_outline = true );
00057
00059 virtual ~Shape();
00060
00065 virtual void draw( Cairo::RefPtr<Cairo::Context> cairo );
00066
00072 virtual void draw_shape( Cairo::RefPtr<Cairo::Context> cairo ) = 0;
00073
00079 virtual void draw_outline( Cairo::RefPtr<Cairo::Context> cairo );
00080
00082 Cairo::RefPtr<Cairo::Pattern> fill();
00083
00085 void set_fill( Cairo::RefPtr<Cairo::Pattern> fill = Cairo::RefPtr<Cairo::Pattern>() );
00086
00088 LineStyle& outline();
00089
00094 void set_outline( const LineStyle& outline, bool use_outline = true );
00095
00100 void set_outline( Cairo::RefPtr<Cairo::Pattern> pattern, bool use_outline = true );
00101
00103 bool use_outline();
00104
00109 void set_use_outline( bool use_outline );
00110
00111 PAPYRUS_CLASS_NAME("Shape");
00112
00113 protected:
00117 Cairo::RefPtr<Cairo::Pattern> m_fill;
00118 LineStyle m_outline;
00119 bool m_use_outline;
00120 Cairo::Path* m_fill_path;
00121 Cairo::Path* m_outline_path;
00122
00123 sigc::connection m_outline_changed_connection;
00124 Region m_internal_extents;
00125
00129 virtual void set_extents( const Region& extents );
00130
00131 virtual void on_outline_changed();
00132
00133 virtual void shape_changed( unsigned which=FILL|OUTLINE );
00134
00135
00136 };
00137
00138 }
00139
00140 #endif