/******************************************************************************
 * QSkinny - Copyright (C) The authors
 *           SPDX-License-Identifier: BSD-3-Clause
 *****************************************************************************/

#ifndef QSK_ANIMATION_HINT_H
#define QSK_ANIMATION_HINT_H

#include "QskGlobal.h"

#include <qeasingcurve.h>
#include <qmetatype.h>

class QSK_EXPORT QskAnimationHint
{
  public:
    enum UpdateFlag
    {
        UpdateAuto = 0, // depending on the animated aspect

        UpdateNode     = 1 << 0,
        UpdatePolish   = 1 << 1,
        UpdateSizeHint = 1 << 2,

        UpdateAll = UpdateNode | UpdatePolish | UpdateSizeHint
    };

    Q_DECLARE_FLAGS( UpdateFlags, UpdateFlag )

    inline constexpr QskAnimationHint() noexcept
        : duration( 0 )
        , type( QEasingCurve::Linear )
        , updateFlags( UpdateAuto )
    {
    }

    inline constexpr QskAnimationHint( uint duration,
            QEasingCurve::Type type = QEasingCurve::Linear ) noexcept
        : duration( duration )
        , type( type )
        , updateFlags( UpdateAuto )
    {
    }

    inline constexpr bool isValid() const
    {
        return duration > 0;
    }

    uint duration;
    QEasingCurve::Type type;
    UpdateFlags updateFlags;
};

Q_DECLARE_METATYPE( QskAnimationHint )
Q_DECLARE_TYPEINFO( QskAnimationHint, Q_PRIMITIVE_TYPE );
Q_DECLARE_OPERATORS_FOR_FLAGS( QskAnimationHint::UpdateFlags )

#ifndef QT_NO_DEBUG_STREAM

class QDebug;
QSK_EXPORT QDebug operator<<( QDebug, const QskAnimationHint& );

#endif

#endif
