1 #ifndef __tdeparts__genericfactory_h__
2 #define __tdeparts__genericfactory_h__
4 #include <tdeparts/factory.h>
5 #include <tdeparts/part.h>
6 #include <kgenericfactory.h>
7 #include <tdeaboutdata.h>
23 kdWarning() <<
"KParts::GenericFactory instantiated more than once!" <<
endl;
26 virtual ~GenericFactoryBase()
44 virtual void virtual_hook(
int id,
void *data )
46 if (
id != VIRTUAL_QUERY_INSTANCE_PARAMS ) {
47 KParts::Factory::virtual_hook(
id, data );
51 QueryInstanceParams *params =
reinterpret_cast<QueryInstanceParams *
>( data );
56 static GenericFactoryBase<T> *s_self;
101 TQObject *parent,
const char *name,
102 const char *className,
103 const TQStringList &args )
105 T *part = KDEPrivate::ConcreteFactory<T>::create( parentWidget,
112 if ( part && !qstrcmp( className,
"KParts::ReadOnlyPart" ) )
122 template <
class T1,
class T2>
123 class GenericFactory<
KTypeList<T1, T2> > :
public GenericFactoryBase<T1>
129 TQObject *parent,
const char *name,
130 const char *className,
131 const TQStringList &args )
133 TQObject *
object = KDEPrivate::MultiFactory< KTypeList<T1, T2> >
::create( parentWidget,
142 if ( part && !qstrcmp( className,
"KParts::ReadOnlyPart" ) )
156 GenericFactoryBase<T> *GenericFactoryBase<T>::s_self = 0;
162 TDEInstance *GenericFactoryBase<T>::s_instance = 0;
179 s_instance = s_self->createInstance();
193 s_aboutData = T::createAboutData();
TQObject * create(TQObject *parent=0, const char *name=0, const char *classname="TQObject", const TQStringList &args=TQStringList())
A generic factory object to create a Part.
A template for a KParts::Factory implementation.
virtual KParts::Part * createPartObject(TQWidget *parentWidget, const char *widgetName, TQObject *parent, const char *name, const char *className, const TQStringList &args)
Reimplement this method in your implementation to create the Part.
Base class for an "editor" part.
virtual void setReadWrite(bool readwrite=true)
Changes the behavior of this part to readonly or readwrite.
kndbgstream & endl(kndbgstream &s)
kdbgstream kdWarning(int area=0)