FifeGUI 0.2.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#include <cstdint>
9
10#include "fifechan/inputevent.hpp"
11#include "fifechan/platform.hpp"
12
13namespace fcn
14{
15 class Gui;
16 class Widget;
17
21 class FIFEGUI_API MouseEvent : public InputEvent
22 {
23 public:
27 enum class Type : std::uint8_t
28 {
29 Moved = 0,
30 Pressed,
31 Released,
32 WheelMovedDown,
33 WheelMovedUp,
34 WheelMovedRight,
35 WheelMovedLeft,
36 Clicked,
37 Entered,
38 Exited,
39 Dragged
40 };
41
45 enum class Button : std::uint8_t
46 {
47 Empty = 0,
48 Left,
49 Middle,
50 Right,
51 X1,
52 X2
53 };
54
72 Widget* source,
73 Widget* distributor,
74 bool isShiftPressed,
75 bool isControlPressed,
76 bool isAltPressed,
77 bool isMetaPressed,
79 MouseEvent::Button button,
80 int x,
81 int y,
82 int clickCount);
83
89 MouseEvent::Button getButton() const;
90
99 int getX() const;
100
109 int getY() const;
110
117 int getClickCount() const;
118
124 MouseEvent::Type getType() const;
125
126 protected:
131
136
140 int mX = 0;
141
145 int mY = 0;
146
152
161 friend class Gui;
162 };
163} // namespace fcn
164
165#endif // INCLUDE_FIFECHAN_MOUSEEVENT_HPP_
The central GUI manager.
Definition gui.hpp:101
InputEvent(Widget *source, Widget *distributor, bool isShiftPressed, bool isControlPressed, bool isAltPressed, bool isMetaPressed)
Constructor.
Represents a mouse event.
friend class Gui
Gui is a friend of this class in order to be able to manipulate the protected member variables of thi...
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:45