Debian Codegraph @

src/imports/Components/Themes/Ambiance/1.3/ToolbarStyle.qml

raw
1 /*
2 * Copyright 2016 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.4
17 import QtQuick.Window 2.2
18 import Lomiri.Components 1.3
19 import Lomiri.Components.Styles 1.3 as Style
20
21 Style.ToolbarStyle {
22 id: toolbarStyle
23 implicitWidth: parent ? parent.width : 0
24 // reduce toolbar height on phone in landscape orientation:
25 implicitHeight: Screen.height > units.gu(50) ? units.gu(4) : units.gu(3)
26
27 backgroundColor: theme.palette.normal.background
28 buttons {
29 foregroundColor: theme.palette.normal.backgroundText
30 pressedForegroundColor: buttons.foregroundColor
31 disabledForegroundColor: theme.palette.disabled.backgroundText
32 backgroundColor: "transparent" // background is already colored
33 pressedBackgroundColor: theme.palette.highlighted.background
34 disabledBackgroundColor: buttons.backgroundColor
35 }
36
37 /*!
38 The default action delegate if the styled item does
39 not provide a delegate.
40 */
41 defaultDelegate: ListItem {
42 width: units.gu(4)
43 height: toolbarStyle.height
44 enabled: modelData.enabled
45 objectName: modelData.objectName + "_button"
46 onClicked: button.trigger()
47 AbstractButton {
48 id: button
49 anchors.fill: parent
50 style: IconButtonStyle {
51 foregroundColor: button.pressed ?
52 toolbarStyle.buttons.pressedForegroundColor :
53 button.enabled ?
54 toolbarStyle.buttons.foregroundColor :
55 toolbarStyle.buttons.disabledForegroundColor
56 backgroundColor: button.pressed ?
57 toolbarStyle.buttons.pressedBackgroundColor :
58 button.enabled ?
59 toolbarStyle.buttons.backgroundColor :
60 toolbarStyle.buttons.disabledBackgroundColor
61 }
62 action: modelData
63 activeFocusOnTab: false
64 }
65 divider.visible: false
66 }
67
68 Rectangle {
69 anchors.fill: parent
70 color: toolbarStyle.backgroundColor
71 }
72 }