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  WheelLeft = 6, /// Supported terminal only.
20  WheelRight = 7, /// Supported terminal only.
21  };
22 
23  enum Motion {
24  Released = 0,
25  Pressed = 1,
26  Moved = 2,
27  };
28 
29  // Button
30  Button button = Button::None;
31 
32  // Motion
33  Motion motion = Motion::Pressed;
34 
35  // Modifiers:
36  bool shift = false;
37  bool meta = false;
38  bool control = false;
39 
40  // Coordinates:
41  int x = 0;
42  int y = 0;
43 };
44 
45 } // namespace ftxui
46 
47 #endif /* end of include guard: FTXUI_COMPONENT_MOUSE_HPP */
A mouse event. It contains the coordinate of the mouse, the button pressed and the modifier (shift,...
Definition: mouse.hpp:11
@ WheelRight
Supported terminal only.
Definition: mouse.hpp:20
bool meta
Definition: mouse.hpp:37
Button button
Definition: mouse.hpp:30
bool shift
Definition: mouse.hpp:36
bool control
Definition: mouse.hpp:38
Motion motion
Definition: mouse.hpp:33