11#include <qmetaobject.h>
12#include <qnamespace.h>
29 static constexpr uint typeCount = 3;
44 static constexpr uint FirstUserSection = Section::Floating + 1;
45 static constexpr uint LastSection = ( 1 << 4 ) - 1;
85 Vertical = Qt::Vertical,
86 Horizontal = Qt::Horizontal,
106 LastSubcontrol = ( 1 << 12 ) - 1
115 FirstSystemState = 1 << 0,
116 FirstUserState = 1 << 5,
117 LastUserState = 1 << 11,
118 LastSystemState = 1 << 15,
124 Q_DECLARE_FLAGS( States, State )
128 constexpr
QskAspect( Subcontrol ) noexcept;
131 constexpr
QskAspect( Variation ) noexcept;
138 bool operator==( const
QskAspect& ) const noexcept;
139 bool operator!=( const
QskAspect& ) const noexcept;
141 bool operator<( const
QskAspect& ) const noexcept;
144 constexpr
QskAspect operator|( Section ) const noexcept;
155 constexpr
QskAspect operator|( States ) const noexcept;
156 QskAspect& operator|=( States ) noexcept;
158 constexpr
QskAspect operator&( States ) const noexcept;
159 QskAspect& operator&=( States ) noexcept;
161 constexpr
QskAspect stateless() const noexcept;
162 constexpr
QskAspect trunk() const noexcept;
164 constexpr quint64 value() const noexcept;
166 constexpr
bool isAnimator() const noexcept;
167 void setAnimator(
bool on ) noexcept;
169 constexpr
Subcontrol subControl() const noexcept;
171 constexpr
bool hasSubcontrol() const noexcept;
172 void clearSubcontrol() noexcept;
174 constexpr Section section() const noexcept;
175 void setSection( Section ) noexcept;
177 constexpr
Type type() const noexcept;
178 void setType(
Type ) noexcept;
180 constexpr
bool isMetric() const noexcept;
181 constexpr
bool isColor() const noexcept;
183 constexpr
Variation variation() const noexcept;
186 constexpr States states() const noexcept;
187 constexpr
bool hasStates() const noexcept;
189 State topState() const noexcept;
190 void clearState(
State ) noexcept;
192 void setStates( States ) noexcept;
193 void addStates( States ) noexcept;
194 void clearStates( States = AllStates ) noexcept;
196 constexpr
Primitive primitive() const noexcept;
198 void clearPrimitive() noexcept;
200 constexpr
Primitive colorPrimitive() const noexcept;
201 constexpr
Primitive metricPrimitive() const noexcept;
203 const
char* toPrintable() const;
205 static
State registerState( const QMetaObject*,
State, const
char* );
206 static
Subcontrol nextSubcontrol( const QMetaObject*, const
char* );
208 static QByteArray subControlName(
Subcontrol );
209 static QVector< QByteArray > subControlNames( const QMetaObject* =
nullptr );
210 static QVector<
Subcontrol > subControls( const QMetaObject* );
212 static quint8 primitiveCount();
213 static
void reservePrimitives( quint8 count );
218 constexpr
QskAspect( uint subControl, uint section, uint type,
bool isAnimator,
219 uint primitive, uint variation, uint states ) noexcept;
223 uint subControl : 12;
245Q_DECLARE_TYPEINFO(
QskAspect, Q_MOVABLE_TYPE );
246Q_DECLARE_OPERATORS_FOR_FLAGS( QskAspect::States )
250 using underlying =
typename std::underlying_type< QskAspect::State >::type;
251 return static_cast< QskAspect::State >(
static_cast< underlying
>( a ) << b );
256 using underlying =
typename std::underlying_type< QskAspect::State >::type;
257 return static_cast< QskAspect::State >(
static_cast< underlying
>( a ) >> b );
261 :
QskAspect( NoSubcontrol, Body, NoType, NoVariation )
266 :
QskAspect( subControl, Body, NoType, NoVariation )
271 :
QskAspect( NoSubcontrol, section, NoType, NoVariation )
276 :
QskAspect( NoSubcontrol, Body, type, NoVariation )
281 :
QskAspect( NoSubcontrol, Body, NoType, variation )
286 Subcontrol subControl, Section section, Type type, Variation variation ) noexcept
287 :
QskAspect( subControl, section, type,
false, 0, variation, NoState )
292 bool isAnimator, uint primitive, uint variation, uint states ) noexcept
293 : m_bits { subControl, section, type, isAnimator, primitive, variation, 0, states, 0 }
299 return m_value == other.m_value;
304 return m_value != other.m_value;
309 return m_value < other.m_value;
314 return QskAspect( subControl, m_bits.section, m_bits.type,
315 m_bits.isAnimator, m_bits.primitive, m_bits.variation, m_bits.states );
320 return QskAspect( m_bits.subControl, section, m_bits.type,
321 m_bits.isAnimator, m_bits.primitive, m_bits.variation, m_bits.states );
326 return QskAspect( m_bits.subControl, m_bits.section, type,
327 m_bits.isAnimator, m_bits.primitive, m_bits.variation, m_bits.states );
332 return QskAspect( m_bits.subControl, m_bits.section, m_bits.type,
333 m_bits.isAnimator, primitive, m_bits.variation, m_bits.states );
338 return QskAspect( m_bits.subControl, m_bits.section, m_bits.type,
339 m_bits.isAnimator, m_bits.primitive, variation, m_bits.states );
344 return QskAspect( m_bits.subControl, m_bits.section, m_bits.type,
345 m_bits.isAnimator, m_bits.primitive, m_bits.variation, m_bits.states | state );
348inline QskAspect& QskAspect::operator|=( State state )
noexcept
354inline constexpr QskAspect QskAspect::operator&( State state )
const noexcept
356 return QskAspect( m_bits.subControl, m_bits.section, m_bits.type, m_bits.isAnimator,
357 m_bits.primitive, m_bits.variation, m_bits.states & state );
360inline QskAspect& QskAspect::operator&=( State state )
noexcept
368 return QskAspect( m_bits.subControl, m_bits.section, m_bits.type, m_bits.isAnimator,
369 m_bits.primitive, m_bits.variation, m_bits.states | states );
372inline QskAspect& QskAspect::operator|=( States states )
noexcept
378inline constexpr QskAspect QskAspect::operator&( States states )
const noexcept
380 return QskAspect( m_bits.subControl, m_bits.section, m_bits.type,
381 m_bits.isAnimator, m_bits.primitive, m_bits.variation, m_bits.states & states );
384inline QskAspect& QskAspect::operator&=( States states )
noexcept
392 return QskAspect( m_bits.subControl, m_bits.section, m_bits.type,
393 m_bits.isAnimator, m_bits.primitive, m_bits.variation, 0 );
398 return QskAspect( m_bits.subControl, 0, m_bits.type,
399 m_bits.isAnimator, m_bits.primitive, 0, 0 );
409 return m_bits.isAnimator;
414 m_bits.isAnimator = on;
419 return static_cast< Subcontrol >( m_bits.subControl );
422inline void QskAspect::setSubcontrol( Subcontrol subControl )
noexcept
424 m_bits.subControl = subControl;
427inline constexpr bool QskAspect::hasSubcontrol() const noexcept
429 return m_bits.subControl != 0;
432inline void QskAspect::clearSubcontrol() noexcept
434 m_bits.subControl = 0;
437inline constexpr QskAspect::Section QskAspect::section() const noexcept
439 return static_cast< Section
>( m_bits.section );
442inline void QskAspect::setSection( Section section )
noexcept
444 m_bits.section = section;
449 return static_cast< Type >( m_bits.type );
469 return static_cast< States
>( m_bits.states );
474 m_bits.states = states;
479 m_bits.states |= states;
484 return m_bits.states;
489 m_bits.states &= ~state;
494 m_bits.states &= ~states;
505 m_bits.primitive = primitive;
510 return ( m_bits.type ==
Color )
516 return ( m_bits.type ==
Metric )
527 return static_cast< Variation >( m_bits.variation );
532 m_bits.variation = variation;
538 return aspect | state;
542 QskAspect::States states,
const QskAspect& aspect )
noexcept
544 return aspect | states;
550 return aspect | subControl;
554 QskAspect::Section section,
const QskAspect& aspect )
noexcept
556 return aspect | section;
562 return aspect | type;
568 return aspect | variation;
574 return QskAspect( subControl ) | section;
580 return subControl | section;
592 return subControl | type;
616 return type | variation;
622 return subControl | state;
628 return subControl | states;
634 return QskAspect( subControl ) | primitive;
640 return subControl | primitive;
646 return QskAspect( subControl ) | variation;
652 return subControl | variation;
659 constexpr size_t operator()(
const QskAspect& aspect )
const noexcept
661 return aspect.
value();
666inline QskHashValue qHash(
const QskAspect aspect, QskHashValue seed = 0 ) noexcept
668 return qHash( aspect.
value(), seed );
671#ifndef QT_NO_DEBUG_STREAM
675QSK_EXPORT QDebug operator<<( QDebug,
QskAspect );
680QSK_EXPORT QDebug operator<<( QDebug, QskAspect::States );
682QSK_EXPORT
void qskDebugStates( QDebug,
const QMetaObject*, QskAspect::States );
683QSK_EXPORT
void qskDebugAspect( QDebug,
const QMetaObject*,
QskAspect );
687#define QSK_SUBCONTROL( type, name ) \
688 const QskAspect::Subcontrol type::name = \
689 QskAspect::nextSubcontrol( &type::staticMetaObject, #type "::" #name );
691#define QSK_STATE( type, name, value ) \
693 ( ( value ) >= QskAspect::FirstUserState ) && ( ( value ) <= QskAspect::LastUserState ), \
696 const QskAspect::State type::name = \
697 QskAspect::registerState( &type::staticMetaObject, value, #type "::" #name );
699#define QSK_SYSTEM_STATE( type, name, value ) \
701 ( ( value ) >= QskAspect::FirstSystemState && ( value ) < QskAspect::FirstUserState ) || \
702 ( ( value ) > QskAspect::LastUserState && ( value ) <= QskAspect::LastSystemState ), \
703 "Invalid system state" \
705 const QskAspect::State type::name = \
706 QskAspect::registerState( &type::staticMetaObject, value, #type "::" #name );
708#if !defined( _MSC_VER )
710#define QSK_SUBCONTROLS( ... ) static const QskAspect::Subcontrol __VA_ARGS__;
711#define QSK_STATES( ... ) static const QskAspect::State __VA_ARGS__;
721#define _QSK_EXPAND(x) x
723#define _QSK_EVAL_0( m, x, ... ) m(x)
724#define _QSK_EVAL_1( m, x, ... ) m(x) _QSK_EXPAND( _QSK_EVAL_0( m, __VA_ARGS__ ) )
725#define _QSK_EVAL_2( m, x, ... ) m(x) _QSK_EXPAND( _QSK_EVAL_1( m, __VA_ARGS__ ) )
726#define _QSK_EVAL_3( m, x, ... ) m(x) _QSK_EXPAND( _QSK_EVAL_2( m, __VA_ARGS__ ) )
727#define _QSK_EVAL_4( m, x, ... ) m(x) _QSK_EXPAND( _QSK_EVAL_3( m, __VA_ARGS__ ) )
728#define _QSK_EVAL_5( m, x, ... ) m(x) _QSK_EXPAND( _QSK_EVAL_4( m, __VA_ARGS__ ) )
729#define _QSK_EVAL_6( m, x, ... ) m(x) _QSK_EXPAND( _QSK_EVAL_5( m, __VA_ARGS__ ) )
730#define _QSK_EVAL_7( m, x, ... ) m(x) _QSK_EXPAND( _QSK_EVAL_6( m, __VA_ARGS__ ) )
731#define _QSK_EVAL_8( m, x, ... ) m(x) _QSK_EXPAND( _QSK_EVAL_7( m, __VA_ARGS__ ) )
732#define _QSK_EVAL_9( m, x, ... ) m(x) _QSK_EXPAND( _QSK_EVAL_8( m, __VA_ARGS__ ) )
733#define _QSK_EVAL_A( m, x, ... ) m(x) _QSK_EXPAND( _QSK_EVAL_9( m, __VA_ARGS__ ) )
734#define _QSK_EVAL_B( m, x, ... ) m(x) _QSK_EXPAND( _QSK_EVAL_A( m, __VA_ARGS__ ) )
735#define _QSK_EVAL_C( m, x, ... ) m(x) _QSK_EXPAND( _QSK_EVAL_B( m, __VA_ARGS__ ) )
736#define _QSK_EVAL_D( m, x, ... ) m(x) _QSK_EXPAND( _QSK_EVAL_C( m, __VA_ARGS__ ) )
737#define _QSK_EVAL_E( m, x, ... ) m(x) _QSK_EXPAND( _QSK_EVAL_D( m, __VA_ARGS__ ) )
738#define _QSK_EVAL_F( m, x, ... ) m(x) _QSK_EXPAND( _QSK_EVAL_E( m, __VA_ARGS__ ) )
740#define _QSK_EVAL_NARG( ... ) _QSK_EVAL_NARG_( __VA_ARGS__, _QSK_EVAL_RSEQ_N() )
741#define _QSK_EVAL_NARG_( ... ) _QSK_EXPAND( _QSK_EVAL_ARG_N( __VA_ARGS__ ) )
743#define _QSK_EVAL_ARG_N( _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, A, B, C, D, E, F, N, ... ) N
744#define _QSK_EVAL_RSEQ_N() F, E, D, C, B, A, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
746#define _QSK_CAT(x,y) x ## y
747#define _QSK_EVAL_( N, m, ... ) _QSK_EXPAND( _QSK_CAT( _QSK_EVAL_, N )( m, __VA_ARGS__ ) )
748#define _QSK_EVAL( m, ... ) _QSK_EVAL_( _QSK_EVAL_NARG( __VA_ARGS__ ), m, __VA_ARGS__ )
750#define _QSK_SUBCONTROLS_HELPER( name ) static const QskAspect::Subcontrol name;
751#define QSK_SUBCONTROLS( ... ) _QSK_EVAL( _QSK_SUBCONTROLS_HELPER, __VA_ARGS__ )
753#define _QSK_STATES_HELPER( name ) static const QskAspect::State name;
754#define QSK_STATES( ... ) _QSK_EVAL( _QSK_STATES_HELPER, __VA_ARGS__ )
Lookup key for a QskSkinHintTable.
constexpr QskAspect operator|(Subcontrol) const noexcept
void clearStates(States=AllStates) noexcept
constexpr bool hasStates() const noexcept
constexpr bool isAnimator() const noexcept
void setStates(States) noexcept
bool operator<(const QskAspect &) const noexcept
Variation
Some sort of variation.
constexpr bool isMetric() const noexcept
constexpr quint64 value() const noexcept
void addStates(States) noexcept
constexpr QskAspect trunk() const noexcept
void setType(Type) noexcept
constexpr bool isColor() const noexcept
constexpr Primitive colorPrimitive() const noexcept
constexpr Primitive primitive() const noexcept
constexpr Subcontrol subControl() const noexcept
constexpr Variation variation() const noexcept
constexpr Type type() const noexcept
void setAnimator(bool on) noexcept
constexpr States states() const noexcept
Primitive
Represents a specific element or attribute.
bool operator!=(const QskAspect &) const noexcept
constexpr QskAspect() noexcept
void setPrimitive(Type, Primitive primitive) noexcept
void setVariation(Variation) noexcept
Type
Represents the type of the Aspect.
Subcontrol
For use within the rendering or lay-outing of a specific QskSkinnable.
bool operator==(const QskAspect &) const noexcept
void clearPrimitive() noexcept
void clearState(State) noexcept
constexpr QskAspect stateless() const noexcept
constexpr Primitive metricPrimitive() const noexcept