comparison DPF-Prymula-audioplugins/dpf/dgl/Base.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
comparison
equal deleted inserted replaced
2:cf2cb71d31dd 3:84e66ea83026
1 /*
2 * DISTRHO Plugin Framework (DPF)
3 * Copyright (C) 2012-2022 Filipe Coelho <falktx@falktx.com>
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any purpose with
6 * or without fee is hereby granted, provided that the above copyright notice and this
7 * permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
10 * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
11 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
12 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
13 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 #ifndef DGL_BASE_HPP_INCLUDED
18 #define DGL_BASE_HPP_INCLUDED
19
20 #include "../distrho/extra/LeakDetector.hpp"
21 #include "../distrho/extra/ScopedPointer.hpp"
22
23 // --------------------------------------------------------------------------------------------------------------------
24 // Define namespace
25
26 #ifndef DGL_NAMESPACE
27 # define DGL_NAMESPACE DGL
28 #endif
29
30 #define START_NAMESPACE_DGL namespace DGL_NAMESPACE {
31 #define END_NAMESPACE_DGL }
32 #define USE_NAMESPACE_DGL using namespace DGL_NAMESPACE;
33
34 START_NAMESPACE_DGL
35
36 // --------------------------------------------------------------------------------------------------------------------
37 // Base DGL enums
38
39 /**
40 Keyboard modifier flags.
41 */
42 enum Modifier {
43 kModifierShift = 1u << 0u, ///< Shift key
44 kModifierControl = 1u << 1u, ///< Control key
45 kModifierAlt = 1u << 2u, ///< Alt/Option key
46 kModifierSuper = 1u << 3u ///< Mod4/Command/Windows key
47 };
48
49 /**
50 Keyboard key codepoints.
51
52 All keys are identified by a Unicode code point in Widget::KeyboardEvent::key.
53 This enumeration defines constants for special keys that do not have a standard
54 code point, and some convenience constants for control characters.
55 Note that all keys are handled in the same way, this enumeration is just for
56 convenience when writing hard-coded key bindings.
57
58 Keys that do not have a standard code point use values in the Private Use
59 Area in the Basic Multilingual Plane (`U+E000` to `U+F8FF`).
60 Applications must take care to not interpret these values beyond key detection,
61 the mapping used here is arbitrary and specific to DPF.
62 */
63 enum Key {
64 // Convenience symbols for ASCII control characters
65 kKeyBackspace = 0x08,
66 kKeyEscape = 0x1B,
67 kKeyDelete = 0x7F,
68
69 // Backwards compatibility with old DPF
70 kCharBackspace DISTRHO_DEPRECATED_BY("kKeyBackspace") = kKeyBackspace,
71 kCharEscape DISTRHO_DEPRECATED_BY("kKeyEscape") = kKeyEscape,
72 kCharDelete DISTRHO_DEPRECATED_BY("kKeyDelete") = kKeyDelete,
73
74 // Unicode Private Use Area
75 kKeyF1 = 0xE000,
76 kKeyF2,
77 kKeyF3,
78 kKeyF4,
79 kKeyF5,
80 kKeyF6,
81 kKeyF7,
82 kKeyF8,
83 kKeyF9,
84 kKeyF10,
85 kKeyF11,
86 kKeyF12,
87 kKeyLeft,
88 kKeyUp,
89 kKeyRight,
90 kKeyDown,
91 kKeyPageUp,
92 kKeyPageDown,
93 kKeyHome,
94 kKeyEnd,
95 kKeyInsert,
96 kKeyShift,
97 kKeyShiftL = kKeyShift,
98 kKeyShiftR,
99 kKeyControl,
100 kKeyControlL = kKeyControl,
101 kKeyControlR,
102 kKeyAlt,
103 kKeyAltL = kKeyAlt,
104 kKeyAltR,
105 kKeySuper,
106 kKeySuperL = kKeySuper,
107 kKeySuperR,
108 kKeyMenu,
109 kKeyCapsLock,
110 kKeyScrollLock,
111 kKeyNumLock,
112 kKeyPrintScreen,
113 kKeyPause
114 };
115
116 /**
117 Common flags for all events.
118 */
119 enum EventFlag {
120 kFlagSendEvent = 1, ///< Event is synthetic
121 kFlagIsHint = 2 ///< Event is a hint (not direct user input)
122 };
123
124 /**
125 Reason for a crossing event.
126 */
127 enum CrossingMode {
128 kCrossingNormal, ///< Crossing due to pointer motion
129 kCrossingGrab, ///< Crossing due to a grab
130 kCrossingUngrab ///< Crossing due to a grab release
131 };
132
133 /**
134 A mouse button.
135
136 Mouse button numbers start from 1, and are ordered: primary, secondary, middle.
137 So, on a typical right-handed mouse, the button numbers are:
138
139 Left: 1
140 Right: 2
141 Middle (often a wheel): 3
142
143 Higher button numbers are reported in the same order they are represented on the system.
144 There is no universal standard here, but buttons 4 and 5 are typically a pair of buttons or a rocker,
145 which are usually bound to "back" and "forward" operations.
146
147 Note that these numbers may differ from those used on the underlying
148 platform, since they are manipulated to provide a consistent portable API.
149 */
150 enum MouseButton {
151 kMouseButtonLeft = 1,
152 kMouseButtonRight,
153 kMouseButtonMiddle,
154 };
155
156 /**
157 A mouse cursor type.
158
159 This is a portable subset of mouse cursors that exist on X11, MacOS, and Windows.
160 */
161 enum MouseCursor {
162 kMouseCursorArrow, ///< Default pointing arrow
163 kMouseCursorCaret, ///< Caret (I-Beam) for text entry
164 kMouseCursorCrosshair, ///< Cross-hair
165 kMouseCursorHand, ///< Hand with a pointing finger
166 kMouseCursorNotAllowed, ///< Operation not allowed
167 kMouseCursorLeftRight, ///< Left/right arrow for horizontal resize
168 kMouseCursorUpDown, ///< Up/down arrow for vertical resize
169 kMouseCursorDiagonal, ///< Top-left to bottom-right arrow for diagonal resize
170 kMouseCursorAntiDiagonal ///< Bottom-left to top-right arrow for diagonal resize
171 };
172
173 /**
174 Scroll direction.
175
176 Describes the direction of a scroll event along with whether the scroll is a "smooth" scroll.
177 The discrete directions are for devices like mouse wheels with constrained axes,
178 while a smooth scroll is for those with arbitrary scroll direction freedom, like some touchpads.
179 */
180 enum ScrollDirection {
181 kScrollUp, ///< Scroll up
182 kScrollDown, ///< Scroll down
183 kScrollLeft, ///< Scroll left
184 kScrollRight, ///< Scroll right
185 kScrollSmooth ///< Smooth scroll in any direction
186 };
187
188 /**
189 A clipboard data offer.
190 @see Window::onClipboardDataOffer
191 */
192 struct ClipboardDataOffer {
193 /**
194 The id of this data offer.
195 @note The value 0 is reserved for null/invalid.
196 */
197 uint32_t id;
198
199 /**
200 The type of this data offer.
201 Usually a MIME type, but may also be another platform-specific type identifier.
202 */
203 const char* type;
204 };
205
206 // --------------------------------------------------------------------------------------------------------------------
207 // Base DGL classes
208
209 /**
210 Graphics context, definition depends on build type.
211 */
212 struct GraphicsContext {};
213
214 /**
215 Idle callback.
216 */
217 struct IdleCallback
218 {
219 virtual ~IdleCallback() {}
220 virtual void idleCallback() = 0;
221 };
222
223 // --------------------------------------------------------------------------------------------------------------------
224
225 END_NAMESPACE_DGL
226
227 #ifndef DONT_SET_USING_DGL_NAMESPACE
228 // If your code uses a lot of DGL classes, then this will obviously save you
229 // a lot of typing, but can be disabled by setting DONT_SET_USING_DGL_NAMESPACE.
230 using namespace DGL_NAMESPACE;
231 #endif
232
233 // --------------------------------------------------------------------------------------------------------------------
234
235 #endif // DGL_BASE_HPP_INCLUDED