QtPdWidgets  2.3.1
Bar_p.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * Copyright (C) 2012 Florian Pose <fp@igh-essen.com>
4  *
5  * This file is part of the QtPdWidgets library.
6  *
7  * The QtPdWidgets library is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation, either version 3 of the License,
10  * or (at your option) any later version.
11  *
12  * The QtPdWidgets library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with the QtPdWidgets Library. If not, see
19  * <http://www.gnu.org/licenses/>.
20  *
21  ****************************************************************************/
22 
23 #ifndef PD_BAR_PRIVATE_H
24 #define PD_BAR_PRIVATE_H
25 
26 #include <QWidget>
27 #include <QPixmap>
28 
29 #include "Bar.h"
30 #include "Export.h"
31 
32 #include <QtPdCom1/ScalarSubscriber.h>
33 #include <QtPdCom1/Transmission.h>
34 #include "Widget.h"
35 #include "Scale.h"
36 
37 namespace Pd {
38 
39 /****************************************************************************/
40 
43 class BarPrivate : public Widget
44 {
45  Q_DECLARE_PUBLIC(Bar)
46  Bar *const q_ptr;
47 
48 
49  BarPrivate(Bar *parent);
50 
53  void clearVariables();
54 
55  private:
56  Bar::Orientation orientation;
57  Bar::Style style;
58  bool showScale;
60  Bar::Origin origin;
63  QColor backgroundColor;
65  QGradientStops gradientStops;
66  QLinearGradient gradient;
67 
68  double minStop;
69  double maxStop;
71  class Stack;
72  typedef QList<Stack *> StackList;
75  QPixmap backgroundPixmap;
77  QRect scaleRect;
78  QRect borderRect;
79  QRect barRect;
81  QLine zeroLine;
82  QPolygon darkPolygon;
83  QPolygon brightPolygon;
86 
87  QString debugStr;
88 
91  static QPolygon verticalArrow;
92  static QPolygon horizontalArrow;
93  static void initDragIndicatorPolygons();
94 
95  void updateLayout();
96  void updateBackground();
97  unsigned int calcPosition(double, bool = true) const;
98 
100  QList<Bar *> findSiblings();
101  void maxBarWidthChanged();
102  void retranslate();
103 
104  void updateGradient();
105  void redrawEvent();
106 };
107 
108 /****************************************************************************/
109 
110 } // namespace Pd
111 
112 #endif
Definition: BarStack.h:34
Definition: Bar.h:36
QRect scaleRect
Definition: Bar_p.h:77
QList< Bar * > findSiblings()
Definition: Bar.cpp:848
void clearVariables()
Clear all stacks and sections.
Definition: Bar.cpp:465
void updateLayout()
Calculates the widget&#39;s layout and draws the background into a pixmap.
Definition: Bar.cpp:659
Scale.
Definition: Scale.h:35
void redrawEvent()
Redraw event slot, that is called by the redraw timer.
Definition: Bar.cpp:917
QRect barRect
Layout rectangle containing the bar drawing area.
Definition: Bar_p.h:79
QGradientStops gradientStops
Color gradient.
Definition: Bar_p.h:65
void updateGradient()
Definition: Bar.cpp:926
double minStop
Value of first gradient stop.
Definition: Bar_p.h:68
Scale valueScale
Value scale.
Definition: Bar_p.h:59
Bar::Origin origin
Bar drawing origin.
Definition: Bar_p.h:60
bool autoBarWidth
Definition: Bar_p.h:64
QLine zeroLine
Zero line.
Definition: Bar_p.h:81
static QPolygon horizontalDragIndicatorPolygon
Drag indicator arrow shape in #Horizontal mode.
Definition: Bar_p.h:90
QPolygon brightPolygon
Polygon to draw the border light.
Definition: Bar_p.h:83
Bar graph widget.
Definition: Bar.h:44
QColor backgroundColor
Background color of the bar area.
Definition: Bar_p.h:63
Bar::Style style
Widget appearance.
Definition: Bar_p.h:57
bool showScale
Whether or not the scale is shown.
Definition: Bar_p.h:58
static QPolygon horizontalArrow
Arrow shape in #Horizontal mode.
Definition: Bar_p.h:92
void updateBackground()
Calculates the widget&#39;s layout and draws the background into a pixmap.
Definition: Bar.cpp:764
Base class for all widgets in this library.
Definition: Widget.h:34
int maxBarWidth
Definition: Bar_p.h:85
QList< Stack * > StackList
Definition: Bar_p.h:71
static void initDragIndicatorPolygons()
Drag indicator polygon initializer.
Definition: Bar.cpp:618
void notifyMaxBarWidthChange()
Definition: Bar.cpp:836
QString debugStr
Definition: Bar_p.h:87
static QPolygon verticalDragIndicatorPolygon
Drag indicator arrow shape in #Vertical mode.
Definition: Bar_p.h:89
QPixmap backgroundPixmap
Pixmap that stores the background and scale.
Definition: Bar_p.h:75
unsigned int calcPosition(double, bool=true) const
Calculates a 1-D position from a real-world value.
Definition: Bar.cpp:875
QPolygon darkPolygon
Polygon to draw the border shadow.
Definition: Bar_p.h:82
Bar *const q_ptr
Definition: Bar_p.h:46
Bar::Orientation orientation
Orientation of the bar.
Definition: Bar_p.h:56
double maxStop
Value of last gradient stop.
Definition: Bar_p.h:69
int borderWidth
Width of the border around the bar drawing area.
Definition: Bar_p.h:61
StackList stacks
Bar stacks.
Definition: Bar_p.h:73
QLinearGradient gradient
Definition: Bar_p.h:66
void maxBarWidthChanged()
Definition: Bar.cpp:864
Bar graph widget.
Definition: Bar_p.h:43
static QPolygon verticalArrow
Arrow shape in #Vertical mode.
Definition: Bar_p.h:91
void retranslate()
Retranslate the widget.
Definition: Bar.cpp:907
QRect borderRect
Definition: Bar_p.h:78