Warning, /plasma/latte-dock/declarativeimports/components/ExternalShadow.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * Copyright 2019 Michail Vourlakos <mvourlakos@gmail.com> 0003 * 0004 * This file is part of Latte-Dock 0005 * 0006 * Latte-Dock is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU General Public License as 0008 * published by the Free Software Foundation; either version 2 of 0009 * the License, or (at your option) any later version. 0010 * 0011 * Latte-Dock is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 * GNU General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU General Public License 0017 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 import QtQuick 2.1 0021 0022 import org.kde.plasma.core 2.0 as PlasmaCore 0023 import QtGraphicalEffects 1.0 0024 0025 import org.kde.latte 0.2 as Latte 0026 0027 Item{ 0028 id: shadowRoot 0029 0030 property int shadowDirection: PlasmaCore.Types.BottomEdge 0031 property int shadowSize: 7 0032 property real shadowOpacity: 1 0033 property color shadowColor: "#040404" 0034 0035 readonly property bool isHorizontal : (shadowDirection !== PlasmaCore.Types.LeftEdge) && (shadowDirection !== PlasmaCore.Types.RightEdge) 0036 0037 readonly property int implicitWidth: shadow.width 0038 readonly property int implicitHeight: shadow.height 0039 0040 Item{ 0041 id: shadow 0042 width: isHorizontal ? shadowRoot.width + 2*shadowSize : shadowSize 0043 height: isHorizontal ? shadowSize: shadowRoot.height + 2*shadowSize 0044 opacity: shadowOpacity 0045 0046 clip: true 0047 0048 Rectangle{ 0049 id: editShadow 0050 width: shadowRoot.width 0051 height: shadowRoot.height 0052 color: "white" 0053 0054 layer.enabled: true 0055 layer.effect: DropShadow { 0056 radius: shadowSize 0057 fast: true 0058 samples: 2 * radius 0059 color: shadowRoot.shadowColor 0060 } 0061 } 0062 0063 states: [ 0064 ///topShadow 0065 State { 0066 name: "topShadow" 0067 when: (shadowDirection === PlasmaCore.Types.BottomEdge) 0068 0069 AnchorChanges { 0070 target: editShadow 0071 anchors{ top:parent.top; bottom:undefined; left:parent.left; right:undefined} 0072 } 0073 PropertyChanges{ 0074 target: editShadow 0075 anchors{ leftMargin: 0; rightMargin:0; topMargin:shadowSize; bottomMargin:0} 0076 } 0077 }, 0078 ///bottomShadow 0079 State { 0080 name: "bottomShadow" 0081 when: (shadowDirection === PlasmaCore.Types.TopEdge) 0082 0083 AnchorChanges { 0084 target: editShadow 0085 anchors{ top:undefined; bottom:parent.bottom; left:parent.left; right:undefined} 0086 } 0087 PropertyChanges{ 0088 target: editShadow 0089 anchors{ leftMargin: 0; rightMargin:0; topMargin:0; bottomMargin:shadowSize} 0090 } 0091 }, 0092 ///leftShadow 0093 State { 0094 name: "leftShadow" 0095 when: (shadowDirection === PlasmaCore.Types.RightEdge) 0096 0097 AnchorChanges { 0098 target: editShadow 0099 anchors{ top:parent.top; bottom: undefined; left:parent.left; right:undefined} 0100 } 0101 PropertyChanges{ 0102 target: editShadow 0103 anchors{ leftMargin: shadowSize; rightMargin:0; topMargin:0; bottomMargin:0} 0104 } 0105 }, 0106 ///rightShadow 0107 State { 0108 name: "rightShadow" 0109 when: (shadowDirection === PlasmaCore.Types.LeftEdge) 0110 0111 AnchorChanges { 0112 target: editShadow 0113 anchors{top:parent.top; bottom:undefined; left:undefined; right:parent.right} 0114 } 0115 PropertyChanges{ 0116 target: editShadow 0117 anchors{ leftMargin: 0; rightMargin:shadowSize; topMargin:0; bottomMargin:0} 0118 } 0119 } 0120 ] 0121 } 0122 }