MCPcopy Create free account
hub / github.com/DISTRHO/DPF / Widget

Class Widget

dgl/Widget.hpp:55–123  ·  view source on GitHub ↗

Base DGL Widget class. This is the base Widget class, from which all widgets are built. All widgets have a parent widget where they'll be drawn, this can be the top-level widget or a group widget. This parent is never changed during a widget's lifetime. Widgets receive events in relative coordinates. (0, 0) means its top-left position. The top-level widget will draw subwidgets i

Source from the content-addressed store, hash-verified

53 @note It is not possible to subclass this Widget class directly, you must use SubWidget or TopLevelWidget instead.
54 */
55class Widget
56{
57public:
58 /**
59 Base event data.
60 These are the fields present on all Widget events.
61 */
62 struct BaseEvent {
63 /** Currently active keyboard modifiers. @see Modifier */
64 uint mod;
65 /** Event flags. @see EventFlag */
66 uint flags;
67 /** Event timestamp in milliseconds (if any). */
68 uint time;
69
70 /** Constructor for default/null values */
71 BaseEvent() noexcept : mod(0x0), flags(0x0), time(0) {}
72 /** Destuctor */
73 virtual ~BaseEvent() noexcept {}
74 };
75
76 /**
77 Keyboard event.
78
79 This event represents low-level key presses and releases.
80 This can be used for "direct" keyboard handing like key bindings, but must not be interpreted as text input.
81
82 Keys are represented portably as Unicode code points, using the "natural" code point for the key.
83 The @a key field is the code for the pressed key, without any modifiers applied.
84 For example, a press or release of the 'A' key will have `key` 97 ('a')
85 regardless of whether shift or control are being held.
86
87 Alternatively, the raw @a keycode can be used to work directly with physical keys,
88 but note that this value is not portable and differs between platforms and hardware.
89
90 @see onKeyboard
91 */
92 struct KeyboardEvent : BaseEvent {
93 /** True if the key was pressed, false if released. */
94 bool press;
95 /** Unicode point of the key pressed. */
96 uint key;
97 /** Raw keycode. */
98 uint keycode;
99
100 /** Constructor for default/null values */
101 KeyboardEvent() noexcept
102 : BaseEvent(),
103 press(false),
104 key(0),
105 keycode(0) {}
106 };
107
108 /**
109 Special keyboard event.
110
111 DEPRECATED This used to be part of DPF due to pugl, but now deprecated and simply non-functional.
112 All events go through KeyboardEvent or CharacterInputEvent, use those instead.

Callers 1

Widget.hppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected