1
/** This file is part of Qt Media Hub**
3
Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).*
6
Contact: Nokia Corporation qmh-development@qt-project.org
8
You may use this file under the terms of the BSD license
11
Redistribution and use in source and binary forms, with or
12
without modification, are permitted provided that the following
14
* Redistributions of source code must retain the above copyright
15
notice, this list of conditions and the following disclaimer.
17
* Redistributions in binary form must reproduce the above copyright
18
notice, this list of conditions and the following disclaimer in the
19
documentation and/or other materials provided with the distribution.
21
* Neither the name of Nokia Corporation and its Subsidiary(-ies)
22
nor the names of its contributors may be used to endorse or promote
23
products derived from this software without specific prior
26
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
29
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
30
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
31
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
32
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
35
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
37
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. **/
44
property int upperThreshold: children.length - 1
46
property bool wrapping: false
47
property int focusedIndex: 0
50
signal lowerBoundExceeded
51
signal upperBoundExceeded
56
if (event.key == Qt.Key_Left) {
58
event.accepted = true;
59
} else if (event.key == Qt.Key_Right) {
61
event.accepted = true;
65
function adjustIndex(delta)
67
var exceededLower = false
68
var exceededUpper = false
72
//FIXME: surely I can queue these?!
73
if(focusedIndex < 0) {
74
focusedIndex = wrapping ? upperThreshold : 0
77
if(focusedIndex > upperThreshold) {
78
focusedIndex = wrapping ? 0 : upperThreshold
82
//Propagate beyond spacers && deactivated items
83
(!children[focusedIndex].enabled || children[focusedIndex].children.length == 0)
87
: children[focusedIndex].forceActiveFocus()
95
function focusItem() {
97
for(var i = 0; i < children.length; i++)
98
if (children[i].activeFocus)
100
return index == -1 ? null : children[index]
103
function setFocusItem(item) {
106
for(var i = 0; i < children.length; i++)
107
if (item == children[i])
111
children[index].forceActiveFocus()
116
function resetFocus() {
121
function giveFocus() {
122
children[focusedIndex].focus = true
125
function focusLowerItem() {
130
function focusUpperItem() {
131
focusedIndex = upperThreshold
138
easing.type: confluence.standardEasingCurve
145
easing.type: confluence.standardEasingCurve