QtPdWidgets  2.3.1
BarSection.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_STACK_SECTION_H
24 #define PD_BAR_STACK_SECTION_H
25 
26 #include <QtGui>
27 
28 #include "BarStack.h"
29 #include <QtPdCom1/ScalarSubscriber.h>
30 
31 /****************************************************************************/
32 
34  public QtPdCom::ScalarSubscriber
35 {
36  public:
37  Section(Stack *, QColor = Qt::black);
38  virtual ~Section();
39 
40  void redrawEvent();
41  void clearData(); // pure-virtual from ScalarSubscriber
42  bool hasData() const { return dataPresent; }
43  double getValue() const { return barValue; }
44  double getDragMin() const { return dragMinValue; }
45  double getDragMax() const { return dragMaxValue; }
46  QColor getColor() const { return color; }
47 
48  private:
49  Stack * const stack;
50  bool dataPresent;
51  QColor color;
52  double barValue;
53  double dragMinValue;
54  double dragMaxValue;
55  bool redraw;
58  void newValues(std::chrono::nanoseconds) override;
59 
60  Section(); // private
61 };
62 
63 #endif
64 
65 /****************************************************************************/
Definition: BarStack.h:34
bool hasData() const
Definition: BarSection.h:42
double getDragMin() const
Definition: BarSection.h:44
bool redraw
True, if the section shall be redrawn on next redrawEvent().
Definition: BarSection.h:55
QColor color
Bar color.
Definition: BarSection.h:51
void redrawEvent()
Update.
Definition: BarSection.cpp:111
double barValue
Current bar value.
Definition: BarSection.h:52
double dragMaxValue
Definition: BarSection.h:54
void newValues(std::chrono::nanoseconds) override
This virtual method is called if the value changes.
Definition: BarSection.cpp:71
QColor getColor() const
Definition: BarSection.h:46
double getValue() const
Definition: BarSection.h:43
bool dataPresent
There is a value to display.
Definition: BarSection.h:50
Stack *const stack
Parent stack.
Definition: BarSection.h:49
double dragMinValue
Definition: BarSection.h:53
void clearData()
Definition: BarSection.cpp:61
Definition: BarSection.h:33
double getDragMax() const
Definition: BarSection.h:45
virtual ~Section()
Destructor.
Definition: BarSection.cpp:54