Debian Codegraph @

src/imports/Components/Popups/2.0/SheetBase.qml

raw
1 /*
2 * Copyright 2015 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
17 import QtQuick 2.4
18 import Lomiri.Components
19
20 /*!
21 \qmltype SheetBase
22 \deprecated
23 \inqmlmodule Lomiri.Components.Popups 1.0
24 \ingroup lomiri-popups
25 \brief Parent class of different types of sheets. Not to be used directly.
26 \deprecated
27
28 Examples: See subclasses.
29 \b{Sheets are deprecated. Consider using \l Dialog, \l Popover or \l PageStack instead.}
30 */
31 PopupBase {
32 id: sheet
33
34 Component.onCompleted: {
35 print("WARNING: Sheets are deprecated. " +
36 "Consider using Dialog, Popover or PageStack instead.")
37 }
38
39 /*!
40 \qmlproperty list<Object> container
41 Content will be put inside the foreround of the sheet.
42 */
43 default property alias container: containerItem.data
44
45 /*!
46 Override the default width of the contents of the sheet.
47 Total sheet width will be clamped between 50 grid units and the screen width.
48 \qmlproperty real contentsWidth
49 */
50 property alias contentsWidth: foreground.contentsWidth
51
52 /*!
53 Override the default height of the contents of the sheet.
54 Total sheet height will be clamped between 40 grid units and the screen height.
55 \qmlproperty real contentsHeight
56 */
57 property alias contentsHeight: foreground.contentsHeight
58
59 /*!
60 The text shown in the header of the sheet.
61 \qmlproperty string title
62 */
63 property alias title: foreground.title
64
65 /*!
66 The property controls whether the sheet is modal or not. Modal sheets block
67 event propagation to items under dismissArea, when non-modal ones let these
68 events passed to these items.
69
70 The default value is true.
71 */
72 property bool modal: true
73
74 /*! \internal */
75 property alias __leftButton: foreground.leftButton
76
77 /*! \internal */
78 property alias __rightButton: foreground.rightButton
79
80 fadingAnimation: LomiriNumberAnimation { duration: LomiriAnimation.SnapDuration }
81
82 __foreground: foreground
83 __eventGrabber.enabled: modal
84
85 StyledItem {
86 id: foreground
87 activeFocusOnPress: true
88
89 property string title
90 property real contentsWidth: units.gu(64)
91 property real contentsHeight: units.gu(40)
92 property Button leftButton
93 property Button rightButton
94
95 y: Math.min(units.gu(15), (sheet.height - height)/2)
96 anchors.horizontalCenter: parent.horizontalCenter
97
98 property real minWidth: Math.min(units.gu(50), sheet.width)
99 property real maxWidth: sheet.width
100 property real minHeight: Math.min(units.gu(40), sheet.height)
101 property real maxHeight: sheet.height
102
103 Item {
104 id: containerItem
105 parent: foreground.__styleInstance.contentItem
106 anchors {
107 fill: parent
108 margins: units.gu(1)
109 }
110 }
111
112 styleName: "SheetForegroundStyle"
113 }
114 }