// Qt
import QtQuick 2.12

// Project

//  Qml imports
import "qrc:/globals"
import "qrc:/components"

Row { id: _root
    property alias  minimum     : _rangeBar.minimum
    property alias  maximum     : _rangeBar.maximum
    property alias  lowerBound  : _rangeBar.lowerBound
    property alias  upperBound  : _rangeBar.upperBound
    property alias  pressure    : _rangeBar.value
    property alias  title       : _title.text
    property color  barColor    : Colors.backgroundRangeRect

    property int    barHeight   : 15
    property int    titleSize   : 35
    property int    valueSize   : 70

    property bool   valueOutRangeNotify  : true

    spacing : Variables.defaultMargin

    Text { id: _title
        width               : Variables.treatmentPressureTitleWidth
        height              : Variables.contentHeight
        color               : Colors.pressuresText
        font {
            pixelSize       : _root.titleSize
            weight          : Font.Medium
        }
        verticalAlignment   : Text.AlignVCenter
    }

    Text { id: _value
        width           : Variables.treatmentPressureValueWidth
        height          : Variables.contentHeight
        text            : pressure > 0 ? "+" + pressure :
                                         pressure
        color           : Colors.pressuresText
        font {
            pixelSize   : _root.valueSize
            weight      : Font.Bold
        }
        verticalAlignment   : Text.AlignVCenter
        horizontalAlignment : Text.AlignRight
    }

    RangeBar { id: _rangeBar
        height              : barHeight
        width               : _root.width * 0.60
        anchors.verticalCenter      : parent.verticalCenter
        anchors.verticalCenterOffset: Variables.defaultMargin
        rangebar.color      : barColor
        markerOutRangeNotify: _root.valueOutRangeNotify
        color               : _root.valueOutRangeNotify ? Colors.backgroundRangeRect :
                                                    rangebar.color
        markerBoundColor    : Colors.rangeMarker
    }
}
