1/* GCompris - GCButtonScroll.qml 2 * 3 * SPDX-FileCopyrightText: 2017 Timothée Giet <animtim@gcompris.net> 4 * 2015 Bruno Coudoin <bruno.coudoin@gcompris.net> 5 * 6 * Authors: 7 * Timothée Giet <animtim@gcompris.net> 8 * Bruno Coudoin <bruno.coudoin@gcompris.net> 9 * 10 * SPDX-License-Identifier: GPL-3.0-or-later 11 */ 12import QtQuick 2.2 13import GCompris 1.0 14 15/** 16 * A QML component representing GCompris' scroll buttons. 17 * @ingroup components 18 * 19 * @inherit QtQuick.Image 20 */ 21Rectangle { 22 id: scrollButtons 23 color: "#00000000" 24 width: (isHorizontal ? 110 : 50) * ApplicationInfo.ratio 25 height: (isHorizontal ? 50 : 110) * ApplicationInfo.ratio 26 27 signal up 28 signal down 29 30 property bool upVisible: false 31 property bool downVisible: false 32 33 property bool isHorizontal: false 34 property real heightRatio: isHorizontal ? (50 / 110) : (110 / 50) 35 property real widthRatio: 1 / heightRatio 36 37 BarButton { 38 id: scrollUp 39 width: isHorizontal ? parent.height : parent.width 40 height: width 41 source: "qrc:/gcompris/src/core/resource/scroll_down.svg"; 42 sourceSize.width: scrollUp.width 43 sourceSize.height: scrollUp.height 44 rotation: 180 45 anchors.top: isHorizontal ? undefined : parent.top 46 anchors.left: isHorizontal ? parent.left : undefined 47 onClicked: up() 48 visible: upVisible 49 } 50 51 BarButton { 52 id: scrollDown 53 width: isHorizontal ? parent.height : parent.width 54 height: width 55 source: "qrc:/gcompris/src/core/resource/scroll_down.svg"; 56 sourceSize.width: scrollDown.width 57 sourceSize.height: scrollDown.height 58 anchors.bottom: parent.bottom 59 anchors.right: isHorizontal ? parent.right : undefined 60 onClicked: down() 61 visible: downVisible 62 } 63} 64