3 @author: Sudheer K. <scifi1947 at gmail.com>
4 @license: GNU General Public License
6 Based on Nokia Qt Quick Demos with copyright notice below.
8 Source: http://doc.qt.nokia.com/4.7-snapshot/demos-declarative-twitter-twittercore-titlebar-qml.html
11 /****************************************************************************
13 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
14 ** All rights reserved.
15 ** Contact: Nokia Corporation (qt-info@nokia.com)
17 ** This file is part of the QtDeclarative module of the Qt Toolkit.
19 ** $QT_BEGIN_LICENSE:LGPL$
20 ** No Commercial Usage
21 ** This file contains pre-release code and may not be distributed.
22 ** You may use this file in accordance with the terms and conditions
23 ** contained in the Technology Preview License Agreement accompanying
26 ** GNU Lesser General Public License Usage
27 ** Alternatively, this file may be used under the terms of the GNU Lesser
28 ** General Public License version 2.1 as published by the Free Software
29 ** Foundation and appearing in the file LICENSE.LGPL included in the
30 ** packaging of this file. Please review the following information to
31 ** ensure the GNU Lesser General Public License version 2.1 requirements
32 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
34 ** In addition, as a special exception, Nokia gives you certain additional
35 ** rights. These rights are described in the Nokia Qt LGPL Exception
36 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
38 ** If you have questions regarding the use of this file, please contact
39 ** Nokia at qt-info@nokia.com.
50 ****************************************************************************/
57 //Default height and width will be overwritten by parent object
61 property string title: "Markets Today"
62 property string buttonType: "Config"
63 property bool displayMenu: false
64 property bool displayMenuIcon: true
65 property int displayMenuTimeout: 8000
67 signal settingsClicked
74 BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 }
78 width: parent.width; height: parent.height
81 id: contextMenuComponent
90 onTickersClicked: titleBar.tickersClicked();
91 onOptionsClicked: titleBar.optionsClicked();
95 name: "visible"; when: titleBar.displayMenu === true;
96 PropertyChanges { target: menuBar; opacity:1}
97 AnchorChanges { target: contextMenuLoader; anchors { bottom: titleArea.bottom; top: parent.top } }
98 PropertyChanges { target: contextMenuLoader; anchors.topMargin: 0; anchors.bottomMargin: -5}
101 name: "hidden"; when: titleBar.displayMenu === false;
102 PropertyChanges { target: menuBar; opacity:0}
103 AnchorChanges { target: contextMenuLoader; anchors { bottom: parent.top; top: parent.top } }
104 PropertyChanges { target: contextMenuLoader; anchors.topMargin: 0;anchors.bottomMargin: 0}
109 //Sequential transition is not working otherway round
111 from: "*"; to: "visible"
113 PropertyAnimation{target: menuBar; property: "opacity"; easing.type:Easing.InExpo; duration: 1000 }
114 AnchorAnimation { easing.type: Easing.InOutQuad; duration: 500 }
117 //Hidden transition is not working as expected
119 from: "*"; to: "hidden"
121 PropertyAnimation{target: menuBar; property: "opacity"; easing.type:Easing.OutExpo; duration: 1000 }
122 AnchorAnimation { easing.type: Easing.InExpo; duration: 500 }
131 interval: displayMenuTimeout
141 id: contextMenuLoader
143 anchors {top: parent.top; horizontalCenter: parent.horizontalCenter}
145 sourceComponent: contextMenuComponent
150 width: parent.width/3
151 height: parent.height
155 leftMargin: 5; rightMargin: 10
161 anchors.centerIn: parent
162 elide: Text.ElideMiddle
164 font.bold: true; color: "White"; style: Text.Raised; styleColor: "Black"
169 source: "images/menu_icon.png"
170 width: 24; height: 24
171 anchors.verticalCenter: parent.verticalCenter
172 anchors.left: categoryText.right
173 visible: titleBar.displayMenuIcon
177 id: contextMenuMouseArea
179 visible: displayMenuIcon
183 //Start timer to hide context menu after 5 sec.
184 contextMenuTimer.start();
200 source: "images/config.png"
201 width: 32; height: 32
202 anchors.centerIn: parent
206 id: configButtonMouseArea
209 titleBar.settingsClicked();
214 name: "pressed"; when: configButtonMouseArea.pressed
215 PropertyChanges { target: configButtonArea; color: "#9a9a9a"}
229 source: "images/close.png"
230 width: 32; height: 32
231 anchors.centerIn: parent
235 id: closeButtonMouseArea
237 onClicked: titleBar.closeClicked();
241 name: "pressed"; when: closeButtonMouseArea.pressed
242 PropertyChanges { target: closeButtonArea; color: "#9a9a9a"}
256 source: "images/back.png"
257 width: 32; height: 32
258 anchors.centerIn: parent
261 id: backButtonMouseArea
263 onClicked: titleBar.backClicked();
267 name: "pressed"; when: backButtonMouseArea.pressed
268 PropertyChanges { target: backButtonArea; color: "#9a9a9a"}
283 height: parent.height
284 anchors.right: parent.right
285 sourceComponent: buttonType == "Config" ? configButton : (buttonType == "Close"? closeButton: (buttonType == "Back"? backButton:blankComponent))