summaryrefslogtreecommitdiffstats
path: root/framework/qml/ContextMenuOverlay.qml
diff options
context:
space:
mode:
Diffstat (limited to 'framework/qml/ContextMenuOverlay.qml')
-rw-r--r--framework/qml/ContextMenuOverlay.qml67
1 files changed, 67 insertions, 0 deletions
diff --git a/framework/qml/ContextMenuOverlay.qml b/framework/qml/ContextMenuOverlay.qml
new file mode 100644
index 00000000..c85e2cb2
--- /dev/null
+++ b/framework/qml/ContextMenuOverlay.qml
@@ -0,0 +1,67 @@
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
20import QtQuick 2.7
21import QtQuick.Controls 2.2
22import org.kube.framework 1.0 as Kube
23import QtQuick.Layouts 1.3
24
25Item {
26 default property alias children: menuLayout.children
27 function close() {
28 menu.close()
29 }
30
31 Rectangle {
32 anchors.fill: parent
33 color: "transparent"
34 border.color: Kube.Colors.highlightColor
35 border.width: 1
36 visible: mouseArea.containsMouse || menu.visible
37 }
38 MouseArea {
39 id: mouseArea
40 anchors.fill: parent
41 hoverEnabled: true
42 acceptedButtons: Qt.RightButton
43 z: 1
44 onClicked: {
45 menu.x = mouseX
46 menu.y = mouseY
47 menu.open()
48 mouse.accepted = true
49 }
50 }
51 Menu {
52 id: menu
53
54 height: menuLayout.height
55 width: menuLayout.width
56 background: Rectangle {
57 anchors.fill: parent
58 color: Kube.Colors.backgroundColor
59 }
60 RowLayout {
61 id: menuLayout
62 width: childrenRect.width
63 height: childrenRect.height
64 }
65 }
66}
67