import QtQuick 2.12
import QtQuick.Controls 2.12

import Utils 1.0

CheckBox {
    id: control
    implicitHeight: 25
    spacing: 15

    indicator: Rectangle {
        implicitWidth: control.implicitHeight
        implicitHeight: control.implicitHeight
        x: control.leftPadding
        y: parent.height / 2 - height / 2
        radius: 5
        border.color: Palette.borderColor
        border.width: 1
        color: control.checked ? Palette.alternativeBackgroundColor : Palette.backgroundColor

        Image {
            source: "qrc:/Icons/check-indicator.svg"
            anchors.centerIn: parent
            visible: control.checked
        }
    }

    contentItem: Text {
        text: control.text
        font.pixelSize: 18
        font.weight: Font.Bold
        color: Palette.textColor
        elide: Text.ElideRight
        verticalAlignment: Text.AlignVCenter
        leftPadding: control.indicator.width + control.spacing
    }
}
