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_ASPECT_H
|
|
|
|
#define QSK_ASPECT_H
|
|
|
|
|
|
|
|
#include "QskFlags.h"
|
|
|
|
#include <QMetaObject>
|
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
#ifdef Q_MOC_RUN
|
|
|
|
|
|
|
|
#define QSK_NAMESPACE( name ) struct name
|
|
|
|
#define QSK_ENUM( name ) Q_GADGET Q_ENUM( name )
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define QSK_NAMESPACE( name ) namespace name
|
|
|
|
#define QSK_ENUM( name )
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
QSK_NAMESPACE( QskAspect )
|
|
|
|
{
|
|
|
|
enum Subcontrol : quint16
|
|
|
|
{
|
|
|
|
Control = 0,
|
|
|
|
LastSubcontrol = ( 1 << 12 ) - 1
|
|
|
|
};
|
|
|
|
QSK_ENUM( Subcontrol )
|
|
|
|
|
|
|
|
enum Type : quint8
|
|
|
|
{
|
|
|
|
Flag = 0,
|
|
|
|
Metric = 1,
|
|
|
|
Color = 2,
|
|
|
|
};
|
|
|
|
QSK_ENUM( Type )
|
|
|
|
|
|
|
|
enum FlagPrimitive : quint8
|
|
|
|
{
|
2017-10-17 17:34:00 +02:00
|
|
|
NoFlagPrimitive,
|
2017-07-21 18:21:34 +02:00
|
|
|
|
|
|
|
Alignment,
|
|
|
|
Style,
|
|
|
|
SizeMode,
|
|
|
|
Decoration,
|
|
|
|
GraphicRole,
|
|
|
|
FontRole
|
|
|
|
};
|
|
|
|
QSK_ENUM( FlagPrimitive )
|
|
|
|
|
|
|
|
enum MetricPrimitive : quint8
|
|
|
|
{
|
2017-10-17 17:34:00 +02:00
|
|
|
NoMetricPrimitive,
|
2017-07-21 18:21:34 +02:00
|
|
|
|
|
|
|
Size,
|
|
|
|
Position,
|
|
|
|
MinimumWidth,
|
|
|
|
MinimumHeight,
|
|
|
|
MaximumWidth,
|
|
|
|
MaximumHeight,
|
2017-08-23 14:53:29 +02:00
|
|
|
|
|
|
|
Margin,
|
|
|
|
Padding,
|
|
|
|
Shadow,
|
|
|
|
|
2017-10-17 17:34:00 +02:00
|
|
|
Spacing,
|
|
|
|
|
|
|
|
Shape,
|
|
|
|
Border
|
2017-07-21 18:21:34 +02:00
|
|
|
};
|
|
|
|
QSK_ENUM( MetricPrimitive )
|
|
|
|
|
2017-10-17 17:34:00 +02:00
|
|
|
enum { LastType = Color }; // max. value for all types
|
|
|
|
enum { LastPrimitive = 16 }; // max. value for all sort of primitives
|
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
enum ColorPrimitive : quint8
|
|
|
|
{
|
2017-10-17 17:34:00 +02:00
|
|
|
NoColorPrimitive,
|
2017-07-21 18:21:34 +02:00
|
|
|
|
|
|
|
TextColor,
|
|
|
|
StyleColor,
|
|
|
|
LinkColor
|
|
|
|
};
|
|
|
|
QSK_ENUM( ColorPrimitive )
|
|
|
|
|
2017-10-17 17:34:00 +02:00
|
|
|
enum Placement : quint8
|
|
|
|
{
|
|
|
|
Preserved = 0,
|
|
|
|
Transposed = 1
|
|
|
|
};
|
|
|
|
QSK_ENUM ( Placement )
|
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
enum State : quint16
|
|
|
|
{
|
|
|
|
NoState = 0,
|
|
|
|
|
|
|
|
FirstSystemState = 1 << 0,
|
|
|
|
FirstUserState = 1 << 4,
|
|
|
|
LastUserState = 1 << 11,
|
|
|
|
LastSystemState = 1 << 15,
|
|
|
|
|
|
|
|
AllStates = 0xFFFF
|
|
|
|
};
|
|
|
|
QSK_ENUM ( State )
|
|
|
|
|
|
|
|
extern const QMetaObject staticMetaObject;
|
|
|
|
}
|
|
|
|
|
|
|
|
QSK_DECLARE_OPERATORS_FOR_FLAGS( QskAspect::State )
|
|
|
|
|
|
|
|
#undef QSK_NAMESPACE
|
|
|
|
#undef QSK_ENUM
|
|
|
|
|
|
|
|
namespace QskAspect
|
|
|
|
{
|
|
|
|
class QSK_EXPORT Aspect
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
constexpr Aspect();
|
|
|
|
constexpr Aspect( Subcontrol );
|
|
|
|
constexpr Aspect( Type );
|
2017-10-17 17:34:00 +02:00
|
|
|
constexpr Aspect( Placement );
|
2017-07-21 18:21:34 +02:00
|
|
|
|
|
|
|
constexpr Aspect( const Aspect& ) = default;
|
|
|
|
constexpr Aspect( Aspect&& ) = default;
|
|
|
|
|
|
|
|
Aspect& operator=( const QskAspect::Aspect& ) = default;
|
|
|
|
|
|
|
|
bool operator==( const Aspect& ) const;
|
|
|
|
bool operator!=( const Aspect& ) const;
|
|
|
|
|
|
|
|
bool operator<( const Aspect& ) const;
|
|
|
|
|
|
|
|
constexpr Aspect operator|( Subcontrol ) const;
|
|
|
|
constexpr Aspect operator|( Type ) const;
|
|
|
|
constexpr Aspect operator|( FlagPrimitive ) const;
|
|
|
|
constexpr Aspect operator|( MetricPrimitive ) const;
|
|
|
|
constexpr Aspect operator|( ColorPrimitive ) const;
|
2017-10-17 17:34:00 +02:00
|
|
|
constexpr Aspect operator|( Placement ) const;
|
2017-07-21 18:21:34 +02:00
|
|
|
constexpr Aspect operator|( State ) const;
|
|
|
|
|
|
|
|
constexpr quint64 value() const;
|
|
|
|
|
|
|
|
bool isAnimator() const;
|
|
|
|
void setAnimator( bool on );
|
|
|
|
|
|
|
|
Subcontrol subControl() const;
|
|
|
|
void setSubControl( Subcontrol );
|
|
|
|
|
|
|
|
Type type() const;
|
|
|
|
void setType( Type );
|
|
|
|
|
2017-10-17 17:34:00 +02:00
|
|
|
Placement placement() const;
|
|
|
|
void setPlacement( Placement );
|
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
State state() const;
|
|
|
|
State topState() const;
|
|
|
|
|
|
|
|
void addState( State state );
|
|
|
|
void clearState( State state );
|
|
|
|
void clearStates();
|
|
|
|
|
|
|
|
FlagPrimitive flagPrimitive() const;
|
|
|
|
ColorPrimitive colorPrimitive() const;
|
|
|
|
MetricPrimitive metricPrimitive() const;
|
|
|
|
|
2017-12-07 16:53:11 +01:00
|
|
|
void setPrimitive( Type, uint primitive );
|
|
|
|
uint primitive() const;
|
2017-10-17 17:34:00 +02:00
|
|
|
void clearPrimitive();
|
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
const char* toPrintable() const;
|
|
|
|
|
|
|
|
private:
|
2017-10-17 17:34:00 +02:00
|
|
|
constexpr Aspect( Subcontrol, Type, Placement );
|
2017-07-21 18:21:34 +02:00
|
|
|
constexpr Aspect( uint subControl, uint type, bool isAnimator,
|
2017-10-17 17:34:00 +02:00
|
|
|
uint primitive, uint placement, uint states );
|
2017-07-21 18:21:34 +02:00
|
|
|
|
2017-12-07 16:53:11 +01:00
|
|
|
struct Bits
|
2017-12-07 11:54:06 +01:00
|
|
|
{
|
2017-12-07 16:53:11 +01:00
|
|
|
uint subControl : 12;
|
2017-07-21 18:21:34 +02:00
|
|
|
|
2017-12-07 16:53:11 +01:00
|
|
|
uint type : 3;
|
|
|
|
bool isAnimator : 1;
|
2017-07-21 18:21:34 +02:00
|
|
|
|
2017-12-07 16:53:11 +01:00
|
|
|
uint primitive : 7;
|
|
|
|
uint placement : 1;
|
|
|
|
uint reserved1 : 8;
|
2017-12-07 12:44:58 +01:00
|
|
|
|
2017-12-07 16:53:11 +01:00
|
|
|
uint states : 16;
|
|
|
|
uint reserved2 : 16;
|
|
|
|
};
|
2017-07-21 18:21:34 +02:00
|
|
|
|
2017-12-07 16:53:11 +01:00
|
|
|
union
|
|
|
|
{
|
|
|
|
Bits m_bits;
|
2017-12-07 11:54:06 +01:00
|
|
|
quint64 m_value;
|
|
|
|
};
|
|
|
|
};
|
2017-07-21 18:21:34 +02:00
|
|
|
|
|
|
|
inline constexpr Aspect::Aspect():
|
2017-10-17 17:34:00 +02:00
|
|
|
Aspect( Control, Flag, Preserved )
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr Aspect::Aspect( Subcontrol subControl ):
|
2017-10-17 17:34:00 +02:00
|
|
|
Aspect( subControl, Flag, Preserved )
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr Aspect::Aspect( Type type ):
|
2017-10-17 17:34:00 +02:00
|
|
|
Aspect( Control, type, Preserved )
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-10-17 17:34:00 +02:00
|
|
|
inline constexpr Aspect::Aspect( Placement placement ):
|
|
|
|
Aspect( Control, Flag, placement )
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-10-17 17:34:00 +02:00
|
|
|
inline constexpr Aspect::Aspect( Subcontrol subControl, Type type, Placement placement ):
|
|
|
|
Aspect( subControl, type, false, 0, placement, NoState )
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr Aspect::Aspect( uint subControl, uint type, bool isAnimator,
|
2017-10-17 17:34:00 +02:00
|
|
|
uint primitive, uint placement, uint states ):
|
2017-12-07 12:44:58 +01:00
|
|
|
m_bits { subControl, type, isAnimator, primitive, placement, 0, states, 0 }
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool Aspect::operator==( const Aspect& other ) const
|
|
|
|
{
|
2017-12-07 11:54:06 +01:00
|
|
|
return m_value == other.m_value;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline bool Aspect::operator!=( const Aspect& other ) const
|
|
|
|
{
|
2017-12-07 11:54:06 +01:00
|
|
|
return m_value != other.m_value;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline bool Aspect::operator<( const Aspect& other ) const
|
|
|
|
{
|
2017-12-07 11:54:06 +01:00
|
|
|
return m_value < other.m_value;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr Aspect Aspect::operator|( Subcontrol subControl ) const
|
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
return Aspect( subControl, m_bits.type, m_bits.isAnimator,
|
|
|
|
m_bits.primitive, m_bits.placement, m_bits.states );
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr Aspect Aspect::operator|( Type type ) const
|
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
return Aspect( m_bits.subControl, type, m_bits.isAnimator,
|
|
|
|
m_bits.primitive, m_bits.placement, m_bits.states );
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr Aspect Aspect::operator|( FlagPrimitive primitive ) const
|
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
return Aspect( m_bits.subControl, m_bits.type, m_bits.isAnimator,
|
|
|
|
primitive, m_bits.placement, m_bits.states );
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr Aspect Aspect::operator|( MetricPrimitive primitive ) const
|
|
|
|
{
|
|
|
|
return operator|( static_cast< FlagPrimitive >( primitive ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr Aspect Aspect::operator|( ColorPrimitive primitive ) const
|
|
|
|
{
|
|
|
|
return operator|( static_cast< FlagPrimitive >( primitive ) );
|
|
|
|
}
|
|
|
|
|
2017-10-17 17:34:00 +02:00
|
|
|
inline constexpr Aspect Aspect::operator|( Placement placement ) const
|
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
return Aspect( m_bits.subControl, m_bits.type, m_bits.isAnimator,
|
|
|
|
m_bits.primitive, placement, m_bits.states );
|
2017-10-17 17:34:00 +02:00
|
|
|
}
|
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
inline constexpr Aspect Aspect::operator|( State state ) const
|
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
return Aspect( m_bits.subControl, m_bits.type, m_bits.isAnimator,
|
|
|
|
m_bits.primitive, m_bits.placement, m_bits.states | state );
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr quint64 Aspect::value() const
|
|
|
|
{
|
2017-12-07 11:54:06 +01:00
|
|
|
return m_value;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline bool Aspect::isAnimator() const
|
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
return m_bits.isAnimator;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Aspect::setAnimator( bool on )
|
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
m_bits.isAnimator = on;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline Subcontrol Aspect::subControl() const
|
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
return static_cast< Subcontrol >( m_bits.subControl );
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Aspect::setSubControl( Subcontrol subControl )
|
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
m_bits.subControl = subControl;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline Type Aspect::type() const
|
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
return static_cast< Type >( m_bits.type );
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Aspect::setType( Type type )
|
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
m_bits.type = type;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline State Aspect::state() const
|
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
return static_cast< State >( m_bits.states );
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Aspect::addState( State state )
|
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
m_bits.states |= state;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Aspect::clearState( State state )
|
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
m_bits.states &= ~state;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Aspect::clearStates()
|
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
m_bits.states = 0;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
2017-10-17 17:34:00 +02:00
|
|
|
inline FlagPrimitive Aspect::flagPrimitive() const
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
if ( m_bits.type != Flag )
|
2017-10-17 17:34:00 +02:00
|
|
|
return NoFlagPrimitive;
|
2017-07-21 18:21:34 +02:00
|
|
|
|
2017-12-07 12:44:58 +01:00
|
|
|
return static_cast< FlagPrimitive >( m_bits.primitive );
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
2017-10-17 17:34:00 +02:00
|
|
|
inline ColorPrimitive Aspect::colorPrimitive() const
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
if ( m_bits.type != Color )
|
2017-10-17 17:34:00 +02:00
|
|
|
return NoColorPrimitive;
|
2017-07-21 18:21:34 +02:00
|
|
|
|
2017-12-07 12:44:58 +01:00
|
|
|
return static_cast< ColorPrimitive >( m_bits.primitive );
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
2017-10-17 17:34:00 +02:00
|
|
|
inline MetricPrimitive Aspect::metricPrimitive() const
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
if ( m_bits.type != Metric )
|
2017-10-17 17:34:00 +02:00
|
|
|
return NoMetricPrimitive;
|
2017-07-21 18:21:34 +02:00
|
|
|
|
2017-12-07 12:44:58 +01:00
|
|
|
return static_cast< MetricPrimitive >( m_bits.primitive );
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
2017-12-07 16:53:11 +01:00
|
|
|
inline uint Aspect::primitive() const
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
return m_bits.primitive;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
2017-12-07 16:53:11 +01:00
|
|
|
inline void Aspect::setPrimitive( Type type, uint primitive )
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
m_bits.type = type;
|
|
|
|
m_bits.primitive = primitive;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
2017-10-17 17:34:00 +02:00
|
|
|
inline void Aspect::clearPrimitive()
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
m_bits.primitive = 0;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
2017-10-17 17:34:00 +02:00
|
|
|
inline Placement Aspect::placement() const
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
return static_cast< Placement >( m_bits.placement );
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
2017-10-17 17:34:00 +02:00
|
|
|
inline void Aspect::setPlacement( Placement placement )
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
2017-12-07 12:44:58 +01:00
|
|
|
m_bits.placement = placement;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr Aspect operator|( State state, const Aspect& aspect )
|
|
|
|
{
|
|
|
|
return aspect | state;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr Aspect operator|( Subcontrol subControl, const Aspect& aspect )
|
|
|
|
{
|
2017-10-30 08:08:58 +01:00
|
|
|
return aspect | subControl;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr Aspect operator|( Type type, const Aspect& aspect )
|
|
|
|
{
|
|
|
|
return aspect | type;
|
|
|
|
}
|
|
|
|
|
2017-10-17 17:34:00 +02:00
|
|
|
inline constexpr Aspect operator|( Placement placement, const Aspect& aspect )
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
2017-10-17 17:34:00 +02:00
|
|
|
return aspect | placement;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr Aspect operator|( Subcontrol subControl, Type type )
|
|
|
|
{
|
|
|
|
return Aspect( subControl ) | type;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr Aspect operator|( Type type, Subcontrol subControl )
|
|
|
|
{
|
|
|
|
return subControl | type;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr Aspect operator|( Subcontrol subControl, State state )
|
|
|
|
{
|
|
|
|
return Aspect( subControl ) | state;
|
|
|
|
}
|
|
|
|
|
2017-12-07 11:54:06 +01:00
|
|
|
inline constexpr Aspect operator|( Type type, Placement placement )
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
2017-10-17 17:34:00 +02:00
|
|
|
return Aspect( type ) | placement;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
2017-10-17 17:34:00 +02:00
|
|
|
inline constexpr Aspect operator|( Placement placement, Type type )
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
2017-10-17 17:34:00 +02:00
|
|
|
return type | placement;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
2017-10-17 17:34:00 +02:00
|
|
|
inline constexpr Aspect operator|( State state, Subcontrol subControl )
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
2017-10-17 17:34:00 +02:00
|
|
|
return subControl | state;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr Aspect operator|( Subcontrol subControl, FlagPrimitive primitive )
|
|
|
|
{
|
|
|
|
return Aspect( subControl ) | primitive;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr Aspect operator|( FlagPrimitive primitive, Subcontrol subControl )
|
|
|
|
{
|
|
|
|
return subControl | primitive;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr Aspect operator|( Subcontrol subControl, ColorPrimitive primitive )
|
|
|
|
{
|
|
|
|
return Aspect( subControl ) | primitive;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr Aspect operator|( ColorPrimitive primitive, Subcontrol subControl )
|
|
|
|
{
|
|
|
|
return subControl | primitive;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr Aspect operator|( Subcontrol subControl, MetricPrimitive primitive )
|
|
|
|
{
|
|
|
|
return Aspect( subControl ) | primitive;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr Aspect operator|( MetricPrimitive primitive, Subcontrol subControl )
|
|
|
|
{
|
|
|
|
return subControl | primitive;
|
|
|
|
}
|
|
|
|
|
2017-10-17 17:34:00 +02:00
|
|
|
inline constexpr Aspect operator|( Subcontrol subControl, Placement placement )
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
2017-10-17 17:34:00 +02:00
|
|
|
return Aspect( subControl ) | placement;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
2017-10-17 17:34:00 +02:00
|
|
|
inline constexpr Aspect operator|( Placement placement, Subcontrol subControl )
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
2017-10-17 17:34:00 +02:00
|
|
|
return subControl | placement;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
QSK_EXPORT State registerState( const QMetaObject*, State, const char* );
|
|
|
|
QSK_EXPORT Subcontrol nextSubcontrol( const QMetaObject*, const char* );
|
|
|
|
|
|
|
|
QSK_EXPORT QByteArray subControlName( Subcontrol );
|
|
|
|
QSK_EXPORT QVector< QByteArray > subControlNames( const QMetaObject* = nullptr );
|
|
|
|
QSK_EXPORT QVector< Subcontrol > subControls( const QMetaObject* );
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace std
|
|
|
|
{
|
|
|
|
template< > struct hash< QskAspect::Aspect >
|
|
|
|
{
|
|
|
|
constexpr size_t operator()( const QskAspect::Aspect& aspect ) const noexcept
|
|
|
|
{
|
|
|
|
return aspect.value();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
Q_DECLARE_TYPEINFO( QskAspect::Aspect, Q_MOVABLE_TYPE );
|
|
|
|
|
|
|
|
#ifndef QT_NO_DEBUG_STREAM
|
|
|
|
|
|
|
|
class QDebug;
|
|
|
|
|
|
|
|
QSK_EXPORT QDebug operator<<( QDebug, const QskAspect::Aspect& );
|
|
|
|
QSK_EXPORT QDebug operator<<( QDebug, const QskAspect::Type& );
|
2017-10-17 17:34:00 +02:00
|
|
|
QSK_EXPORT QDebug operator<<( QDebug, const QskAspect::Subcontrol& );
|
|
|
|
|
2017-07-21 18:21:34 +02:00
|
|
|
QSK_EXPORT QDebug operator<<( QDebug, const QskAspect::FlagPrimitive& );
|
|
|
|
QSK_EXPORT QDebug operator<<( QDebug, const QskAspect::ColorPrimitive& );
|
|
|
|
QSK_EXPORT QDebug operator<<( QDebug, const QskAspect::MetricPrimitive& );
|
2017-10-17 17:34:00 +02:00
|
|
|
|
|
|
|
QSK_EXPORT QDebug operator<<( QDebug, const QskAspect::Placement& );
|
2017-07-21 18:21:34 +02:00
|
|
|
QSK_EXPORT QDebug operator<<( QDebug, const QskAspect::State& );
|
|
|
|
|
|
|
|
QSK_EXPORT void qskDebugState( QDebug, const QMetaObject*, QskAspect::State );
|
|
|
|
QSK_EXPORT void qskDebugAspect( QDebug, const QMetaObject*, QskAspect::Aspect );
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define QSK_SUBCONTROLS( ... ) static const QskAspect::Subcontrol __VA_ARGS__;
|
|
|
|
#define QSK_STATES( ... ) static const QskAspect::State __VA_ARGS__;
|
|
|
|
|
|
|
|
#define QSK_SUBCONTROL( type, name ) \
|
|
|
|
const QskAspect::Subcontrol type::name = \
|
|
|
|
QskAspect::nextSubcontrol( &type::staticMetaObject, #type "::" #name );
|
|
|
|
|
|
|
|
#define QSK_STATE( type, name, value ) \
|
|
|
|
const QskAspect::State type::name = \
|
|
|
|
QskAspect::registerState( &type::staticMetaObject, value, #type "::" #name );
|
|
|
|
#endif
|