1/* 2 SPDX-FileCopyrightText: 2016 Marco Martin <mart@kde.org> 3 4 SPDX-License-Identifier: LGPL-2.0-or-later 5*/ 6 7import QtQuick 2.6 8import QtQuick.Templates @QQC2_VERSION@ as T 9import org.kde.plasma.core 2.0 as PlasmaCore 10 11T.Drawer { 12 id: control 13 14 parent: T.ApplicationWindow.overlay 15 16 implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding) 17 implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding) 18 19 contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) 20 contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) 21 22 topPadding: control.edge === Qt.BottomEdge ? Math.round(PlasmaCore.Units.devicePixelRatio) : 0 23 leftPadding: control.edge === Qt.RightEdge ? Math.round(PlasmaCore.Units.devicePixelRatio) : 0 24 rightPadding: control.edge === Qt.LeftEdge ? Math.round(PlasmaCore.Units.devicePixelRatio) : 0 25 bottomPadding: control.edge === Qt.TopEdge ? Math.round(PlasmaCore.Units.devicePixelRatio) : 0 26 27 background: PlasmaCore.FrameSvgItem { 28 anchors { 29 fill: parent 30 leftMargin: -margins.left 31 topMargin: -margins.top 32 rightMargin: -margins.right 33 bottomMargin: -margins.bottom 34 } 35 implicitWidth: PlasmaCore.Units.gridUnit * 12 36 imagePath: "widgets/background" 37 enabledBorders: { 38 switch (control.edge) { 39 case Qt.BottomEdge: 40 return PlasmaCore.FrameSvgItem.TopBorder; 41 case Qt.RightEdge: 42 return PlasmaCore.FrameSvgItem.LeftBorder; 43 case Qt.TopEdge: 44 return PlasmaCore.FrameSvgItem.BottomBorder; 45 case Qt.LeftEdge: 46 default: 47 return PlasmaCore.FrameSvgItem.RightBorder; 48 } 49 } 50 } 51 52 enter: Transition { 53 SmoothedAnimation { 54 velocity: 5 55 } 56 } 57 exit: Transition { 58 SmoothedAnimation { 59 velocity: 5 60 } 61 } 62} 63