qskinny/src/controls/QskSwipeView.h

70 lines
1.9 KiB
C
Raw Normal View History

2023-06-19 11:22:34 +02:00
/******************************************************************************
2024-01-17 14:31:45 +01:00
* QSkinny - Copyright (C) The authors
2023-06-19 11:22:34 +02:00
* SPDX-License-Identifier: BSD-3-Clause
*****************************************************************************/
#ifndef QSK_SWIPE_VIEW_H
#define QSK_SWIPE_VIEW_H
#include "QskStackBox.h"
class QSK_EXPORT QskSwipeView : public QskStackBox
{
Q_OBJECT
2023-08-10 19:54:06 +02:00
Q_PROPERTY( int duration READ duration
WRITE setDuration RESET resetDuration NOTIFY durationChanged )
Q_PROPERTY( int swipeDistance READ swipeDistance
WRITE setSwipeDistance RESET resetSwipeDistance NOTIFY swipeDistanceChanged )
Q_PROPERTY( Qt::Orientation orientation READ orientation
WRITE setOrientation NOTIFY orientationChanged )
2023-08-10 19:10:31 +02:00
using Inherited = QskStackBox;
2023-06-19 11:22:34 +02:00
public:
QSK_SUBCONTROLS( Panel )
QskSwipeView( QQuickItem* parent = nullptr );
~QskSwipeView() override;
2023-08-10 19:54:06 +02:00
void setOrientation( Qt::Orientation );
Qt::Orientation orientation() const;
// Duration is the time ( in ms ) used for changing between pages
2023-06-19 11:22:34 +02:00
int duration() const;
void setDuration( int );
2023-08-10 19:10:31 +02:00
void resetDuration();
2023-08-10 19:54:06 +02:00
/*
Even if called "swipe view" we use a pan - no swipe - gesture.
( = pages are moved before the gesture has been confirmed )
The swipe distance is the minimum distance in pixels of the pan gesture
*/
int swipeDistance() const;
void setSwipeDistance( int );
void resetSwipeDistance();
2023-08-10 19:10:31 +02:00
QskAspect::Subcontrol effectiveSubcontrol( QskAspect::Subcontrol ) const;
2023-06-19 11:22:34 +02:00
2023-08-10 19:54:06 +02:00
Q_SIGNALS:
void orientationChanged( Qt::Orientation );
void durationChanged( int );
void swipeDistanceChanged( int );
2023-06-19 11:22:34 +02:00
protected:
2023-08-10 19:10:31 +02:00
void gestureEvent( QskGestureEvent* ) override;
2023-06-19 11:22:34 +02:00
private:
2023-08-10 19:10:31 +02:00
void setAnimator( QskStackBoxAnimator* ) = delete;
2023-06-19 11:22:34 +02:00
class PrivateData;
std::unique_ptr< PrivateData > m_data;
};
#endif