2 * Copyright (C) 2013-2016 Canonical, Ltd.
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.
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.
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/>.
18 import Ubuntu.Components 1.3
19 import Unity.Application 0.1
20 import "../Components"
21 import "../Components/PanelState"
26 readonly property real panelHeight: indicatorArea.y + d.indicatorHeight
27 property alias indicators: __indicators
28 property alias callHint: __callHint
29 property bool fullscreenMode: false
30 property real indicatorAreaShowProgress: 1.0
31 property bool locked: false
35 anchors.topMargin: panelHeight
36 visible: !indicators.fullyClosed
38 onClicked: if (indicators.fullyOpened) indicators.hide();
39 hoverEnabled: true // should also eat hover events, otherwise they will pass through
44 property: "panelHeight"
45 value: indicators.minimizedPanelHeight
50 objectName: "indicatorArea"
54 transform: Translate {
55 y: indicators.state === "initial"
56 ? (1.0 - indicatorAreaShowProgress) * -d.indicatorHeight
61 id: indicatorsDropShadow
64 leftMargin: -units.gu(1)
65 bottomMargin: -units.gu(1)
67 visible: !indicators.fullyClosed
68 source: "graphics/rectangular_dropshadow.sci"
74 fill: indicatorAreaBackground
75 bottomMargin: -units.gu(1)
77 visible: PanelState.dropShadow && !callHint.visible
78 source: "graphics/rectangular_dropshadow.sci"
82 id: indicatorAreaBackground
83 color: callHint.visible ? theme.palette.normal.positive : theme.palette.normal.background
89 height: indicators.minimizedPanelHeight
91 Behavior on color { ColorAnimation { duration: UbuntuAnimation.FastDuration } }
95 objectName: "windowControlArea"
99 right: indicators.left
101 height: indicators.minimizedPanelHeight
103 onClicked: if (callHint.visible) { callHint.showLiveCall(); }
106 if (!callHint.visible) {
107 // let it fall through to the window decoration of the maximized window behind, if any
108 mouse.accepted = false;
112 // WindowControlButtons inside the mouse area, otherwise QML doesn't grok nested hover events :/
113 // cf. https://bugreports.qt.io/browse/QTBUG-32909
114 WindowControlButtons {
115 id: windowControlButtons
116 objectName: "panelWindowControlButtons"
121 height: indicators.minimizedPanelHeight
123 visible: ((PanelState.buttonsVisible && parent.containsMouse) || PanelState.buttonsAlwaysVisible)
124 && !root.locked && !callHint.visible
125 active: PanelState.buttonsVisible || PanelState.buttonsAlwaysVisible
126 windowIsMaximized: true
127 onCloseClicked: PanelState.closeClicked()
128 onMinimizeClicked: PanelState.minimizeClicked()
129 onMaximizeClicked: PanelState.restoreClicked()
130 closeButtonShown: PanelState.closeButtonShown
136 objectName: "indicators"
144 width: root.width - (windowControlButtons.visible ? windowControlButtons.width + titleLabel.width : 0)
145 minimizedPanelHeight: units.gu(3)
146 expandedPanelHeight: units.gu(7)
147 openedHeight: root.height
150 if (callHint.visible) {
151 return Math.max(root.width - (callHint.width + units.gu(2)), 0)
155 enableHint: !callHint.active && !fullscreenMode
156 showOnClick: !callHint.visible
157 panelColor: indicatorAreaBackground.color
160 if (callHint.active) {
161 callHint.showLiveCall();
168 objectName: "windowDecorationTitle"
171 right: __indicators.left
173 leftMargin: units.gu(1)
174 rightMargin: units.gu(1)
175 topMargin: units.gu(0.5)
176 bottomMargin: units.gu(0.5)
179 height: indicators.minimizedPanelHeight - anchors.topMargin - anchors.bottomMargin
180 opacity: !windowControlButtons.visible && !root.locked && !callHint.visible ? 1 : 0
181 visible: opacity != 0
182 verticalAlignment: Text.AlignVCenter
184 font.weight: PanelState.buttonsVisible ? Font.Light : Font.Medium
185 text: PanelState.title
186 elide: Text.ElideRight
188 Behavior on opacity { UbuntuNumberAnimation {} }
191 // TODO here would the Locally integrated menus come
199 height: indicators.minimizedPanelHeight
200 visible: active && indicators.state == "initial"
206 objectName: "panelPriv"
207 readonly property real indicatorHeight: indicators.minimizedPanelHeight
212 name: "onscreen" //fully opaque and visible at top edge of screen
213 when: !fullscreenMode
215 target: indicatorArea;
221 name: "offscreen" //pushed off screen
224 target: indicatorArea;
225 anchors.topMargin: indicators.state === "initial" ? -d.indicatorHeight : 0
226 opacity: indicators.fullyClosed ? 0.0 : 1.0
229 target: indicators.showDragHandle;
230 anchors.bottomMargin: -units.gu(1)
238 UbuntuNumberAnimation { target: indicatorArea; properties: "anchors.topMargin,opacity" }
242 UbuntuNumberAnimation { target: indicatorArea; properties: "anchors.topMargin,opacity" }