2017-10-17 17:29:02 +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_BOX_BORDER_COLORS_H
|
|
|
|
#define QSK_BOX_BORDER_COLORS_H
|
|
|
|
|
2022-02-04 16:11:11 +01:00
|
|
|
#include "QskGradient.h"
|
2017-10-17 17:29:02 +02:00
|
|
|
#include "QskNamespace.h"
|
|
|
|
|
2018-07-19 14:10:48 +02:00
|
|
|
#include <qcolor.h>
|
|
|
|
#include <qmetatype.h>
|
2017-10-17 17:29:02 +02:00
|
|
|
|
|
|
|
class QDebug;
|
|
|
|
|
|
|
|
class QSK_EXPORT QskBoxBorderColors
|
|
|
|
{
|
2018-08-03 08:15:28 +02:00
|
|
|
public:
|
2017-10-17 17:29:02 +02:00
|
|
|
QskBoxBorderColors();
|
2018-08-03 08:15:28 +02:00
|
|
|
|
2022-02-04 16:11:11 +01:00
|
|
|
QskBoxBorderColors( const QskGradient& left, const QskGradient& top,
|
|
|
|
const QskGradient& right, const QskGradient& bottom );
|
2017-10-17 17:29:02 +02:00
|
|
|
|
|
|
|
QskBoxBorderColors( Qt::GlobalColor );
|
|
|
|
QskBoxBorderColors( QRgb );
|
|
|
|
QskBoxBorderColors( const QColor& );
|
2022-02-04 16:11:11 +01:00
|
|
|
QskBoxBorderColors( const QskGradient& );
|
2017-10-17 17:29:02 +02:00
|
|
|
|
|
|
|
~QskBoxBorderColors();
|
|
|
|
|
|
|
|
bool operator==( const QskBoxBorderColors& ) const;
|
|
|
|
bool operator!=( const QskBoxBorderColors& ) const;
|
|
|
|
|
|
|
|
void setAlpha( int alpha );
|
|
|
|
|
2022-02-04 16:11:11 +01:00
|
|
|
void setGradients( const QskGradient& );
|
|
|
|
void setGradients( const QskGradient& left, const QskGradient& top,
|
|
|
|
const QskGradient& right, const QskGradient& bottom );
|
2017-10-17 17:29:02 +02:00
|
|
|
|
2022-02-04 16:11:11 +01:00
|
|
|
void setGradient( Qsk::Position, const QskGradient& );
|
|
|
|
QskGradient gradient( Qsk::Position ) const;
|
2017-10-17 17:29:02 +02:00
|
|
|
|
2022-02-04 16:11:11 +01:00
|
|
|
void setGradientAt( Qt::Edges, const QskGradient& );
|
|
|
|
const QskGradient& gradientAt( Qt::Edge ) const;
|
2017-10-17 17:29:02 +02:00
|
|
|
|
|
|
|
QskBoxBorderColors interpolated( const QskBoxBorderColors&, qreal value ) const;
|
|
|
|
|
|
|
|
static QVariant interpolate( const QskBoxBorderColors&,
|
|
|
|
const QskBoxBorderColors&, qreal ratio );
|
|
|
|
|
|
|
|
uint hash( uint seed = 0 ) const;
|
|
|
|
|
|
|
|
bool isMonochrome() const;
|
|
|
|
bool isVisible() const;
|
|
|
|
|
2018-08-03 08:15:28 +02:00
|
|
|
private:
|
2022-02-04 16:11:11 +01:00
|
|
|
QskGradient m_gradients[ 4 ];
|
2017-10-17 17:29:02 +02:00
|
|
|
};
|
|
|
|
|
2018-08-03 08:15:28 +02:00
|
|
|
inline QskBoxBorderColors::QskBoxBorderColors( Qt::GlobalColor color )
|
|
|
|
: QskBoxBorderColors( QColor( color ) )
|
2017-10-17 17:29:02 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-08-03 08:15:28 +02:00
|
|
|
inline QskBoxBorderColors::QskBoxBorderColors( QRgb rgb )
|
|
|
|
: QskBoxBorderColors( QColor::fromRgba( rgb ) )
|
2017-10-17 17:29:02 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool QskBoxBorderColors::operator!=( const QskBoxBorderColors& other ) const
|
|
|
|
{
|
|
|
|
return !( *this == other );
|
|
|
|
}
|
|
|
|
|
2022-02-04 16:11:11 +01:00
|
|
|
inline QskGradient QskBoxBorderColors::gradient( Qsk::Position position ) const
|
2017-10-17 17:29:02 +02:00
|
|
|
{
|
2022-02-04 16:11:11 +01:00
|
|
|
return m_gradients[ position ];
|
2017-10-17 17:29:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef QT_NO_DEBUG_STREAM
|
|
|
|
|
|
|
|
QSK_EXPORT QDebug operator<<( QDebug, const QskBoxBorderColors& );
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE( QskBoxBorderColors )
|
|
|
|
|
|
|
|
#endif
|