2 * DISTRHO Plugin Framework (DPF)
3 * Copyright (C) 2012-2022 Filipe Coelho <falktx@falktx.com>
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.
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.
17 #ifndef DGL_BASE_HPP_INCLUDED
18 #define DGL_BASE_HPP_INCLUDED
20 #include "../distrho/extra/LeakDetector.hpp"
21 #include "../distrho/extra/ScopedPointer.hpp"
23 // --------------------------------------------------------------------------------------------------------------------
27 # define DGL_NAMESPACE DGL
30 #define START_NAMESPACE_DGL namespace DGL_NAMESPACE {
31 #define END_NAMESPACE_DGL }
32 #define USE_NAMESPACE_DGL using namespace DGL_NAMESPACE;
36 // --------------------------------------------------------------------------------------------------------------------
40 Keyboard modifier flags.
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
50 Keyboard key codepoints.
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.
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.
64 // Convenience symbols for ASCII control characters
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
,
74 // Unicode Private Use Area
97 kKeyShiftL
= kKeyShift
,
100 kKeyControlL
= kKeyControl
,
106 kKeySuperL
= kKeySuper
,
117 Common flags for all events.
120 kFlagSendEvent
= 1, ///< Event is synthetic
121 kFlagIsHint
= 2 ///< Event is a hint (not direct user input)
125 Reason for a crossing event.
128 kCrossingNormal
, ///< Crossing due to pointer motion
129 kCrossingGrab
, ///< Crossing due to a grab
130 kCrossingUngrab
///< Crossing due to a grab release
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:
141 Middle (often a wheel): 3
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.
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.
151 kMouseButtonLeft
= 1,
159 This is a portable subset of mouse cursors that exist on X11, MacOS, and Windows.
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
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.
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
189 A clipboard data offer.
190 @see Window::onClipboardDataOffer
192 struct ClipboardDataOffer
{
194 The id of this data offer.
195 @note The value 0 is reserved for null/invalid.
200 The type of this data offer.
201 Usually a MIME type, but may also be another platform-specific type identifier.
206 // --------------------------------------------------------------------------------------------------------------------
210 Graphics context, definition depends on build type.
212 struct GraphicsContext
{};
219 virtual ~IdleCallback() {}
220 virtual void idleCallback() = 0;
223 // --------------------------------------------------------------------------------------------------------------------
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
;
233 // --------------------------------------------------------------------------------------------------------------------
235 #endif // DGL_BASE_HPP_INCLUDED