Unity 8
 All Classes Functions
PageHeadStyle.qml
1 /*
2  * Copyright 2014 Canonical Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 import QtQuick 2.2
17 import Ubuntu.Components 1.1
18 import Ubuntu.Components.Styles 1.1 as Style
19 
20 // FIXME: copied with large modifications from Ubuntu UI Toolkit's Ambiance's theme
21 Style.PageHeadStyle {
22  id: headerStyle
23 
24  contentHeight: units.gu(7)
25  separatorSource: "graphics/PageHeaderBaseDividerLight.sci"
26  separatorBottomSource: "graphics/PageHeaderBaseDividerBottom.png"
27  fontWeight: Font.Light
28  fontSize: "x-large"
29  textColor: styledItem.config.foregroundColor
30  textLeftMargin: units.gu(2)
31 
32  implicitHeight: headerStyle.contentHeight
33 
34  property var theme
35 
36  Label {
37  anchors {
38  left: parent.left
39  leftMargin: headerStyle.textLeftMargin
40  right: parent.right
41  verticalCenter: parent.verticalCenter
42  }
43  LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
44  text: styledItem.title
45  font.weight: headerStyle.fontWeight
46  fontSize: headerStyle.fontSize
47  color: headerStyle.textColor
48  elide: Text.ElideRight
49  }
50 
51  BorderImage {
52  id: separator
53  anchors {
54  top: parent.bottom
55  topMargin: separatorBottom.height
56  left: parent.left
57  right: parent.right
58  }
59  source: headerStyle.separatorSource
60  height: styledItem.config.sections.model !== undefined ? units.gu(3) : units.gu(2)
61  asynchronous: true
62  cache: true
63  }
64 
65  Image {
66  id: separatorBottom
67  anchors {
68  top: separator.bottom
69  left: parent.left
70  right: parent.right
71  }
72  source: headerStyle.separatorBottomSource
73  asynchronous: true
74  cache: true
75  }
76 }