on cbbcfdd help sign in
unity8/Dash/Generic/FlatTileStyle.qml
79 lines 2.3 kB history raw
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
17import QtQuick 2.0
18import Ubuntu.Components 0.1
20Item {
21 id: tile
23 property bool disabled: false
25 anchors.fill: parent
27 Image {
28 id: icon
29 objectName: "image"
30 width: styledItem.imageWidth
31 height: styledItem.imageHeight
33 anchors.horizontalCenter: parent.horizontalCenter
35 sourceSize { width: width; height: height }
36 asynchronous: true
37 cache: false
38 source: styledItem.source
39 fillMode: styledItem.fillMode
40 opacity: tile.disabled ? 0.3 : 1.0
41 horizontalAlignment: Image.AlignHCenter
42 verticalAlignment: Image.AlignVCenter
43 }
45 UbuntuShape {
46 id: borderPressed
47 objectName: "borderPressed"
49 anchors.fill: icon
50 radius: "medium"
51 borderSource: "radius_pressed.sci"
52 opacity: styledItem.pressed ? 1.0 : 0.0
53 Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } }
54 }
56 Label {
57 id: label
58 objectName: "label"
59 anchors {
60 baseline: icon.bottom
61 baselineOffset: units.gu(2)
62 left: parent.left
63 right: parent.right
64 leftMargin: units.gu(1)
65 rightMargin: units.gu(1)
66 }
68 color: Theme.palette.selected.backgroundText
69 opacity: 0.9
70 style: Text.Raised
71 styleColor: "black"
72 fontSize: "small"
73 elide: Text.ElideMiddle
74 horizontalAlignment: styledItem.horizontalAlignment
75 text: styledItem.text
76 wrapMode: Text.Wrap
77 maximumLineCount: styledItem.maximumLineCount
78 }