1import QtQuick 2.0
2import AsemanTools 1.0
3
4Item {
5    id: cp_list
6    width: 100
7    height: 62
8
9    property string number
10
11    onNumberChanged: {
12        if( number.length == 0 )
13            countries_list.currentIndex = -1
14    }
15
16    AsemanListView {
17        id: countries_list
18        anchors.fill: parent
19        currentIndex: -1
20        clip: true
21        model: CountriesModel{}
22
23        delegate: Rectangle {
24            id: item
25            height: 40*Devices.density
26            width: countries_list.width
27            color: marea.pressed || countries_list.currentItem==item? "#88FF5532" : "#00000000"
28
29            Text {
30                anchors.right: parent.right
31                anchors.left: parent.left
32                anchors.verticalCenter: parent.verticalCenter
33                anchors.margins: 8*Devices.density
34                font.family: AsemanApp.globalFont.family
35                font.pixelSize: Math.floor(10*Devices.fontDensity)
36                color: textColor0
37                text: name
38            }
39
40            MouseArea {
41                id: marea
42                anchors.fill: parent
43                onClicked: {
44                    countries_list.currentIndex = index
45                    cp_list.number = callingCode
46                }
47            }
48        }
49    }
50
51    NormalWheelScroll {
52        flick: countries_list
53        animated: Cutegram.smoothScroll
54    }
55
56    PhysicalScrollBar {
57        scrollArea: countries_list; height: countries_list.height; width: 6*Devices.density
58        anchors.right: countries_list.right; anchors.top: countries_list.top; color: textColor0
59    }
60}
61