Terminal++ 4.0.3.9
A C++ library for interacting with ANSI terminal windows
Loading...
Searching...
No Matches
mouse.hpp
1#pragma once
2
3#include "terminalpp/point.hpp"
4#include "terminalpp/virtual_key.hpp"
5
6#include <iosfwd>
7#include <optional>
8
9namespace terminalpp::mouse {
10
11enum class button : byte
12{
13 none,
14 left,
15 middle,
16 right,
17 unknown,
18 scrollwheel_up,
19 scrollwheel_down,
20 scrollwheel_right,
21 scrollwheel_left,
22 button_8,
23 button_9,
24 button_10,
25 button_11,
26};
27
28enum class event_type : byte
29{
30 left_button_down,
31 middle_button_down,
32 right_button_down,
33 button_up,
34 no_button_change,
35 scrollwheel_up,
36 scrollwheel_down,
37};
38
39//* =========================================================================
41//* =========================================================================
43{
44 //* =====================================================================
46 //* =====================================================================
47 event_type action_ = event_type::no_button_change;
48
49 //* =====================================================================
51 //* =====================================================================
53
54 button button_ = button::none;
55 std::optional<std::uint16_t> button_code_;
56 terminalpp::vk_modifier modifiers_ = terminalpp::vk_modifier::none;
57 bool is_motion_ = false;
58 bool is_release_ = false;
59
60 //* =====================================================================
62 //* =====================================================================
63 [[nodiscard]] constexpr friend auto operator<=>(
64 event const &lhs, event const &rhs) noexcept = default;
65};
66
67//* =========================================================================
69//* =========================================================================
71std::ostream &operator<<(std::ostream &out, event const &ev);
72
73} // namespace terminalpp::mouse
A structure representing an ANSI graphics effect (e.g. intensity, underlining)
Definition effect.hpp:27
A structure that encapsulates a mouse event.
Definition mouse.hpp:43
point position_
The position of the mouse in this event.
Definition mouse.hpp:52
constexpr friend auto operator<=>(event const &lhs, event const &rhs) noexcept=default
Relational operators for events.
A class that represents a position in space.
Definition point.hpp:17