Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Examples  

qsruler.h

00001 /*
00002  * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017  */
00018 #ifndef QSRULER_H
00019 #define QSRULER_H
00020 
00021 #include <qframe.h>
00022 #include <qpainter.h>
00023 #include <qpixmap.h>
00024 
00025 enum MeasurementUnit {
00026   UnitPoint, UnitMillimeter, UnitInch, UnitPica, UnitCentimeter,
00027   UnitDidot, UnitCicero
00028 };
00029 
00030 class QSRuler : public QFrame
00031 {
00032  Q_OBJECT
00033 public:
00034   enum Orientation { Horizontal, Vertical };
00035 
00036   QSRuler(Orientation, QWidget* parent=0, const char* name=0);
00037   ~QSRuler();
00038 
00039   int unit();
00040 
00041 public slots:
00042   void setZoom(float);
00043   void updatePointer(int x, int y);
00044   void updateVisibleArea(int xpos, int ypos);
00045 
00046   void setUnit(int);
00047 
00048   void hide();
00049   void show();
00050 
00051 protected:
00052   void paintEvent(QPaintEvent*);
00053   void resizeEvent(QResizeEvent*);
00054 
00055   void recalculateSize(QResizeEvent*);
00056   void drawQSRuler();
00057 
00058   void initMarker(int w, int h);
00059   void drawNums(QPainter*, int x, int y, QString& num, bool orientationHoriz);
00060 
00061 private:
00062   float m_pZoom;
00063   int munit;
00064   Orientation orientation;
00065   QPixmap *buffer;
00066   int firstVisible;
00067   int currentPosition;
00068   QPixmap* marker;
00069   QPixmap* m_pNums;
00070 };
00071 
00072 #endif

Generated on Mon Mar 18 19:16:33 2002 for KMatplot library by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002