qwt_abstract_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_ABSTRACT_SCALE_DRAW_H 00011 #define QWT_ABSTRACT_SCALE_DRAW_H 00012 00013 #include "qwt_global.h" 00014 #include "qwt_scale_div.h" 00015 #include "qwt_text.h" 00016 00017 00018 #if QT_VERSION < 0x040000 00019 class QColorGroup; 00020 #else 00021 class QPalette; 00022 #endif 00023 class QPainter; 00024 class QFont; 00025 class QwtScaleTransformation; 00026 class QwtScaleMap; 00027 00037 class QWT_EXPORT QwtAbstractScaleDraw 00038 { 00039 public: 00040 00051 enum ScaleComponent 00052 { 00053 Backbone = 1, 00054 Ticks = 2, 00055 Labels = 4 00056 }; 00057 00058 QwtAbstractScaleDraw(); 00059 QwtAbstractScaleDraw( const QwtAbstractScaleDraw & ); 00060 virtual ~QwtAbstractScaleDraw(); 00061 00062 QwtAbstractScaleDraw &operator=(const QwtAbstractScaleDraw &); 00063 00064 void setScaleDiv(const QwtScaleDiv &s); 00065 const QwtScaleDiv& scaleDiv() const; 00066 00067 void setTransformation(QwtScaleTransformation *); 00068 const QwtScaleMap &map() const; 00069 00070 void enableComponent(ScaleComponent, bool enable = true); 00071 bool hasComponent(ScaleComponent) const; 00072 00073 void setTickLength(QwtScaleDiv::TickType, int length); 00074 int tickLength(QwtScaleDiv::TickType) const; 00075 int majTickLength() const; 00076 00077 void setSpacing(int margin); 00078 int spacing() const; 00079 00080 #if QT_VERSION < 0x040000 00081 virtual void draw(QPainter *, const QColorGroup &) const; 00082 #else 00083 virtual void draw(QPainter *, const QPalette &) const; 00084 #endif 00085 00086 virtual QwtText label(double) const; 00087 00097 virtual int extent(const QPen &, const QFont &) const = 0; 00098 00099 void setMinimumExtent(int); 00100 int minimumExtent() const; 00101 00102 QwtScaleMap &scaleMap(); 00103 00104 protected: 00114 virtual void drawTick(QPainter *painter, double value, int len) const = 0; 00115 00122 virtual void drawBackbone(QPainter *painter) const = 0; 00123 00132 virtual void drawLabel(QPainter *painter, double value) const = 0; 00133 00134 void invalidateCache(); 00135 const QwtText &tickLabel(const QFont &, double value) const; 00136 00137 private: 00138 int operator==(const QwtAbstractScaleDraw &) const; 00139 int operator!=(const QwtAbstractScaleDraw &) const; 00140 00141 class PrivateData; 00142 PrivateData *d_data; 00143 }; 00144 00145 #endif
Generated on Wed Sep 2 18:37:21 2009 for Qwt User's Guide by 1.6.1