|
| 1 | +// Copyright (c) 2024 The Bitcoin Core developers |
| 2 | +// Distributed under the MIT software license, see the accompanying |
| 3 | +// file COPYING or http://www.opensource.org/licenses/mit-license.php. |
| 4 | + |
| 5 | +import QtQuick 2.15 |
| 6 | +import QtQuick.Controls 2.15 |
| 7 | +import QtQuick.Layouts 1.15 |
| 8 | + |
| 9 | +import org.bitcoincore.qt 1.0 |
| 10 | + |
| 11 | +Button { |
| 12 | + id: root |
| 13 | + |
| 14 | + property color bgActiveColor: Theme.color.neutral2 |
| 15 | + property color textColor: Theme.color.neutral7 |
| 16 | + property color textHoverColor: Theme.color.orange |
| 17 | + property color textActiveColor: Theme.color.orange |
| 18 | + |
| 19 | + hoverEnabled: AppMode.isDesktop |
| 20 | + implicitHeight: 30 |
| 21 | + implicitWidth: 220 |
| 22 | + |
| 23 | + MouseArea { |
| 24 | + anchors.fill: parent |
| 25 | + enabled: false |
| 26 | + hoverEnabled: true |
| 27 | + cursorShape: Qt.PointingHandCursor |
| 28 | + } |
| 29 | + |
| 30 | + contentItem: Item { |
| 31 | + anchors.fill: parent |
| 32 | + RowLayout { |
| 33 | + anchors.centerIn: parent |
| 34 | + spacing: 3 |
| 35 | + Icon { |
| 36 | + id: addIcon |
| 37 | + Layout.alignment: Qt.AlignRight |
| 38 | + source: "image://images/plus" |
| 39 | + color: Theme.color.neutral7 |
| 40 | + size: 16 |
| 41 | + Layout.minimumWidth: 16 |
| 42 | + Layout.preferredWidth: 16 |
| 43 | + Layout.maximumWidth: 16 |
| 44 | + } |
| 45 | + CoreText { |
| 46 | + id: addText |
| 47 | + Layout.fillHeight: true |
| 48 | + Layout.alignment: Qt.AlignLeft |
| 49 | + text: qsTr("Add Wallet") |
| 50 | + color: Theme.color.neutral7 |
| 51 | + font.pixelSize: 15 |
| 52 | + } |
| 53 | + } |
| 54 | + } |
| 55 | + |
| 56 | + background: Rectangle { |
| 57 | + id: bg |
| 58 | + height: 30 |
| 59 | + width: 220 |
| 60 | + radius: 5 |
| 61 | + color: Theme.color.neutral3 |
| 62 | + visible: root.hovered || root.checked |
| 63 | + |
| 64 | + FocusBorder { |
| 65 | + visible: root.visualFocus |
| 66 | + } |
| 67 | + |
| 68 | + Behavior on color { |
| 69 | + ColorAnimation { duration: 150 } |
| 70 | + } |
| 71 | + } |
| 72 | + |
| 73 | + states: [ |
| 74 | + State { |
| 75 | + name: "CHECKED"; when: root.checked |
| 76 | + }, |
| 77 | + State { |
| 78 | + name: "HOVER"; when: root.hovered |
| 79 | + PropertyChanges { target: addText; color: textHoverColor } |
| 80 | + PropertyChanges { target: addIcon; color: textHoverColor } |
| 81 | + } |
| 82 | + ] |
| 83 | +} |
0 commit comments