Warning, /plasma/latte-dock/declarativeimports/components/ExternalShadow.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2019 Michail Vourlakos <mvourlakos@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 import QtQuick 2.1
0007 
0008 import org.kde.plasma.core 2.0 as PlasmaCore
0009 import QtGraphicalEffects 1.0
0010 
0011 Item{
0012     id: shadowRoot
0013 
0014     property int shadowDirection: PlasmaCore.Types.BottomEdge
0015     property int shadowSize: 7
0016     property real shadowOpacity: 1
0017     property color shadowColor: "#040404"
0018 
0019     readonly property bool isHorizontal : (shadowDirection !== PlasmaCore.Types.LeftEdge) && (shadowDirection !== PlasmaCore.Types.RightEdge)
0020 
0021     readonly property int implicitWidth: shadow.width
0022     readonly property int implicitHeight: shadow.height
0023 
0024     Item{
0025         id: shadow
0026         width: isHorizontal ? shadowRoot.width + 2*shadowSize : shadowSize
0027         height: isHorizontal ? shadowSize: shadowRoot.height + 2*shadowSize
0028         opacity: shadowOpacity
0029 
0030         clip: true
0031 
0032         Rectangle{
0033             id: editShadow
0034             width: shadowRoot.width
0035             height: shadowRoot.height
0036             color: "white"
0037 
0038             layer.enabled: true
0039             layer.effect: DropShadow {
0040                 radius: shadowSize
0041                 fast: true
0042                 samples: 2 * radius
0043                 color: shadowRoot.shadowColor
0044             }
0045         }
0046 
0047         states: [
0048             ///topShadow
0049             State {
0050                 name: "topShadow"
0051                 when: (shadowDirection === PlasmaCore.Types.BottomEdge)
0052 
0053                 AnchorChanges {
0054                     target: editShadow
0055                     anchors{ top:parent.top; bottom:undefined; left:parent.left; right:undefined}
0056                 }
0057                 PropertyChanges{
0058                     target: editShadow
0059                     anchors{ leftMargin: 0; rightMargin:0; topMargin:shadowSize; bottomMargin:0}
0060                 }
0061             },
0062             ///bottomShadow
0063             State {
0064                 name: "bottomShadow"
0065                 when: (shadowDirection === PlasmaCore.Types.TopEdge)
0066 
0067                 AnchorChanges {
0068                     target: editShadow
0069                     anchors{ top:undefined; bottom:parent.bottom; left:parent.left; right:undefined}
0070                 }
0071                 PropertyChanges{
0072                     target: editShadow
0073                     anchors{ leftMargin: 0; rightMargin:0; topMargin:0; bottomMargin:shadowSize}
0074                 }
0075             },
0076             ///leftShadow
0077             State {
0078                 name: "leftShadow"
0079                 when: (shadowDirection === PlasmaCore.Types.RightEdge)
0080 
0081                 AnchorChanges {
0082                     target: editShadow
0083                     anchors{ top:parent.top; bottom: undefined; left:parent.left; right:undefined}
0084                 }
0085                 PropertyChanges{
0086                     target: editShadow
0087                     anchors{ leftMargin: shadowSize; rightMargin:0; topMargin:0; bottomMargin:0}
0088                 }
0089             },
0090             ///rightShadow
0091             State {
0092                 name: "rightShadow"
0093                 when: (shadowDirection === PlasmaCore.Types.LeftEdge)
0094 
0095                 AnchorChanges {
0096                     target: editShadow
0097                     anchors{top:parent.top; bottom:undefined; left:undefined; right:parent.right}
0098                 }
0099                 PropertyChanges{
0100                     target: editShadow
0101                     anchors{ leftMargin: 0; rightMargin:shadowSize; topMargin:0; bottomMargin:0}
0102                 }
0103             }
0104         ]
0105     }
0106 }