strip long stations in resultlist
[pywienerlinien] / qml / StationListItem.qml
1
2 import QtQuick 1.1
3 import com.nokia.meego 1.0
4 import com.nokia.extras 1.0
5
6 import "UIConstants.js" as UIConstants
7 import "ExtrasConstants.js" as ExtrasConstants
8
9 Item {
10     property Item selector
11
12     width: parent.width
13     height: 60
14
15     BorderImage {
16         anchors.fill: parent
17         visible: mouseArea.pressed
18         source: theme.inverted ? 'image://theme/meegotouch-list-inverted-background-pressed-vertical-center': 'image://theme/meegotouch-list-background-pressed-vertical-center'
19     }
20
21     BorderImage {
22         anchors.fill: parent
23         visible: selector.selectedIndex == index
24         source: theme.inverted ? 'image://theme/meegotouch-list-inverted-background-selected-vertical-center': 'image://theme/meegotouch-list-background-selected-vertical-center'
25     }
26
27     Item {
28         anchors.fill: parent
29         anchors.margins: UIConstants.DEFAULT_MARGIN
30
31         Text {
32             anchors {
33                 verticalCenter: parent.center
34                 left: parent.left
35                 leftMargin: 10
36                 right: parent.right
37             }
38
39             elide: Text.ElideRight
40
41             text: station
42             font.pixelSize: UIConstants.FONT_DEFAULT
43             font.family: ExtrasConstants.FONT_FAMILY
44
45             color: {
46                 if (theme.inverted) {
47                     (selector.selectedIndex == index) ? UIConstants.COLOR_FOREGROUND : UIConstants.COLOR_INVERTED_FOREGROUND
48                 } else {
49                     (selector.selectedIndex != index) ? UIConstants.COLOR_FOREGROUND : UIConstants.COLOR_INVERTED_FOREGROUND
50                 }
51             }
52         }
53     }
54
55     MouseArea {
56         id: mouseArea
57         anchors.fill: parent
58         onClicked: selector.selectedIndex = index
59     }
60 }
61