factory.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) 2005 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_FACTORY_H
23#define KPROPERTY_FACTORY_H
24
25#include "koproperty_global.h"
26#include <kstaticdeleter.h>
27#include <tqobject.h>
28
29template<class U> class TQValueList;
30
31namespace KoProperty {
32
33class Widget;
34class CustomProperty;
35class Property;
36class FactoryManagerPrivate;
37
39//typedef Widget *(*createWidget) (Property*);
40//typedef CustomProperty *(*createCustomProperty) (Property*);
41
43class KOPROPERTY_EXPORT CustomPropertyFactory : public TQObject
44{
45 public:
46 CustomPropertyFactory(TQObject *parent);
47 virtual ~CustomPropertyFactory();
48
53
57 virtual Widget* createCustomWidget(Property *property) = 0;
58};
59
61
113class KOPROPERTY_EXPORT FactoryManager : public TQObject
114{
115 public:
124 void registerFactoryForEditor(int editorType, CustomPropertyFactory *factory);
125
128 void registerFactoryForEditors(const TQValueList<int> &editorTypes, CustomPropertyFactory *factory);
129
133 CustomPropertyFactory *factoryForEditorType(int type);
134
139 Widget* createWidgetForProperty(Property *property);
140
143 void registerFactoryForProperty(int propertyType, CustomPropertyFactory *factory);
144
147 void registerFactoryForProperties(const TQValueList<int> &propertyTypes,
148 CustomPropertyFactory *factory);
149
154
156 static FactoryManager* self();
157
158 private:
161
162 FactoryManagerPrivate *d;
163 friend class KStaticDeleter<KoProperty::FactoryManager>;
164};
165
166}
167
168#endif
Base class for custom properties.
Manages factories providing custom editors and properties.
Definition factory.h:114
The base class representing a single property.
Definition property.h:177
The base class for all item editors used in Editor.
Definition widget.h:37
Namespace for a set of classes implementing generic properties framework.
virtual Widget * createCustomWidget(Property *property)=0
virtual CustomProperty * createCustomProperty(Property *parent)=0
A prototype for custom property factory class KOPROPERTY_EXPORT CustomPropertyFactory : public TQObje...