Warning, /maui/mauikit/src/style.5/ScrollView.qml is written in an unsupported language. File is not indexed.

0001 /****************************************************************************
0002 **
0003 ** Copyright (C) 2017 The Qt Company Ltd.
0004 ** Contact: http://www.qt.io/licensing/
0005 **
0006 ** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
0007 **
0008 ** $QT_BEGIN_LICENSE:LGPL3$
0009 ** Commercial License Usage
0010 ** Licensees holding valid commercial Qt licenses may use this file in
0011 ** accordance with the commercial license agreement provided with the
0012 ** Software or, alternatively, in accordance with the terms contained in
0013 ** a written agreement between you and The Qt Company. For licensing terms
0014 ** and conditions see http://www.qt.io/terms-conditions. For further
0015 ** information use the contact form at http://www.qt.io/contact-us.
0016 **
0017 ** GNU Lesser General Public License Usage
0018 ** Alternatively, this file may be used under the terms of the GNU Lesser
0019 ** General Public License version 3 as published by the Free Software
0020 ** Foundation and appearing in the file LICENSE.LGPLv3 included in the
0021 ** packaging of this file. Please review the following information to
0022 ** ensure the GNU Lesser General Public License version 3 requirements
0023 ** will be met: https://www.gnu.org/licenses/lgpl.html.
0024 **
0025 ** GNU General Public License Usage
0026 ** Alternatively, this file may be used under the terms of the GNU
0027 ** General Public License version 2.0 or later as published by the Free
0028 ** Software Foundation and appearing in the file LICENSE.GPL included in
0029 ** the packaging of this file. Please review the following information to
0030 ** ensure the GNU General Public License version 2.0 requirements will be
0031 ** met: http://www.gnu.org/licenses/gpl-2.0.html.
0032 **
0033 ** $QT_END_LICENSE$
0034 **
0035 ****************************************************************************/
0036 
0037 import QtQuick 2.12
0038 import QtQuick.Templates 2.12 as T
0039 import org.mauikit.controls 1.3 as Maui
0040 
0041 T.ScrollView
0042 {
0043     id: control
0044 
0045     implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
0046                             contentWidth + leftPadding + rightPadding)
0047     implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
0048                              contentHeight + topPadding + bottomPadding)
0049 
0050     Maui.Theme.colorSet: Maui.Theme.View
0051     Maui.Theme.inherit: !background || !background.visible
0052     clip: false
0053         
0054     padding: 0
0055     rightPadding: padding + (Maui.Style.scrollBarPolicy === Maui.Style.AutoHide ? 0 : ScrollBar.vertical.width)
0056     leftPadding: padding 
0057     topPadding: padding
0058     bottomPadding: padding + (Maui.Style.scrollBarPolicy === Maui.Style.AutoHide ? 0 :ScrollBar.horizontal.height)
0059     
0060     property alias orientation : _wheelHandler.primaryOrientation
0061 
0062     data: Maui.WheelHandler
0063     {
0064         id: _wheelHandler
0065         target: control.contentItem
0066             }
0067     
0068     ScrollBar.vertical: ScrollBar 
0069     {
0070         parent: control
0071         width: visible ? implicitWidth : 0
0072         x: control.mirrored ? 0 : control.width - width - 2
0073         y: control.topPadding
0074         height: control.availableHeight
0075         active: control.ScrollBar.vertical.active
0076         policy: switch(Maui.Style.scrollBarPolicy)
0077         {
0078             case Maui.Style.AlwaysOn: return ScrollBar.AlwaysOn;   
0079             case Maui.Style.AlwaysOff: return ScrollBar.AlwaysOff;   
0080             case Maui.Style.AsNeeded: return ScrollBar.AsNeeded;   
0081             case Maui.Style.AutoHide: return ScrollBar.AsNeeded;   
0082         }
0083     }
0084 
0085     ScrollBar.horizontal: ScrollBar
0086     {
0087         parent: control
0088         height: visible ? implicitHeight : 0
0089         
0090         x: control.leftPadding
0091         y: control.height - height - 2
0092         width: control.availableWidth
0093         active: control.ScrollBar.horizontal.active
0094         policy: ScrollBar.AlwaysOff
0095         
0096     }
0097     
0098     background: null
0099 }