This commit is contained in:
Jorijn van der Graaf 2025-11-10 22:06:27 +01:00
commit 224dc563e9
9 changed files with 200 additions and 46 deletions

View file

@ -105,4 +105,35 @@ export namespace Crafter::CppDOMBindings {
__attribute__((import_module("env"), import_name("addDragLeaveListener"))) void AddDragLeaveListener(void* ptr, int id);
__attribute__((import_module("env"), import_name("removeDragLeaveListener"))) void RemoveDragLeaveListener(void* ptr, int id);
// Style functions
__attribute__((import_module("env"), import_name("setStyle"))) void SetStyle(void* ptr, const char* style, std::size_t styleLength);
void SetStyle(void* ptr, const std::string_view style) {
SetStyle(ptr, style.data(), style.size());
}
__attribute__((import_module("env"), import_name("setProperty"))) void SetProperty(void* ptr, const char* property, std::size_t propertyLength, const char* value, std::size_t valueLength);
void SetProperty(void* ptr, const std::string_view property, const std::string_view value) {
SetProperty(ptr, property.data(), property.size(), value.data(), value.size());
}
__attribute__((import_module("env"), import_name("addClass"))) void AddClass(void* ptr, const char* className, std::size_t classNameLength);
void AddClass(void* ptr, const std::string_view className) {
AddClass(ptr, className.data(), className.size());
}
__attribute__((import_module("env"), import_name("removeClass"))) void RemoveClass(void* ptr, const char* className, std::size_t classNameLength);
void RemoveClass(void* ptr, const std::string_view className) {
RemoveClass(ptr, className.data(), className.size());
}
__attribute__((import_module("env"), import_name("toggleClass"))) void ToggleClass(void* ptr, const char* className, std::size_t classNameLength);
void ToggleClass(void* ptr, const std::string_view className) {
ToggleClass(ptr, className.data(), className.size());
}
__attribute__((import_module("env"), import_name("hasClass"))) bool HasClass(void* ptr, const char* className, std::size_t classNameLength);
bool HasClass(void* ptr, const std::string_view className) {
return HasClass(ptr, className.data(), className.size());
}
}