// Copyright © SixtyFPS GmbH // SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial) import { SpinBox, Button, CheckBox, Slider, LineEdit, ScrollView, ListView, HorizontalBox, VerticalBox, GridBox } from "sixtyfps_widgets.60"; export struct TodoItem := { title: string, checked: bool, } MainWindow := Window { preferred-width: 400px; preferred-height: 600px; callback todo-added(string); callback remove-done(); property <[TodoItem]> todo-model: [ { title: "Implement the .60 file", checked: true }, { title: "Do the Rust part", checked: false }, { title: "Make the C++ code", checked: false }, { title: "Write some JavaScript code", checked: false }, { title: "Test the application", checked: false }, { title: "Ship to customer", checked: false }, { title: "???", checked: false }, { title: "Profit", checked: false }, ]; VerticalBox { HorizontalBox { text-edit := LineEdit { placeholder-text: "What needs to be done?"; accepted(text) => { todo-added(text); self.text = ""; } } btn := Button { text: "Add New Entry"; enabled: text-edit.text != ""; clicked => { todo-added(text-edit.text); text-edit.text = ""; } } } list-view := ListView { for todo in todo-model: HorizontalLayout { CheckBox { text: todo.title; checked: todo.checked; toggled => { todo.checked = checked; } } } } HorizontalBox { alignment: end; Button { text: "Remove Done Items"; clicked => { root.remove-done(); } } } } }