docs
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
19
20#ifdef __cplusplus
21extern "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///
44
45///
46/// Destroy a mouse event created by ulCreateMouseEvent().
47///
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///
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///
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///
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///
85
86#ifdef __cplusplus
87} // extern "C"
88#endif
89
90#endif // ULTRALIGHT_CAPI_MOUSEEVENT_H
int ulMouseEventGetY(ULMouseEvent evt)
Get the y-position of the mouse.
ULMouseEvent ulCreateMouseEvent(ULMouseEventType type, int x, int y, ULMouseButton button)
Create a mouse event.
int ulMouseEventGetX(ULMouseEvent evt)
Get the x-position of the mouse.
void ulDestroyMouseEvent(ULMouseEvent evt)
Destroy a mouse event created by ulCreateMouseEvent().
ULMouseEventType ulMouseEventGetType(ULMouseEvent evt)
Get the type of a mouse event.
ULMouseButton ulMouseEventGetButton(ULMouseEvent evt)
Get the mouse button that was pressed or released.
Various defines and utility functions for the C API.
#define ULExport
Definition CAPI_Defines.h:42
ULMouseEventType
The various MouseEvent types.
Definition CAPI_Defines.h:280
ULMouseButton
The various mouse button types.
Definition CAPI_Defines.h:296
struct C_MouseEvent * ULMouseEvent
Opaque handle to a MouseEvent object.
Definition CAPI_Defines.h:107