Qwt User's Guide 6.1.0

- Main Page
- Related Pages
- Classes

All Classes Functions Variables Typedefs Enumerations Enumerator Pages
qwt_column_symbol.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10 #ifndef QWT_COLUMN_SYMBOL_H
11 #define QWT_COLUMN_SYMBOL_H
12
13 #include "qwt_global.h"
14 #include "qwt_interval.h"
15 #include <qpen.h>
16 #include <qsize.h>
17 #include <qrect.h>
18
19 class QPainter;
20 class QPalette;
21 class QRect;
22 class QwtText;
23
28 class QWT_EXPORT QwtColumnRect
29 {
30 public:
32 enum Direction
33 {
35 LeftToRight,
36
38 RightToLeft,
39
41 BottomToTop,
42
44 TopToBottom
45 };
46
48 QwtColumnRect():
49 direction( BottomToTop )
50 {
51 }
52
54 QRectF toRect() const
55 {
56 QRectF r( hInterval.minValue(), vInterval.minValue(),
57 hInterval.maxValue() - hInterval.minValue(),
58 vInterval.maxValue() - vInterval.minValue() );
59 r = r.normalized();
60
61 if ( hInterval.borderFlags() & QwtInterval::ExcludeMinimum )
62 r.adjust( 1, 0, 0, 0 );
63 if ( hInterval.borderFlags() & QwtInterval::ExcludeMaximum )
64 r.adjust( 0, 0, -1, 0 );
65 if ( vInterval.borderFlags() & QwtInterval::ExcludeMinimum )
66 r.adjust( 0, 1, 0, 0 );
67 if ( vInterval.borderFlags() & QwtInterval::ExcludeMaximum )
68 r.adjust( 0, 0, 0, -1 );
69
70 return r;
71 }
72
74 Qt::Orientation orientation() const
75 {
76 if ( direction == LeftToRight || direction == RightToLeft )
77 return Qt::Horizontal;
78
79 return Qt::Vertical;
80 }
81
83 QwtInterval hInterval;
84
86 QwtInterval vInterval;
87
89 Direction direction;
90 };
91
93 class QWT_EXPORT QwtColumnSymbol
94 {
95 public:
100 enum Style
101 {
103 NoStyle = -1,
104
109 Box,
110
116 UserStyle = 1000
117 };
118
123 enum FrameStyle
124 {
126 NoFrame,
127
129 Plain,
130
132 Raised
133 };
134
135 public:
136 QwtColumnSymbol( Style = NoStyle );
137 virtual ~QwtColumnSymbol();
138
139 void setFrameStyle( FrameStyle style );
140 FrameStyle frameStyle() const;
141
142 void setLineWidth( int width );
143 int lineWidth() const;
144
145 void setPalette( const QPalette & );
146 const QPalette &palette() const;
147
148 void setStyle( Style );
149 Style style() const;
150
151 virtual void draw( QPainter *, const QwtColumnRect & ) const;
152
153 protected:
154 void drawBox( QPainter *, const QwtColumnRect & ) const;
155
156 private:
157 class PrivateData;
158 PrivateData* d_data;
159 };
160
161 #endif