26 lines
No EOL
695 B
C++
26 lines
No EOL
695 B
C++
import Crafter.CppDOM;
|
|
using namespace Crafter::CppDOM;
|
|
using namespace Crafter::CppDOMBindings;
|
|
import std;
|
|
|
|
int main() {
|
|
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;
|
|
|
|
return 0;
|
|
} |