Mercurial > hg > pub > prymula > com
annotate DPF-Prymula-audioplugins/dpf/dgl/EventHandlers.hpp @ 3:84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
author | prymula <prymula76@outlook.com> |
---|---|
date | Mon, 16 Oct 2023 21:53:34 +0200 |
parents | |
children |
rev | line source |
---|---|
3
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
1 /* |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
2 * DISTRHO Plugin Framework (DPF) |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2022 Filipe Coelho <falktx@falktx.com> |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
4 * |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
5 * Permission to use, copy, modify, and/or distribute this software for any purpose with |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
6 * or without fee is hereby granted, provided that the above copyright notice and this |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
7 * permission notice appear in all copies. |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
8 * |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
10 * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
11 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
12 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
13 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
15 */ |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
16 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
17 #ifndef DGL_EVENT_HANDLERS_HPP_INCLUDED |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
18 #define DGL_EVENT_HANDLERS_HPP_INCLUDED |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
19 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
20 #include "Widget.hpp" |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
21 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
22 START_NAMESPACE_DGL |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
23 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
24 /* NOTE none of these classes get assigned to a widget automatically |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
25 Manual plugging into Widget events is needed, like so: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
26 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
27 ``` |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
28 bool onMouse(const MouseEvent& ev) override |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
29 { |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
30 return ButtonEventHandler::mouseEvent(ev); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
31 } |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
32 ``` |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
33 */ |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
34 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
35 // -------------------------------------------------------------------------------------------------------------------- |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
36 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
37 class ButtonEventHandler |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
38 { |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
39 public: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
40 enum State { |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
41 kButtonStateDefault = 0x0, |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
42 kButtonStateHover = 0x1, |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
43 kButtonStateActive = 0x2, |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
44 kButtonStateActiveHover = kButtonStateActive|kButtonStateHover |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
45 }; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
46 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
47 class Callback |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
48 { |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
49 public: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
50 virtual ~Callback() {} |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
51 virtual void buttonClicked(SubWidget* widget, int button) = 0; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
52 }; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
53 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
54 explicit ButtonEventHandler(SubWidget* self); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
55 virtual ~ButtonEventHandler(); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
56 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
57 bool isActive() noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
58 void setActive(bool active, bool sendCallback) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
59 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
60 bool isChecked() const noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
61 void setChecked(bool checked, bool sendCallback) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
62 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
63 bool isCheckable() const noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
64 void setCheckable(bool checkable) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
65 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
66 Point<double> getLastClickPosition() const noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
67 Point<double> getLastMotionPosition() const noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
68 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
69 void setCallback(Callback* callback) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
70 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
71 bool mouseEvent(const Widget::MouseEvent& ev); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
72 bool motionEvent(const Widget::MotionEvent& ev); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
73 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
74 protected: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
75 State getState() const noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
76 void clearState() noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
77 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
78 virtual void stateChanged(State state, State oldState); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
79 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
80 void setInternalCallback(Callback* callback) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
81 void triggerUserCallback(SubWidget* widget, int button); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
82 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
83 private: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
84 struct PrivateData; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
85 PrivateData* const pData; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
86 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
87 DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ButtonEventHandler) |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
88 }; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
89 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
90 // -------------------------------------------------------------------------------------------------------------------- |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
91 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
92 class KnobEventHandler |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
93 { |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
94 public: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
95 enum Orientation { |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
96 Horizontal, |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
97 Vertical, |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
98 Both |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
99 }; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
100 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
101 // NOTE hover not implemented yet |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
102 enum State { |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
103 kKnobStateDefault = 0x0, |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
104 kKnobStateHover = 0x1, |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
105 kKnobStateDragging = 0x2, |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
106 kKnobStateDraggingHover = kKnobStateDragging|kKnobStateHover |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
107 }; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
108 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
109 class Callback |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
110 { |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
111 public: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
112 virtual ~Callback() {} |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
113 virtual void knobDragStarted(SubWidget* widget) = 0; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
114 virtual void knobDragFinished(SubWidget* widget) = 0; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
115 virtual void knobValueChanged(SubWidget* widget, float value) = 0; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
116 virtual void knobDoubleClicked(SubWidget*) {}; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
117 }; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
118 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
119 explicit KnobEventHandler(SubWidget* self); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
120 explicit KnobEventHandler(SubWidget* self, const KnobEventHandler& other); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
121 KnobEventHandler& operator=(const KnobEventHandler& other); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
122 virtual ~KnobEventHandler(); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
123 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
124 // if setStep(1) has been called before, this returns true |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
125 bool isInteger() const noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
126 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
127 // returns raw value, is assumed to be scaled if using log |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
128 float getValue() const noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
129 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
130 // NOTE: value is assumed to be scaled if using log |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
131 virtual bool setValue(float value, bool sendCallback = false) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
132 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
133 // returns 0-1 ranged value, already with log scale as needed |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
134 float getNormalizedValue() const noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
135 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
136 // NOTE: value is assumed to be scaled if using log |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
137 void setDefault(float def) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
138 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
139 // NOTE: value is assumed to be scaled if using log |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
140 void setRange(float min, float max) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
141 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
142 void setStep(float step) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
143 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
144 void setUsingLogScale(bool yesNo) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
145 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
146 Orientation getOrientation() const noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
147 void setOrientation(Orientation orientation) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
148 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
149 void setCallback(Callback* callback) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
150 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
151 // default 200, higher means slower |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
152 void setMouseDeceleration(float accel) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
153 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
154 bool mouseEvent(const Widget::MouseEvent& ev, double scaleFactor = 1.0); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
155 bool motionEvent(const Widget::MotionEvent& ev, double scaleFactor = 1.0); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
156 bool scrollEvent(const Widget::ScrollEvent& ev); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
157 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
158 protected: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
159 State getState() const noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
160 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
161 private: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
162 struct PrivateData; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
163 PrivateData* const pData; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
164 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
165 /* not for use */ |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
166 #ifdef DISTRHO_PROPER_CPP11_SUPPORT |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
167 KnobEventHandler(KnobEventHandler& other) = delete; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
168 KnobEventHandler(const KnobEventHandler& other) = delete; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
169 #else |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
170 KnobEventHandler(KnobEventHandler& other); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
171 KnobEventHandler(const KnobEventHandler& other); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
172 #endif |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
173 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
174 DISTRHO_LEAK_DETECTOR(KnobEventHandler) |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
175 }; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
176 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
177 // -------------------------------------------------------------------------------------------------------------------- |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
178 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
179 class SliderEventHandler |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
180 { |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
181 public: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
182 explicit SliderEventHandler(SubWidget* self); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
183 virtual ~SliderEventHandler(); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
184 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
185 private: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
186 struct PrivateData; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
187 PrivateData* const pData; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
188 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
189 DISTRHO_LEAK_DETECTOR(SliderEventHandler) |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
190 }; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
191 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
192 // -------------------------------------------------------------------------------------------------------------------- |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
193 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
194 END_NAMESPACE_DGL |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
195 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
196 #endif // DGL_EVENT_HANDLERS_HPP_INCLUDED |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
197 |