1 /***************************************************************************
2 * This file is part of KWorship. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
5 * KWorship is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
10 * KWorship is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with KWorship. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 #ifndef _KwCssStyleRule_h_
21 #define _KwCssStyleRule_h_
24 * @file KwCssStyleRule.h
25 * @brief Rule for apply cascading styles.
26 * @author James Hogan <james@albanarts.com>
29 #include "KwCssScopeKey.h"
30 #include "KwCssStyles.h"
32 #include "CountedReference.h"
35 #include <QStringList>
39 /// Rule for apply cascading styles.
49 typedef QList
<KwCssScopeKey
> KeyList
;
52 typedef QSet
<QString
> StringSet
;
55 * Constructors + destructors
58 /// Default constructor.
62 virtual ~KwCssStyleRule();
68 /// Set the set of critieria keys.
69 void setCriteriaKeys(const KeyList
& keys
);
71 /// Set the set of required classes.
72 void setCriteriaClasses(const StringSet
& classes
);
75 void setRawStyle(const QString
& name
, KwCssAbstractStyle
* style
);
77 /// Set a style of a particular type.
79 void setStyle(const QString
& name
, const T
& value
)
81 m_styles
->setStyle
<T
>(name
, value
);
88 /// Get the list of criteria keys.
89 KeyList
& getCriteriaKeys();
91 /// Get the set of criteria classes.
92 StringSet
& getCriteriaClasses();
94 /// Get the list of included styles.
95 const StringSet
& getIncludedStyles() const;
98 const ReferenceCountedExtension
<KwCssStyles
>* getStyles() const;
100 /// Convert to CSS-like format.
101 QString
toString() const;
109 /// List of (sequences of scope keys to match in order).
110 KeyList m_criteriaKeys
;
112 /// Classes required to match.
113 StringSet m_criteriaClasses
;
119 /// Names of included classes.
120 StringSet m_includedStyles
;
123 Reference
<ReferenceCountedExtension
<KwCssStyles
> > m_styles
;
126 #endif // _KwCssStyleRule_h_