Qwt User's Guide: qwt_column_symbol.h Source File

Qwt User's Guide 6.1.6

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 );
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
QwtColumnSymbol::Plain
@ Plain
A plain frame style.
Definition: qwt_column_symbol.h:129
QwtColumnRect::orientation
Qt::Orientation orientation() const
Definition: qwt_column_symbol.h:74
QwtColumnRect::toRect
QRectF toRect() const
Definition: qwt_column_symbol.h:54
QwtInterval::ExcludeMaximum
@ ExcludeMaximum
Max value is not included in the interval.
Definition: qwt_interval.h:42
QwtColumnRect::QwtColumnRect
QwtColumnRect()
Build an rectangle with invalid intervals directed BottomToTop.
Definition: qwt_column_symbol.h:48
QwtColumnSymbol
A drawing primitive for columns.
Definition: qwt_column_symbol.h:94
QwtColumnRect::hInterval
QwtInterval hInterval
Interval for the horizontal coordinates.
Definition: qwt_column_symbol.h:83
QwtColumnSymbol::NoFrame
@ NoFrame
No frame.
Definition: qwt_column_symbol.h:126
QwtColumnSymbol::FrameStyle
FrameStyle
Definition: qwt_column_symbol.h:124
QwtText
A class representing a text.
Definition: qwt_text.h:52
QwtColumnRect::vInterval
QwtInterval vInterval
Interval for the vertical coordinates.
Definition: qwt_column_symbol.h:86
QwtColumnSymbol::Style
Style
Definition: qwt_column_symbol.h:101
QwtColumnRect::LeftToRight
@ LeftToRight
From left to right.
Definition: qwt_column_symbol.h:35
QwtInterval::ExcludeMinimum
@ ExcludeMinimum
Min value is not included in the interval.
Definition: qwt_interval.h:39
QwtColumnRect::Direction
Direction
Direction of the column.
Definition: qwt_column_symbol.h:33
QwtColumnSymbol::Box
@ Box
Definition: qwt_column_symbol.h:109
QwtColumnRect::RightToLeft
@ RightToLeft
From right to left.
Definition: qwt_column_symbol.h:38
QwtColumnRect
Directed rectangle representing bounding rectangle and orientation of a column.
Definition: qwt_column_symbol.h:29
QwtInterval
A class representing an interval.
Definition: qwt_interval.h:27
QwtColumnRect::direction
Direction direction
Direction.
Definition: qwt_column_symbol.h:89
QwtColumnRect::BottomToTop
@ BottomToTop
From bottom to top.
Definition: qwt_column_symbol.h:41