FTXUI
5.0.0
C++ functional terminal UI.
mouse.hpp
Go to the documentation of this file.
1
// Copyright 2020 Arthur Sonzogni. All rights reserved.
2
// Use of this source code is governed by the MIT license that can be found in
3
// the LICENSE file.
4
#ifndef FTXUI_COMPONENT_MOUSE_HPP
5
#define FTXUI_COMPONENT_MOUSE_HPP
6
namespace
ftxui
{
7
8
/// @brief A mouse event. It contains the coordinate of the mouse, the button
9
/// pressed and the modifier (shift, ctrl, meta).
10
/// @ingroup component
11
struct
Mouse
{
12
enum
Button
{
13
Left
= 0,
14
Middle
= 1,
15
Right
= 2,
16
None
= 3,
17
WheelUp
= 4,
18
WheelDown
= 5,
19
};
20
21
enum
Motion
{
22
Released
= 0,
23
Pressed
= 1,
24
};
25
26
// Utility function to check the variations of the mouse state.
27
bool
IsPressed
(
Button
btn =
Left
)
const
;
// Released => Pressed.
28
bool
IsHeld
(
Button
btn =
Left
)
const
;
// Pressed => Pressed.
29
bool
IsReleased
(
Button
btn =
Left
)
const
;
// Pressed => Released.
30
31
// Button
32
Button
button
= Button::None;
33
34
// Motion
35
Motion
motion
= Motion::Pressed;
36
37
// Modifiers:
38
bool
shift
=
false
;
39
bool
meta
=
false
;
40
bool
control
=
false
;
41
42
// Coordinates:
43
int
x
= 0;
44
int
y
= 0;
45
46
// Previous mouse event, if any.
47
Mouse
*
previous
=
nullptr
;
48
};
49
50
}
// namespace ftxui
51
52
#endif
/* end of include guard: FTXUI_COMPONENT_MOUSE_HPP */
ftxui
Definition:
animation.hpp:12
ftxui::Mouse
A mouse event. It contains the coordinate of the mouse, the button pressed and the modifier (shift,...
Definition:
mouse.hpp:11
ftxui::Mouse::Button
Button
Definition:
mouse.hpp:12
ftxui::Mouse::Middle
@ Middle
Definition:
mouse.hpp:14
ftxui::Mouse::Left
@ Left
Definition:
mouse.hpp:13
ftxui::Mouse::WheelUp
@ WheelUp
Definition:
mouse.hpp:17
ftxui::Mouse::None
@ None
Definition:
mouse.hpp:16
ftxui::Mouse::Right
@ Right
Definition:
mouse.hpp:15
ftxui::Mouse::WheelDown
@ WheelDown
Definition:
mouse.hpp:18
ftxui::Mouse::Motion
Motion
Definition:
mouse.hpp:21
ftxui::Mouse::Pressed
@ Pressed
Definition:
mouse.hpp:23
ftxui::Mouse::Released
@ Released
Definition:
mouse.hpp:22
ftxui::Mouse::y
int y
Definition:
mouse.hpp:44
ftxui::Mouse::meta
bool meta
Definition:
mouse.hpp:39
ftxui::Mouse::x
int x
Definition:
mouse.hpp:43
ftxui::Mouse::IsHeld
bool IsHeld(Button btn=Left) const
Definition:
mouse.cpp:25
ftxui::Mouse::previous
Mouse * previous
Definition:
mouse.hpp:47
ftxui::Mouse::button
Button button
Definition:
mouse.hpp:32
ftxui::Mouse::IsPressed
bool IsPressed(Button btn=Left) const
Definition:
mouse.cpp:18
ftxui::Mouse::shift
bool shift
Definition:
mouse.hpp:38
ftxui::Mouse::control
bool control
Definition:
mouse.hpp:40
ftxui::Mouse::IsReleased
bool IsReleased(Button btn=Left) const
Definition:
mouse.cpp:32
ftxui::Mouse::motion
Motion motion
Definition:
mouse.hpp:35