grid.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PAPYRUSGRID_H
00021 #define PAPYRUSGRID_H
00022
00023 #include <papyrus/drawable.h>
00024 #include <papyrus/stroke.h>
00025 #include <papyrus/enums.h>
00026
00027 namespace Papyrus
00028 {
00029
00033 class Grid : public Drawable
00034 {
00035 protected:
00036
00037 Grid ( const Glib::ustring& id,
00038 double xmin=-infinity, double xmax=infinity,
00039 double ymin=-infinity, double ymax=infinity );
00040
00041 public:
00042 PAPYRUS_DRAWABLE(Grid);
00043
00044 static const double infinity;
00045
00046 static pointer create ( double xmin=-infinity, double xmax=infinity,
00047 double ymin=-infinity, double ymax=infinity );
00048
00049 static pointer create ( const Glib::ustring& id,
00050 double xmin=-infinity, double xmax=infinity,
00051 double ymin=-infinity, double ymax=infinity );
00052
00053 virtual ~Grid();
00054
00055 double x_min();
00056
00057 void set_x_min ( double min );
00058
00059 double x_max();
00060
00061 void set_x_max ( double max );
00062
00063 void x_min_max ( double& min, double& max );
00064
00065 void set_x_min_max ( double min, double max );
00066
00067 double y_min();
00068
00069 void set_y_min ( double min );
00070
00071 double y_max();
00072
00073 void set_y_max ( double max );
00074
00075 void y_min_max ( double& min, double& max );
00076
00077 void set_y_min_max ( double min, double max );
00078
00079 void xy_min_max ( double& x_min, double& x_max, double& y_min, double& y_max );
00080
00081 void set_xy_min_max ( double x_min, double x_max, double y_min, double y_max );
00082
00083 void enable_axis ( unsigned which = X_AXIS | Y_AXIS );
00084
00085 void disable_axis ( unsigned which = X_AXIS | Y_AXIS );
00086
00087 Stroke::pointer x_axis_stroke() const;
00088
00089 void set_x_axis_stroke ( Stroke::pointer stroke );
00090
00091 Stroke::pointer y_axis_stroke() const;
00092
00093 void set_y_axis_stroke ( Stroke::pointer stroke );
00094
00095 void set_xy_axis_stroke ( Stroke::pointer stroke );
00096
00097 void enable_border ( unsigned which = TOP | RIGHT | BOTTOM | LEFT );
00098
00099 void disable_border ( unsigned which = TOP | RIGHT | BOTTOM | LEFT );
00100
00101 void set_border_stroke ( Stroke::pointer stroke,
00102 unsigned which = TOP | RIGHT | BOTTOM | LEFT );
00103
00104 double x_interval();
00105
00106 void set_x_interval ( double x_interval );
00107
00108 Stroke::pointer x_interval_stroke();
00109
00110 void set_x_interval_stroke ( Stroke::pointer );
00111
00112 double y_interval();
00113
00114 void set_y_interval ( double y_interval );
00115
00116 Stroke::pointer y_interval_stroke();
00117
00118 void set_y_interval_stroke ( Stroke::pointer );
00119
00120 void xy_interval ( double& x_interval, double& y_interval );
00121
00122 void set_xy_interval ( double interval );
00123
00124 void set_xy_interval ( double x_interval, double y_interval );
00125
00126 void xy_interval_stroke ( Stroke::pointer x_stroke, Stroke::pointer y_stroke );
00127
00128 void set_xy_interval_stroke ( Stroke::pointer stroke );
00129
00130 void set_xy_interval_stroke ( Stroke::pointer x_stroke, Stroke::pointer y_stroke );
00131
00133 virtual void draw ( Context& cairo ) const;
00134
00135 protected:
00136 Stroke::pointer m_x_axis_stroke;
00137 Stroke::pointer m_y_axis_stroke;
00138 Stroke::pointer m_x_interval_stroke;
00139 Stroke::pointer m_y_interval_stroke;
00140 Stroke::pointer m_border_stroke[ 4 ];
00141 double m_x_min, m_x_max, m_y_min, m_y_max;
00142 double m_x_interval, m_y_interval;
00143 unsigned int m_enabled_axes, m_enabled_borders;
00144
00145 };
00146
00147 }
00148
00149 #endif