Loading...
Searching...
No Matches
lib/score/widgets/ControlWidgets.hpp
1#pragma once
2#include <score/widgets/DoubleSlider.hpp>
3#include <score/widgets/IntSlider.hpp>
4
5#include <QPushButton>
6
7#include <score_lib_base_export.h>
8
9#include <array>
10namespace score
11{
12struct SCORE_LIB_BASE_EXPORT ToggleButton : public QPushButton
13{
14public:
15 ToggleButton(std::array<QString, 2> alts, QWidget* parent);
16
17 ToggleButton(std::array<const char*, 2> alt, QWidget* parent);
18
19 ToggleButton(QStringList alt, QWidget* parent);
21
22 std::array<QString, 2> alternatives;
23
24protected:
25 void paintEvent(QPaintEvent* event) override;
26};
27
28struct SCORE_LIB_BASE_EXPORT ValueSlider : public score::IntSlider
29{
30public:
31 using IntSlider::IntSlider;
33 bool moving = false;
34
35protected:
36 void paintEvent(QPaintEvent* event) override;
37};
38
39struct SCORE_LIB_BASE_EXPORT SpeedSlider : public score::DoubleSlider
40{
41public:
42 explicit SpeedSlider(QWidget* parent = nullptr);
44 bool showText = true;
45
46 double speed() const noexcept;
47 void setSpeed(double);
48 void setTempo(double);
49
50protected:
51 using score::DoubleSlider::setValue;
52 using score::DoubleSlider::value;
53
54 void paintEvent(QPaintEvent* event) override;
55 void mousePressEvent(QMouseEvent*) override;
56 void createPopup(QPoint pos) override;
57};
58
59struct SCORE_LIB_BASE_EXPORT VolumeSlider : public score::DoubleSlider
60{
61public:
62 using DoubleSlider::DoubleSlider;
63 double map(double v) const override; //TODO this is not very DRY friendly
64 double unmap(double v) const override;
66
67protected:
68 void paintEvent(QPaintEvent* event) override;
69};
70
71struct SCORE_LIB_BASE_EXPORT ValueDoubleSlider : public score::DoubleSlider
72{
73public:
74 using score::DoubleSlider::DoubleSlider;
76
77protected:
78 void paintEvent(QPaintEvent* event) override;
79};
80
81struct SCORE_LIB_BASE_EXPORT ValueLogDoubleSlider : public score::DoubleSlider
82{
83public:
84 using score::DoubleSlider::DoubleSlider;
85 double map(double v) const override;
86 double unmap(double v) const override;
88
89protected:
90 void paintEvent(QPaintEvent* event) override;
91};
92
93struct SCORE_LIB_BASE_EXPORT ComboSlider : public score::IntSlider
94{
95 QStringList array;
96
97public:
98 template <std::size_t N>
99 ComboSlider(const std::array<const char*, N>& arr, QWidget* parent)
100 : score::IntSlider{parent}
101 {
102 array.reserve(N);
103 for(auto str : arr)
104 array.push_back(str);
105 }
106
107 ComboSlider(const QStringList& arr, QWidget* parent);
108 ~ComboSlider();
109
110protected:
111 void paintEvent(QPaintEvent* event) override;
112};
113
114SCORE_LIB_BASE_EXPORT const QPalette& transparentPalette();
115}
The DoubleSlider class.
Definition DoubleSlider.hpp:19
Definition IntSlider.hpp:12
Base toolkit upon which the software is built.
Definition Application.cpp:90
Definition lib/score/widgets/ControlWidgets.hpp:94
Definition lib/score/widgets/ControlWidgets.hpp:40
Definition lib/score/widgets/ControlWidgets.hpp:13
Definition lib/score/widgets/ControlWidgets.hpp:72
Definition lib/score/widgets/ControlWidgets.hpp:82
Definition lib/score/widgets/ControlWidgets.hpp:29
Definition lib/score/widgets/ControlWidgets.hpp:60