Change C++ API to use the ComponentHandle

This commit is contained in:
Olivier Goffart 2020-11-10 19:28:34 +01:00
parent 8f362ead43
commit d6a440aa4a
65 changed files with 222 additions and 141 deletions

View file

@ -11,7 +11,7 @@ LICENSE END */
int main()
{
static MainWindow demo;
auto demo = MainWindow::create();
auto todo_model = std::make_shared<sixtyfps::VectorModel<TodoItem>>(std::vector {
TodoItem { true, "Implement the .60 file" },
@ -23,13 +23,13 @@ int main()
TodoItem { false, "???" },
TodoItem { false, "Profit" }
});
demo.set_todo_model(todo_model);
demo->set_todo_model(todo_model);
demo.on_todo_added([todo_model](const sixtyfps::SharedString &s) {
demo->on_todo_added([todo_model](const sixtyfps::SharedString &s) {
todo_model->push_back(TodoItem { false, s });
});
demo.on_remove_done([todo_model] {
demo->on_remove_done([todo_model] {
int offset = 0;
int count = todo_model->row_count();
for (int i = 0; i < count; ++i) {
@ -40,5 +40,5 @@ int main()
}
});
demo.run();
demo->run();
}