This commit is contained in:
Jorijn van der Graaf 2025-11-12 16:25:12 +01:00
commit b96faacf89
4 changed files with 39 additions and 0 deletions

View file

@ -62,6 +62,21 @@ namespace Crafter {
return CppDOMBindings::HasClass(ptr, className);
}
std::string HtmlElementView::GetValue() {
const char* value = CppDOMBindings::GetValue(ptr);
if(value != nullptr) {
std::string result(value);
std::free(value);
return result;
} else {
return "";
}
}
void HtmlElementView::SetValue(const std::string_view value) {
CppDOMBindings::SetValue(ptr, value);
}
std::int32_t HtmlElementView::AddClickListener(std::function<void(Crafter::MouseEvent)> callback) {
std::int32_t id = CppDOMBindings::clickHandlerMaxId++;
clickHandlers.push_back(id);