set.h
1/* This file is part of the KDE project
2 Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
3 Copyright (C) 2004 Alexander Dymo <cloudtemple@mskat.net>
4 Copyright (C) 2004-2006 Jaroslaw Staniek <js@iidea.pl>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20*/
21
22#ifndef KPROPERTY_SET_H
23#define KPROPERTY_SET_H
24
25#include "koproperty_global.h"
26#include <tqobject.h>
27#include <tqasciidict.h>
28
29namespace KoProperty {
30
31class Property;
32class SetPrivate;
33
40class KOPROPERTY_EXPORT Set : public TQObject
41{
42 TQ_OBJECT
43
44
45 public:
52 class KOPROPERTY_EXPORT Iterator {
53 public:
54 Iterator(const Set &set);
55 ~Iterator();
56
57 void operator ++();
58 Property* operator *() const;
59
60 TQCString currentKey() const;
61 Property* current() const;
62
63 private:
64 TQAsciiDictIterator<Property> *iterator;
65 friend class Set;
66 };
67
68 explicit Set(TQObject *parent=0, const TQString &typeName=TQString());
69
72 explicit Set(const Set& set);
73
74 virtual ~Set();
75
78 void addProperty(Property *property, TQCString group = "common");
79
81 void removeProperty(Property *property);
82
85 void removeProperty(const TQCString &name);
86
88 virtual void clear();
89
91 uint count() const;
92
94 bool isEmpty() const;
95
103 bool isReadOnly() const;
104
107 void setReadOnly(bool readOnly);
108
110 bool contains(const TQCString &name) const;
111
114 Property& property( const TQCString &name) const;
115
130 Property& operator[](const TQCString &name) const;
131
133 const Set& operator= (const Set &set);
134
137 void changeProperty(const TQCString &property, const TQVariant &value);
138
141 void setGroupDescription(const TQCString &group, const TQString& desc);
142
146 TQString groupDescription(const TQCString &group) const;
147
149 void setGroupIcon(const TQCString &group, const TQString& icon);
150
152 TQString groupIcon(const TQCString &group) const;
153
156 const TQValueList<TQCString>& groupNames() const;
157
160 const TQValueList<TQCString>& propertyNamesForGroup(const TQCString &group) const;
161
164 TQCString prevSelection() const;
165
166 void setPrevSelection(const TQCString& prevSelection);
167
174 TQString typeName() const;
175
177 void debug();
178
179 protected:
181 Set(bool propertyOwner);
182
184 void addToGroup(const TQCString &group, Property *property);
185
187 void removeFromGroup(Property *property);
188
193 void addPropertyInternal(Property *property, TQCString group, bool updateSortingKey);
194
197 void informAboutClearing(bool& cleared);
198
199 signals:
202
205 void propertyChangedInternal(KoProperty::Set& set, KoProperty::Property& property);
206
209
212
216
219
220 protected:
221 SetPrivate *d;
222
223 friend class Iterator;
224 friend class Property;
225 friend class Buffer;
226};
227
234class KOPROPERTY_EXPORT Buffer : public Set
235{
236 TQ_OBJECT
237
238
239 public:
240 Buffer();
241 Buffer(const Set *set);
242
244 virtual void intersect(const Set *set);
245
246 protected slots:
247 void intersectedChanged(KoProperty::Set& set, KoProperty::Property& prop);
248 void intersectedReset(KoProperty::Set& set, KoProperty::Property& prop);
249
250 private:
251 void initialSet(const Set *set);
252};
253
254}
255
256#endif
The base class representing a single property.
Definition property.h:177
A class to iterate over a Set. It behaves like a TQDictIterator. To use it:
Definition set.h:52
Lists holding properties in groups.
Definition set.h:41
void propertyChanged(KoProperty::Set &set, KoProperty::Property &property)
void aboutToBeDeleted()
void propertyReset(KoProperty::Set &set, KoProperty::Property &property)
void aboutToBeCleared()
void aboutToDeleteProperty(KoProperty::Set &set, KoProperty::Property &property)
Namespace for a set of classes implementing generic properties framework.