summaryrefslogtreecommitdiffstats
path: root/res/qml/Slider.qml
blob: 7d7a83006d78e22560eff2aba31b271ce21982f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import "." as Skin
import Mixxx.Controls 0.1 as MixxxControls
import QtGraphicalEffects 1.12
import QtQuick 2.12
import "Theme"

MixxxControls.Slider {
    id: root

    property alias fg: handleImage.source
    property alias bg: backgroundImage.source

    bar: true
    barColor: Theme.sliderBarColor
    barMargin: 10
    implicitWidth: backgroundImage.implicitWidth
    implicitHeight: backgroundImage.implicitHeight

    Image {
        id: handleImage

        visible: false
        source: Theme.imgSliderHandle
        fillMode: Image.PreserveAspectFit
    }

    handle: Item {
        id: handleItem

        width: handleImage.paintedWidth
        height: handleImage.paintedHeight
        anchors.horizontalCenter: root.vertical ? parent.horizontalCenter : undefined
        anchors.verticalCenter: root.horizontal ? parent.verticalCenter : undefined
        x: root.horizontal ? (root.visualPosition * (root.width - width)) : ((root.width - width) / 2)
        y: root.vertical ? (root.visualPosition * (root.height - height)) : ((root.height - height) / 2)

        DropShadow {
            source: handleImage
            width: parent.width + 5
            height: parent.height + 5
            radius: 5
            verticalOffset: 5
            color: "#80000000"
        }

    }

    background: Image {
        id: backgroundImage

        anchors.fill: parent
        anchors.margins: root.barMargin
    }

}