aboutsummaryrefslogtreecommitdiff
path: root/components/MenuButton.qml
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2016-12-20 23:14:19 +0200
committerRiccardo Spagni <ric@spagni.net>2016-12-20 23:14:19 +0200
commit3039a008dc4d392ec6c7199426f1b0ecd90b8d1a (patch)
tree39c320291382b5286c1ce6668089af9c789d5f68 /components/MenuButton.qml
parentff274721f6ab68230e9402d162590d064685252e (diff)
parentd760232af98a7699dcddaea3fe1d58a0fd519b43 (diff)
downloadmonzero-gui-3039a008dc4d392ec6c7199426f1b0ecd90b8d1a.tar.gz
monzero-gui-3039a008dc4d392ec6c7199426f1b0ecd90b8d1a.tar.xz
monzero-gui-3039a008dc4d392ec6c7199426f1b0ecd90b8d1a.zip
Merge pull request #307
d760232 LeftPanel: rejig some options to second level (moneromooo.monero) 67a7646 MenuButton: add submenus (moneromooo.monero)
Diffstat (limited to 'components/MenuButton.qml')
-rw-r--r--components/MenuButton.qml38
1 files changed, 36 insertions, 2 deletions
diff --git a/components/MenuButton.qml b/components/MenuButton.qml
index 1d0b00e1..9d4bbdc6 100644
--- a/components/MenuButton.qml
+++ b/components/MenuButton.qml
@@ -34,15 +34,48 @@ Rectangle {
property bool checked: false
property alias dotColor: dot.color
property alias symbol: symbolText.text
+ property int numSelectedChildren: 0
+ property var under: null
signal clicked()
- height: (appWindow.height >= 800) ? 64 : 56
+ function getOffset() {
+ var offset = 0
+ var item = button
+ while (item.under) {
+ offset += 20
+ item = item.under
+ }
+ return offset
+ }
+
color: checked ? "#FFFFFF" : "#1C1C1C"
+ property bool present: !under || under.checked || checked || under.numSelectedChildren > 0
+ height: present ? ((appWindow.height >= 800) ? 64 : 56) : 0
+
+ transform: Scale {
+ yScale: button.present ? 1 : 0
+
+ Behavior on yScale {
+ NumberAnimation { duration: 500; easing.type: Easing.InOutCubic }
+ }
+ }
+
+ Behavior on height {
+ SequentialAnimation {
+ NumberAnimation { duration: 500; easing.type: Easing.InOutCubic }
+ }
+ }
+
+ Behavior on checked {
+ // we get the value of checked before the change
+ ScriptAction { script: if (under) under.numSelectedChildren += checked > 0 ? -1 : 1 }
+ }
Item {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
+ anchors.leftMargin: parent.getOffset()
width: 50
Rectangle {
@@ -85,6 +118,7 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 20
+ anchors.leftMargin: parent.getOffset()
source: "../images/menuIndicator.png"
}
@@ -92,7 +126,7 @@ Rectangle {
id: label
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
- anchors.leftMargin: 50
+ anchors.leftMargin: parent.getOffset() + 50
font.family: "Arial"
font.pixelSize: 18
color: parent.checked ? "#000000" : "#FFFFFF"