# KJSEmbed::JSFactory Class Reference

Factory class for KJSEmbed. More...

`#include <jsfactory.h>`

List of all members.

## Public Types

enum | ProxyTypes { TypeInvalid = 0, TypeQObject = 1, TypeValue = 2, TypeOpaque = 4, TypePlugin = 8, TypeQObjectPlugin = 9 }

## Public Member Functions

| JSFactory (KJSEmbedPart *part)
virtual | ~JSFactory ()
JSEventMapper * | eventMapper () const
KJSEmbedPart * | part () const
KJS::Object | create (KJS::ExecState *exec, const QString &classname, const KJS::List &args)
KJS::Object | createProxy (KJS::ExecState *exec, QObject *target, const JSObjectProxy *context=0) const
KJS::Object | createProxy (KJS::ExecState *exec, QTextStream *target, const JSObjectProxy *context=0) const
KJS::Object | createProxy (KJS::ExecState *exec, QEvent *target, const JSObjectProxy *context) const
KParts::ReadOnlyPart * | createROPart (const QString &svc, QObject *parent=0, const char *name=0)
KParts::ReadOnlyPart * | createROPart (const QString &svc, const QString &constraint, QObject *parent=0, const char *name=0)
KParts::ReadOnlyPart * | createROPart (const QString &svc, const QString &constraint, QObject *parent, const char *name, const QStringList &args)
KParts::ReadWritePart * | createRWPart (const QString &svc, QObject *parent=0, const char *name=0)
KParts::ReadWritePart * | createRWPart (const QString &svc, const QString &constraint, QObject *parent=0, const char *name=0)
KParts::ReadWritePart * | createRWPart (const QString &svc, const QString &constraint, QObject *parent, const char *name, const QStringList &args)
QWidget * | loadUI (const QString &uiFile, QObject *connector=0, QWidget *parent=0, const char *name=0)
QStringList | listBindingPlugins (KJS::ExecState *exec, KJS::Object &self)
void | addBindingPluginTypes (KJS::ExecState *exec, KJS::Object &parent)
bool | isBindingPlugin (const QString &classname) const
KJS::Object | createBindingPlugin (KJS::ExecState *exec, const QString &classname, const KJS::List &args)
bool | isSupported (const QString &clazz) const
bool | isQObject (const QString &clazz) const
bool | isValue (const QString &clazz) const
bool | isOpaque (const QString &clazz) const
uint | proxyType (const QString &clazz) const
void | addQObjectPlugin (const QString &classname, KJSEmbed::Bindings::JSBindingPlugin *plugin)
void | addBindingsPlugin (KJS::ExecState *exec, KJS::Object &target) const
void | addType (const QString &clazz, uint proxytype=JSFactory::TypeQObject)
void | addTypes (KJS::ExecState *exec, KJS::Object &parent)
QStringList | types () const

## Protected Member Functions

KJS::Object | extendProxy (KJS::ExecState *exec, KJS::Object &target) const
KJS::Object | createValue (KJS::ExecState *exec, const QString &cname, const KJS::List &args)
QObject * | create (const QString &classname, QObject *parent=0, const char *name=0)
KJS::Object | createOpaque (KJS::ExecState *exec, const QString &cname, const KJS::List &args)
QObject * | createBinding (const QString &cname, QObject *parent, const char *name)
QObject * | createObject (const QString &cname, QObject *parent, const char *name)
QWidget * | createWidget (const QString &cname, QWidget *parent, const char *name)

## Detailed Description

Factory class for KJSEmbed.

Author:
  Richard Moore, rich@kde.org

## Member Enumeration Documentation

enum KJSEmbed::JSFactory::ProxyTypes

The types of proxy that can be associated with a class name.

These are used when decoding the return values of slots.

Enumeration values:

  TypeInvalid |
  TypeQObject |
  TypeValue |
  TypeOpaque |
  TypePlugin |
  TypeQObjectPlugin |

## Constructor & Destructor Documentation

KJSEmbed::JSFactory::JSFactory | ( | KJSEmbedPart * | part | ) |

| Creates a factory object for the specified part.

virtual KJSEmbed::JSFactory::~JSFactory | ( |  | ) | `[virtual]`

| Cleans up.

## Member Function Documentation

void KJSEmbed::JSFactory::addBindingPluginTypes | ( | KJS::ExecState * | exec,
|  | KJS::Object & | parent
| ) |

| Adds a binding plugin type to the list of available types the factory can create.

void KJSEmbed::JSFactory::addBindingsPlugin | ( | KJS::ExecState * | exec,
|  | KJS::Object & | target
| ) | const

void KJSEmbed::JSFactory::addQObjectPlugin | ( | const QString & | classname,
|  | KJSEmbed::Bindings::JSBindingPlugin * | plugin
| ) |

| Allows adding of an already loaded binding plugin for a certain class type.

void KJSEmbed::JSFactory::addType | ( | const QString & | clazz,
|  | uint | proxytype = JSFactory::TypeQObject
| ) |

| Tells the factory the specified type of proxy to use for the named class. Note that you can remove support for a type by using this method with TypeInvalid.

void KJSEmbed::JSFactory::addTypes | ( | KJS::ExecState * | exec,
|  | KJS::Object & | parent
| ) |

| Adds the types defined by the factory to the specified parent.

QObject* KJSEmbed::JSFactory::create | ( | const QString & | classname,
|  | QObject * | parent = 0,
|  | const char * | name = 0
| ) | `[protected]`

| Creates an instance of a QObject subclass. If the instance cannot be created then 0 is returned.

KJS::Object KJSEmbed::JSFactory::create | ( | KJS::ExecState * | exec,
|  | const QString & | classname,
|  | const KJS::List & | args
| ) |

| Creates an object of the specified class, then returns a proxy.

QObject* KJSEmbed::JSFactory::createBinding | ( | const QString & | cname,
|  | QObject * | parent,
|  | const char * | name
| ) | `[protected]`

| Creates an instance of the named binding QObject.

KJS::Object KJSEmbed::JSFactory::createBindingPlugin | ( | KJS::ExecState * | exec,
|  | const QString & | classname,
|  | const KJS::List & | args
| ) |

| Creates the actual object from the binding plugin.

QObject* KJSEmbed::JSFactory::createObject | ( | const QString & | cname,
|  | QObject * | parent,
|  | const char * | name
| ) | `[protected]`

| Creates an instance of the named QObject. This method is only used for non-widget objects.

KJS::Object KJSEmbed::JSFactory::createOpaque | ( | KJS::ExecState * | exec,
|  | const QString & | cname,
|  | const KJS::List & | args
| ) | `[protected]`

| Creates an instance of the named class and returns it in a JSOpaqueProxy.

KJS::Object KJSEmbed::JSFactory::createProxy | ( | KJS::ExecState * | exec,
|  | QEvent * | target,
|  | const JSObjectProxy * | context
| ) | const

| Creates a proxy object for the specified target with the specified context.

KJS::Object KJSEmbed::JSFactory::createProxy | ( | KJS::ExecState * | exec,
|  | QTextStream * | target,
|  | const JSObjectProxy * | context = 0
| ) | const

| Creates a proxy object for the specified target with the specified context.

KJS::Object KJSEmbed::JSFactory::createProxy | ( | KJS::ExecState * | exec,
|  | QObject * | target,
|  | const JSObjectProxy * | context = 0
| ) | const

| Creates a proxy object for the specified target with the specified context.

KParts::ReadOnlyPart* KJSEmbed::JSFactory::createROPart | ( | const QString & | svc,
|  | const QString & | constraint,
|  | QObject * | parent,
|  | const char * | name,
|  | const QStringList & | args
| ) |

| Creates a ReadOnlyPart that views the specified service type and matches the specified constraint.

KParts::ReadOnlyPart* KJSEmbed::JSFactory::createROPart | ( | const QString & | svc,
|  | const QString & | constraint,
|  | QObject * | parent = 0,
|  | const char * | name = 0
| ) |

| Creates a ReadOnlyPart that views the specified service type and matches the specified constraint.

KParts::ReadOnlyPart* KJSEmbed::JSFactory::createROPart | ( | const QString & | svc,
|  | QObject * | parent = 0,
|  | const char * | name = 0
| ) |

| Creates a ReadOnlyPart that views the specified service type. The service type will often be a MIME type like 'text/html'. The part created is the first offer returned by the trader, and will have the specified parent and name.

KParts::ReadWritePart* KJSEmbed::JSFactory::createRWPart | ( | const QString & | svc,
|  | const QString & | constraint,
|  | QObject * | parent,
|  | const char * | name,
|  | const QStringList & | args
| ) |

| Creates a ReadWritePart that edits the specified service type and matches the specified constraint.

KParts::ReadWritePart* KJSEmbed::JSFactory::createRWPart | ( | const QString & | svc,
|  | const QString & | constraint,
|  | QObject * | parent = 0,
|  | const char * | name = 0
| ) |

| Creates a ReadWritePart that edits the specified service type and matches the specified constraint.

KParts::ReadWritePart* KJSEmbed::JSFactory::createRWPart | ( | const QString & | svc,
|  | QObject * | parent = 0,
|  | const char * | name = 0
| ) |

| Creates a ReadWritePart that edits the specified service type. The service type will often be a MIME type like 'text/plain'. The part created is the first offer returned by the trader, and will have the specified parent and name.

KJS::Object KJSEmbed::JSFactory::createValue | ( | KJS::ExecState * | exec,
|  | const QString & | cname,
|  | const KJS::List & | args
| ) | `[protected]`

| Creates an instance of the named class and returns it in a JSValueProxy.

QWidget* KJSEmbed::JSFactory::createWidget | ( | const QString & | cname,
|  | QWidget * | parent,
|  | const char * | name
| ) | `[protected]`

| Creates an instance of the named QWidget. Note that this method is only used to create widgets that are not supported by QWidgetFactory.

JSEventMapper* KJSEmbed::JSFactory::eventMapper | ( |  | ) | const`[inline]`

| Returns the mapper that translates between event types and the names of the handler methods.

KJS::Object KJSEmbed::JSFactory::extendProxy | ( | KJS::ExecState * | exec,
|  | KJS::Object & | target
| ) | const`[protected]`

| Adds custom bindings to the specified proxy object.

bool KJSEmbed::JSFactory::isBindingPlugin | ( | const QString & | classname | ) | const

bool KJSEmbed::JSFactory::isOpaque | ( | const QString & | clazz | ) | const

| Returns true iff the class with the specified name is handled with the opaque proxy type.

bool KJSEmbed::JSFactory::isQObject | ( | const QString & | clazz | ) | const

| Returns true iff the class with the specified name is handled with the QObject proxy type.

bool KJSEmbed::JSFactory::isSupported | ( | const QString & | clazz | ) | const

| Returns true iff the factory knows the type of proxy to use for the class with the name specified.

bool KJSEmbed::JSFactory::isValue | ( | const QString & | clazz | ) | const

| Returns true iff the class with the specified name is handled with the value proxy type.

QStringList KJSEmbed::JSFactory::listBindingPlugins | ( | KJS::ExecState * | exec,
|  | KJS::Object & | self
| ) |

| Queries KTrader for a plugin that provides the asked for object binding. If the binding was added the object is returned, otherwise a KJS::Null is.

QWidget* KJSEmbed::JSFactory::loadUI | ( | const QString & | uiFile,
|  | QObject * | connector = 0,
|  | QWidget * | parent = 0,
|  | const char * | name = 0
| ) |

| Loads the widget defined in the specified .ui file. If the widget cannot be created then 0 is returned.

KJSEmbedPart* KJSEmbed::JSFactory::part | ( |  | ) | const`[inline]`

| Returns the part that the factory is attached to.

uint KJSEmbed::JSFactory::proxyType | ( | const QString & | clazz | ) | const

| Returns the ProxyType of the class with the specified name. If the named class is not known to the interpreter then TypeInvalid is returned.

QStringList KJSEmbed::JSFactory::types | ( |  | ) | const

The documentation for this class was generated from the following file:

- jsfactory.h