/*!
 *
 * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved.
 * \copyright
 * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN
 * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER.
 *
 * \file ProgressBar.qml
 * \author (last) Behrouz NemaiPour
 * \date (last) 04-Jun-2020
 * \author (original) Behrouz NematiPour
 * \date (original) 23-Jan-2020
 *
 */

// Qt
import QtQuick 2.12

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

/*!
 * \brief   Denali project ProgressBar
 */
RangeRect { id: _root

    property int    progressWidth   : _progressRect.width
    property alias  value           : _progressRect.value

    property alias  color           : _progressRect.color
    property alias  bgColor         : _root.color

    property alias  marker          : _marker
    property alias  markerHeight    : _marker.height

    property alias  decimal         : _root.decimal
    property alias  minimum         : _root.minimum
    property alias  maximum         : _root.maximum

    signal          progressClicked()

    height          : Variables.progressbarHeight

    minimum         : 0
    maximum         : 0

    minText.visible : true
    maxText.visible : true

    // Since this Component is the base Component of the ProgressBarEx
    // we need to use the z order
    // to order the parent object (ProgressBar) Components
    // in the child(ProgressBarEx)
    ProgressRect { id: _progressRect
        z           : 1 // Main ProgressBar Rect, z order in the gui
        decimal     : _root.decimal
        minimum     : _root.minimum
        maximum     : _root.maximum
        value       : _root.value

        color       : Colors.highlightProgressBar
        onClicked   : progressClicked()
    }

    RangeMarker { id: _marker
        z           : 2 // ProgressBar marker should be on top of the all ProgressBars z order in the gui
        anchors {
            left    : _progressRect.right
        }

        height      : Variables.rangeMarkerHeight
        hasHandle   : true

        decimal     : _root.decimal
        value       : _root.value
    }
}
