Browse Source

Reorder/organize the Widget event docs

Signed-off-by: falkTX <falktx@falktx.com>
pull/321/head
falkTX 2 years ago
parent
commit
487d918d5c
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 33 additions and 36 deletions
  1. +33
    -36
      dgl/Widget.hpp

+ 33
- 36
dgl/Widget.hpp View File

@@ -56,17 +56,16 @@ public:
/** /**
Base event data. Base event data.
These are the fields present on all Widget events. These are the fields present on all Widget events.

@a mod Currently active keyboard modifiers, @see Modifier.
@a mod Event flags, @see EventFlag.
@a time Event timestamp (if any).
*/ */
struct BaseEvent { struct BaseEvent {
/** Currently active keyboard modifiers. @see Modifier */
uint mod; uint mod;
/** Event flags. @see EventFlag */
uint flags; uint flags;
/** Event timestamp (if any). */
uint time; uint time;


/** Constructor */
/** Constructor for default/null values */
BaseEvent() noexcept : mod(0x0), flags(0x0), time(0) {} BaseEvent() noexcept : mod(0x0), flags(0x0), time(0) {}
/** Destuctor */ /** Destuctor */
virtual ~BaseEvent() noexcept {} virtual ~BaseEvent() noexcept {}
@@ -86,17 +85,17 @@ public:
Alternatively, the raw @a keycode can be used to work directly with physical keys, Alternatively, the raw @a keycode can be used to work directly with physical keys,
but note that this value is not portable and differs between platforms and hardware. but note that this value is not portable and differs between platforms and hardware.


@a press True if the key was pressed, false if released.
@a key Unicode point of the key pressed.
@a keycode Raw keycode.
@see onKeyboard @see onKeyboard
*/ */
struct KeyboardEvent : BaseEvent { struct KeyboardEvent : BaseEvent {
/** True if the key was pressed, false if released. */
bool press; bool press;
/** Unicode point of the key pressed. */
uint key; uint key;
/** Raw keycode. */
uint keycode; uint keycode;


/** Constructor */
/** Constructor for default/null values */
KeyboardEvent() noexcept KeyboardEvent() noexcept
: BaseEvent(), : BaseEvent(),
press(false), press(false),
@@ -112,9 +111,9 @@ public:
*/ */
struct DISTRHO_DEPRECATED_BY("KeyboardEvent") SpecialEvent : BaseEvent { struct DISTRHO_DEPRECATED_BY("KeyboardEvent") SpecialEvent : BaseEvent {
bool press; bool press;
Key key;
Key key;


/** Constructor */
/** Constructor for default/null values */
SpecialEvent() noexcept SpecialEvent() noexcept
: BaseEvent(), : BaseEvent(),
press(false), press(false),
@@ -131,17 +130,17 @@ public:
so there is not necessarily a direct correspondence between text events and physical key presses. so there is not necessarily a direct correspondence between text events and physical key presses.
For example, with some input methods a sequence of several key presses will generate a single character. For example, with some input methods a sequence of several key presses will generate a single character.


@a keycode Raw key code.
@a character Unicode character code.
@a string UTF-8 string.
@see onCharacterInput @see onCharacterInput
*/ */
struct CharacterInputEvent : BaseEvent { struct CharacterInputEvent : BaseEvent {
/** Raw key code. */
uint keycode; uint keycode;
/** Unicode character code. */
uint character; uint character;
/** UTF-8 string. */
char string[8]; char string[8];


/** Constructor */
/** Constructor for default/null values */
CharacterInputEvent() noexcept CharacterInputEvent() noexcept
: BaseEvent(), : BaseEvent(),
keycode(0), keycode(0),
@@ -155,20 +154,19 @@ public:


/** /**
Mouse press or release event. Mouse press or release event.

@a button The button number starting from 1 (1 = left, 2 = middle, 3 = right).
@a press True if the button was pressed, false if released.
@a pos The widget-relative coordinates of the pointer.
@a absolutePos The absolute coordinates of the pointer.
@see onMouse @see onMouse
*/ */
struct MouseEvent : BaseEvent { struct MouseEvent : BaseEvent {
/** The button number starting from 1. @see MouseButton */
uint button; uint button;
/** True if the button was pressed, false if released. */
bool press; bool press;
/** The widget-relative coordinates of the pointer. */
Point<double> pos; Point<double> pos;
/** The absolute coordinates of the pointer. */
Point<double> absolutePos; Point<double> absolutePos;


/** Constructor */
/** Constructor for default/null values */
MouseEvent() noexcept MouseEvent() noexcept
: BaseEvent(), : BaseEvent(),
button(0), button(0),
@@ -179,16 +177,15 @@ public:


/** /**
Mouse motion event. Mouse motion event.

@a pos The widget-relative coordinates of the pointer.
@a absolutePos The absolute coordinates of the pointer.
@see onMotion @see onMotion
*/ */
struct MotionEvent : BaseEvent { struct MotionEvent : BaseEvent {
/** The widget-relative coordinates of the pointer. */
Point<double> pos; Point<double> pos;
/** The absolute coordinates of the pointer. */
Point<double> absolutePos; Point<double> absolutePos;


/** Constructor */
/** Constructor for default/null values */
MotionEvent() noexcept MotionEvent() noexcept
: BaseEvent(), : BaseEvent(),
pos(0.0, 0.0), pos(0.0, 0.0),
@@ -204,19 +201,19 @@ public:
Some systems and devices support finer resolution and/or higher values for fast scrolls, Some systems and devices support finer resolution and/or higher values for fast scrolls,
so programs should handle any value gracefully. so programs should handle any value gracefully.


@a pos The widget-relative coordinates of the pointer.
@a absolutePos The absolute coordinates of the pointer.
@a delta The scroll distance.
@a direction The direction of the scroll or "smooth".
@see onScroll @see onScroll
*/ */
struct ScrollEvent : BaseEvent { struct ScrollEvent : BaseEvent {
/** The widget-relative coordinates of the pointer. */
Point<double> pos; Point<double> pos;
/** The absolute coordinates of the pointer. */
Point<double> absolutePos; Point<double> absolutePos;
/** The scroll distance. */
Point<double> delta; Point<double> delta;
/** The direction of the scroll or "smooth". */
ScrollDirection direction; ScrollDirection direction;


/** Constructor */
/** Constructor for default/null values */
ScrollEvent() noexcept ScrollEvent() noexcept
: BaseEvent(), : BaseEvent(),
pos(0.0, 0.0), pos(0.0, 0.0),
@@ -227,15 +224,15 @@ public:


/** /**
Resize event. Resize event.
@a size The new widget size.
@a oldSize The previous size, may be null.
@see onResize @see onResize
*/ */
struct ResizeEvent { struct ResizeEvent {
/** The new widget size. */
Size<uint> size; Size<uint> size;
/** The previous size, can be null. */
Size<uint> oldSize; Size<uint> oldSize;


/** Constructor */
/** Constructor for default/null values */
ResizeEvent() noexcept ResizeEvent() noexcept
: size(0, 0), : size(0, 0),
oldSize(0, 0) {} oldSize(0, 0) {}
@@ -243,15 +240,15 @@ public:


/** /**
Widget position changed event. Widget position changed event.
@a pos The new absolute position of the widget.
@a oldPos The previous absolute position of the widget.
@see onPositionChanged @see onPositionChanged
*/ */
struct PositionChangedEvent { struct PositionChangedEvent {
/** The new absolute position of the widget. */
Point<int> pos; Point<int> pos;
/** The previous absolute position of the widget. */
Point<int> oldPos; Point<int> oldPos;


/** Constructor */
/** Constructor for default/null values */
PositionChangedEvent() noexcept PositionChangedEvent() noexcept
: pos(0, 0), : pos(0, 0),
oldPos(0, 0) {} oldPos(0, 0) {}


Loading…
Cancel
Save