571aaf25c3a7d885e91d043bb83afd3f73b9c825
[ubi] / qml / ubi / components / DialogBox.qml
1 import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
2 import "../UIConstants.js" as Const
3
4 Item {
5     id: root
6
7     anchors.left: parent.left; anchors.right: parent.right
8     height: parent.height
9     state: "closed"
10
11     signal opened()
12     signal canceled()
13
14     function open() {
15         root.forceActiveFocus();
16         root.state = "opened";
17         root.opened();
18     }
19
20     function close() {
21         root.state = "closed";
22     }
23
24     MouseArea {
25         anchors.fill: parent
26         onClicked: {
27             root.canceled();
28             root.close();
29         }
30     }
31
32     states: [
33         State {
34             name: "opened"
35             PropertyChanges { target: root; opacity: 1 }
36             PropertyChanges { target: root; y: 0}
37         },
38         State {
39             name: "closed"
40             PropertyChanges { target: root; opacity: 0 }
41             PropertyChanges { target: root; y: root.height }
42         }
43     ]
44
45     transitions: Transition {
46         NumberAnimation { properties: "opacity"; easing.type: Easing.InOutQuad }
47         NumberAnimation { properties: "y"; easing.type: Easing.InOutQuad }
48     }
49 }
50