/usr/share/kde4/apps/kwin/decorations/kwin4_decoration_qml_plastik/contents/ui/PlastikButton.qml is in kde-window-manager-common 4:4.11.8-0ubuntu6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | /********************************************************************
Copyright (C) 2012 Martin Gräßlin <mgraesslin@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
import QtQuick 1.1
import org.kde.kwin.decoration 0.1
import org.kde.kwin.decorations.plastik 1.0
DecorationButton {
id: button
function colorize() {
var highlightColor = null;
if (button.pressed) {
if (button.buttonType == "X") {
highlightColor = colorHelper.foreground(decoration.active, ColorHelper.NegativeText);
} else {
highlightColor = options.titleBarColor;
}
highlightColor = colorHelper.shade(highlightColor, ColorHelper.ShadowShade);
highlightColor = colorHelper.multiplyAlpha(highlightColor, 0.3);
} else if (button.hovered) {
if (button.buttonType == "X") {
highlightColor = colorHelper.foreground(decoration.active, ColorHelper.NegativeText);
} else {
highlightColor = options.titleBarColor;
}
highlightColor = colorHelper.shade(highlightColor, ColorHelper.LightShade, Math.min(1.0, colorHelper.contrast + 0.4));
highlightColor = colorHelper.multiplyAlpha(highlightColor, 0.6);
}
if (highlightColor) {
button.surfaceTop = Qt.tint(button.baseSurfaceTop, highlightColor);
button.surfaceBottom = Qt.tint(button.baseSurfaceBottom, highlightColor);
highlightColor = colorHelper.multiplyAlpha(highlightColor, 0.4);
button.conturTop = Qt.tint(button.baseConturTop, highlightColor);
button.conturBottom = Qt.tint(button.baseConturBottom, highlightColor);
} else {
button.conturTop = button.baseConturTop;
button.conturBottom = button.baseConturBottom;
button.surfaceTop = button.baseSurfaceTop;
button.surfaceBottom = button.baseSurfaceBottom;
}
}
property real size
property color conturTop
property color conturBottom
property color surfaceTop
property color surfaceBottom
property color baseConturTop: colorHelper.shade(options.titleBarColor, ColorHelper.DarkShade, colorHelper.contrast - 0.4)
property color baseConturBottom: colorHelper.shade(options.titleBarColor, ColorHelper.MidShade)
property color baseSurfaceTop: colorHelper.shade(options.titleBarColor, ColorHelper.MidlightShade, colorHelper.contrast - 0.4)
property color baseSurfaceBottom: colorHelper.shade(options.titleBarColor, ColorHelper.LightShade, colorHelper.contrast - 0.4)
Behavior on conturTop {
ColorAnimation { duration: root.animateButtons ? root.animationDuration : 0 }
}
Behavior on conturBottom {
ColorAnimation { duration: root.animateButtons ? root.animationDuration : 0 }
}
Behavior on surfaceTop {
ColorAnimation { duration: root.animateButtons ? root.animationDuration : 0 }
}
Behavior on surfaceBottom {
ColorAnimation { duration: root.animateButtons ? root.animationDuration : 0 }
}
width: size
height: size
Rectangle {
radius: 2
smooth: true
anchors.fill: parent
gradient: Gradient {
GradientStop {
position: 0.0
color: button.conturTop
}
GradientStop {
position: 1.0
color: button.conturBottom
}
}
Rectangle {
radius: 2
smooth: true
anchors {
fill: parent
leftMargin: 1
rightMargin: 1
topMargin: 1
bottomMargin: 1
}
gradient: Gradient {
GradientStop {
position: 0.0
color: button.surfaceTop
}
GradientStop {
position: 1.0
color: button.surfaceBottom
}
}
}
}
Item {
property int imageWidth: button.width > 14 ? button.width - 2 * Math.floor(button.width/3.5) : button.width - 6
property int imageHeight: button.height > 14 ? button.height - 2 * Math.floor(button.height/3.5) : button.height - 6
property string source: "image://plastik/" + button.buttonType + "/" + decoration.active + "/" + ((buttonType == "A") ? decoration.maximized : button.toggled)
anchors.fill: parent
Image {
id: shadowImage
x: button.x + button.width / 2 - width / 2 + 1
y: button.y + button.height / 2 - height / 2 + 1
source: parent.source + "/true"
width: parent.imageWidth
height: parent.imageHeight
sourceSize.width: width
sourceSize.height: height
visible: !button.pressed
}
Image {
id: image
x: button.x + button.width / 2 - width / 2
y: button.y + button.height / 2 - height / 2 + (button.pressed ? 1 : 0)
source: parent.source
width: parent.imageWidth
height: parent.imageHeight
sourceSize.width: width
sourceSize.height: height
}
}
Component.onCompleted: {
colorize();
if (buttonType == "H") {
visible = decoration.providesContextHelp;
}
if (buttonType == "N") {
visible = decoration.appMenu;
}
}
onHoveredChanged: colorize()
onPressedChanged: colorize()
Connections {
target: decoration
onActiveChanged: button.colorize()
onAppMenuChanged: {
if (buttonType == "N") {
visible = decoration.appMenu;
}
}
}
}
|