- Main Page
- Classes
- Files
- Related Pages

# qwt_scale_draw.h

    00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
    00002  * Qwt Widget Library
    00003  * Copyright (C) 1997   Josef Wilgen
    00004  * Copyright (C) 2002   Uwe Rathmann
    00005  *
    00006  * This library is free software; you can redistribute it and/or
    00007  * modify it under the terms of the Qwt License, Version 1.0
    00008  *****************************************************************************/
    00009
    00010 #ifndef QWT_SCALE_DRAW_H
    00011 #define QWT_SCALE_DRAW_H
    00012
    00013 #include <qpoint.h>
    00014 #include "qwt_global.h"
    00015 #include "qwt_abstract_scale_draw.h"
    00016
    00030 class QWT_EXPORT QwtScaleDraw: public QwtAbstractScaleDraw
    00031 {
    00032 public:
    00037     enum Alignment { BottomScale, TopScale, LeftScale, RightScale };
    00038
    00039     QwtScaleDraw();
    00040     QwtScaleDraw(const QwtScaleDraw &);
    00041
    00042     virtual ~QwtScaleDraw();
    00043
    00044     QwtScaleDraw &operator=(const QwtScaleDraw &other);
    00045
    00046     void getBorderDistHint(const QFont &, int &start, int &end) const;
    00047     int minLabelDist(const QFont &) const;
    00048
    00049     int minLength(const QPen &, const QFont &) const;
    00050     virtual int extent(const QPen &, const QFont &) const;
    00051
    00052     void move(int x, int y);
    00053     void move(const QPoint &);
    00054     void setLength(int length);
    00055
    00056     Alignment alignment() const;
    00057     void setAlignment(Alignment);
    00058
    00059     Qt::Orientation orientation() const;
    00060
    00061     QPoint pos() const;
    00062     int length() const;
    00063
    00064 #if QT_VERSION < 0x040000
    00065     void setLabelAlignment(int);
    00066     int labelAlignment() const;
    00067 #else
    00068     void setLabelAlignment(Qt::Alignment);
    00069     Qt::Alignment labelAlignment() const;
    00070 #endif
    00071
    00072     void setLabelRotation(double rotation);
    00073     double labelRotation() const;
    00074
    00075     int maxLabelHeight(const QFont &) const;
    00076     int maxLabelWidth(const QFont &) const;
    00077
    00078     QPoint labelPosition(double val) const;
    00079
    00080     QRect labelRect(const QFont &, double val) const;
    00081     QSize labelSize(const QFont &, double val) const;
    00082
    00083 protected:
    00084
    00085 #if QT_VERSION < 0x040000
    00086     QWMatrix labelMatrix(const QPoint &, const QSize &) const;
    00087 #else
    00088     QMatrix labelMatrix(const QPoint &, const QSize &) const;
    00089 #endif
    00090
    00091     virtual void drawTick(QPainter *p, double val, int len) const;
    00092     virtual void drawBackbone(QPainter *p) const;
    00093     virtual void drawLabel(QPainter *p, double val) const;
    00094
    00095 private:
    00096     void updateMap();
    00097
    00098     class PrivateData;
    00099     PrivateData *d_data;
    00100 };
    00101
    00102 inline void QwtScaleDraw::move(int x, int y)
    00103 {
    00104     move(QPoint(x, y));
    00105 }
    00106
    00107 #endif