Warning, /education/gcompris/src/core/GCButtonScroll.qml is written in an unsupported language. File is not indexed.

0001 /* GCompris - GCButtonScroll.qml
0002  *
0003  * SPDX-FileCopyrightText: 2017 Timothée Giet <animtim@gcompris.net>
0004  *               2015 Bruno Coudoin <bruno.coudoin@gcompris.net>
0005  *
0006  * Authors:
0007  *   Timothée Giet <animtim@gcompris.net>
0008  *   Bruno Coudoin <bruno.coudoin@gcompris.net>
0009  *
0010  *   SPDX-License-Identifier: GPL-3.0-or-later
0011  */
0012 import QtQuick 2.12
0013 import GCompris 1.0
0014 
0015 /**
0016  * A QML component representing GCompris' scroll buttons.
0017  * @ingroup components
0018  *
0019  * @inherit QtQuick.Image
0020  */
0021 Rectangle {
0022     id: scrollButtons
0023     color: "#00000000"
0024     width: (isHorizontal ? 110 : 50) * ApplicationInfo.ratio
0025     height: (isHorizontal ? 50 : 110) * ApplicationInfo.ratio
0026 
0027     signal up
0028     signal down
0029 
0030     property bool upVisible: false
0031     property bool downVisible: false
0032 
0033     property bool isHorizontal: false
0034     property real heightRatio: isHorizontal ? (50 / 110) : (110 / 50)
0035     property real widthRatio: 1 / heightRatio
0036 
0037     BarButton {
0038         id: scrollUp
0039         width: isHorizontal ? parent.height : parent.width
0040         height: width
0041         source: "qrc:/gcompris/src/core/resource/scroll_down.svg";
0042         sourceSize.width: scrollUp.width
0043         sourceSize.height: scrollUp.height
0044         rotation: 180
0045         anchors.top: isHorizontal ? undefined : parent.top
0046         anchors.left: isHorizontal ? parent.left : undefined
0047         onClicked: up()
0048         visible: upVisible
0049     }
0050 
0051     BarButton {
0052         id: scrollDown
0053         width: isHorizontal ? parent.height : parent.width
0054         height: width
0055         source: "qrc:/gcompris/src/core/resource/scroll_down.svg";
0056         sourceSize.width: scrollDown.width
0057         sourceSize.height: scrollDown.height
0058         anchors.bottom: parent.bottom
0059         anchors.right: isHorizontal ? parent.right : undefined
0060         onClicked: down()
0061         visible: downVisible
0062     }
0063 }