00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef PAPYRUSGRID_H
00020 #define PAPYRUSGRID_H
00021
00022 #include <papyrus/drawable.h>
00023 #include <papyrus/linestyle.h>
00024 #include <papyrus/enums.h>
00025
00026 namespace Papyrus
00027 {
00028
00032 class Grid : public Drawable
00033 {
00034 public:
00035 typedef PapyrusSmartPointer<Grid> pointer;
00036
00037 static const double infinity;
00038
00039 Grid(double xmin=-infinity, double xmax=infinity,
00040 double ymin=-infinity, double ymax=infinity);
00041
00042 static pointer create(double xmin=-infinity, double xmax=infinity,
00043 double ymin=-infinity, double ymax=infinity);
00044
00045 ~Grid();
00046
00047 double x_min();
00048
00049 void set_x_min( double min );
00050
00051 double x_max();
00052
00053 void set_x_max( double max );
00054
00055 void x_min_max( double& min, double& max );
00056
00057 void set_x_min_max( double min, double max );
00058
00059 double y_min();
00060
00061 void set_y_min( double min );
00062
00063 double y_max();
00064
00065 void set_y_max( double max );
00066
00067 void y_min_max( double& min, double& max );
00068
00069 void set_y_min_max( double min, double max );
00070
00071 void xy_min_max( double& x_min, double& x_max, double& y_min, double& y_max );
00072
00073 void set_xy_min_max( double x_min, double x_max, double y_min, double y_max );
00074
00075 void enable_axis( unsigned which = X_AXIS | Y_AXIS );
00076
00077 void disable_axis( unsigned which = X_AXIS | Y_AXIS );
00078
00079 const LineStyle& x_axis_style() const;
00080
00081 void set_x_axis_style( const LineStyle& style );
00082
00083 const LineStyle& y_axis_style() const;
00084
00085 void set_y_axis_style( const LineStyle& style );
00086
00087 void set_xy_axis_style( const LineStyle& style );
00088
00089 void enable_border( unsigned which = TOP | RIGHT | BOTTOM | LEFT );
00090
00091 void disable_border( unsigned which = TOP | RIGHT | BOTTOM | LEFT );
00092
00093 void set_border_style( const LineStyle& style,
00094 unsigned which = TOP | RIGHT | BOTTOM | LEFT );
00095
00096 double x_interval();
00097
00098 void set_x_interval( double x_interval );
00099
00100 const LineStyle& x_interval_style();
00101
00102 void set_x_interval_style( const LineStyle& );
00103
00104 double y_interval();
00105
00106 void set_y_interval( double y_interval );
00107
00108 const LineStyle& y_interval_style();
00109
00110 void set_y_interval_style( const LineStyle& );
00111
00112 void xy_interval( double& x_interval, double& y_interval );
00113
00114 void set_xy_interval( double interval );
00115
00116 void set_xy_interval( double x_interval, double y_interval );
00117
00118 void xy_interval_style( LineStyle& x_style, LineStyle& y_style );
00119
00120 void set_xy_interval_style( const LineStyle& style );
00121
00122 void set_xy_interval_style( const LineStyle& x_style, const LineStyle& y_style );
00123
00125 virtual void draw( Cairo::RefPtr<Cairo::Context> cairo );
00126
00127 PAPYRUS_CLONE_METHOD( Grid );
00128
00129 protected:
00130 LineStyle m_x_axis_style,
00131 m_y_axis_style,
00132 m_x_interval_style,
00133 m_y_interval_style,
00134 m_border_style[ 4 ];
00135 double m_x_min, m_x_max, m_y_min, m_y_max;
00136 double m_x_interval, m_y_interval;
00137 unsigned int m_enabled_axes, m_enabled_borders;
00138
00139 };
00140
00141 }
00142
00143 #endif