FifeGUI 0.2.0
A C++ GUI library designed for games.
dragevent.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
2// SPDX-FileCopyrightText: 2013 - 2026 Fifeengine contributors
3
4// Corresponding header include
5#include "fifechan/events/dragevent.hpp"
6
7// Standard library includes
8#include <cassert>
9
10// Platform config include
11#include "fifechan/platform.hpp"
12
13namespace fcn
14{
16 Widget* source, DragPayload const * payload, Type type, int x, int y, int screenX, int screenY) :
17 Event(source), mType(type), mPayload(payload), mX(x), mY(y), mScreenX(screenX), mScreenY(screenY)
18 {
19 assert(
20 "Type must be valid" && (type == Type::Enter || type == Type::Leave || type == Type::Hover ||
21 type == Type::Drop || type == Type::Cancel));
22 (void)source;
23 }
24
26 {
27 return mType;
28 }
30 {
31 return mPayload;
32 }
33 int DragEvent::getX() const
34 {
35 return mX;
36 }
37 int DragEvent::getY() const
38 {
39 return mY;
40 }
42 {
43 return mScreenX;
44 }
46 {
47 return mScreenY;
48 }
49
50} // namespace fcn
Type mType
The event type.
Definition dragevent.hpp:76
int mX
X coordinate relative to the widget.
Definition dragevent.hpp:86
int getScreenY() const
Get the Y coordinate on the screen.
Definition dragevent.cpp:45
int mY
Y coordinate relative to the widget.
Definition dragevent.hpp:91
int mScreenY
Y coordinate on the screen.
Type getType() const
Get the event type.
Definition dragevent.cpp:25
int mScreenX
X coordinate on the screen.
Definition dragevent.hpp:96
DragPayload const * getPayload() const
Get the payload for this event.
Definition dragevent.cpp:29
Type
Event for drag and drop actions.
Definition dragevent.hpp:29
int getX() const
Get the X coordinate relative to the widget.
Definition dragevent.cpp:33
DragPayload const * mPayload
The associated payload for this event.
Definition dragevent.hpp:81
int getY() const
Get the Y coordinate relative to the widget.
Definition dragevent.cpp:37
DragEvent(Widget *source, DragPayload const *payload, Type type, int x, int y, int screenX, int screenY)
Construct a drag event.
Definition dragevent.cpp:15
int getScreenX() const
Get the X coordinate on the screen.
Definition dragevent.cpp:41
Container for arbitrary data carried during a drag operation.
Definition dragdrop.hpp:83
Event(Widget *source)
Constructor.
Definition event.cpp:16
Abstract base class defining the common behavior, properties, and lifecycle of all GUI elements.
Definition widget.hpp:55
Used replacement tokens by configure_file():