| 1 |
import QtQuick 2.4 |
| 2 |
/* Copyright (C) 2014-2016 Dan Chapman <[email protected]> |
| 3 |
|
| 4 |
This file is part of Dekko email client for Ubuntu Devices/ |
| 5 |
|
| 6 |
This program is free software; you can redistribute it and/or |
| 7 |
modify it under the terms of the GNU General Public License as |
| 8 |
published by the Free Software Foundation; either version 2 of |
| 9 |
the License or (at your option) version 3 |
| 10 |
|
| 11 |
This program is distributed in the hope that it will be useful, |
| 12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
GNU General Public License for more details. |
| 15 |
|
| 16 |
You should have received a copy of the GNU General Public License |
| 17 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
*/ |
| 19 |
import Lomiri.Components 1.3 |
| 20 |
import QtQuick.Controls.Suru 2.2 |
| 21 |
|
| 22 |
AbstractButton { |
| 23 |
id: button |
| 24 |
|
| 25 |
property string iconName |
| 26 |
property alias iconColor: icon.color |
| 27 |
property bool showText: false |
| 28 |
property int verticalCenterOffset: 0 |
| 29 |
property int iconSize: units.gu(2) |
| 30 |
property alias highlightColor: h.color |
| 31 |
|
| 32 |
width: showText ? description.width : units.gu(5) |
| 33 |
height: width |
| 34 |
|
| 35 |
LomiriShape { |
| 36 |
id: h |
| 37 |
anchors { |
| 38 |
fill: parent |
| 39 |
topMargin: units.gu(1) |
| 40 |
bottomMargin: units.gu(1) |
| 41 |
} |
| 42 |
aspect: LomiriShape.Flat |
| 43 |
radius: "small" |
| 44 |
color: Suru.neutralColor |
| 45 |
visible: button.pressed |
| 46 |
} |
| 47 |
|
| 48 |
Icon { |
| 49 |
id: icon |
| 50 |
anchors.centerIn: parent |
| 51 |
anchors.verticalCenterOffset: button.verticalCenterOffset |
| 52 |
width: iconSize |
| 53 |
height: width |
| 54 |
name: action && action.iconName ? action.iconName : "" |
| 55 |
source: action && action.iconSource ? action.iconSource : "" |
| 56 |
opacity: action ? (action.enabled ? 1.0 : 0.5) : 1.0 |
| 57 |
} |
| 58 |
Label { |
| 59 |
id: description |
| 60 |
anchors { |
| 61 |
horizontalCenter: parent.horizontalCenter |
| 62 |
top: icon.bottom |
| 63 |
} |
| 64 |
text: action ? action.text : "" |
| 65 |
fontSize: "small" |
| 66 |
visible: showText |
| 67 |
horizontalAlignment: Text.AlignHCenter |
| 68 |
elide: Text.ElideRight |
| 69 |
} |
| 70 |
} |