Mercurial > hg > pub > prymula > com
annotate DPF-Prymula-audioplugins/dpf/dgl/ImageBaseWidgets.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-2021 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_IMAGE_BASE_WIDGETS_HPP_INCLUDED |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
18 #define DGL_IMAGE_BASE_WIDGETS_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 "EventHandlers.hpp" |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
21 #include "StandaloneWindow.hpp" |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
22 #include "SubWidget.hpp" |
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 START_NAMESPACE_DGL |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
25 |
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 /** |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
29 DGL Image About Window class. |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
30 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
31 This is a Window attached (transient) to another Window that simply shows an Image as its content. |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
32 It is typically used for "about this project" style pop-up Windows. |
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 Pressing 'Esc' or clicking anywhere on the window will automatically close it. |
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 @see CairoImageAboutWindow, OpenGLImageAboutWindow, Window::runAsModal(bool) |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
37 */ |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
38 template <class ImageType> |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
39 class ImageBaseAboutWindow : public StandaloneWindow |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
40 { |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
41 public: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
42 /** |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
43 Constructor taking an existing Window as the parent transient window and an optional image. |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
44 If @a image is valid, the about window size will match the image size. |
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 explicit ImageBaseAboutWindow(Window& transientParentWindow, const ImageType& image = ImageType()); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
47 |
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 Constructor taking a top-level-widget's Window as the parent transient window and an optional image. |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
50 If @a image is valid, the about window size will match the image size. |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
51 */ |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
52 explicit ImageBaseAboutWindow(TopLevelWidget* topLevelWidget, const ImageType& image = ImageType()); |
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 /** |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
55 Set a new image to use as background for this window. |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
56 Window size will adjust to match the image size. |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
57 */ |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
58 void setImage(const ImageType& image); |
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 protected: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
61 void onDisplay() override; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
62 bool onKeyboard(const KeyboardEvent&) override; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
63 bool onMouse(const MouseEvent&) override; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
64 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
65 private: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
66 ImageType img; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
67 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
68 DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ImageBaseAboutWindow) |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
69 }; |
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 // -------------------------------------------------------------------------------------------------------------------- |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
72 |
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 DGL Image Button class. |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
75 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
76 This is a typical button, where the drawing comes from a pregenerated set of images. |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
77 The button can be under "normal", "hover" and "down" states, with one separate image possible for each. |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
78 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
79 The event logic for this button comes from the ButtonEventHandler class. |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
80 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
81 @see CairoImageButton, OpenGLImageButton |
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 template <class ImageType> |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
84 class ImageBaseButton : public SubWidget, |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
85 public ButtonEventHandler |
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 public: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
88 class Callback |
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 public: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
91 virtual ~Callback() {} |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
92 virtual void imageButtonClicked(ImageBaseButton* imageButton, int button) = 0; |
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 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
95 explicit ImageBaseButton(Widget* parentWidget, const ImageType& image); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
96 explicit ImageBaseButton(Widget* parentWidget, const ImageType& imageNormal, const ImageType& imageDown); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
97 explicit ImageBaseButton(Widget* parentWidget, const ImageType& imageNormal, const ImageType& imageHover, const ImageType& imageDown); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
98 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
99 ~ImageBaseButton() override; |
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 void setCallback(Callback* callback) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
102 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
103 protected: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
104 void onDisplay() override; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
105 bool onMouse(const MouseEvent&) override; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
106 bool onMotion(const MotionEvent&) override; |
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 private: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
109 struct PrivateData; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
110 PrivateData* const pData; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
111 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
112 DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ImageBaseButton) |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
113 }; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
114 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
115 // -------------------------------------------------------------------------------------------------------------------- |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
116 |
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 DGL Image Knob class. |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
119 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
120 This is a typical knob/dial, where the drawing comes from a pregenerated image "filmstrip". |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
121 The knob's "filmstrip" image can be either horizontal or vertical, |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
122 with the number of steps automatically based on the largest value (ie, horizontal if width>height, vertical if height>width). |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
123 There are no different images for "hover" or "down" states. |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
124 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
125 The event logic for this knob comes from the KnobEventHandler class. |
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 @see CairoImageKnob, OpenGLImageKnob |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
128 */ |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
129 template <class ImageType> |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
130 class ImageBaseKnob : public SubWidget, |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
131 public KnobEventHandler |
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 public: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
134 class Callback |
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 public: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
137 virtual ~Callback() {} |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
138 virtual void imageKnobDragStarted(ImageBaseKnob* imageKnob) = 0; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
139 virtual void imageKnobDragFinished(ImageBaseKnob* imageKnob) = 0; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
140 virtual void imageKnobValueChanged(ImageBaseKnob* imageKnob, float value) = 0; |
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 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
143 explicit ImageBaseKnob(Widget* parentWidget, const ImageType& image, Orientation orientation = Vertical) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
144 explicit ImageBaseKnob(const ImageBaseKnob& imageKnob); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
145 ImageBaseKnob& operator=(const ImageBaseKnob& imageKnob); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
146 ~ImageBaseKnob() override; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
147 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
148 void setCallback(Callback* callback) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
149 void setImageLayerCount(uint count) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
150 void setRotationAngle(int angle); |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
151 bool setValue(float value, bool sendCallback = false) noexcept override; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
152 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
153 protected: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
154 void onDisplay() override; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
155 bool onMouse(const MouseEvent&) override; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
156 bool onMotion(const MotionEvent&) override; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
157 bool onScroll(const ScrollEvent&) override; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
158 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
159 private: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
160 struct PrivateData; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
161 PrivateData* const pData; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
162 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
163 DISTRHO_LEAK_DETECTOR(ImageBaseKnob) |
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 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
166 // -------------------------------------------------------------------------------------------------------------------- |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
167 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
168 // note set range and step before setting the value |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
169 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
170 template <class ImageType> |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
171 class ImageBaseSlider : public SubWidget |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
172 { |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
173 public: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
174 class Callback |
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 public: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
177 virtual ~Callback() {} |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
178 virtual void imageSliderDragStarted(ImageBaseSlider* imageSlider) = 0; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
179 virtual void imageSliderDragFinished(ImageBaseSlider* imageSlider) = 0; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
180 virtual void imageSliderValueChanged(ImageBaseSlider* imageSlider, float value) = 0; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
181 }; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
182 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
183 explicit ImageBaseSlider(Widget* parentWidget, const ImageType& image) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
184 ~ImageBaseSlider() override; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
185 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
186 float getValue() const noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
187 void setValue(float value, bool sendCallback = false) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
188 void setDefault(float def) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
189 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
190 void setStartPos(const Point<int>& startPos) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
191 void setStartPos(int x, int y) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
192 void setEndPos(const Point<int>& endPos) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
193 void setEndPos(int x, int y) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
194 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
195 void setCheckable(bool checkable) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
196 void setInverted(bool inverted) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
197 void setRange(float min, float max) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
198 void setStep(float step) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
199 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
200 void setCallback(Callback* callback) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
201 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
202 protected: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
203 void onDisplay() override; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
204 bool onMouse(const MouseEvent&) override; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
205 bool onMotion(const MotionEvent&) override; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
206 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
207 private: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
208 struct PrivateData; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
209 PrivateData* const pData; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
210 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
211 // these should not be used |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
212 void setAbsoluteX(int) const noexcept {} |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
213 void setAbsoluteY(int) const noexcept {} |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
214 void setAbsolutePos(int, int) const noexcept {} |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
215 void setAbsolutePos(const Point<int>&) const noexcept {} |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
216 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
217 DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ImageBaseSlider) |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
218 }; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
219 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
220 // -------------------------------------------------------------------------------------------------------------------- |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
221 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
222 template <class ImageType> |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
223 class ImageBaseSwitch : public SubWidget |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
224 { |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
225 public: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
226 class Callback |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
227 { |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
228 public: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
229 virtual ~Callback() {} |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
230 virtual void imageSwitchClicked(ImageBaseSwitch* imageSwitch, bool down) = 0; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
231 }; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
232 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
233 explicit ImageBaseSwitch(Widget* parentWidget, const ImageType& imageNormal, const ImageType& imageDown) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
234 explicit ImageBaseSwitch(const ImageBaseSwitch& imageSwitch) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
235 ImageBaseSwitch& operator=(const ImageBaseSwitch& imageSwitch) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
236 ~ImageBaseSwitch() override; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
237 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
238 bool isDown() const noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
239 void setDown(bool down) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
240 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
241 void setCallback(Callback* callback) noexcept; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
242 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
243 protected: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
244 void onDisplay() override; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
245 bool onMouse(const MouseEvent&) override; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
246 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
247 private: |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
248 struct PrivateData; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
249 PrivateData* const pData; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
250 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
251 DISTRHO_LEAK_DETECTOR(ImageBaseSwitch) |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
252 }; |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
253 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
254 // -------------------------------------------------------------------------------------------------------------------- |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
255 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
256 END_NAMESPACE_DGL |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
257 |
84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff
changeset
|
258 #endif // DGL_IMAGE_BASE_WIDGETS_HPP_INCLUDED |