QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskStackBoxAnimator.h
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#ifndef QSK_STACK_BOX_ANIMATOR_H
7#define QSK_STACK_BOX_ANIMATOR_H
8
9#include "QskAnimator.h"
10#include "QskNamespace.h"
11
12#include <qobject.h>
13
14class QskStackBox;
15class QQuickItem;
16class QTransform;
17
18class QSK_EXPORT QskStackBoxAnimator : public QObject, public QskAnimator
19{
20 Q_OBJECT
21
22 public:
24 ~QskStackBoxAnimator() override;
25
26 void setStartIndex( int index );
27 void setEndIndex( int index );
28
29 int startIndex() const;
30 int endIndex() const;
31
32 qreal transientIndex() const;
33
34 protected:
35 QskStackBox* stackBox() const;
36 QQuickItem* itemAt( int index ) const;
37
38 private:
39 void advance( qreal value ) override final;
40 virtual void advanceIndex( qreal value ) = 0;
41
42 int m_startIndex;
43 int m_endIndex;
44
45 qreal m_transientIndex;
46};
47
49{
50 Q_OBJECT
51
52 Q_PROPERTY( Qsk::Direction direction READ direction WRITE setDirection )
53
54 public:
56 ~QskStackBoxAnimator1() override;
57
58 void setDirection( Qsk::Direction );
59 Qsk::Direction direction() const;
60
61 protected:
62 bool eventFilter( QObject*, QEvent* ) override;
63
64 void setup() override;
65 void advanceIndex( qreal value ) override;
66 void done() override;
67
68 private:
69 qreal m_itemOffset[ 2 ];
70
71 Qsk::Direction m_direction : 4;
72 bool m_isDirty : 1;
73 bool m_hasClip : 1;
74};
75
77{
78 Q_OBJECT
79
80 Q_PROPERTY( Qt::Orientation orientation READ orientation WRITE setOrientation )
81 Q_PROPERTY( bool inverted READ isInverted WRITE setInverted )
82
83 public:
85 ~QskStackBoxAnimator2() override;
86
87 void setOrientation( Qt::Orientation );
88 Qt::Orientation orientation() const;
89
90 void setInverted( bool );
91 bool isInverted() const;
92
93 protected:
94 void setup() override;
95 void advanceIndex( qreal value ) override;
96 void done() override;
97
98 private:
99 Qt::Orientation m_orientation : 2;
100 bool m_inverted : 1;
101};
102
104{
105 Q_OBJECT
106
107 public:
109 ~QskStackBoxAnimator3() override;
110
111 protected:
112 void setup() override;
113 void advanceIndex( qreal value ) override;
114 void done() override;
115};
116
118{
119 Q_OBJECT
120
121 Q_PROPERTY( Qt::Orientation orientation READ orientation WRITE setOrientation )
122 Q_PROPERTY( bool inverted READ isInverted WRITE setInverted )
123
124 public:
126 ~QskStackBoxAnimator4() override;
127
128 void setOrientation( Qt::Orientation );
129 Qt::Orientation orientation() const;
130
131 void setInverted( bool );
132 bool isInverted() const;
133
134 protected:
135 void setup() override;
136 void advanceIndex( qreal value ) override;
137 void done() override;
138
139 private:
140 QTransform transformation( const QQuickItem*, bool increasing, qreal value ) const;
141
142 Qt::Orientation m_orientation : 2;
143 bool m_inverted : 1;
144};
145
146#endif
Direction
This enum type specifies a horizontal ot vertical direction.