1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
13 File: YQMultiProgressMeter.h
15 Author: Stefan Hundhammer <sh@suse.de>
20 #ifndef YQMultiProgressMeter_h
21 #define YQMultiProgressMeter_h
24 #include "YMultiProgressMeter.h"
33 class YQMultiProgressMeter : public QWidget, public YMultiProgressMeter
42 YQMultiProgressMeter( YWidget * parent,
44 const vector<float> & maxValues );
48 virtual ~YQMultiProgressMeter();
51 * Overall thickness (in pixels) of the MultiProgressMeter.
56 * Overall length (in pixels) of the MultiProgressMeter.
61 * Returns the margin around the widget contents.
63 int margin() const { return _margin; }
66 * Sets the margin around the widget contents.
67 * Does not trigger an update.
69 void setMargin( int value ) { _margin = value; }
72 * Returns the spacing between segments in pixels.
74 int spacing() const { return _spacing; }
77 * Sets the spacing between segments in pixels.
78 * Does not trigger an update.
80 void setSpacing( int value ) { _spacing = value; }
83 * Returns the minimal length of a segment in pixels.
85 int segmentMinLength() const { return _segmentMinLength; }
88 * Set the minimal length of a segment in pixels.
90 void setSegmentMinLength( int val ) { _segmentMinLength = val; }
93 * Returns the thickness (base to point) of the small triangles next to the
94 * spacing between individual segments. The base length of those small
95 * triangles is double this value minus one. A value <1 indicates no
96 * such triangles will be drawn.
98 int triThickness() const { return _triThickness; }
101 * Set the thickness (base to point) of the small triangles next to the
102 * spacing between individual segments. The base length of those small
103 * triangles is double this value minus one.
105 * Use -1 to switch off those triangles - in which case triSpacing (see
106 * below) will be set to 0.
108 * This call does not trigger a screen update.
110 void setTriThickness( int value );
113 * Returns the spacing between the segment indicators and the small
114 * triangles next to the spacing between segments.
116 int triSpacing() const { return _triSpacing; }
119 * Sets the spacing between the segment indicators and the small
120 * triangles next to the spacing between segments.
122 void setTriSpacing( int value ) { _triSpacing = value; }
125 * Returns "true" if the segments of this widget are triangular shaped.
127 bool triangularShaped() const { return _triangularShaped; }
130 * Set triangular shape (true) or normal rectangular shape.
131 * This call does not trigger a screen update.
133 void setTriangularShaped( bool triangular = true );
136 * Set enabled/disabled state.
138 * Reimplemented from YWidget.
140 virtual void setEnabled( bool enabled );
143 * Preferred width of the widget.
145 * Reimplemented from YWidget.
147 virtual int preferredWidth();
150 * Preferred height of the widget.
152 * Reimplemented from YWidget.
154 virtual int preferredHeight();
157 * Set the new size of the widget.
159 * Reimplemented from YWidget.
161 virtual void setSize( int newWidth, int newHeight );
167 * Common initialization
172 * Perform a visual update on the screen.
173 * Reimplemented from YMultiProgressMeter.
175 virtual void doUpdate();
178 * Paint the widget's contents.
179 * Reimplemented from QWidget.
181 virtual void paintEvent ( QPaintEvent * );
184 * Mouse double click -
186 * reimplemented from QWidget.
188 virtual void mouseDoubleClickEvent ( QMouseEvent * e );
191 * Draw segment number 'segment' with pixel length 'length' from pixel
192 * coordinate 'offset' on and fill it according to that segment's current
193 * value. 'painter' is set up previously to take rotating into account
194 * (horizontal / vertical).
196 void drawSegment( int segment,
204 * Draw markers between segments (or beside that spacing).
206 void drawMarkers( QPainter & painter, int offset, int thickness );
211 bool _triangularShaped;
214 int _segmentMinLength;
220 #endif // YQMultiProgressMeter_h