qwt_column_symbol.h
Go to the documentation of this file.
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_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     {
00035         LeftToRight,
00036 
00038         RightToLeft,
00039 
00041         BottomToTop,
00042 
00044         TopToBottom
00045     };
00046 
00048     QwtColumnRect():
00049         direction( BottomToTop )
00050     {
00051     }
00052 
00054     QRectF toRect() const
00055     {
00056         QRectF r( hInterval.minValue(), vInterval.minValue(),
00057             hInterval.maxValue() - hInterval.minValue(),
00058             vInterval.maxValue() - vInterval.minValue() );
00059         r = r.normalized();
00060 
00061         if ( hInterval.borderFlags() & QwtInterval::ExcludeMinimum )
00062             r.adjust( 1, 0, 0, 0 );
00063         if ( hInterval.borderFlags() & QwtInterval::ExcludeMaximum )
00064             r.adjust( 0, 0, -1, 0 );
00065         if ( vInterval.borderFlags() & QwtInterval::ExcludeMinimum )
00066             r.adjust( 0, 1, 0, 0 );
00067         if ( vInterval.borderFlags() & QwtInterval::ExcludeMaximum )
00068             r.adjust( 0, 0, 0, -1 );
00069 
00070         return r;
00071     }
00072 
00074     Qt::Orientation orientation() const
00075     {
00076         if ( direction == LeftToRight || direction == RightToLeft )
00077             return Qt::Horizontal;
00078 
00079         return Qt::Vertical;
00080     }
00081 
00083     QwtInterval hInterval;
00084 
00086     QwtInterval vInterval;
00087 
00089     Direction direction;
00090 };
00091 
00093 class QWT_EXPORT QwtColumnSymbol
00094 {
00095 public:
00100     enum Style
00101     {
00103         NoStyle = -1,
00104 
00109         Box,
00110 
00116         UserStyle = 1000
00117     };
00118 
00123     enum FrameStyle
00124     {
00126         NoFrame,
00127 
00129         Plain,
00130 
00132         Raised
00133     };
00134 
00135 public:
00136     explicit QwtColumnSymbol( Style = NoStyle );
00137     virtual ~QwtColumnSymbol();
00138 
00139     void setFrameStyle( FrameStyle style );
00140     FrameStyle frameStyle() const;
00141 
00142     void setLineWidth( int width );
00143     int lineWidth() const;
00144 
00145     void setPalette( const QPalette & );
00146     const QPalette &palette() const;
00147 
00148     void setStyle( Style );
00149     Style style() const;
00150 
00151     virtual void draw( QPainter *, const QwtColumnRect & ) const;
00152 
00153 protected:
00154     void drawBox( QPainter *, const QwtColumnRect & ) const;
00155 
00156 private:
00157     Q_DISABLE_COPY(QwtColumnSymbol)
00158 
00159     class PrivateData;
00160     PrivateData* d_data;
00161 };
00162 
00163 #endif


plotjuggler
Author(s): Davide Faconti
autogenerated on Fri Sep 1 2017 02:41:56