Qwt User's Guide  6.1.3
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  {
36 
39 
42 
44  TopToBottom
45  };
46 
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 
84 
87 
90 };
91 
93 class QWT_EXPORT QwtColumnSymbol
94 {
95 public:
100  enum Style
101  {
103  NoStyle = -1,
104 
110 
116  UserStyle = 1000
117  };
118 
124  {
127 
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
FrameStyle
Definition: qwt_column_symbol.h:123
A class representing a text.
Definition: qwt_text.h:51
Directed rectangle representing bounding rectangle and orientation of a column.
Definition: qwt_column_symbol.h:28
QwtColumnRect()
Build an rectangle with invalid intervals directed BottomToTop.
Definition: qwt_column_symbol.h:48
From left to right.
Definition: qwt_column_symbol.h:35
A drawing primitive for columns.
Definition: qwt_column_symbol.h:93
QwtInterval vInterval
Interval for the vertical coordinates.
Definition: qwt_column_symbol.h:86
Definition: qwt_column_symbol.h:109
QRectF toRect() const
Definition: qwt_column_symbol.h:54
Qt::Orientation orientation() const
Definition: qwt_column_symbol.h:74
QwtInterval hInterval
Interval for the horizontal coordinates.
Definition: qwt_column_symbol.h:83
From right to left.
Definition: qwt_column_symbol.h:38
Direction direction
Direction.
Definition: qwt_column_symbol.h:89
A class representing an interval.
Definition: qwt_interval.h:26
Max value is not included in the interval.
Definition: qwt_interval.h:42
From bottom to top.
Definition: qwt_column_symbol.h:41
A plain frame style.
Definition: qwt_column_symbol.h:129
Min value is not included in the interval.
Definition: qwt_interval.h:39
No frame.
Definition: qwt_column_symbol.h:126
Style
Definition: qwt_column_symbol.h:100
Direction
Direction of the column.
Definition: qwt_column_symbol.h:32