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 _KwCssStyleStates_h_
21 #define _KwCssStyleStates_h_
24 * @file KwCssStyleStates.h
25 * @brief Set of cascading style property states.
26 * @author James Hogan <james@albanarts.com>
29 #include "KwCssStyle.h"
31 #include <kdemacros.h>
37 class KwCssAbstractStyleState
;
39 /// Set of cascading style properties.
40 class KDE_EXPORT KwCssStyleStates
45 * Constructors + destructors
48 /// Default constructor.
52 KwCssStyleStates(const KwCssStyleStates
& other
);
55 virtual ~KwCssStyleStates();
65 const KwCssAbstractStyleState
* getRawStyle(QString name
) const;
67 /// Get the value of a state.
69 T
getStyle(QString name
) const
71 const KwCssAbstractStyleState
* rawStyle
= getRawStyle(name
);
74 const KwCssStyleState
<T
>* style
= dynamic_cast<const KwCssStyleState
<T
>*>(rawStyle
);
75 assert(0 != style
&&"style with incorrect type");
78 return style
->getValue();
88 /// Copy assignment operator.
89 KwCssStyleStates
& operator = (const KwCssStyleStates
& other
);
91 /// Index into styles mapping.
92 KwCssAbstractStyleState
*& operator [] (QString name
);
100 /// Dictionary of strings to styles.
101 typedef QHash
<QString
, KwCssAbstractStyleState
*> StyleStateDictionary
;
107 /// The style properties.
108 StyleStateDictionary m_styleStates
;
112 #endif // _KwCssStyleStates_h_