LMMS
Loading...
Searching...
No Matches
FadeButton.h
Go to the documentation of this file.
1/*
2 * FadeButton.h - declaration of class fadeButton
3 *
4 * Copyright (c) 2005-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
5 *
6 * This file is part of LMMS - https://lmms.io
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
22 *
23 */
24
25#ifndef LMMS_GUI_FADE_BUTTON_H
26#define LMMS_GUI_FADE_BUTTON_H
27
28#include <QAbstractButton>
29#include <QColor>
30#include <QElapsedTimer>
31
32
33namespace lmms::gui
34{
35
36
37class FadeButton : public QAbstractButton
38{
39 Q_OBJECT
40public:
41 FadeButton( const QColor & _normal_color,
42 const QColor & _activated_color,
43 const QColor & _hold_color,
44 QWidget * _parent );
45
46 ~FadeButton() override = default;
47 void setActiveColor( const QColor & activated_color );
48
49
50public slots:
51 void activate();
52 void activateOnce();
53 void noteEnd();
54
55
56protected:
57 void paintEvent( QPaintEvent * _pe ) override;
58
59
60private:
61 QElapsedTimer m_stateTimer;
62 QElapsedTimer m_releaseTimer;
63
64 // the default color of the widget
66 // the color on note play
68 // the color after the "play" fade is done but a note is still playing
71
72 QColor fadeToColor(QColor, QColor, QElapsedTimer, float);
73
74} ;
75
76
77} // namespace lmms::gui
78
79#endif // LMMS_GUI_FADE_BUTTON_H
QColor fadeToColor(QColor, QColor, QElapsedTimer, float)
Definition FadeButton.cpp:149
QElapsedTimer m_stateTimer
Definition FadeButton.h:61
QColor m_normalColor
Definition FadeButton.h:65
int activeNotes
Definition FadeButton.h:70
~FadeButton() override=default
void noteEnd()
Definition FadeButton.cpp:83
void activate()
Definition FadeButton.cpp:65
QColor m_activatedColor
Definition FadeButton.h:67
void paintEvent(QPaintEvent *_pe) override
Definition FadeButton.cpp:106
QElapsedTimer m_releaseTimer
Definition FadeButton.h:62
void activateOnce()
Definition FadeButton.cpp:75
FadeButton(const QColor &_normal_color, const QColor &_activated_color, const QColor &_hold_color, QWidget *_parent)
Definition FadeButton.cpp:39
void setActiveColor(const QColor &activated_color)
Definition FadeButton.cpp:57
QColor m_holdColor
Definition FadeButton.h:69
Definition AudioPortAudio.cpp:223