mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-30 05:44:52 +00:00

* Added TodoMVC example (Rust mock version) * TodoMVC: use visible-width instead of width for selection items and format * TodoMVC: layout fix for qt checkbox * TdodoMVC: fix license issues in the example * Update examples/todo_mvc/ui/views/task_list_view.slint Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * TdodoMVC: fix license issues in the example * TodoMVC: code review changes * TodoMVC: code review changes * Update .reuse/dep5 Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev> * Update examples/todo_mvc/rust/src/adapters/navigation_adapter.rs Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev> * Update examples/todo_mvc/rust/src/adapters/navigation_adapter.rs Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev> * TodoMVC: refactor task list model (code review feedback) * TodoMVC: code review feedback * Update examples/todo-mvc/rust/src/mvc/controllers/task_list_controller.rs Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * TodoMVC: add missing link in dep5 * dep5 fix --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
45 lines
1.2 KiB
Text
45 lines
1.2 KiB
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import { SizeSettings, SpaceSettings, FontSettings, TodoPalette } from "styling.slint";
|
|
import { FocusTouchArea } from "focus_touch_area.slint";
|
|
import { StateLayer } from "./state_layer.slint";
|
|
|
|
export component TextButton {
|
|
callback clicked;
|
|
|
|
in property <string> text;
|
|
|
|
vertical-stretch: 0;
|
|
forward-focus: touch-area;
|
|
min-width: content-layer.min-width;
|
|
min-height: max(content-layer.min-height, SizeSettings.control-height);
|
|
|
|
touch-area := FocusTouchArea {
|
|
width: 100%;
|
|
height: 100%;
|
|
|
|
clicked => {
|
|
root.clicked();
|
|
}
|
|
}
|
|
|
|
StateLayer {
|
|
width: 100%;
|
|
height: 100%;
|
|
pressed: touch-area.pressed || touch-area.enter-pressed;
|
|
has-focus: touch-area.has-focus;
|
|
has-hover: touch-area.has-hover;
|
|
}
|
|
|
|
content-layer := HorizontalLayout {
|
|
Text {
|
|
text: root.text;
|
|
horizontal-alignment: left;
|
|
vertical-alignment: center;
|
|
font-size: FontSettings.body.font-size;
|
|
font-weight: FontSettings.body.font-weight;
|
|
color: TodoPalette.foreground;
|
|
}
|
|
}
|
|
}
|