| 1 | // Copyright © SixtyFPS GmbH <info@slint.dev> |
| 2 | // SPDX-License-Identifier: MIT |
| 3 | |
| 4 | import { Palette } from "std-widgets.slint" ; |
| 5 | import { StateContainer } from "container.slint" ; |
| 6 | |
| 7 | export component IconButton { |
| 8 | callback clicked <=> state-container.clicked; |
| 9 | |
| 10 | in property <image> icon <=> icon.source; |
| 11 | |
| 12 | width: self.height; |
| 13 | min-height: 32px; |
| 14 | |
| 15 | vertical-stretch: 0; |
| 16 | horizontal-stretch: 0; |
| 17 | |
| 18 | state-container := StateContainer { |
| 19 | background: transparent; |
| 20 | border-radius: max(self.width, self.height) / 2; |
| 21 | icon := Image { |
| 22 | height: 16px; |
| 23 | colorize: Palette.foreground; |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | |