Qwt User's Guide: qwt_scale_widget.h Source File

- Main Page
- Classes
- Files
- Related Pages

- File List
- File Members

# qwt_scale_widget.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_WIDGET_H
    00011 #define QWT_SCALE_WIDGET_H
    00012
    00013 #include <qwidget.h>
    00014 #include <qfont.h>
    00015 #include <qcolor.h>
    00016 #include <qstring.h>
    00017
    00018 #include "qwt_global.h"
    00019 #include "qwt_text.h"
    00020 #include "qwt_scale_draw.h"
    00021
    00022 class QPainter;
    00023 class QwtScaleTransformation;
    00024 class QwtScaleDiv;
    00025 class QwtColorMap;
    00026
    00034 class QWT_EXPORT QwtScaleWidget : public QWidget
    00035 {
    00036     Q_OBJECT
    00037
    00038 public:
    00039     explicit QwtScaleWidget(QWidget *parent = NULL);
    00040 #if QT_VERSION < 0x040000
    00041     explicit QwtScaleWidget(QWidget *parent, const char *name);
    00042 #endif
    00043     explicit QwtScaleWidget(QwtScaleDraw::Alignment, QWidget *parent = NULL);
    00044     virtual ~QwtScaleWidget();
    00045
    00046 signals:
    00048     void scaleDivChanged();
    00049
    00050 public:
    00051     void setTitle(const QString &title);
    00052     void setTitle(const QwtText &title);
    00053     QwtText title() const;
    00054
    00055     void setBorderDist(int start, int end);
    00056     int startBorderDist() const;
    00057     int endBorderDist() const;
    00058
    00059     void getBorderDistHint(int &start, int &end) const;
    00060
    00061     void getMinBorderDist(int &start, int &end) const;
    00062     void setMinBorderDist(int start, int end);
    00063
    00064     void setMargin(int);
    00065     int margin() const;
    00066
    00067     void setSpacing(int td);
    00068     int spacing() const;
    00069
    00070     void setPenWidth(int);
    00071     int penWidth() const;
    00072
    00073     void setScaleDiv(QwtScaleTransformation *, const QwtScaleDiv &sd);
    00074
    00075     void setScaleDraw(QwtScaleDraw *);
    00076     const QwtScaleDraw *scaleDraw() const;
    00077     QwtScaleDraw *scaleDraw();
    00078
    00079 #if QT_VERSION < 0x040000
    00080     void setLabelAlignment(int);
    00081 #else
    00082     void setLabelAlignment(Qt::Alignment);
    00083 #endif
    00084     void setLabelRotation(double rotation);
    00085
    00086     void setColorBarEnabled(bool);
    00087     bool isColorBarEnabled() const;
    00088
    00089     void setColorBarWidth(int);
    00090     int colorBarWidth() const;
    00091
    00092     void setColorMap(const QwtDoubleInterval &, const QwtColorMap &);
    00093
    00094     QwtDoubleInterval colorBarInterval() const;
    00095     const QwtColorMap &colorMap() const;
    00096
    00097     virtual QSize sizeHint() const;
    00098     virtual QSize minimumSizeHint() const;
    00099
    00100     int titleHeightForWidth(int width) const;
    00101     int dimForLength(int length, const QFont &scaleFont) const;
    00102
    00103     void drawColorBar(QPainter *painter, const QRect &rect) const;
    00104     void drawTitle(QPainter *painter, QwtScaleDraw::Alignment,
    00105         const QRect &rect) const;
    00106
    00107     void setAlignment(QwtScaleDraw::Alignment);
    00108     QwtScaleDraw::Alignment alignment() const;
    00109
    00110     QRect colorBarRect(const QRect&) const;
    00111
    00112 protected:
    00113     virtual void paintEvent(QPaintEvent *e);
    00114     virtual void resizeEvent(QResizeEvent *e);
    00115
    00116 #if QT_VERSION < 0x040000
    00117     virtual void fontChange(const QFont &oldfont);
    00118 #endif
    00119
    00120     void draw(QPainter *p) const;
    00121
    00122     void scaleChange();
    00123     void layoutScale( bool update = true );
    00124
    00125 private:
    00126     void initScale(QwtScaleDraw::Alignment);
    00127
    00128     class PrivateData;
    00129     PrivateData *d_data;
    00130 };
    00131
    00132 #endif