| 1 | // Copyright © SixtyFPS GmbH <info@slint.dev> |
| 2 | // SPDX-License-Identifier: MIT |
| 3 | import { Palette, Measurements, Colors } from "../../common.slint" ; |
| 4 | import { AppState } from "../../appState.slint" ; |
| 5 | |
| 6 | export component InnerShadowRectangle inherits Rectangle { |
| 7 | in property <length> inner-shadow-blur: 7px; |
| 8 | in property <brush> inner-color: Palette.background; |
| 9 | in property <brush> inner-shadow-color: Palette.shadow-color; |
| 10 | in property <bool> nine-slice: true; |
| 11 | clip: true; |
| 12 | if nine-slice: |
| 13 | Rectangle { |
| 14 | clip: true; |
| 15 | width: 100%; |
| 16 | height: 100%; |
| 17 | background: inner-color; |
| 18 | animate background, border-color, drop-shadow-blur, drop-shadow-color { |
| 19 | duration: 0; |
| 20 | easing: ease-in-out-sine; |
| 21 | } |
| 22 | Image { |
| 23 | source: @image-url("../../images/inner-shadow-box-soft.png" , nine-slice(60)); |
| 24 | colorize: inner-shadow-color; |
| 25 | opacity: 0.6; |
| 26 | width: 100%; |
| 27 | height: 100%; |
| 28 | } |
| 29 | } |
| 30 | if !nine-slice: |
| 31 | Rectangle { |
| 32 | height: root.height; |
| 33 | width: root.width; |
| 34 | clip: true; |
| 35 | border-color: Palette.alternate-background; |
| 36 | background: inner-shadow-color; |
| 37 | Rectangle { |
| 38 | border-radius: parent.border-radius; |
| 39 | background: transparent; |
| 40 | drop-shadow-blur: inner-shadow-blur + 0.01px; |
| 41 | drop-shadow-color: inner-color; |
| 42 | width: parent.width - (inner-shadow-blur + 0.01px) * 2; |
| 43 | height: parent.height - (inner-shadow-blur + 0.01px) * 2; |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | |