FifeGUI 0.3.0
A C++ GUI library designed for games.
mouseevent.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_MOUSEEVENT_HPP_
6#define INCLUDE_FIFECHAN_MOUSEEVENT_HPP_
7
8// Standard library includes
9#include <cstdint>
10
11// Platform config include
12#include "fifechan/platform.hpp"
13
14// Project headers (subdirs before local)
15#include "fifechan/events/inputevent.hpp"
16
17namespace fcn
18{
19 class Gui;
20 class Widget;
21
25 class FIFEGUI_API MouseEvent : public InputEvent
26 {
27 public:
31 enum class Type : std::uint8_t
32 {
33 Moved = 0,
34 Pressed,
35 Released,
36 WheelMovedDown,
37 WheelMovedUp,
38 WheelMovedRight,
39 WheelMovedLeft,
40 Clicked,
41 Entered,
42 Exited,
43 Dragged
44 };
45
49 enum class Button : std::uint8_t
50 {
51 Empty = 0,
52 Left,
53 Middle,
54 Right,
55 X1,
56 X2
57 };
58
76 Widget* source,
77 Widget* distributor,
78 bool isShiftPressed,
79 bool isControlPressed,
80 bool isAltPressed,
81 bool isMetaPressed,
83 MouseEvent::Button button,
84 int x,
85 int y,
86 int clickCount);
87
93 MouseEvent::Button getButton() const;
94
104 int getX() const;
105
115 int getY() const;
116
124 int getClickCount() const;
125
131 MouseEvent::Type getType() const;
132
133 protected:
138
143
147 int mX = 0;
148
152 int mY = 0;
153
159
169 friend class Gui;
170 };
171} // namespace fcn
172
173#endif // INCLUDE_FIFECHAN_MOUSEEVENT_HPP_
The central GUI manager.
Definition gui.hpp:108
InputEvent(Widget *source, Widget *distributor, bool isShiftPressed, bool isControlPressed, bool isAltPressed, bool isMetaPressed)
Constructor.
Represents a mouse event.
friend class Gui
Grants Gui privileged access to internal state.
int mClickCount
The number of clicks generated with the same button.
MouseEvent::Button mButton
Holds the button of the mouse event.
Button
Mouse button types.
int mY
Holds the y-coordinate of the mouse event.
MouseEvent::Type mType
Holds the type of the mouse event.
MouseEvent(Widget *source, Widget *distributor, bool isShiftPressed, bool isControlPressed, bool isAltPressed, bool isMetaPressed, MouseEvent::Type type, MouseEvent::Button button, int x, int y, int clickCount)
Constructor.
Type
Mouse event types.
int mX
Holds the x-coordinate of the mouse event.
Abstract base class defining the common behavior, properties, and lifecycle of all GUI elements.
Definition widget.hpp:56
Used replacement tokens by configure_file():