working keydown

This commit is contained in:
Jorijn van der Graaf 2025-11-10 20:02:11 +01:00
commit 6210e9c99b
12 changed files with 975 additions and 401 deletions

View file

@ -0,0 +1,73 @@
/*
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;
};
struct InputEvent {
std::string data;
bool isComposing;
};
struct WheelEvent : public MouseEvent {
double deltaX;
double deltaY;
double deltaZ;
};
struct ResizeEvent {
std::uint_fast32_t width;
std::uint_fast32_t height;
};
struct ScrollEvent {
double scrollX;
double scrollY;
};
struct ChangeEvent {
std::string value;
};
}