00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef KPROPERTY_FACTORY_H
00023 #define KPROPERTY_FACTORY_H
00024
00025 #include "koproperty_global.h"
00026 #include <kstaticdeleter.h>
00027 #include <QObject>
00028
00029 namespace KoProperty {
00030
00031 class Widget;
00032 class CustomProperty;
00033 class Property;
00034 class FactoryManagerPrivate;
00035
00037
00038
00039
00041 class KOPROPERTY_EXPORT CustomPropertyFactory : public QObject
00042 {
00043 public:
00044 CustomPropertyFactory(QObject *parent);
00045 virtual ~CustomPropertyFactory();
00046
00050 virtual CustomProperty* createCustomProperty(Property *parent) = 0;
00051
00055 virtual Widget* createCustomWidget(Property *property) = 0;
00056 };
00057
00059
00111 class KOPROPERTY_EXPORT FactoryManager : public QObject
00112 {
00113 public:
00122 void registerFactoryForEditor(int editorType, CustomPropertyFactory *factory);
00123
00126 void registerFactoryForEditors(const QList<int> &editorTypes, CustomPropertyFactory *factory);
00127
00131 CustomPropertyFactory *factoryForEditorType(int type);
00132
00137 Widget* createWidgetForProperty(Property *property);
00138
00141 void registerFactoryForProperty(int propertyType, CustomPropertyFactory *factory);
00142
00145 void registerFactoryForProperties(const QList<int> &propertyTypes,
00146 CustomPropertyFactory *factory);
00147
00151 CustomProperty* createCustomProperty(Property *parent);
00152
00154 static FactoryManager* self();
00155
00156 private:
00157 FactoryManager();
00158 ~FactoryManager();
00159
00160 FactoryManagerPrivate *d;
00161 friend class KStaticDeleter<KoProperty::FactoryManager>;
00162 };
00163
00164 }
00165
00166 #endif