summaryrefslogtreecommitdiffstats
path: root/src/styles/PopupStyle.qml
blob: 3a33f0a287c8bd905fc7806f7bda4ff44053af11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
 * Copyright (C) 2013 Tomasz Olszak <olszak.tomasz@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Controls.Private 1.0
import QtQuick.Controls.Tizen 1.0
import "DefaultSettings.js" as Theme

Style {
    id: style

    property Popup control: __control

    property Component lookAndFeel: Item {
        id: contentItem
        anchors.fill: parent
        implicitWidth: control.root.width - 100
        implicitHeight: 2*control.root.height/3
        Rectangle {
            x: -(control.root.width-contentItem.width)/2
            y: -(control.root.height-contentItem.height)/2
            width:control.root.width
            height:control.root.height
            color:"#AA000000"
        }

        TizenBorderImage {
            id: contentOfControl
            anchors.fill: parent
            source: Theme.popup.source
            effectSource: Theme.popup.effectSource
            backgroundColor: Theme.popup.color
            anchors.topMargin: -Theme.popup.margins.top
            anchors.leftMargin: -Theme.popup.margins.left
            anchors.rightMargin: -Theme.popup.margins.right
            anchors.bottomMargin: -Theme.popup.margins.bottom
        }

        state: styleData.state === "hidden" ? "contentHidden" : "contentShown"

        states: [
            State {
                name:"contentHidden"
                PropertyChanges {
                    target: control
                    opacity:0
                }
            },
            State {
                name:"contentShown"
                PropertyChanges {
                    target: control
                    opacity:0
                }
            }
        ]

        transitions: [
            Transition {
                to: "contentHidden"
                SequentialAnimation {
                    NumberAnimation {
                        target: control
                        property: "opacity"
                        duration: 250
                    }
                    PropertyAction {
                        target: control
                        property: "visible"
                        value:false
                    }
                }
            },
            Transition {
                to: "contentShown"
                SequentialAnimation {
                    PropertyAction {
                        target: control
                        property: "visible"
                        value:true
                    }
                    NumberAnimation {
                        target: control
                        property: "opacity"
                        to: 1
                        duration: 250
                    }
                }
            }
        ]
    }
}