2
* Copyright 2013-2014 Canonical Ltd.
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.
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.
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/>.
18
import Ubuntu.Components 1.2
24
Do not use an UbuntuShape but a Rectangle as the background of the BubbleShape.
26
property bool square: false
29
The background color of the bubble.
31
property color color: square ? Theme.palette.normal.background : Theme.palette.normal.overlay
34
property string direction: "down"
35
property bool clipContent: false
36
default property alias children: content.children
37
// FIXME: This should not be necessary. See
38
// https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1214978
39
property alias arrowSource: arrow.source
41
implicitWidth: units.gu(10)
42
implicitHeight: units.gu(8)
44
signal showCompleted()
45
signal hideCompleted()
51
showAnimation.start();
56
hideAnimation.start();
67
duration: UbuntuAnimation.FastDuration
68
easing: UbuntuAnimation.StandardEasing
71
target: scaleTransform
72
property: (direction === "up" || direction === "down") ? "yScale" : "xScale"
75
duration: UbuntuAnimation.FastDuration
76
easing: UbuntuAnimation.StandardEasing
78
onStopped: showCompleted()
87
duration: UbuntuAnimation.FastDuration
88
easing: UbuntuAnimation.StandardEasing
89
onStopped: hideCompleted()
94
origin.x: direction === "right" ? bubbleShape.width :
95
direction === "left" ? 0 :
97
origin.y: direction === "up" ? 0 :
98
direction === "down" ? bubbleShape.height :
99
bubbleShape.height/2.0
105
anchors.margins: square ? -units.gu(1) : -units.dp(2)
106
anchors.topMargin: square ? 0 : anchors.margins
107
source: !square ? Qt.resolvedUrl("../artwork/bubble_shadow.sci") : Qt.resolvedUrl("../artwork/header_overflow_dropshadow.sci")
114
color: Theme.palette.normal.overlay
115
image: bubbleShape.clipContent ? shapeSource : null
121
visible: bubbleShape.clipContent
122
sourceItem: bubbleShape.clipContent ? content : null
124
// FIXME: visible: false prevents rendering so make it a nearly
125
// transparent 1x1 pixel instead
138
color: bubbleShape.color
139
visible: bubbleShape.clipContent
150
visible: !square && bubbleShape.direction != "none"
152
function directionToRotation(direction) {
160
default: // "down" or "none"
167
transformOrigin: Item.Bottom
168
rotation: directionToRotation(bubbleShape.direction)
169
source: Qt.resolvedUrl("../artwork/bubble_arrow.png")