diff options
Diffstat (limited to 'framework/qml/AbstractButton.qml')
-rw-r--r-- | framework/qml/AbstractButton.qml | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/framework/qml/AbstractButton.qml b/framework/qml/AbstractButton.qml new file mode 100644 index 00000000..a92ab5df --- /dev/null +++ b/framework/qml/AbstractButton.qml | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2017 Michael Bohlender, <bohlender@kolabsys.com> | ||
3 | * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License along | ||
16 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | ||
19 | |||
20 | import QtQuick 2.7 | ||
21 | import QtQuick.Templates 2.0 as T | ||
22 | import org.kube.framework 1.0 | ||
23 | |||
24 | T.Button { | ||
25 | id: root | ||
26 | |||
27 | width: Math.max(Units.gridUnit, contentItem.implicitWidth + leftPadding + rightPadding) | ||
28 | height: contentItem.implicitHeight + Units.smallSpacing * 2 | ||
29 | |||
30 | padding: Units.largeSpacing | ||
31 | topPadding: Units.smallSpacing * 2 | ||
32 | bottomPadding: Units.smallSpacing *2 | ||
33 | |||
34 | clip: true | ||
35 | hoverEnabled: true | ||
36 | Keys.onReturnPressed: root.clicked() | ||
37 | |||
38 | background: Rectangle { | ||
39 | color: Colors.buttonColor | ||
40 | |||
41 | border.width: 2 | ||
42 | border.color: root.activeFocus && !root.pressed ? Colors.highlightColor : Colors.buttonColor | ||
43 | |||
44 | Rectangle { | ||
45 | anchors.fill: parent | ||
46 | visible: root.hovered || root.pressed | ||
47 | color: root.pressed ? Colors.textColor : Colors.viewBackgroundColor | ||
48 | opacity: 0.2 | ||
49 | } | ||
50 | } | ||
51 | } | ||