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_MouseEvent.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_MouseEvent.h
8
///
9
/// Mouse event interface.
10
///
11
/// `#include <Ultralight/CAPI/CAPI_MouseEvent.h>`
12
///
13
/// This file defines the C API for mouse events.
14
///
15
#ifndef ULTRALIGHT_CAPI_MOUSEEVENT_H
16
#define ULTRALIGHT_CAPI_MOUSEEVENT_H
17
18
#include <
Ultralight/CAPI/CAPI_Defines.h
>
19
20
#ifdef __cplusplus
21
extern
"C"
{
22
#endif
23
24
/******************************************************************************
25
* Mouse Event
26
*****************************************************************************/
27
28
///
29
/// Create a mouse event.
30
///
31
/// Modifier keys reported to the page come from the last key event fired on the View, so you
32
/// should forward modifier key presses and releases as key events. A right-button click also
33
/// fires `contextmenu` on the page (after the release on Windows, after the press elsewhere); the
34
/// library shows no menu of its own.
35
///
36
/// @param type The type of mouse event.
37
/// @param x The current x-position of the mouse, in logical pixels relative to the View.
38
/// @param y The current y-position of the mouse, in logical pixels relative to the View.
39
/// @param button The mouse button that was pressed/released, if any.
40
///
41
/// @return Returns a new ULMouseEvent instance. You must call ulDestroyMouseEvent() when finished.
42
///
43
ULExport
ULMouseEvent
ulCreateMouseEvent
(
ULMouseEventType
type,
int
x,
int
y,
ULMouseButton
button);
44
45
///
46
/// Destroy a mouse event created by ulCreateMouseEvent().
47
///
48
ULExport
void
ulDestroyMouseEvent
(
ULMouseEvent
evt);
49
50
///
51
/// Get the type of a mouse event.
52
///
53
/// @param evt The mouse event.
54
///
55
/// @return Returns the type of mouse event (see ULMouseEventType).
56
///
57
ULExport
ULMouseEventType
ulMouseEventGetType
(
ULMouseEvent
evt);
58
59
///
60
/// Get the x-position of the mouse.
61
///
62
/// @param evt The mouse event.
63
///
64
/// @return Returns the x-position, in logical pixels relative to the View.
65
///
66
ULExport
int
ulMouseEventGetX
(
ULMouseEvent
evt);
67
68
///
69
/// Get the y-position of the mouse.
70
///
71
/// @param evt The mouse event.
72
///
73
/// @return Returns the y-position, in logical pixels relative to the View.
74
///
75
ULExport
int
ulMouseEventGetY
(
ULMouseEvent
evt);
76
77
///
78
/// Get the mouse button that was pressed or released.
79
///
80
/// @param evt The mouse event.
81
///
82
/// @return Returns the button, or kMouseButton_None if no button changed state.
83
///
84
ULExport
ULMouseButton
ulMouseEventGetButton
(
ULMouseEvent
evt);
85
86
#ifdef __cplusplus
87
}
// extern "C"
88
#endif
89
90
#endif
// ULTRALIGHT_CAPI_MOUSEEVENT_H
ulMouseEventGetY
int ulMouseEventGetY(ULMouseEvent evt)
Get the y-position of the mouse.
ulCreateMouseEvent
ULMouseEvent ulCreateMouseEvent(ULMouseEventType type, int x, int y, ULMouseButton button)
Create a mouse event.
ulMouseEventGetX
int ulMouseEventGetX(ULMouseEvent evt)
Get the x-position of the mouse.
ulDestroyMouseEvent
void ulDestroyMouseEvent(ULMouseEvent evt)
Destroy a mouse event created by ulCreateMouseEvent().
ulMouseEventGetType
ULMouseEventType ulMouseEventGetType(ULMouseEvent evt)
Get the type of a mouse event.
ulMouseEventGetButton
ULMouseButton ulMouseEventGetButton(ULMouseEvent evt)
Get the mouse button that was pressed or released.
CAPI_Defines.h
Various defines and utility functions for the C API.
ULExport
#define ULExport
Definition
CAPI_Defines.h:42
ULMouseEventType
ULMouseEventType
The various MouseEvent types.
Definition
CAPI_Defines.h:280
ULMouseButton
ULMouseButton
The various mouse button types.
Definition
CAPI_Defines.h:296
ULMouseEvent
struct C_MouseEvent * ULMouseEvent
Opaque handle to a MouseEvent object.
Definition
CAPI_Defines.h:107
Ultralight
CAPI
CAPI_MouseEvent.h
Docs
C++ API
C API
Version
2.0
2.0
latest
1.4