1 #ifndef _KwCssStyleStates_h_
2 #define _KwCssStyleStates_h_
5 * @file KwCssStyleStates.h
6 * @brief Set of cascading style property states.
7 * @author James Hogan <james@albanarts.com>
10 #include "KwCssStyle.h"
16 class KwCssAbstractStyleState
;
18 /// Set of cascading style properties.
19 class KwCssStyleStates
24 * Constructors + destructors
27 /// Default constructor.
31 KwCssStyleStates(const KwCssStyleStates
& other
);
34 virtual ~KwCssStyleStates();
44 const KwCssAbstractStyleState
* getRawStyle(QString name
) const;
46 /// Get the value of a state.
48 T
getStyle(QString name
) const
50 const KwCssAbstractStyleState
* rawStyle
= getRawStyle(name
);
53 const KwCssStyleState
<T
>* style
= dynamic_cast<const KwCssStyleState
<T
>*>(rawStyle
);
54 assert(0 != style
&&"style with incorrect type");
57 return style
->getValue();
67 /// Copy assignment operator.
68 KwCssStyleStates
& operator = (const KwCssStyleStates
& other
);
70 /// Index into styles mapping.
71 KwCssAbstractStyleState
*& operator [] (QString name
);
79 /// Dictionary of strings to styles.
80 typedef QHash
<QString
, KwCssAbstractStyleState
*> StyleStateDictionary
;
86 /// The style properties.
87 StyleStateDictionary m_styleStates
;
91 #endif // _KwCssStyleStates_h_