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 protected:
00047
00049 Shape( Cairo::RefPtr<Cairo::Pattern> fill = Cairo::RefPtr<Cairo::Pattern>() );
00050
00052 Shape( Cairo::RefPtr<Cairo::Pattern> fill, const LineStyle& outline );
00053
00054 public:
00055 typedef PapyrusSmartPointer<Shape> pointer;
00056
00058 virtual ~Shape();
00059
00064 virtual void draw( Cairo::RefPtr<Cairo::Context> cairo );
00065
00071 virtual void draw_shape( Cairo::RefPtr<Cairo::Context> cairo ) = 0;
00072
00078 virtual void draw_outline( Cairo::RefPtr<Cairo::Context> cairo );
00079
00081 Cairo::RefPtr<Cairo::Pattern> fill();
00082
00084 void set_fill( Cairo::RefPtr<Cairo::Pattern> fill = Cairo::RefPtr<Cairo::Pattern>() );
00085
00087 LineStyle& outline();
00088
00093 void set_outline( const LineStyle& outline, bool use_outline = true );
00094
00099 void set_outline( Cairo::RefPtr<Cairo::Pattern> pattern, bool use_outline = true );
00100
00102 bool use_outline();
00103
00108 void set_use_outline( bool use_outline );
00109
00110 PAPYRUS_CLASS_NAME("Shape");
00111
00112 protected:
00116 Cairo::RefPtr<Cairo::Pattern> m_fill;
00117 LineStyle m_outline;
00118 bool m_use_outline;
00119 Cairo::Path* m_fill_path;
00120 Cairo::Path* m_outline_path;
00121
00122 sigc::connection m_outline_changed_connection;
00123 Region m_internal_extents;
00124
00128 virtual void set_extents( const Region& extents );
00129
00130 virtual void on_outline_changed();
00131
00132 virtual void shape_changed( unsigned which=FILL|OUTLINE );
00133
00134
00135 };
00136
00137 }
00138
00139 #endif