1 // File: QtxColorScale.h
2 // Author: Sergey TELKOV
4 #ifndef QTXCOLORSCALE_H
5 #define QTXCOLORSCALE_H
10 #include <qvaluelist.h>
13 #include <qdockwindow.h>
17 class QSimpleRichText;
20 #pragma warning( disable:4251 )
23 class QTX_EXPORT QtxColorScale : public QFrame
28 typedef enum { Auto, User } Mode;
29 typedef enum { None, Left, Right, Center } Position;
30 typedef enum { NoDump, TitleDump, ScaleDump, FullDump } DumpMode;
31 typedef enum { AtBorder = 0x001, Reverse = 0x002, Integer = 0x004,
32 WrapTitle = 0x008, PreciseFormat = 0x010, Transparent = 0x020 } Flags;
35 class Dock : public QDockWindow
38 Dock( Place = InDock, QWidget* = 0, const char* = 0, WFlags = 0 );
41 QtxColorScale* colorScale() const;
46 bool isActive() const;
51 virtual void resize( int, int );
52 virtual void setOrientation( Orientation );
55 QtxColorScale* myScale;
61 QtxColorScale( Dock*, const char* = 0, WFlags = 0 );
65 QtxColorScale( QWidget* = 0, const char* = 0, WFlags = 0 );
66 QtxColorScale( const int, QWidget* = 0, const char* = 0, WFlags = 0 );
67 virtual ~QtxColorScale();
69 double minimum() const;
70 double maximum() const;
71 void range( double&, double& ) const;
73 int labelMode() const;
74 int colorMode() const;
75 int intervalsNumber() const;
77 QString title() const;
78 QString format() const;
79 QString label( const int ) const;
80 QColor color( const int ) const;
81 void labels( QStringList& ) const;
82 void colors( QValueList<QColor>& ) const;
84 int labelPosition() const;
85 int titlePosition() const;
87 void setMinimum( const double );
88 void setMaximum( const double );
89 void setRange( const double, const double );
90 void setDumpMode( const int );
91 void setColorMode( const int );
92 void setLabelMode( const int );
93 void setIntervalsNumber( const int );
95 void setTitle( const QString& );
96 void setFormat( const QString& );
97 void setLabel( const QString&, const int = -1 );
98 void setColor( const QColor&, const int = -1 );
99 void setLabels( const QStringList& );
100 void setColors( const QValueList<QColor>& );
102 void setLabelPosition( const int );
103 void setTitlePosition( const int );
105 void setFlags( const int );
106 bool testFlags( const int ) const;
107 void clearFlags( const int );
109 QPixmap dump() const;
110 QPixmap dump( const int = -1, const int = -1 ) const;
111 QPixmap dump( const QColor&, const int = -1, const int = -1 ) const;
113 virtual QSize minimumSizeHint() const;
114 virtual QSize sizeHint() const;
120 virtual void drawContents( QPainter* );
124 QString getFormat() const;
125 QString getLabel( const int ) const;
126 QColor getColor( const int ) const;
127 double getNumber( const int ) const;
128 QSimpleRichText* simpleRichText( const int ) const;
129 void drawScale( QPainter*, const bool, const int, const int,
130 const int, const int, const bool, const bool, const bool ) const;
131 void drawScale( QPainter*, const QColor&, const bool,
132 const int, const int, const int, const int,
133 const bool, const bool, const bool ) const;
134 QSize calculateSize( const bool, const int,
135 const bool, const bool, const bool ) const;
150 QValueList<QColor> myColors;
151 QValueList<QString> myLabels;
157 QStyleSheet* myStyleSheet;
161 #pragma warning( default:4251 )