qskinny/src/controls/QskHintAnimator.h

110 lines
2.5 KiB
C
Raw Normal View History

2017-07-21 18:21:34 +02:00
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the QSkinny License, Version 1.0
*****************************************************************************/
#ifndef QSK_HINT_ANIMATOR_H
#define QSK_HINT_ANIMATOR_H
#include "QskAspect.h"
2018-08-03 08:15:28 +02:00
#include "QskVariantAnimator.h"
#include "QskAnimationHint.h"
2017-07-21 18:21:34 +02:00
2018-07-19 14:10:48 +02:00
#include <qpointer.h>
2017-07-21 18:21:34 +02:00
class QskControl;
class QSK_EXPORT QskHintAnimator : public QskVariantAnimator
{
using Inherited = QskVariantAnimator;
2018-08-03 08:15:28 +02:00
public:
2022-09-13 13:05:47 +02:00
QskHintAnimator() noexcept;
QskHintAnimator( QskAspect, int index ) noexcept;
2018-07-31 17:32:25 +02:00
~QskHintAnimator() override;
2017-07-21 18:21:34 +02:00
2022-09-04 10:37:40 +02:00
void setAspect( QskAspect ) noexcept;
QskAspect aspect() const noexcept;
2017-07-21 18:21:34 +02:00
void setIndex( int ) noexcept;
int index() const noexcept;
2022-09-04 10:37:40 +02:00
void setControl( QskControl* ) noexcept;
QskControl* control() const noexcept;
2017-07-21 18:21:34 +02:00
2022-09-04 10:37:40 +02:00
void setUpdateFlags( QskAnimationHint::UpdateFlags ) noexcept;
QskAnimationHint::UpdateFlags updateFlags() const noexcept;
2018-07-31 17:32:25 +02:00
void advance( qreal value ) override;
2017-07-21 18:21:34 +02:00
2022-09-04 10:37:40 +02:00
bool operator<( const QskHintAnimator& ) const noexcept;
2018-08-03 08:15:28 +02:00
private:
2020-12-21 16:06:58 +01:00
QskAspect m_aspect;
2022-09-13 13:05:47 +02:00
int m_index;
QskAnimationHint::UpdateFlags m_updateFlags;
2017-07-21 18:21:34 +02:00
QPointer< QskControl > m_control;
};
#ifndef QT_NO_DEBUG_STREAM
class QDebug;
QSK_EXPORT QDebug operator<<( QDebug, const QskHintAnimator& );
#endif
2017-07-21 18:21:34 +02:00
class QSK_EXPORT QskHintAnimatorTable
{
2018-08-03 08:15:28 +02:00
public:
2017-07-21 18:21:34 +02:00
QskHintAnimatorTable();
~QskHintAnimatorTable();
void start( QskControl*, QskAspect, int index,
2017-07-21 18:21:34 +02:00
QskAnimationHint, const QVariant& from, const QVariant& to );
const QskHintAnimator* animator( QskAspect, int index = -1 ) const;
QVariant currentValue( QskAspect, int index = -1 ) const;
2017-07-21 18:21:34 +02:00
bool cleanup();
2022-09-06 07:57:08 +02:00
bool isEmpty() const;
2017-07-21 18:21:34 +02:00
2018-08-03 08:15:28 +02:00
private:
2017-07-21 18:21:34 +02:00
void reset();
class PrivateData;
2022-09-06 07:57:08 +02:00
PrivateData* m_data = nullptr;
2017-07-21 18:21:34 +02:00
};
2022-09-04 10:37:40 +02:00
inline QskAspect QskHintAnimator::aspect() const noexcept
2017-07-21 18:21:34 +02:00
{
return m_aspect;
}
inline int QskHintAnimator::index() const noexcept
{
return m_index;
}
2022-09-04 10:37:40 +02:00
inline QskAnimationHint::UpdateFlags QskHintAnimator::updateFlags() const noexcept
{
return m_updateFlags;
}
2022-09-04 10:37:40 +02:00
inline QskControl* QskHintAnimator::control() const noexcept
2017-07-21 18:21:34 +02:00
{
return m_control;
}
2022-09-04 10:37:40 +02:00
inline bool QskHintAnimator::operator<( const QskHintAnimator& other ) const noexcept
{
return m_aspect < other.m_aspect;
}
2022-09-06 07:57:08 +02:00
inline bool QskHintAnimatorTable::isEmpty() const
{
return m_data == nullptr;
}
2017-07-21 18:21:34 +02:00
#endif