docs
Docs
C++ API
C API
Search API
Ctrl K
2.0
2.0
latest
1.4
Ultralight C API
2.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
CAPI_ScrollEvent.h
Go to the documentation of this file.
1
///
2
/// Copyright (C) 2026 Ultralight, Inc. All rights reserved.
3
/// A license is required for commercial use. https://ultralig.ht
4
///
5
6
///
7
/// @file CAPI_ScrollEvent.h
8
///
9
/// Scroll event interface.
10
///
11
/// `#include <Ultralight/CAPI/CAPI_ScrollEvent.h>`
12
///
13
/// This file defines the C API for scroll events.
14
///
15
#ifndef ULTRALIGHT_CAPI_SCROLLEVENT_H
16
#define ULTRALIGHT_CAPI_SCROLLEVENT_H
17
18
#include <
Ultralight/CAPI/CAPI_Defines.h
>
19
20
#ifdef __cplusplus
21
extern
"C"
{
22
#endif
23
24
/******************************************************************************
25
* Scroll Event
26
*****************************************************************************/
27
28
///
29
/// Create a scroll event.
30
///
31
/// Positive deltas scroll up (or left), like a mouse wheel turned away from the user. Pages that
32
/// read the legacy `wheelDelta` properties see 120 for every 100 pixels (or every page) of delta.
33
/// Modifier keys reported to the page come from the last key event fired on the View.
34
///
35
/// @param type The scroll granularity type.
36
/// @param delta_x Horizontal scroll amount, in the unit named by `type` (logical pixels, or
37
/// pages).
38
/// @param delta_y Vertical scroll amount, in the unit named by `type` (logical pixels, or
39
/// pages).
40
/// @param x The x-position of the cursor when the event occurred, in logical pixels
41
/// relative to the View. Pass a negative value to dispatch at the last known
42
/// cursor position instead; if either coordinate is negative, both are
43
/// ignored.
44
/// @param y The y-position of the cursor when the event occurred, in logical pixels
45
/// relative to the View. Same sentinel rule as `x`.
46
///
47
/// @return Returns a new ULScrollEvent instance. You must call ulDestroyScrollEvent() when
48
/// finished.
49
///
50
ULExport
ULScrollEvent
ulCreateScrollEvent
(
ULScrollEventType
type,
int
delta_x,
int
delta_y,
51
int
x,
int
y);
52
53
///
54
/// Destroy a scroll event created by ulCreateScrollEvent().
55
///
56
ULExport
void
ulDestroyScrollEvent
(
ULScrollEvent
evt);
57
58
///
59
/// Get the scroll granularity type of a scroll event.
60
///
61
/// @param evt The scroll event.
62
///
63
/// @return Returns the scroll granularity type (see ULScrollEventType).
64
///
65
ULExport
ULScrollEventType
ulScrollEventGetType
(
ULScrollEvent
evt);
66
67
///
68
/// Get the horizontal scroll amount.
69
///
70
/// @param evt The scroll event.
71
///
72
/// @return Returns the horizontal scroll amount, in the unit named by the event's type.
73
///
74
ULExport
int
ulScrollEventGetDeltaX
(
ULScrollEvent
evt);
75
76
///
77
/// Get the vertical scroll amount.
78
///
79
/// @param evt The scroll event.
80
///
81
/// @return Returns the vertical scroll amount, in the unit named by the event's type.
82
///
83
ULExport
int
ulScrollEventGetDeltaY
(
ULScrollEvent
evt);
84
85
///
86
/// Get the x-position of the cursor when the event occurred.
87
///
88
/// @param evt The scroll event.
89
///
90
/// @return Returns the x-position, in logical pixels relative to the View, or a negative value if
91
/// the event dispatches at the last known cursor position.
92
///
93
ULExport
int
ulScrollEventGetX
(
ULScrollEvent
evt);
94
95
///
96
/// Get the y-position of the cursor when the event occurred.
97
///
98
/// @param evt The scroll event.
99
///
100
/// @return Returns the y-position, in logical pixels relative to the View, or a negative value if
101
/// the event dispatches at the last known cursor position.
102
///
103
ULExport
int
ulScrollEventGetY
(
ULScrollEvent
evt);
104
105
#ifdef __cplusplus
106
}
// extern "C"
107
#endif
108
109
#endif
// ULTRALIGHT_CAPI_SCROLLEVENT_H
ulScrollEventGetType
ULScrollEventType ulScrollEventGetType(ULScrollEvent evt)
Get the scroll granularity type of a scroll event.
ulCreateScrollEvent
ULScrollEvent ulCreateScrollEvent(ULScrollEventType type, int delta_x, int delta_y, int x, int y)
Create a scroll event.
ulScrollEventGetDeltaX
int ulScrollEventGetDeltaX(ULScrollEvent evt)
Get the horizontal scroll amount.
ulScrollEventGetDeltaY
int ulScrollEventGetDeltaY(ULScrollEvent evt)
Get the vertical scroll amount.
ulScrollEventGetX
int ulScrollEventGetX(ULScrollEvent evt)
Get the x-position of the cursor when the event occurred.
ulScrollEventGetY
int ulScrollEventGetY(ULScrollEvent evt)
Get the y-position of the cursor when the event occurred.
ulDestroyScrollEvent
void ulDestroyScrollEvent(ULScrollEvent evt)
Destroy a scroll event created by ulCreateScrollEvent().
CAPI_Defines.h
Various defines and utility functions for the C API.
ULScrollEventType
ULScrollEventType
The scroll event granularity type.
Definition
CAPI_Defines.h:310
ULExport
#define ULExport
Definition
CAPI_Defines.h:42
ULScrollEvent
struct C_ScrollEvent * ULScrollEvent
Opaque handle to a ScrollEvent object.
Definition
CAPI_Defines.h:110
Ultralight
CAPI
CAPI_ScrollEvent.h
Docs
C++ API
C API
Version
2.0
2.0
latest
1.4