~gerboland/+junk/windowmanager

« back to all changes in this revision

Viewing changes to WindowDecoration.qml

  • Committer: Gerry Boland
  • Date: 2015-01-27 00:46:30 UTC
  • Revision ID: gerry.boland@canonical.com-20150127004630-ailo4n6xhb0apgtp
Take WindowDecoration bits from unity8, looks prettier now

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 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 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 General Public License for more details.
 
12
 *
 
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/>.
 
15
 *
 
16
 * Authors: Michael Zanetti <michael.zanetti@canonical.com>
 
17
 */
 
18
 
 
19
import QtQuick 2.3
 
20
import Ubuntu.Components 1.1
 
21
 
 
22
Item {
 
23
    id: root
 
24
    clip: true
 
25
 
 
26
    property alias title: titleLabel.text
 
27
    property bool active: false
 
28
 
 
29
    signal close()
 
30
    signal minimize()
 
31
    signal maximize()
 
32
 
 
33
    Rectangle {
 
34
        anchors.fill: parent
 
35
        anchors.bottomMargin: -radius
 
36
        radius: units.gu(.5)
 
37
        gradient: Gradient {
 
38
            GradientStop { color: "#626055"; position: 0 }
 
39
            GradientStop { color: "#3C3B37"; position: 1 }
 
40
        }
 
41
    }
 
42
 
 
43
    Row {
 
44
        anchors { left: parent.left; top: parent.top; bottom: parent.bottom; margins: units.gu(0.7) }
 
45
        spacing: units.gu(1)
 
46
        opacity: root.active ? 1 : 0.5
 
47
 
 
48
        WindowControlButtons {
 
49
            height: parent.height
 
50
            onClose: root.close();
 
51
            onMinimize: root.minimize();
 
52
            onMaximize: root.maximize();
 
53
        }
 
54
 
 
55
        Label {
 
56
            id: titleLabel
 
57
            color: "#DFDBD2"
 
58
            height: parent.height
 
59
            verticalAlignment: Text.AlignVCenter
 
60
            fontSize: "small"
 
61
            font.bold: true
 
62
        }
 
63
    }
 
64
}