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
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
#pragma once
6
#include <
Ultralight/Defines.h
>
7
8
namespace
ultralight
{
9
10
///
11
/// Mouse event representing a change in mouse state.
12
///
13
/// \parblock
14
/// @note Coordinates are logical pixels: the View's device scale is not applied to them, so
15
/// they run over View::width() and View::height() divided by View::device_scale().
16
/// Convert from your window's device pixels before firing the event.
17
/// \endparblock
18
///
19
/// \parblock
20
/// @note Modifier keys reported to the page (eg, `shiftKey`) come from the last KeyEvent fired
21
/// on the View, so you should forward modifier key presses and releases as key events.
22
/// \endparblock
23
///
24
/// @see View::FireMouseEvent()
25
///
26
class
MouseEvent
{
27
public
:
28
///
29
/// The various MouseEvent types.
30
///
31
enum
Type
{
32
///
33
/// Mouse moved type
34
///
35
kType_MouseMoved
,
36
37
///
38
/// Mouse button pressed type
39
///
40
kType_MouseDown
,
41
42
///
43
/// Mouse button released type
44
///
45
kType_MouseUp
,
46
};
47
48
///
49
/// The various mouse button types.
50
///
51
enum
Button
{
52
kButton_None
= 0,
53
kButton_Left
,
54
kButton_Middle
,
55
56
///
57
/// The right button. A right-button click also fires `contextmenu` on the page (after the
58
/// release on Windows, after the press elsewhere); the library shows no menu of its own.
59
///
60
kButton_Right
,
61
62
///
63
/// The first side button ("back"), eg, X1 on Windows. Reaches the page as
64
/// `MouseEvent.button` 3; the library performs no history navigation of its own.
65
///
66
kButton_Back
,
67
68
///
69
/// The second side button ("forward"), eg, X2 on Windows. Reaches the page as
70
/// `MouseEvent.button` 4; the library performs no history navigation of its own.
71
///
72
kButton_Forward
,
73
};
74
75
///
76
/// The type of this MouseEvent
77
///
78
Type
type
;
79
80
///
81
/// The current x-position of the mouse, in logical pixels relative to the View.
82
///
83
int
x
;
84
85
///
86
/// The current y-position of the mouse, in logical pixels relative to the View.
87
///
88
int
y
;
89
90
///
91
/// The mouse button that was pressed/released, if any.
92
///
93
Button
button
;
94
};
95
96
}
// namespace ultralight
Defines.h
ultralight::MouseEvent
Mouse event representing a change in mouse state.
Definition
MouseEvent.h:26
ultralight::MouseEvent::Button
Button
The various mouse button types.
Definition
MouseEvent.h:51
ultralight::MouseEvent::kButton_Forward
@ kButton_Forward
The second side button ("forward"), eg, X2 on Windows.
Definition
MouseEvent.h:72
ultralight::MouseEvent::kButton_None
@ kButton_None
Definition
MouseEvent.h:52
ultralight::MouseEvent::kButton_Back
@ kButton_Back
The first side button ("back"), eg, X1 on Windows.
Definition
MouseEvent.h:66
ultralight::MouseEvent::kButton_Middle
@ kButton_Middle
Definition
MouseEvent.h:54
ultralight::MouseEvent::kButton_Left
@ kButton_Left
Definition
MouseEvent.h:53
ultralight::MouseEvent::kButton_Right
@ kButton_Right
The right button.
Definition
MouseEvent.h:60
ultralight::MouseEvent::y
int y
The current y-position of the mouse, in logical pixels relative to the View.
Definition
MouseEvent.h:88
ultralight::MouseEvent::Type
Type
The various MouseEvent types.
Definition
MouseEvent.h:31
ultralight::MouseEvent::kType_MouseMoved
@ kType_MouseMoved
Mouse moved type.
Definition
MouseEvent.h:35
ultralight::MouseEvent::kType_MouseDown
@ kType_MouseDown
Mouse button pressed type.
Definition
MouseEvent.h:40
ultralight::MouseEvent::kType_MouseUp
@ kType_MouseUp
Mouse button released type.
Definition
MouseEvent.h:45
ultralight::MouseEvent::x
int x
The current x-position of the mouse, in logical pixels relative to the View.
Definition
MouseEvent.h:83
ultralight::MouseEvent::button
Button button
The mouse button that was pressed/released, if any.
Definition
MouseEvent.h:93
ultralight::MouseEvent::type
Type type
The type of this MouseEvent.
Definition
MouseEvent.h:78
ultralight
Root namespace for every public Ultralight type, function, and enumeration.
Ultralight
MouseEvent.h
Docs
C++ API
C API
Version
2.0
2.0
latest
1.4