00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef QWT_COLUMN_SYMBOL_H
00011 #define QWT_COLUMN_SYMBOL_H
00012
00013 #include "qwt_global.h"
00014 #include "qwt_interval.h"
00015 #include <qpen.h>
00016 #include <qsize.h>
00017 #include <qrect.h>
00018
00019 class QPainter;
00020 class QPalette;
00021 class QRect;
00022 class QwtText;
00023
00028 class QWT_EXPORT QwtColumnRect
00029 {
00030 public:
00032 enum Direction
00033 {
00034 LeftToRight,
00035 RightToLeft,
00036 BottomToTop,
00037 TopToBottom
00038 };
00039
00041 QwtColumnRect():
00042 direction( BottomToTop )
00043 {
00044 }
00045
00047 QRectF toRect() const
00048 {
00049 QRectF r( hInterval.minValue(), vInterval.minValue(),
00050 hInterval.maxValue() - hInterval.minValue(),
00051 vInterval.maxValue() - vInterval.minValue() );
00052 r = r.normalized();
00053
00054 if ( hInterval.borderFlags() & QwtInterval::ExcludeMinimum )
00055 r.adjust( 1, 0, 0, 0 );
00056 if ( hInterval.borderFlags() & QwtInterval::ExcludeMaximum )
00057 r.adjust( 0, 0, -1, 0 );
00058 if ( vInterval.borderFlags() & QwtInterval::ExcludeMinimum )
00059 r.adjust( 0, 1, 0, 0 );
00060 if ( vInterval.borderFlags() & QwtInterval::ExcludeMaximum )
00061 r.adjust( 0, 0, 0, -1 );
00062
00063 return r;
00064 }
00065
00067 Qt::Orientation orientation() const
00068 {
00069 if ( direction == LeftToRight || direction == RightToLeft )
00070 return Qt::Horizontal;
00071
00072 return Qt::Vertical;
00073 }
00074
00076 QwtInterval hInterval;
00077
00079 QwtInterval vInterval;
00080
00082 Direction direction;
00083 };
00084
00086 class QWT_EXPORT QwtColumnSymbol
00087 {
00088 public:
00106 enum Style
00107 {
00108 NoSymbol = -1,
00109
00110 Box,
00111
00112 UserSymbol = 1000
00113 };
00114
00124 enum FrameStyle
00125 {
00126 NoFrame,
00127
00128 Plain,
00129 Raised
00130 };
00131
00132 public:
00133 QwtColumnSymbol( Style = NoSymbol );
00134 virtual ~QwtColumnSymbol();
00135
00136 void setFrameStyle( FrameStyle style );
00137 FrameStyle frameStyle() const;
00138
00139 void setLineWidth( int width );
00140 int lineWidth() const;
00141
00142 void setPalette( const QPalette & );
00143 const QPalette &palette() const;
00144
00145 void setStyle( Style );
00146 Style style() const;
00147
00148 virtual void draw( QPainter *, const QwtColumnRect & ) const;
00149
00150 protected:
00151 void drawBox( QPainter *, const QwtColumnRect & ) const;
00152
00153 private:
00154 class PrivateData;
00155 PrivateData* d_data;
00156 };
00157
00158 #endif