Cleaned up initial playlist and added playlist song verse activate
[kworship.git] / kworship / css / KwCssScope.h
blob6479b750fdbfdf213fdc5979a5de1177bb28ef77
1 #ifndef _KwCssScope_h_
2 #define _KwCssScope_h_
4 /**
5 * @file KwCssScope.h
6 * @brief Cascading style scope.
7 * @author James Hogan <james@albanarts.com>
8 */
10 #include "KwCssScopeKey.h"
11 #include "KwCssStyleSheet.h"
12 #include "KwCssStyles.h"
13 #include "KwCssStyleStates.h"
15 #include <QStringList>
16 #include <QString>
17 #include <QSet>
18 #include <QList>
20 class KwCssStyleSheet;
22 /// Cascading style scope.
23 class KwCssScope
25 public:
28 * Constructors + destructors
31 /// Primary constructor.
32 KwCssScope(KwCssScope* parent = 0);
34 /// Destructor.
35 virtual ~KwCssScope();
38 * Main interface
41 /// Add a stylesheet for this scope.
42 void addStyleSheet(KwCssStyleSheet* styleSheet);
44 /// Set an explicit style.
45 template <typename T>
46 void setExplicitStyle(QString name, const T& value)
48 m_styles.setStyle<T>(name, value);
49 recalculateStyles();
52 /// Add a class to this scope.
53 void addClass(QString className);
55 /// Get all the styles included in this scope.
56 const KwCssStyleStates& getStyles() const;
58 /// Recalculate all styles.
59 void recalculateStyles();
62 * Virtual interface
65 /// Get the type id corresponding to this type.
66 virtual KwCssScopeKey::ScopeTypeId getTypeId() const;
69 * Accessors
72 /// Get explicit styles.
73 const KwCssStyles& getExplicitStyles() const;
75 /// Get the scope's key.
76 KwCssScopeKey getKey() const;
78 /// Find whether a scope key matches this scope.
79 bool isKeyMatching(KwCssScopeKey key) const;
82 * Mutators
85 /// Set the parent scope.
86 void setParentScope(KwCssScope* parent);
88 private:
91 * Types
94 /// Set of scopes.
95 typedef QSet<KwCssScope*> ScopeSet;
97 /// Set of strings.
98 typedef QSet<QString> StringSet;
100 /// List of style sheets.
101 typedef QList<KwCssStyleSheet*> StyleSheetList;
104 * Basic data
107 /// Parent scope.
108 KwCssScope* m_parentScope;
110 /// Set of child scopes.
111 ScopeSet m_childScopes;
113 /// Name of the scope.
114 KwCssScopeKey::ScopeName m_name;
117 * Variables
120 /// Classes enabled by default in this scope.
121 StringSet m_classes;
123 /// Style sheets.
124 StyleSheetList m_styleSheets;
126 /// Explicit style overrides.
127 KwCssStyles m_styles;
130 * Cache
133 /// Cached styles.
134 KwCssStyleStates m_cachedStyles;
136 /// Cached stylesheet accumulation.
137 KwCssStyleSheet m_cachedStyleSheet;
139 /// Cached total class list.
140 StringSet m_cachedClasses;
143 #endif // _KwCssScope_h_