QSkinny 0.8.0
C++/Qt UI toolkit
|
#include <QskAspect.h>
Lookup key for a QskSkinHintTable.
QskAspect is used by the themeing system to determine a a certain aspect of a QskSkinnable. While an aspect is simply a 64-bit unsigned integer, it is composed of smaller enum bitfields which can be ORed together to describe a more specific part of the user interface.
For example, the border colors of a QskPushButton while pressed is defined by combining the State (QskAbstractButton::Pressed) with the Subcontrol (QskPushButton::Panel), the Primitive (QskAspect::Border), and the Type (QskAspect::Color) as so:
auto aspect = QskPushButton::Panel | QskAbstractButton::Pressed | QskAspect::Color | QskAspect::Border
Definition at line 14 of file QskAspect.h.
Public Types | |
enum | Type : quint8 { NoType = 0 , Metric = 1 , Color = 2 } |
Represents the type of the Aspect. More... | |
enum | Section : quint8 { Body = 0 , Header , Footer , Card , Floating } |
enum | Primitive : quint8 { NoPrimitive = 0 , Alignment , Direction , Style , Option , GraphicRole , FontRole , Symbol , TextColor , StyleColor , LinkColor , StrutSize , Size , Position , Margin , Padding , Spacing , Shadow , Shape , Border , Graduation } |
Represents a specific element or attribute. More... | |
enum | Variation : quint8 { NoVariation = 0 , Vertical = Qt::Vertical , Horizontal = Qt::Horizontal , Lower = 1 , Upper = 2 , Top = 1 , Left = 2 , Right = 3 , Bottom = 4 , Tiny = 1 , Small = 2 , Large = 3 , Huge = 4 } |
Some sort of variation. More... | |
enum | Subcontrol : quint16 { NoSubcontrol = 0 , LastSubcontrol = ( 1 << 12 ) - 1 } |
For use within the rendering or lay-outing of a specific QskSkinnable. More... | |
enum | State : quint16 { NoState = 0 , FirstSystemState = 1 << 0 , FirstUserState = 1 << 5 , LastUserState = 1 << 11 , LastSystemState = 1 << 15 , AllStates = 0xFFFF } |
Static Public Attributes | |
static constexpr uint | typeCount = 3 |
static constexpr uint | FirstUserSection = Section::Floating + 1 |
static constexpr uint | LastSection = ( 1 << 4 ) - 1 |
Public Member Functions | |
constexpr | QskAspect () noexcept |
constexpr | QskAspect (Subcontrol) noexcept |
constexpr | QskAspect (Section) noexcept |
constexpr | QskAspect (Type) noexcept |
constexpr | QskAspect (Variation) noexcept |
constexpr | QskAspect (const QskAspect &) noexcept=default |
constexpr | QskAspect (QskAspect &&) noexcept=default |
QskAspect & | operator= (const QskAspect &) noexcept=default |
bool | operator== (const QskAspect &) const noexcept |
bool | operator!= (const QskAspect &) const noexcept |
bool | operator< (const QskAspect &) const noexcept |
constexpr QskAspect | operator| (Subcontrol) const noexcept |
constexpr QskAspect | operator| (Section) const noexcept |
constexpr QskAspect | operator| (Type) const noexcept |
constexpr QskAspect | operator| (Primitive) const noexcept |
constexpr QskAspect | operator| (Variation) const noexcept |
constexpr QskAspect | operator| (State) const noexcept |
QskAspect & | operator|= (State) noexcept |
constexpr QskAspect | operator& (State) const noexcept |
QskAspect & | operator&= (State) noexcept |
constexpr QskAspect | operator| (States) const noexcept |
QskAspect & | operator|= (States) noexcept |
constexpr QskAspect | operator& (States) const noexcept |
QskAspect & | operator&= (States) noexcept |
constexpr QskAspect | stateless () const noexcept |
constexpr QskAspect | trunk () const noexcept |
constexpr quint64 | value () const noexcept |
constexpr bool | isAnimator () const noexcept |
void | setAnimator (bool on) noexcept |
constexpr Subcontrol | subControl () const noexcept |
void | setSubcontrol (Subcontrol) noexcept |
constexpr bool | hasSubcontrol () const noexcept |
void | clearSubcontrol () noexcept |
constexpr Section | section () const noexcept |
void | setSection (Section) noexcept |
constexpr Type | type () const noexcept |
void | setType (Type) noexcept |
constexpr bool | isMetric () const noexcept |
constexpr bool | isColor () const noexcept |
constexpr Variation | variation () const noexcept |
void | setVariation (Variation) noexcept |
constexpr States | states () const noexcept |
constexpr bool | hasStates () const noexcept |
State | topState () const noexcept |
void | clearState (State) noexcept |
void | setStates (States) noexcept |
void | addStates (States) noexcept |
void | clearStates (States=AllStates) noexcept |
constexpr Primitive | primitive () const noexcept |
void | setPrimitive (Type, Primitive primitive) noexcept |
void | clearPrimitive () noexcept |
constexpr Primitive | colorPrimitive () const noexcept |
constexpr Primitive | metricPrimitive () const noexcept |
const char * | toPrintable () const |
Static Public Member Functions | |
static State | registerState (const QMetaObject *, State, const char *) |
static Subcontrol | nextSubcontrol (const QMetaObject *, const char *) |
static QByteArray | subControlName (Subcontrol) |
static QVector< QByteArray > | subControlNames (const QMetaObject *=nullptr) |
static QVector< Subcontrol > | subControls (const QMetaObject *) |
static quint8 | primitiveCount () |
static void | reservePrimitives (quint8 count) |
enum QskAspect::Primitive : quint8 |
Represents a specific element or attribute.
This enum defines an initial list of primitive elements. A primitive is a common element, such as a border, font role etc.
The number of primitives can be extended by additional application specific elements by using reservePrimitives()
Enumerator | |
---|---|
NoPrimitive | No specific primitive |
Alignment | Usually used in combination with QskAspect::Flag
|
Style | Usually used in combination with QskAspect::Flag |
GraphicRole | A graphic role is an id that can be used to retrieve a specific color filter for a graphic.
|
FontRole | A font role is an id that can be used to retrieve a specific font from the font table.
|
TextColor | A color for regular text |
StyleColor | This color is used as the outline color for outlined text, and as the shadow color for raised or sunken text.
|
LinkColor | The color of links in texts. |
StrutSize | A sensible metric - usually a QSizeF. This size is usually used for layout calculations. It might be interpreted as a minimum, maximum or fixed size.
|
Size | A placeholder for defining a metric. |
Position | A metric that is often used for animating controls ( slide in/out ) or handles. |
Margin | Margins like being described in the CSS Box Model.
|
Padding | Margins like being described in the CSS Box Model.
|
Spacing | A metric, that is used by layout code for the distance between elements.
|
Shadow | A primitive to define colors and metrics for shadows.
|
Shape |
|
Border | A primitive to define colors and metrics for borders.
|
Definition at line 47 of file QskAspect.h.
enum QskAspect::Section : quint8 |
Definition at line 31 of file QskAspect.h.
enum QskAspect::State : quint16 |
Applies to a given aspect when the control is in a given state. QskSkinnable subclasses (typically QskControl subclasses) can define UI states, as denoted by any OR combination of State flags. For example, a checked QskPushButton has the QskPushButton::Checked state flag set when it is checked.
The skin hint resolving algorithms is removing the state bits one by one until it finds a match, what gives lower bits a higher priority. This is a rather obscure and error prone approach and needs to be replaced by something more user friendly. But until this has been done the state bits are divided into 3 sections:
- [ QskAspect::FirstSystemState, QskAspect::FirstUserState [ High priority state bits - [ QskAspect::FirstUserState, QskAspect::LastUserState ] State bits reserved for application code - ] QskAspect::LastUserState, QskAspect::LastSystemState ] Low priority state bits
Definition at line 111 of file QskAspect.h.
enum QskAspect::Subcontrol : quint16 |
For use within the rendering or lay-outing of a specific QskSkinnable.
While the Default value applies to any control (and can be used as a fallback), specifying a Subcontrol limits the aspect's scope to that sub-component (or subcontrol) of the control. For example, the Subcontrol type QskPushButton::Panel refers to the background panel of a push button.
Beside the default values below subcontrols are defined and registered using the QSK_SUBCONTROL and QSK_SUBCONTROLS macros.
Enumerator | |
---|---|
LastSubcontrol | Highest number that fits into the reserved bits for the subcontrol |
Definition at line 103 of file QskAspect.h.
enum QskAspect::Type : quint8 |
Represents the type of the Aspect.
The type categorizes the aspect to be a metric, color or "something else".
Often primitives are related to a specific category. F.e QskAspect::Alignment will probably always be a QskAspect::Flag, while QskAspect::Border will usually be combined with QskAspect::Color and QskAspect::Metric.
Smooth transitions can be set up depending on these categories. F.e when changing from daylight to darkness color schemem only values of QskAspect::Color aspects need to be considered. But when changing the Look&Feel of the application all type of aspects need to be considered.
Definition at line 20 of file QskAspect.h.
enum QskAspect::Variation : quint8 |
Some sort of variation.
The variation bits can be used to have different definitions for a skinnable depending on its position, orientation or emphasis. F.e a tab bar looks slightly different depending on its position.
Definition at line 81 of file QskAspect.h.
|
inlineconstexprnoexcept |
Constructs an aspect with no bits being set.
Definition at line 260 of file QskAspect.h.
|
inlineconstexprnoexcept |
Constructs an aspect with the subcontrol bits being initialized
subControl | Initial subcontrol |
Definition at line 265 of file QskAspect.h.
|
inlineconstexprnoexcept |
Definition at line 270 of file QskAspect.h.
|
inlineconstexprnoexcept |
Constructs an aspect with the type bits being initialized
type | Initial type |
Definition at line 275 of file QskAspect.h.
|
inlineconstexprnoexcept |
Constructs an aspect with the variation bits being initialized
variation | Initial variation |
Definition at line 280 of file QskAspect.h.
|
constexprdefaultnoexcept |
Copy constructor
|
constexprdefaultnoexcept |
Move constructor
|
inlinenoexcept |
ORs state to the state bits
Definition at line 477 of file QskAspect.h.
|
inlinenoexcept |
Clears all primitive bits
Definition at line 520 of file QskAspect.h.
|
inlinenoexcept |
Clear the state bit for state
Definition at line 487 of file QskAspect.h.
|
inlinenoexcept |
Clears all state bits
Definition at line 492 of file QskAspect.h.
|
inlinenoexcept |
Definition at line 432 of file QskAspect.h.
|
inlineconstexprnoexcept |
Definition at line 508 of file QskAspect.h.
|
inlineconstexprnoexcept |
Definition at line 482 of file QskAspect.h.
|
inlineconstexprnoexcept |
Definition at line 427 of file QskAspect.h.
|
inlineconstexprnoexcept |
Definition at line 407 of file QskAspect.h.
|
inlineconstexprnoexcept |
Definition at line 462 of file QskAspect.h.
|
inlineconstexprnoexcept |
Definition at line 457 of file QskAspect.h.
|
inlineconstexprnoexcept |
Definition at line 514 of file QskAspect.h.
|
static |
This method is called from the QSK_SUBCONTROL macro and is usually never called manually in application code
Definition at line 91 of file QskAspect.cpp.
|
inlinenoexcept |
"Not equal to" operator
Definition at line 302 of file QskAspect.h.
Definition at line 354 of file QskAspect.h.
|
inlineconstexprnoexcept |
Definition at line 378 of file QskAspect.h.
Definition at line 360 of file QskAspect.h.
|
inlinenoexcept |
Definition at line 384 of file QskAspect.h.
|
inlinenoexcept |
"Less than" operator
Definition at line 307 of file QskAspect.h.
|
defaultnoexcept |
Assignment operator
|
inlinenoexcept |
Sets the primitive bits
Definition at line 330 of file QskAspect.h.
|
inlineconstexprnoexcept |
Definition at line 318 of file QskAspect.h.
ORs state to the state bits
state | Additional state bit |
Definition at line 342 of file QskAspect.h.
|
inlineconstexprnoexcept |
ORs states to the state bits
states | Additional state bits |
Definition at line 366 of file QskAspect.h.
|
inlineconstexprnoexcept |
Sets the subcontrol bits
Definition at line 312 of file QskAspect.h.
Sets the type bits
Definition at line 324 of file QskAspect.h.
Sets the variation bits
Definition at line 336 of file QskAspect.h.
Definition at line 348 of file QskAspect.h.
|
inlinenoexcept |
Definition at line 372 of file QskAspect.h.
|
inlineconstexprnoexcept |
Definition at line 497 of file QskAspect.h.
|
static |
Definition at line 51 of file QskAspect.cpp.
|
static |
Registers a printable string for a state.
This method is called from the QSK_STATE and QSK_SYSTEM_STATE macros and is usually never called manually in application code
Definition at line 78 of file QskAspect.cpp.
|
static |
Definition at line 56 of file QskAspect.cpp.
|
inlineconstexprnoexcept |
Definition at line 437 of file QskAspect.h.
|
inlinenoexcept |
Set/Clear the animator bit depending on on
Definition at line 412 of file QskAspect.h.
|
inlinenoexcept |
Sets the primitive bits
Definition at line 502 of file QskAspect.h.
|
inlinenoexcept |
Definition at line 442 of file QskAspect.h.
|
inlinenoexcept |
Sets the state bits
Definition at line 472 of file QskAspect.h.
|
inlinenoexcept |
Definition at line 422 of file QskAspect.h.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlineconstexprnoexcept |
Definition at line 390 of file QskAspect.h.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
static |
Definition at line 111 of file QskAspect.cpp.
|
static |
Definition at line 122 of file QskAspect.cpp.
|
static |
Definition at line 140 of file QskAspect.cpp.
const char * QskAspect::toPrintable | ( | ) | const |
Definition at line 330 of file QskAspect.cpp.
|
noexcept |
|
inlineconstexprnoexcept |
Definition at line 396 of file QskAspect.h.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Definition at line 402 of file QskAspect.h.
|
inlineconstexprnoexcept |
|
staticconstexpr |
Definition at line 44 of file QskAspect.h.
|
staticconstexpr |
Definition at line 45 of file QskAspect.h.
Bits QskAspect::m_bits |
Definition at line 240 of file QskAspect.h.
quint64 QskAspect::m_value |
Definition at line 241 of file QskAspect.h.
|
staticconstexpr |
Definition at line 29 of file QskAspect.h.