mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-22 16:22:17 +00:00
These are showing off use-cases for Slint, but they're not examples showing individual Slint features. Also removed the old printerdemo while at it.
37 lines
849 B
Text
37 lines
849 B
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import { Theme } from "../theme.slint";
|
|
|
|
export component IconButton {
|
|
in property <image> icon <=> i-icon.source;
|
|
in property <bool> enabled <=> i-touch-area.enabled;
|
|
|
|
callback clicked <=> i-touch-area.clicked;
|
|
|
|
vertical-stretch: 0;
|
|
horizontal-stretch: 0;
|
|
min-width: 24px;
|
|
min-height: 24px;
|
|
|
|
states [
|
|
disabled when !root.enabled : {
|
|
opacity: 0.25;
|
|
}
|
|
pressed when i-touch-area.pressed : {
|
|
i-icon.colorize: Theme.palette.lemon-green;
|
|
}
|
|
]
|
|
|
|
GridLayout {
|
|
padding: 4px;
|
|
|
|
i-icon := Image {
|
|
colorize: Theme.palette.slint-blue-300;
|
|
|
|
animate colorize { duration: Theme.durations.medium; }
|
|
}
|
|
}
|
|
|
|
i-touch-area := TouchArea {}
|
|
}
|