docs
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
19
20#ifdef __cplusplus
21extern "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///
51 int x, int y);
52
53///
54/// Destroy a scroll event created by ulCreateScrollEvent().
55///
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///
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///
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///
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///
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///
104
105#ifdef __cplusplus
106} // extern "C"
107#endif
108
109#endif // ULTRALIGHT_CAPI_SCROLLEVENT_H
ULScrollEventType ulScrollEventGetType(ULScrollEvent evt)
Get the scroll granularity type of a scroll event.
ULScrollEvent ulCreateScrollEvent(ULScrollEventType type, int delta_x, int delta_y, int x, int y)
Create a scroll event.
int ulScrollEventGetDeltaX(ULScrollEvent evt)
Get the horizontal scroll amount.
int ulScrollEventGetDeltaY(ULScrollEvent evt)
Get the vertical scroll amount.
int ulScrollEventGetX(ULScrollEvent evt)
Get the x-position of the cursor when the event occurred.
int ulScrollEventGetY(ULScrollEvent evt)
Get the y-position of the cursor when the event occurred.
void ulDestroyScrollEvent(ULScrollEvent evt)
Destroy a scroll event created by ulCreateScrollEvent().
Various defines and utility functions for the C API.
ULScrollEventType
The scroll event granularity type.
Definition CAPI_Defines.h:310
#define ULExport
Definition CAPI_Defines.h:42
struct C_ScrollEvent * ULScrollEvent
Opaque handle to a ScrollEvent object.
Definition CAPI_Defines.h:110