79 lines
No EOL
3.1 KiB
C++
79 lines
No EOL
3.1 KiB
C++
/*
|
|
Crafter.CppDOM
|
|
Copyright (C) 2025 Catcrafts
|
|
Catcrafts.net
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 3.0 of the License, or (at your option) any later version.
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with this library; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
export module Crafter.CppDOM:EventTypes;
|
|
import std;
|
|
|
|
export namespace Crafter {
|
|
struct KeyboardEvent {
|
|
std::string key;
|
|
std::uint_fast8_t keyCode;
|
|
bool altKey;
|
|
bool ctrlKey;
|
|
bool shiftKey;
|
|
bool metaKey;
|
|
KeyboardEvent(const char* key, std::int32_t keyCode, bool altKey, bool ctrlKey, bool shiftKey, bool metaKey) : key(key), keyCode(keyCode), altKey(altKey), ctrlKey(ctrlKey), shiftKey(shiftKey), metaKey(metaKey) {}
|
|
};
|
|
|
|
// Mouse event structure
|
|
struct MouseEvent {
|
|
double clientX;
|
|
double clientY;
|
|
double screenX;
|
|
double screenY;
|
|
std::uint_fast32_t button;
|
|
std::uint_fast32_t buttons;
|
|
bool altKey;
|
|
bool ctrlKey;
|
|
bool shiftKey;
|
|
bool metaKey;
|
|
MouseEvent(double clientX, double clientY, double screenX, double screenY, std::uint_fast32_t button, std::uint_fast32_t buttons, bool altKey, bool ctrlKey, bool shiftKey, bool metaKey) : clientX(clientX), clientY(clientY), screenX(screenX), screenY(screenY), button(button), buttons(buttons), altKey(altKey), ctrlKey(ctrlKey), shiftKey(shiftKey), metaKey(metaKey) {}
|
|
};
|
|
|
|
struct InputEvent {
|
|
std::string data;
|
|
bool isComposing;
|
|
InputEvent(const char* data, bool isComposing) : data(data), isComposing(isComposing) {}
|
|
};
|
|
|
|
struct WheelEvent : public MouseEvent {
|
|
double deltaX;
|
|
double deltaY;
|
|
double deltaZ;
|
|
WheelEvent(double clientX, double clientY, double screenX, double screenY, std::uint_fast32_t button, std::uint_fast32_t buttons, bool altKey, bool ctrlKey, bool shiftKey, bool metaKey, double deltaX, double deltaY, double deltaZ): MouseEvent(clientX, clientY, screenX, screenY, button, buttons, altKey, ctrlKey, shiftKey, metaKey), deltaX(deltaX), deltaY(deltaY), deltaZ(deltaZ) {}
|
|
};
|
|
|
|
struct ResizeEvent {
|
|
std::uint_fast32_t width;
|
|
std::uint_fast32_t height;
|
|
ResizeEvent(std::uint_fast32_t width, std::uint_fast32_t height) : width(width), height(height) {}
|
|
};
|
|
|
|
struct ScrollEvent {
|
|
double scrollX;
|
|
double scrollY;
|
|
ScrollEvent(double scrollX, double scrollY) : scrollX(scrollX), scrollY(scrollY) {}
|
|
};
|
|
|
|
struct ChangeEvent {
|
|
std::string value;
|
|
ChangeEvent(const char* value) : value(value) {}
|
|
};
|
|
} |