karbon
vruler.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef VRULER_H_
00021 #define VRULER_H_
00022
00023 #include <qframe.h>
00024 #include <qpixmap.h>
00025 #include <KoUnit.h>
00026
00027
00028
00029
00030
00031 class QPainter;
00032
00033 class VRuler : public QFrame {
00034 Q_OBJECT
00035 typedef QFrame super;
00036
00037 public:
00038 VRuler(Qt::Orientation, QWidget *parent = 0, const char *name = 0);
00039 virtual ~VRuler();
00040
00041 public:
00042 KoUnit::Unit unit() const;
00043
00044 public slots:
00045 void setZoom(double zoom);
00046 void updatePointer(Q_INT32 x, Q_INT32 y);
00047 void updateVisibleArea(Q_INT32 xpos, Q_INT32 ypos);
00048 void setUnit(KoUnit::Unit u);
00049 void hide();
00050 void show();
00051
00052 public:
00053 virtual void paintEvent(QPaintEvent *e);
00054 virtual void resizeEvent(QResizeEvent *e);
00055
00056 protected:
00057 void recalculateSize();
00058 void drawRuler();
00059 void initMarker(Q_INT32 w, Q_INT32 h);
00060 void drawNums(QPainter *gc, Q_INT32 x, Q_INT32 y, QString& num, bool orientationHoriz);
00061
00062 private:
00063 KoUnit::Unit m_unit;
00064 Qt::Orientation m_orientation;
00065 Q_INT32 m_firstVisible;
00066 Q_INT32 m_currentPosition;
00067 QPixmap *m_pixmapBuffer;
00068 QPixmap m_pixmapMarker;
00069 QPixmap m_pixmapNums;
00070 double m_zoom;
00071
00072 private:
00073 static const char *m_nums[];
00074 };
00075
00076 #endif // VRULER_H_
00077
|