source: arc-theme/trunk/fuentes/karc/usr/share/kwin/aurorae/aurorae.lliurex @ 1811

Last change on this file since 1811 was 1811, checked in by hectorgh, 5 years ago

adding file

File size: 9.4 KB
Line 
1/********************************************************************
2Copyright (C) 2012 Martin Gräßlin <mgraesslin@kde.org>
3
4This program is free software; you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation; either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program.  If not, see <http://www.gnu.org/licenses/>.
16*********************************************************************/
17import QtQuick 2.0
18import org.kde.kwin.decoration 0.1
19import org.kde.plasma.core 2.0 as PlasmaCore
20
21Decoration {
22    id: root
23    property bool animate: false
24    Component.onCompleted: {
25        borders.left   = Qt.binding(function() { return Math.max(0, auroraeTheme.borderLeft);});
26        borders.right  = Qt.binding(function() { return Math.max(0, auroraeTheme.borderRight);});
27        borders.top    = Qt.binding(function() { return Math.max(0, auroraeTheme.borderTop);});
28        borders.bottom = Qt.binding(function() { return Math.max(0, auroraeTheme.borderBottom);});
29        maximizedBorders.left   = Qt.binding(function() { return Math.max(0, auroraeTheme.borderLeftMaximized);});
30        maximizedBorders.right  = Qt.binding(function() { return Math.max(0, auroraeTheme.borderRightMaximized);});
31        maximizedBorders.bottom = Qt.binding(function() { return Math.max(0, auroraeTheme.borderBottomMaximized);});
32        maximizedBorders.top    = Qt.binding(function() { return Math.max(0, auroraeTheme.borderTopMaximized);});
33        padding.left   = auroraeTheme.paddingLeft;
34        padding.right  = auroraeTheme.paddingRight;
35        padding.bottom = auroraeTheme.paddingBottom;
36        padding.top    = auroraeTheme.paddingTop;
37        root.animate = true;
38    }
39    DecorationOptions {
40        id: options
41        deco: decoration
42    }
43    Item {
44        id: titleRect
45        x: decoration.client.maximized ? maximizedBorders.left : borders.left
46        y: decoration.client.maximized ? 0 : root.borders.bottom
47        width: decoration.client.width//parent.width - x - (decoration.client.maximized ? maximizedBorders.right : borders.right)
48        height: decoration.client.maximized ? maximizedBorders.top : borders.top
49        Component.onCompleted: {
50            decoration.installTitleItem(titleRect);
51        }
52    }
53    PlasmaCore.FrameSvg {
54        property bool supportsInactive: hasElementPrefix("decoration-inactive")
55        property bool supportsMaximized: hasElementPrefix("decoration-maximized")
56        property bool supportsMaximizedInactive: hasElementPrefix("decoration-maximized-inactive")
57        property bool supportsInnerBorder: hasElementPrefix("innerborder")
58        property bool supportsInnerBorderInactive: hasElementPrefix("innerborder-inactive")
59        id: backgroundSvg
60        imagePath: auroraeTheme.decorationPath
61    }
62    PlasmaCore.FrameSvgItem {
63        id: decorationActive
64        property bool shown: (!decoration.client.maximized || !backgroundSvg.supportsMaximized) && (decoration.client.active || !backgroundSvg.supportsInactive)
65        anchors.fill: parent
66        imagePath: backgroundSvg.imagePath
67        prefix: "decoration"
68        opacity: shown ? 1 : 0
69        enabledBorders: decoration.client.maximized ? PlasmaCore.FrameSvg.NoBorder : PlasmaCore.FrameSvg.TopBorder | PlasmaCore.FrameSvg.BottomBorder | PlasmaCore.FrameSvg.LeftBorder | PlasmaCore.FrameSvg.RightBorder
70        Behavior on opacity {
71            enabled: root.animate
72            NumberAnimation {
73                duration: auroraeTheme.animationTime
74            }
75        }
76    }
77    PlasmaCore.FrameSvgItem {
78        id: decorationInactive
79        anchors.fill: parent
80        imagePath: backgroundSvg.imagePath
81        prefix: "decoration-inactive"
82        opacity: (!decoration.client.active && backgroundSvg.supportsInactive) ? 1 : 0
83        enabledBorders: decoration.client.maximized ? PlasmaCore.FrameSvg.NoBorder : PlasmaCore.FrameSvg.TopBorder | PlasmaCore.FrameSvg.BottomBorder | PlasmaCore.FrameSvg.LeftBorder | PlasmaCore.FrameSvg.RightBorder
84        Behavior on opacity {
85            enabled: root.animate
86            NumberAnimation {
87                duration: auroraeTheme.animationTime
88            }
89        }
90    }
91    PlasmaCore.FrameSvgItem {
92        id: decorationMaximized
93        property bool shown: decoration.client.maximized && backgroundSvg.supportsMaximized && (decoration.client.active || !backgroundSvg.supportsMaximizedInactive)
94        anchors {
95            left: parent.left
96            right: parent.right
97            top: parent.top
98            leftMargin: 0
99            rightMargin: 0
100            topMargin: 0
101        }
102        imagePath: backgroundSvg.imagePath
103        prefix: "decoration-maximized"
104        height: parent.maximizedBorders.top
105        opacity: shown ? 1 : 0
106        enabledBorders: PlasmaCore.FrameSvg.NoBorder
107        Behavior on opacity {
108            enabled: root.animate
109            NumberAnimation {
110                duration: auroraeTheme.animationTime
111            }
112        }
113    }
114    PlasmaCore.FrameSvgItem {
115        id: decorationMaximizedInactive
116        anchors {
117            left: parent.left
118            right: parent.right
119            top: parent.top
120            leftMargin: 0
121            rightMargin: 0
122            topMargin: 0
123        }
124        imagePath: backgroundSvg.imagePath
125        prefix: "decoration-maximized-inactive"
126        height: parent.maximizedBorders.top
127        opacity: (!decoration.client.active && decoration.client.maximized && backgroundSvg.supportsMaximizedInactive) ? 1 : 0
128        enabledBorders: PlasmaCore.FrameSvg.NoBorder
129        Behavior on opacity {
130            enabled: root.animate
131            NumberAnimation {
132                duration: auroraeTheme.animationTime
133            }
134        }
135    }
136    AuroraeButtonGroup {
137        id: leftButtonGroup
138        buttons: options.titleButtonsLeft
139        width: childrenRect.width
140        animate: root.animate
141        anchors {
142            left: root.left
143            leftMargin: decoration.client.maximized ? auroraeTheme.titleEdgeLeftMaximized : (auroraeTheme.titleEdgeLeft + root.padding.left)
144        }
145    }
146    AuroraeButtonGroup {
147        id: rightButtonGroup
148        buttons: options.titleButtonsRight
149        width: childrenRect.width
150        animate: root.animate
151        anchors {
152            right: root.right
153            rightMargin: decoration.client.maximized ? auroraeTheme.titleEdgeRightMaximized : (auroraeTheme.titleEdgeRight + root.padding.right)
154        }
155    }
156    Text {
157        id: caption
158        text: decoration.client.caption
159        textFormat: Text.PlainText
160        horizontalAlignment: auroraeTheme.horizontalAlignment
161        verticalAlignment: auroraeTheme.verticalAlignment
162        elide: Text.ElideRight
163        height: Math.max(auroraeTheme.titleHeight, auroraeTheme.buttonHeight * auroraeTheme.buttonSizeFactor)
164        color: decoration.client.active ? auroraeTheme.activeTextColor : auroraeTheme.inactiveTextColor
165        renderType: Text.NativeRendering
166        anchors {
167            left: leftButtonGroup.right
168            right: rightButtonGroup.left
169            top: root.top
170            topMargin: decoration.client.maximized ? auroraeTheme.titleEdgeTopMaximized : (auroraeTheme.titleEdgeTop + root.padding.top)
171            leftMargin: auroraeTheme.titleBorderLeft
172            rightMargin: auroraeTheme.titleBorderRight
173        }
174        Behavior on color {
175            enabled: root.animate
176            ColorAnimation {
177                duration: auroraeTheme.animationTime
178            }
179        }
180    }
181    PlasmaCore.FrameSvgItem {
182        id: innerBorder
183        anchors {
184            fill: parent
185            leftMargin: parent.padding.left + parent.borders.left - margins.left
186            rightMargin: parent.padding.right + parent.borders.right - margins.right
187            topMargin: parent.padding.top + parent.borders.top - margins.top
188            bottomMargin: parent.padding.bottom + parent.borders.bottom - margins.bottom
189        }
190        imagePath: backgroundSvg.imagePath
191        prefix: "innerborder"
192        opacity: (decoration.client.active && !decoration.client.maximized && backgroundSvg.supportsInnerBorder) ? 1 : 0
193        Behavior on opacity {
194            enabled: root.animate
195            NumberAnimation {
196                duration: auroraeTheme.animationTime
197            }
198        }
199    }
200    PlasmaCore.FrameSvgItem {
201        id: innerBorderInactive
202        anchors {
203            fill: parent
204            leftMargin: parent.padding.left + parent.borders.left - margins.left
205            rightMargin: parent.padding.right + parent.borders.right - margins.right
206            topMargin: parent.padding.top + parent.borders.top - margins.top
207            bottomMargin: parent.padding.bottom + parent.borders.bottom - margins.bottom
208        }
209        imagePath: backgroundSvg.imagePath
210        prefix: "innerborder-inactive"
211        opacity: (!decoration.client.active && !decoration.client.maximized && backgroundSvg.supportsInnerBorderInactive) ? 1 : 0
212        Behavior on opacity {
213            enabled: root.animate
214            NumberAnimation {
215                duration: auroraeTheme.animationTime
216            }
217        }
218    }
219}
Note: See TracBrowser for help on using the repository browser.