slint/examples/cpptest/main.cpp
Simon Hausmann 8f613685ba Expose a ComponentWindow in C++
This paves a way for a more modular API.
2020-06-17 19:15:18 +02:00

22 lines
545 B
C++

#include "hello.h"
#include <iostream>
int main()
{
static Hello component;
component.foobar.set_handler([](auto...) { std::cout << "Hello from C++" << std::endl; });
component.plus_clicked.set_handler([](auto ctx) {
auto &counter = component.counter;
counter.set(counter.get(ctx) + 1);
});
component.minus_clicked.set_handler([](auto ctx) {
auto &counter = component.counter;
counter.set(counter.get(ctx) - 1);
});
sixtyfps::ComponentWindow window;
window.run(&component);
}