import QtQuick 2.7
import QtQuick.Controls.Styles 1.4
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.1


Rectangle {
     width: ROOT_WIDTH ; height: ROOT_HEIGHT

    color: "#e3e3e3"

    ListModel {
        id: appGridModel
        objectName : "appGridModel"

        ELEMENTS        
    }


    GridView {
            id: menu
            objectName: "inkScreen"
            boundsBehavior :Flickable.StopAtBounds
            anchors.centerIn: parent
            anchors.margins: 16
            width: parent.width
            height: parent.height
            model: appGridModel
            cellWidth: width / NUMBER_COLS
            cellHeight: height / NUMBER_ROWS
            delegate: Component {
                id: appGridDelegate
                Item {
                    id: wrapper
                     width: menu.cellWidth
                     height: menu.cellHeight
                     Rectangle {
                       anchors.fill: parent
                       anchors.margins: 10
                       ProgressBar {
                         id: progressBarElement
                         anchors.centerIn: parent
                         orientation: ORIENTATION
                         value: progress
                         style: ProgressBarStyle {
                           background: Rectangle {
                             radius: 5
                             color: "lightgray"
                             border.color: "gray"
                             border.width: 2
                             implicitWidth:  progressBarElement.orientation == Qt.Vertical ? menu.cellHeight / 1.5 :menu.cellWidth / 1.5
                             implicitHeight: progressBarElement.orientation == Qt.Vertical ? menu.cellWidth / 2.5 :menu.cellHeight /2.5
                           }
                          progress: Rectangle {
                            border.width: 2
                             radius: 5
                             color: colorBar
                             border.color: "gray"
                            }
                          }
                        }
                        Text{
                          id: textLabel
                          text: INK_TEXT
                          width: text.contentWidth
                          height: text.contentHeight
                          color: PERCENTAGE_COLOR
                          font.pixelSize: Math.min(progressBarElement.width, progressBarElement.height) *0.25
                          anchors.top: progressBarElement.bottom
                          anchors.centerIn: parent
                        }
                    }
                }
            }
        }
    }
