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

0001 /*
0002  *   Copyright 2019 Camilo Higuita <milo.h@aol.com>
0003  *
0004  *   This program is free software; you can redistribute it and/or modify
0005  *   it under the terms of the GNU Library General Public License as
0006  *   published by the Free Software Foundation; either version 2, or
0007  *   (at your option) any later version.
0008  *
0009  *   This program is distributed in the hope that it will be useful,
0010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *   GNU General Public License for more details
0013  *
0014  *   You should have received a copy of the GNU Library General Public
0015  *   License along with this program; if not, write to the
0016  *   Free Software Foundation, Inc.,
0017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
0018  */
0019 
0020 import QtQuick 2.15
0021 import QtQml 2.15
0022 import QtQuick.Controls 2.15
0023 import QtQuick.Layouts 1.3
0024 import QtQuick.Templates 2.15 as T
0025 import QtGraphicalEffects 1.15
0026 
0027 import org.mauikit.controls 1.3 as Maui
0028 
0029 /*!
0030  * \since org.mauikit.controls 1.0
0031  * \inqmlmodule org.mauikit.controls
0032  * \brief A page with a header and footer bar, that can be switched among many other features.
0033  *
0034  * This page has a header and footer bar that by default are a MauiKit ToolBar,
0035  * the header bar can be dinamically moved to the bottom under the footer for better
0036  * reachability on hand held devices like phones.
0037  *
0038  * Among other features, the page can have a reference to a flickable element to allow to have pull back
0039  * toolbar behaviour, floating toolbars, etc.
0040  *
0041  */
0042 T.Pane
0043 {
0044     id: control
0045     padding: 0
0046     
0047     leftPadding: control.padding
0048     rightPadding: control.padding
0049     topPadding: control.padding
0050     bottomPadding: control.padding
0051         
0052     Maui.Theme.colorSet: Maui.Theme.View
0053     Maui.Theme.inherit: false
0054     
0055     /*!
0056      *      \qmlproperty list<Object> Item::content
0057      *
0058      *      The default content of the page.
0059      *      To position child elements use anchors or do it manually.
0060      */
0061     default property alias content: _content.data
0062 
0063     /*!
0064          *      \qmlproperty Item Page::pageContent
0065          *
0066          *      An alias to the actual Item that contains the page children.
0067          */
0068     readonly property alias pageContent : _content
0069 
0070     /*!
0071          *      \qmlproperty int Page::internalHeight
0072          *
0073          *      The actual height of the page contents withouth the header or footer bars.
0074          */
0075     readonly property alias internalHeight : _content.height
0076 
0077     /*!
0078          *      A flickable element can be referenced in order to support the header and footer positioning options
0079          *        such as Inline, Pullback or floating.
0080          *        If a flickable is set, the page will modify its top or bottom margins properties.
0081          *        And watch for changes in properties such a contentX and contentY in order to support the former mentioned features.
0082          */
0083     property Flickable flickable : null
0084 
0085     /*!
0086          *      The footer bar can be place static and always visible with the InlineFooter value, or move with the flickable contents when using the PullBackFooter value.
0087          *      This is only supported if a flickable element has been set.
0088          *      By default this is set to InlineFooter.
0089          */
0090     property int footerPositioning : ListView.InlineFooter
0091 
0092     /*!
0093          *      The header bar can be place static and always visible with the InlineHeader value, or move with the flickable contents when using the PullBackHeader value.
0094          *      This is only supported if a flickable element has been set.
0095          *      By default this is set to InlineHeader unless it is a Mobile device, in which case it is PullBackHeader.
0096          */
0097     property int headerPositioning : flickable ? ListView.PullBackHeader : ListView.InlineHeader
0098 
0099     property int headerColorSet : altHeader ? Maui.Theme.Window : Maui.Theme.Header
0100 
0101     /*!
0102          *      A title for the page.
0103          *      This title is shown in the middle of the default header bar if the showTitle property is set to true.
0104          *      The displayed title in the header bar wont wrap and will elide in the middle.
0105          */
0106     property string title
0107 
0108     /*!
0109          *      If a title is set and this is set to true, such title will be displayed in the default header bar in the middle.
0110          */
0111     property bool showTitle : true
0112 
0113     /*!
0114          *      \qmlproperty ToolBar Page::headBar
0115          *      An alias to the default header bar toolbar.
0116          *      The toolbar is a MauiKit ToolBar.
0117          */
0118     property alias headBar : _headBar
0119 
0120     /*!
0121          *      \qmlproperty ToolBar Page::footBar
0122          *      An alias to the default footer bar toolbar.
0123          *      The toolbar is a MauiKit ToolBar.
0124          */
0125     property alias footBar: _footBar
0126 
0127     /*!
0128          *      \qmlproperty list<Object> Page::footerColumn
0129          *      Quick way to add more children to the footer bar.
0130          *      The footer bar is handled by a ColumnLayout so any elements to be added need to be postioned using the Layout attached properties.
0131          *      Layout.fillWidth can be set, but an implicit or preferredHeight must be given.
0132          */
0133     property alias footerColumn : _footerContent.data
0134     property alias footerContainer : _footerContent
0135 
0136     /*!
0137          *      \qmlproperty list<Object> Page::headerColumn
0138          *      Quick way to add more children to the header bar.
0139          *      The header bar is handled by a ColumnLayout so any elements to be added need to be postioned using the Layout attached properties.
0140          *      Layout.fillWidth can be set, but an implicit or preferredHeight must be given.
0141          */
0142     property alias headerColumn : _headerContent.data
0143     property alias headerContainer : _headerContent
0144 
0145     /*!
0146          *      The page margins between the children contents and the actual container.
0147          *      This margins do not affect the header or footer bars.
0148          *      By default this is set to 0
0149          */
0150     property int margins: 0
0151 
0152     /*!
0153          *      Page left margins
0154          */
0155     property int leftMargin : margins
0156 
0157     /*!
0158          *      Page right margins
0159          */
0160     property int rightMargin: margins
0161 
0162     /*!
0163          *      Page top margins
0164          */
0165     property int topMargin: margins
0166 
0167     /*!
0168          *      Page bottom margins
0169          */
0170     property int bottomMargin: margins
0171 
0172     /*!
0173          *      If set to true the header bar will be positioned to the bottom under the footer bar.
0174          *      This makes sense in some cases for better reachability, or custom design patterns.
0175          */
0176     property bool altHeader : false
0177 
0178     /*!
0179          *      If the header bar should hide under certain conditions.
0180          *      To fine tune a threshold margin can be set, and a time delay.
0181          */
0182     property bool autoHideHeader : false
0183 
0184     /*!
0185          *      If the footer bar should hide under certain conditions.
0186          *      To fine tune a threshold margin can be set, and a time delay.
0187          */
0188     property bool autoHideFooter : false
0189 
0190     /*!
0191          *      Pixels threshold for when the header should auto hide.
0192          *      The default value is set to Maui.Style.toolBarHeight, which is the double distance of the default header bar toolbar.
0193          */
0194     property int autoHideHeaderMargins : Maui.Style.toolBarHeight
0195 
0196     /*!
0197          *      Pixels threshold for when the footer should auto hide.
0198          *      The default value is set to Maui.Style.toolBarHeight, which is the double distance of the default footer bar toolbar.
0199          */
0200     property int autoHideFooterMargins : Maui.Style.toolBarHeight
0201 
0202     /*!
0203          *      Span of time to hide the footer bar after the conditions have been met.
0204          *      If within the span of time the conditions changed then the timer gets reseted.
0205          */
0206     property int autoHideFooterDelay : Maui.Handy.isTouch ? 0 : 1000
0207 
0208     /*!
0209          *      Span of time to hide the header bar after the conditions have been met.
0210          *      If within the span of time the conditions changed then the timer gets reseted.
0211          */
0212     property int autoHideHeaderDelay : Maui.Handy.isTouch ? 0 : 1000
0213 
0214     //    property bool floatingHeader : control.flickable && !control.flickable.atYBeginning
0215 
0216     /*!
0217          *      If the footer bar should float over the page contents, if a flickable has been set then the default header bar will have a translucent ShaderEffect
0218          *      to hint about the content under it.
0219          */
0220     property bool floatingHeader : false
0221 
0222     /*!
0223          *      If the header bar should float over the page contents, if a flickable has been set then the default header bar will have a translucent ShaderEffect
0224          *      to hint about the content under it.
0225          */
0226     property bool floatingFooter: false
0227 
0228     property bool showCSDControls : false
0229 
0230     /*!
0231          *      The page has requested to go back by a gesture or keyboard shortcut
0232          */
0233     signal goBackTriggered()
0234 
0235     /*!
0236          *      The page has requested to go forward by a gesture or keyboard shortcut
0237          */
0238     signal goForwardTriggered()
0239 
0240     QtObject
0241     {
0242         id: _private
0243         property int topMargin : (!control.altHeader ? (control.floatingHeader ? 0 : _headerContent.implicitHeight) : 0) + control.topMargin
0244         property int bottomMargin: ((control.floatingFooter && control.footerPositioning === ListView.InlineFooter ? 0 : _footerContent.implicitHeight)  + (control.altHeader ? _headerContent.implicitHeight : 0))
0245     }
0246 
0247     background: Rectangle
0248     {
0249         color: Maui.Theme.backgroundColor
0250          Behavior on color
0251         {
0252             Maui.ColorTransition{}
0253         }
0254     }
0255 
0256     onFlickableChanged:
0257     {
0258         returnToBounds()
0259     }
0260 
0261     Binding
0262     {
0263         when:  control.floatingFooter && control.footerPositioning === ListView.InlineFooter && _footerContent.implicitHeight > 0
0264         target: control.flickable
0265         property: "bottomMargin"
0266         value: _footerContent.implicitHeight
0267         restoreMode: Binding.RestoreBindingOrValue
0268     }
0269 
0270     Connections
0271     {
0272         target: control.flickable ? control.flickable : null
0273         ignoreUnknownSignals: true
0274         enabled: control.flickable && ((control.header && control.headerPositioning === ListView.PullBackHeader) || (control.footer &&  control.footerPositioning === ListView.PullBackFooter))
0275         property int oldContentY
0276         property bool updatingContentY: false
0277 
0278         function onContentYChanged()
0279         {
0280             _headerAnimation.enabled = false
0281             _footerAnimation.enabled = false
0282 
0283             if(!control.flickable.dragging && control.flickable.atYBeginning)
0284             {
0285                 control.returnToBounds()
0286             }
0287 
0288             if (updatingContentY || !control.flickable || !control.flickable.dragging)
0289             {
0290                 oldContentY = control.flickable.contentY;
0291                 return;
0292                 //TODO: merge
0293                 //if moves but not dragging, just update oldContentY
0294             }
0295 
0296             if(control.flickable.contentHeight < control.height)
0297             {
0298                 return
0299             }
0300 
0301             var oldFHeight
0302             var oldHHeight
0303 
0304             if (control.footer && control.footerPositioning === ListView.PullBackFooter && control.footer.visible)
0305             {
0306                 oldFHeight = control.footer.height
0307                 control.footer.height = Math.max(0,
0308                                                  Math.min(control.footer.implicitHeight,
0309                                                           control.footer.height + oldContentY - control.flickable.contentY));
0310             }
0311 
0312             if (control.header && control.headerPositioning === ListView.PullBackHeader && control.header.visible && !control.altHeader)
0313             {
0314                 oldHHeight = control.header.height
0315                 control.header.height = Math.max(0,
0316                                                  Math.min(control.header.implicitHeight,
0317                                                           control.header.height + oldContentY - control.flickable.contentY));
0318             }
0319 
0320             //if the implicitHeight is changed, use that to simulate scroll
0321             if (control.header && oldHHeight !== control.header.height && control.header.visible && !control.altHeader)
0322             {
0323                 updatingContentY = true
0324                 control.flickable.contentY -= (oldHHeight - control.header.height)
0325                 updatingContentY = false
0326 
0327             } else {
0328                 oldContentY = control.flickable.contentY
0329             }
0330         }
0331 
0332         function onMovementEnded()
0333         {
0334             if (control.header && control.header.visible && control.headerPositioning === ListView.PullBackHeader && !control.altHeader)
0335             {
0336                 _headerAnimation.enabled = true
0337 
0338                 if (control.header.height >= (control.header.implicitHeight/2) || control.flickable.atYBeginning )
0339                 {
0340                     control.header.height =  control.header.implicitHeight
0341 
0342                 } else
0343                 {
0344                     control.header.height = 0
0345                 }
0346             }
0347 
0348             if (control.footer && control.footer.visible && control.footerPositioning === ListView.PullBackFooter)
0349             {
0350                 _footerAnimation.enabled = true
0351 
0352                 if (control.footer.height >= (control.footer.implicitHeight/2) ||  control.flickable.atYEnd)
0353                 {
0354                     if(control.flickable.atYEnd)
0355                     {
0356                         control.footer.height =  control.footer.implicitHeight
0357 
0358                         control.flickable.contentY = control.flickable.contentHeight - control.flickable.height
0359                         oldContentY = control.flickable.contentY
0360                     }else
0361                     {
0362                         control.footer.height =  control.footer.implicitHeight
0363 
0364                     }
0365 
0366                 } else
0367                 {
0368                     control.footer.height = 0
0369                 }
0370             }
0371         }
0372     }
0373 
0374     /*!
0375          *
0376          */
0377     property Item header : Maui.ToolBar
0378     {
0379         id: _headBar
0380         visible: count > 0
0381         width: visible ? parent.width : 0
0382         position: control.altHeader ? ToolBar.Footer : ToolBar.Header
0383         translucencySource: ShaderEffectSource
0384         {
0385             sourceItem: _content
0386             sourceRect:  _headBar.background ? (control.floatingHeader ? Qt.rect(0, (_headBar.position === ToolBar.Header ? 0 :  _content.height - _headBar.background.height), _headBar.background.width, _headBar.background.height) : Qt.rect(0, (_headBar.position === ToolBar.Header ?  0 - (_headBar.background.height) :  _content.height), _headBar.background.width, _headBar.background.height)) : null
0387         }
0388         
0389         Binding on height
0390         {
0391             value: visible ? _headBar.implicitHeight : 0
0392             restoreMode: Binding.RestoreBindingOrValue
0393         }               
0394 
0395         Behavior on height
0396         {
0397             id: _headerAnimation
0398             enabled: false
0399             NumberAnimation
0400             {
0401                 duration: Maui.Style.units.shortDuration
0402                 easing.type: Easing.InOutQuad
0403             }
0404         }
0405         
0406         Component
0407         {
0408             id: _titleComponent
0409             
0410             Item
0411             {
0412                 implicitHeight:_titleLabel.implicitHeight
0413                 
0414                 Label
0415                 {
0416                     id: _titleLabel
0417                     anchors.fill: parent
0418                     text: control.title
0419                     elide : Text.ElideRight
0420 //                     font.bold : true
0421                     font: Maui.Style.h2Font
0422                     horizontalAlignment : Text.AlignHCenter
0423                     verticalAlignment :  Text.AlignVCenter
0424                 }
0425             }
0426         }
0427 
0428         middleContent: Loader
0429         {
0430             visible: item
0431             active: control.title && control.showTitle
0432             sourceComponent: _titleComponent
0433 
0434             asynchronous: true
0435             Layout.fillWidth: true
0436             Layout.fillHeight: true
0437         }
0438     }
0439 
0440     //Label
0441     //{
0442     //z: 999999999999
0443     //color: "yellow"
0444     //text: _footBar.visibleCount + " / " + _footBar.count + " - " + _footBar.height + " / " + footer.height + " - " + _footBar.visible + " / " + footer.visible + " / " + footer.height + " / " + _footerContent.implicitHeight  + " / " + _footerContent.implicitHeight
0445     //}
0446 
0447     /*!
0448          *
0449          */
0450     property Item footer : Maui.ToolBar
0451     {
0452         id: _footBar
0453         visible: count > 0
0454         width: visible ? parent.width : 0
0455         height: visible ? implicitHeight : 0
0456 
0457         position: ToolBar.Footer
0458 
0459         translucencySource: ShaderEffectSource
0460         {
0461             //textureSize: Qt.size(_headBarBG.width * 0.2, _headBarBG.height * 0.2)
0462             sourceItem: _content
0463             sourceRect: _footBar.background ? (control.floatingFooter  ?  Qt.rect(0, _content.height - _footBar.background.height, _footBar.background.width, _footBar.background.height) : Qt.rect(0, _content.height, _footBar.background.width, _footBar.background.height)) : null
0464         }        
0465         
0466         Behavior on height
0467         {
0468             id: _footerAnimation
0469             enabled: false
0470             NumberAnimation
0471             {
0472                 duration: Maui.Style.units.shortDuration
0473                 easing.type: Easing.InOutQuad
0474             }
0475         }
0476     }
0477 
0478     states: [  State
0479         {
0480             when: !altHeader 
0481             
0482             AnchorChanges
0483             {
0484                 target: _headerContent
0485                 anchors.top: parent.top
0486                 anchors.bottom: undefined
0487             }
0488             
0489             AnchorChanges
0490             {
0491                 target: _footerContent
0492                 anchors.top: undefined
0493                 anchors.bottom: parent.bottom
0494             }
0495         },
0496         
0497         State
0498         {
0499             when: altHeader 
0500             
0501             AnchorChanges
0502             {
0503                 target: _headerContent
0504                 anchors.top: undefined
0505                 anchors.bottom: parent.bottom
0506             }
0507             
0508             AnchorChanges
0509             {
0510                 target: _footerContent
0511                 anchors.top: undefined
0512                 anchors.bottom: _headerContent.top
0513             }
0514         } ]
0515 
0516     onAutoHideHeaderChanged:
0517     {
0518         if(control.autoHideHeader)
0519         {
0520             pullBackHeader()
0521         }else
0522         {
0523             pullDownHeader()
0524         }
0525     }
0526 
0527     onAutoHideFooterChanged:
0528     {
0529         if(control.autoHideFooter)
0530         {
0531             pullBackFooter()
0532         } else
0533         {
0534             pullDownFooter()
0535         }
0536     }
0537     onAltHeaderChanged: pullDownHeader()
0538 
0539 
0540     //                 Label
0541     //                 {
0542     //                     anchors.centerIn: _headerContent
0543     //                     text: header.height + "/" + _headerContent.height + " - " + _layout.anchors.topMargin
0544     //                     color: "orange"
0545     //                     z: _headerContent.z + 1
0546     //                     visible: header.visible
0547     //                 }
0548     //
0549     //                    Label
0550     //                 {
0551     //                     anchors.centerIn: _footerContent
0552     //                     text: footer.height + "/" + _footerContent.height + " - " + _layout.anchors.topMargin
0553     //                     color: "orange"
0554     //                     z: _footerContent.z + 9999
0555     //                 }
0556 
0557     contentItem: Item
0558     {        
0559             Item
0560             {
0561                 id: _content
0562                 anchors.fill: parent
0563                 
0564                 anchors.topMargin: _private.topMargin                
0565                 anchors.bottomMargin: _private.bottomMargin
0566                 
0567                 anchors.leftMargin: control.leftMargin
0568                 anchors.rightMargin: control.rightMargin
0569             }
0570             
0571             Column
0572             {
0573                 id: _headerContent
0574                 anchors.left: parent.left
0575                 anchors.right: parent.right
0576             }              
0577         
0578         Column
0579         {
0580             id: _footerContent
0581             anchors.left: parent.left
0582             anchors.right: parent.right
0583         }
0584 
0585         Loader
0586         {
0587             anchors.fill: parent
0588             asynchronous: true
0589             sourceComponent: MouseArea // to support tbutton go back and forward
0590             {
0591                 propagateComposedEvents: true
0592                 acceptedButtons: Qt.BackButton | Qt.ForwardButton
0593                 cursorShape: undefined
0594                 
0595                 //        hoverEnabled: true
0596                 //        onEntered: _splitView.currentIndex = control.index
0597                 onPressed:
0598                 {
0599                     mouse.accepted = false
0600                     if(mouse.button === Qt.BackButton)
0601                     {
0602                         control.goBackTriggered()
0603                     }
0604 
0605                     if(mouse.button === Qt.ForwardButton)
0606                     {
0607                         control.goForwardTriggered()
0608                     }
0609                 }
0610             }
0611         }
0612 
0613         Loader
0614         {
0615             anchors.fill: parent
0616             asynchronous: true
0617             z: _content.z +1
0618             active: (control.autoHideFooter || control.autoHideHeader ) && Maui.Handy.isTouch
0619 
0620             sourceComponent: MouseArea
0621             {
0622                 parent: _content
0623                 propagateComposedEvents: true
0624                 drag.filterChildren: true
0625 
0626                 Timer
0627                 {
0628                     id: doubleClickTimer
0629                     interval: 900
0630                     onTriggered:
0631                     {
0632                         if(control.autoHideHeader)
0633                         {
0634                             if(header.height !== 0)
0635                             {
0636                                 _autoHideHeaderTimer.start()
0637                                 _revealHeaderTimer.stop()
0638 
0639                             }else
0640                             {
0641                                 _autoHideHeaderTimer.stop()
0642                                 _revealHeaderTimer.start()
0643                             }
0644                         }
0645 
0646                         if(control.autoHideFooter)
0647                         {
0648                             if(footer.height !== 0)
0649                             {
0650                                 _autoHideFooterTimer.start()
0651 
0652                             }else
0653                             {
0654                                 pullDownFooter()
0655                                 _autoHideFooterTimer.stop()
0656                             }
0657                         }
0658                     }
0659                 }
0660 
0661                 onPressed:
0662                 {
0663                     doubleClickTimer.restart();
0664                     mouse.accepted = false
0665                 }
0666             }
0667         }
0668 
0669         Loader
0670         {
0671             asynchronous: true
0672             anchors.top: parent.top
0673             anchors.left: parent.left
0674             anchors.right: parent.right
0675             height: active ? _headerContent.implicitHeight + control.autoHideHeaderMargins : 0
0676             z: _content.z +1
0677             active: control.autoHideHeader && !control.altHeader && !Maui.Handy.isTouch
0678 
0679             sourceComponent: Item
0680             {
0681                 HoverHandler
0682                 {
0683                     target: parent
0684                     acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus
0685 
0686                     onHoveredChanged:
0687                     {
0688                         if(!control.autoHideHeader || control.altHeader)
0689                         {
0690                             _autoHideHeaderTimer.stop()
0691                             return
0692                         }
0693 
0694                         if(!hovered)
0695                         {
0696                             _autoHideHeaderTimer.start()
0697                             _revealHeaderTimer.stop()
0698 
0699                         }else
0700                         {
0701                             _autoHideHeaderTimer.stop()
0702                             _revealHeaderTimer.start()
0703                         }
0704                     }
0705                 }
0706             }
0707         }
0708 
0709         Loader
0710         {
0711             asynchronous: true
0712             anchors.bottom: parent.bottom
0713             anchors.left: parent.left
0714             anchors.right: parent.right
0715             height: active ? _footerContent.implicitHeight + control.autoHideFooterMargins : 0
0716             z: _footerContent.z - 1
0717             active: control.autoHideFooter && !control.altHeader && !Maui.Handy.isTouch
0718 
0719             sourceComponent: Item
0720             {
0721                 HoverHandler
0722                 {
0723                     target: parent
0724 
0725                     acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus
0726 
0727                     onHoveredChanged:
0728                     {
0729                         if(!control.autoHideFooter)
0730                         {
0731                             return
0732                         }
0733 
0734                         if(!hovered)
0735                         {
0736                             _autoHideFooterTimer.start()
0737 
0738                         }else
0739                         {
0740                             pullDownFooter()
0741                             _autoHideFooterTimer.stop()
0742                         }
0743                     }
0744                 }
0745             }
0746         }
0747     }
0748 
0749     Timer
0750     {
0751         id: _revealHeaderTimer
0752         interval: autoHideHeaderDelay
0753 
0754         onTriggered:
0755         {
0756             pullDownHeader()
0757         }
0758     }
0759 
0760     Timer
0761     {
0762         id: _autoHideHeaderTimer
0763         interval: autoHideHeaderDelay
0764         onTriggered:
0765         {
0766             if(control.autoHideHeader)
0767             {
0768                 pullBackHeader()
0769             }
0770 
0771             stop()
0772         }
0773     }
0774 
0775     Timer
0776     {
0777         id: _autoHideFooterTimer
0778         interval: control.autoHideFooterDelay
0779         onTriggered:
0780         {
0781             if(control.autoHideFooter)
0782             {
0783                 pullBackFooter()
0784             }
0785 
0786             stop()
0787         }
0788     }
0789 
0790     //Keys.onBackPressed:
0791     //{
0792         //control.goBackTriggered();
0793     //}
0794 
0795     //Shortcut
0796     //{
0797         //sequence: "Forward"
0798         //onActivated: control.goForwardTriggered();
0799     //}
0800 
0801     //Shortcut
0802     //{
0803         //sequence: StandardKey.Forward
0804         //onActivated: control.goForwardTriggered();
0805     //}
0806 
0807     //Shortcut
0808     //{
0809         //sequence: StandardKey.Back
0810         //onActivated: control.goBackTriggered();
0811     //}
0812 
0813     Component
0814     {
0815         id: _csdRightControlsComponent
0816         Loader
0817         {
0818             active: control.showCSDControls
0819             visible: active
0820             sourceComponent: Maui.WindowControls
0821             {
0822                 
0823             }
0824         }
0825     }
0826 
0827     Component.onCompleted :
0828     {
0829         if(footer)
0830         {
0831             _footerContent.data.push(footer)                   
0832         }
0833         
0834         if(header)
0835         {
0836             let data = [header]            
0837             
0838             for(var i in _headerContent.data)
0839             {
0840                 data.push(_headerContent.data[i])
0841             }
0842             _headerContent.data = data
0843         }
0844         
0845         var obj = _csdRightControlsComponent.createObject( control.headBar.farRightContent)
0846         control.headBar.farRightContent.push(obj)        
0847     }
0848 
0849     /*!
0850          *
0851          */
0852     function returnToBounds()
0853     {
0854         if(control.header)
0855         {
0856             // pullDownHeader()
0857         }
0858 
0859         if(control.footer)
0860         {
0861             // pullDownFooter()
0862         }
0863     }
0864 
0865     /*!
0866          *
0867          */
0868     function pullBackHeader()
0869     {
0870         _headerAnimation.enabled = true
0871         header.height = 0
0872     }
0873 
0874     /*!
0875          *
0876          */
0877     function pullDownHeader()
0878     {
0879         _headerAnimation.enabled = true
0880         header.height = header.implicitHeight
0881     }
0882 
0883     /*!
0884          *
0885          */
0886     function pullBackFooter()
0887     {
0888         _footerAnimation.enabled = true
0889         footer.height= 0
0890     }
0891 
0892     /*!
0893          *
0894          */
0895     function pullDownFooter()
0896     {
0897         _footerAnimation.enabled = true
0898         footer.height = _footerContent.implicitHeight
0899     }
0900 }