FifeGUI 0.3.0
A C++ GUI library designed for games.
mouseinput.hpp
1// SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
2// SPDX-FileCopyrightText: 2004 - 2008 Olof Naessén and Per Larsson
3// SPDX-FileCopyrightText: 2013 - 2026 Fifengine contributors
4
5#ifndef INCLUDE_FIFECHAN_MOUSEINPUT_HPP_
6#define INCLUDE_FIFECHAN_MOUSEINPUT_HPP_
7
8// Standard library includes
9#include <cstdint>
10
11// Platform config include
12#include "fifechan/platform.hpp"
13
14namespace fcn
15{
16
25 class FIFEGUI_API MouseInput
26 {
27 public:
28 MouseInput() = default;
29
31 enum class Type : std::uint8_t
32 {
33 Moved = 0,
34 Pressed,
35 Released,
36 WheelMovedDown,
37 WheelMovedUp,
38 WheelMovedRight,
39 WheelMovedLeft
40 };
41
43 enum class Button : std::uint8_t
44 {
45 Empty = 0,
46 Left,
47 Right,
48 Middle,
49 X1,
50 X2
51 };
52
63 MouseInput(Button button, Type type, int x, int y, int timeStamp);
64
71 void setType(Type type);
72
79 Type getType() const;
80
87 void setButton(Button button);
88
95 Button getButton() const;
96
104 void setTimeStamp(int timeStamp);
105
113 int getTimeStamp() const;
114
121 void setX(int x);
122
129 int getX() const;
130
137 void setY(int y);
138
145 int getY() const;
146
147 protected:
151 Type mType{Type::Moved};
152
156 Button mButton{Button::Empty};
157
163
167 int mX{0};
168
172 int mY{0};
173 };
174} // namespace fcn
175
176#endif // INCLUDE_FIFECHAN_MOUSEINPUT_HPP_
A standard clickable button widget.
Definition button.hpp:42
Internal class representing raw mouse input data.
Button mButton
Holds the button of the mouse input.
int mX
Holds the x coordinate of the mouse input.
int mTimeStamp
Holds the timestamp of the mouse input.
Button
Mouse button.
int mY
Holds the y coordinate of the mouse input.
Type mType
Holds the type of the mouse input.
Type
Type of mouse input.
Used replacement tokens by configure_file():