Initial Release
[marketstoday] / src / qml / Library / ToolBar.qml
1 /*
2 @version: 0.1
3 @author: Sudheer K. <scifi1947 at gmail.com>
4 @license: GNU General Public License
5 */
6
7 import Qt 4.7
8
9 Item {
10     id: toolbar
11     property bool updatePending: false
12
13     signal reloadButtonClicked
14     signal downButtonClicked
15     signal upButtonClicked
16     signal newsButtonClicked
17
18     BorderImage { source: "images/toolbar.sci"; width: parent.width; height: parent.height + 14; y: -7 }
19
20     Rectangle {
21         id: reloadButtonArea
22         width: 60
23         height: parent.height
24         anchors.left: parent.left
25         color: "#00000000"
26
27         Image {
28             id: reloadButton
29             source: "images/reload.png"
30             width: 32; height: 32
31             anchors.centerIn: parent
32
33             NumberAnimation on rotation {
34                 from: 0; to: 360; running: toolbar.updatePending == true; loops: Animation.Infinite; duration: 900
35             }
36         }
37
38         MouseArea{
39           id: reloadButtonMouseArea
40           anchors.fill: parent
41           onClicked: {
42               toolbar.updatePending = true;
43               toolbar.reloadButtonClicked();
44           }
45         }
46
47         states: State {
48                  name: "pressed"; when: reloadButtonMouseArea.pressed
49                  PropertyChanges { target: reloadButtonArea; color: "#9a9a9a"}
50         }
51     }
52
53     Rectangle {
54         id: downButtonArea
55         width: 60
56         height: parent.height
57         anchors.right: parent.horizontalCenter; anchors.horizontalCenterOffset: -60;
58         color: "#00000000"
59
60         Image {
61             id: downButton
62             source: "images/down.png"
63             width: 32; height: 32
64             anchors.verticalCenter: parent.verticalCenter
65             anchors.right: parent.right
66             anchors.rightMargin: 5
67         }
68
69         MouseArea{
70           id: downButtonMouseArea
71           anchors.fill: parent
72           onClicked: toolbar.downButtonClicked()
73         }
74
75         states: State {
76                  name: "pressed"; when: downButtonMouseArea.pressed
77                  PropertyChanges { target: downButtonArea; color: "#9a9a9a"}
78         }
79     }
80
81
82     Rectangle {
83         id: upButtonArea
84         width: 60
85         height: parent.height
86         anchors.left: parent.horizontalCenter; anchors.horizontalCenterOffset: 60;
87         color: "#00000000"
88
89         Image {
90             id: upButton
91             source: "images/up.png"
92             width: 32; height: 32
93             anchors.verticalCenter: parent.verticalCenter
94             anchors.left: parent.left
95             anchors.leftMargin: 5
96         }
97
98         MouseArea{
99           id: upButtonMouseArea
100           anchors.fill: parent
101           onClicked: toolbar.upButtonClicked()
102         }
103
104         states: State {
105                  name: "pressed"; when: upButtonMouseArea.pressed
106                  PropertyChanges { target: upButtonArea; color: "#9a9a9a"}
107         }
108     }
109
110     Rectangle {
111         id: newsButtonArea
112         width: 60
113         height: parent.height
114         anchors.right: parent.right
115         color: "#00000000"
116
117         Image {
118             id: newsButton
119             source: "images/news.png"
120             width: 32; height: 32
121             anchors.centerIn: parent
122         }
123
124         MouseArea{
125           id: newsButtonMouseArea
126           anchors.fill: parent
127           onClicked: toolbar.newsButtonClicked()
128         }
129
130         states: State {
131                  name: "pressed"; when: newsButtonMouseArea.pressed
132                  PropertyChanges { target: newsButtonArea; color: "#9a9a9a"}
133         }
134     }
135 }