Grid.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     File                 : Grid.h
00003     Project              : QtiPlot
00004     --------------------------------------------------------------------
00005     Copyright            : (C) 2007 by Ion Vasilief
00006     Email (use @ for *)  : ion_vasilief*yahoo.fr
00007     Description          : 2D Grid class
00008 
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  *                                                                         *
00013  *  This program is free software; you can redistribute it and/or modify   *
00014  *  it under the terms of the GNU General Public License as published by   *
00015  *  the Free Software Foundation; either version 2 of the License, or      *
00016  *  (at your option) any later version.                                    *
00017  *                                                                         *
00018  *  This program is distributed in the hope that it will be useful,        *
00019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
00020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
00021  *  GNU General Public License for more details.                           *
00022  *                                                                         *
00023  *   You should have received a copy of the GNU General Public License     *
00024  *   along with this program; if not, write to the Free Software           *
00025  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
00026  *   Boston, MA  02110-1301  USA                                           *
00027  *                                                                         *
00028  ***************************************************************************/
00029 #ifndef GRID_H
00030 #define GRID_H
00031 
00032 #include <qwt_plot.h>
00033 #include <qwt_plot_grid.h>
00034 #include <qwt_plot_marker.h>
00035 
00036 class Grid : public QwtPlotGrid
00037 {
00038 public:
00039     Grid();
00040 
00041     void draw (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &rect) const;
00042     void drawLines(QPainter *painter, const QRect &rect, Qt::Orientation orientation, const QwtScaleMap &map,
00043         const QwtValueList &values) const;
00044 
00045     bool xZeroLineEnabled(){return (mrkX >= 0)?true:false;};
00046     void enableZeroLineX(bool enable = true);
00047     bool yZeroLineEnabled(){return (mrkY >= 0)?true:false;};
00048     void enableZeroLineY(bool enable = true);
00049 
00050     void setMajPenX(const QPen &p){ setMajPen(p);};
00051     const QPen& majPenX() const {return majPen();};
00052 
00053     void setMinPenX(const QPen &p){ setMinPen(p);};
00054     const QPen& minPenX() const {return minPen();};
00055 
00056     void setMajPenY(const QPen &p){ if (d_maj_pen_y != p) d_maj_pen_y = p;};
00057     const QPen& majPenY() const {return d_maj_pen_y;};
00058 
00059     void setMinPenY(const QPen &p){ if (d_min_pen_y != p) d_min_pen_y = p;};
00060     const QPen& minPenY() const {return d_min_pen_y;};
00061 
00062     void load(const QStringList& );
00063     void copy(Grid *);
00064     QString saveToString();
00065 
00066 private:
00067     QPen d_maj_pen_y;
00068     QPen d_min_pen_y;
00069 
00070     long mrkX, mrkY;//x=0 et y=0 line markers keys
00071 };
00072 
00073 #endif

Generated on Thu Feb 7 13:59:27 2008 for QtiPlot by  doxygen 1.5.4