2025-11-10 21:31:06 +01:00
|
|
|
import Crafter.CppDOM;
|
2025-11-12 20:45:35 +01:00
|
|
|
using namespace Crafter::CppDOM;
|
|
|
|
|
using namespace Crafter::CppDOMBindings;
|
2025-11-10 21:31:06 +01:00
|
|
|
import std;
|
|
|
|
|
|
|
|
|
|
int main() {
|
2025-11-12 20:45:35 +01:00
|
|
|
HtmlElementView body("body");
|
|
|
|
|
body.SetInnerHTML("<h1>All Event Handling</h1>");
|
|
|
|
|
|
|
|
|
|
HtmlElementView div("div");
|
|
|
|
|
div.SetInnerHTML("<p>Click me!</p>");
|
|
|
|
|
div.SetStyle("padding: 20px; background-color: lightblue; cursor: pointer;");
|
|
|
|
|
|
|
|
|
|
// Add click handler
|
|
|
|
|
div.AddClickListener([](Crafter::MouseEvent e) {
|
|
|
|
|
std::cout << "Clicked!" << std::endl;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
body.AddChild(div);
|
|
|
|
|
|
|
|
|
|
// Demonstrate new bindings
|
|
|
|
|
std::string path = GetPathNameString();
|
|
|
|
|
std::cout << "Current path: " << path << std::endl;
|
|
|
|
|
|
2025-11-10 21:31:06 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|