
// Qt
import QtQuick 2.12

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

Item { id : _root
    property string topText             : ""
    property string topTextColor        : Colors.textTextRectLabel
    property alias  topTextFont         : _topText.font

    property string centerText          : ""
    property bool   showCenterText      : false
    property bool   leftAlign           : false

    property string bottomText          : ""
    property string bottomTextColor     : Colors.textTextRectLabel
    property alias  bottomTextFont      : _bottomText.font
    property int    bottomTextTopMargin : 0

    property string  unitText            : ""

    clip: false

    Text { id: _topText
        anchors {
            top             : parent.top
            left            : leftAlign ?   parent.left :
                                            undefined
            horizontalCenter: leftAlign ? undefined :
                                          parent.horizontalCenter
        }
        text                : _root.topText
        color               : topTextColor
        font.pixelSize      : Fonts.fontPixelTextRectLabel
    }

    Text { id: _centerText
        anchors {
            top         : _topText.bottom
            topMargin   : 10
            left        : _topText.left
        }
        text            : _root.centerText
        color           : topTextColor
        font.pixelSize  : 20
        font.weight     : Font.Light
    }

    Text { id: _bottomText
        anchors {
            top             : showCenterText ? _centerText.bottom :
                                               _topText.bottom
            topMargin       : bottomTextTopMargin
            horizontalCenter: leftAlign ? undefined :
                                          _topText.horizontalCenter
        }
        text                : _root.bottomText
        color               : bottomTextColor
        font.pixelSize      : Fonts.fontPixelTextRectExtra
    }

    Text { id: _unitText
        anchors {
            left        :   _bottomText.right
            leftMargin  : 5
            bottom      : _bottomText.bottom
            bottomMargin: 10
        }
        text            : _root.unitText
        color           : topTextColor
        font.pixelSize  : 22
    }
}
