
// Qt
import QtQuick 2.12

// Project
import "qrc:/globals"
import "qrc:/components"
import "qrc:/compounds"

TreatmentAdjustmentBase { id: _root
    contentItem.objectName: "TreatmentAdjustmentMode"
    titleText           : qsTr("Treatment Mode")

    titlePixelSize      : Fonts.fontPixelSection
    height              : Variables.smallDialogHeight
    width               : Variables.smallDialogWidth

    function confirm() {
        vTreatmentCreate.hdfTreatmentMode  = _treatmentModeControl.currentIndex
        _root.close()
    }

    onOpened: _treatmentModeControl.currentIndex = vTreatmentCreate.hdfTreatmentMode

    LabelUnitContainer { id: _treatmentMode
        objectName      : "_treatmentMode"
        anchors {
            verticalCenter      : _root.contentItem.verticalCenter
            verticalCenterOffset: Variables.defaultMargin * -3 // better align label with dialog height
            horizontalCenter    : _root.contentItem.horizontalCenter
        }
        text            : qsTr("Treatment Mode")
        width           : Variables.adjustmentLabelUnitContainerWidth
        height          : Variables.adjustmentLabelUnitContainerHeight
        onEditClicked   : _root.treatmentModeEditClicked()

        contentItem : ValueAdjusterCustom { id: _treatmentModeControl
            value       : vTreatmentCreate.hdfTreatmentMode
            model       : vTreatmentRanges.hdfTreatmentModeOptions

        }
    }

    ConfirmButton { id : _confirmButton
        anchors {
            bottom          : _root.contentItem.bottom
            bottomMargin    : Variables.defaultMargin * 4
            horizontalCenter: _root.contentItem.horizontalCenter
        }

        width       : Variables.defaultButtonWidth
        height      : Variables.defaultButtonHeight

        anchors {
            top     : undefined
            right   : undefined
            margins : 0
        }
        onClicked   : {
            _root.confirm()
        }
    }
}
