Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members

KJSEmbed::KJSEmbedPart Class Reference

A KPart for embedding KJS in an application. More...

#include <kjsembedpart.h>

List of all members.

Public Slots

virtual KJSEmbed::JSConsoleWidgetview ()
virtual bool openURL (const KURL &url)
KJSEmbed::XMLActionClient * actionClient () const
bool loadActionSet (const QString &file)
KJS::Interpreter * interpreter () const
KJS::ExecState * globalExec () const
JSFactoryfactory () const
virtual KJS::Value evaluate (const QString &script, const KJS::Value &self=KJS::Null())
bool execute (const QString &script, const KJS::Value &self=KJS::Null())
virtual bool execute (KJS::Completion &result, const QString &script, const KJS::Value &self)
virtual bool runFile (const QString &filename, const KJS::Value &self=KJS::Null())
QString loadFile (const QString &file)

Public Member Functions

 KJSEmbedPart (QObject *parent=0, const char *name=0)
 KJSEmbedPart (QWidget *wparent, const char *wname=0, QObject *parent=0, const char *name=0)
 KJSEmbedPart (KJS::Interpreter *js, QWidget *wparent, const char *wname=0, QObject *parent=0, const char *name=0)
virtual ~KJSEmbedPart ()
QCString versionString () const
int versionMajor () const
int versionMinor () const
KJS::Value callMethod (const QString &methodName, const KJS::List &args) const
KJS::Value getValue (const QString &valueName) const
void putValue (const QString &valueName, const KJS::Value &value)
void putVariant (const QString &valueName, const QVariant &value)
QVariant getVariant (const QString &valueName) const
KJS::Object globalObject () const
KJS::Completion completion () const
KJS::Object partObject () const
KJS::Object addObject (QObject *obj, const char *name=0)
KJS::Object addObject (QObject *obj, KJS::Object &parent, const char *name=0)
KJS::Object bind (QObject *obj)
QStringList constructorNames () const
KJS::Value constructors () const
KJS::List constructorList () const

Protected Member Functions

void createInterpreter ()
void createBuiltIn (KJS::ExecState *exec, KJS::Object &parent)
void createActionClient ()
virtual bool openFile ()
virtual void virtual_hook (int id, void *data)


Detailed Description

A KPart for embedding KJS in an application.

Version:
Id
kjsembedpart.h,v 1.34 2004/05/20 01:24:54 geiseri Exp
Author:
Richard Moore, rich@kde.org


Constructor & Destructor Documentation

KJSEmbed::KJSEmbedPart::KJSEmbedPart QObject *  parent = 0,
const char *  name = 0
 

Create a KJSEmbedPart.

KJSEmbed::KJSEmbedPart::KJSEmbedPart QWidget *  wparent,
const char *  wname = 0,
QObject *  parent = 0,
const char *  name = 0
 

Creates a KJSEmbedPart for which the parents of the view and part are different.

Caution! you cannot use parent = [KQ]Application and wparent = 0L. This will cause a crash on exit since the widget will not be destroyed but the part will get destroyed at the end of the QApplication constructor. This results in the widget trying to do GUI related things after the QPaint stuff is destroyed.

KJSEmbed::KJSEmbedPart::KJSEmbedPart KJS::Interpreter *  js,
QWidget *  wparent,
const char *  wname = 0,
QObject *  parent = 0,
const char *  name = 0
 

Create a KJSEmbedPart with the specified interpreter.

See warning above.

virtual KJSEmbed::KJSEmbedPart::~KJSEmbedPart  )  [virtual]
 

Cleans up.


Member Function Documentation

KJSEmbed::XMLActionClient* KJSEmbed::KJSEmbedPart::actionClient  )  const [inline, slot]
 

Returns the current XMLActionClient.

KJS::Object KJSEmbed::KJSEmbedPart::addObject QObject *  obj,
KJS::Object &  parent,
const char *  name = 0
 

Publishes 'obj' as property 'name' of object 'parent'.

The binding is defined using JSObjectProxy, and is subject to the current default SecurityPolicy.

KJS::Object KJSEmbed::KJSEmbedPart::addObject QObject *  obj,
const char *  name = 0
 

Publishes 'obj' as property 'name' of the global object.

If 'name' is not specified then the name property of 'obj' is used instead.

KJS::Object KJSEmbed::KJSEmbedPart::bind QObject *  obj  ) 
 

Returns a JS::Object that provides a binding to the specified QObject.

KJS::Value KJSEmbed::KJSEmbedPart::callMethod const QString &  methodName,
const KJS::List &  args
const
 

Checks to see if a desired method is available in Javascript.

 if ( js->hasMethod( "javascriptFunction" ) )
   ... // do something with that function.
 else
   ... // function not present.
    */
    bool hasMethod( const QString &methodName );
    

KJS::Completion KJSEmbed::KJSEmbedPart::completion  )  const [inline]
 

Returns the completion object for the last script executed.

KJS::List KJSEmbed::KJSEmbedPart::constructorList  )  const
 

Returns a list of the constructors of this interpreter.

QStringList KJSEmbed::KJSEmbedPart::constructorNames  )  const
 

Returns a list of the names of the constructors of this interpreter.

KJS::Value KJSEmbed::KJSEmbedPart::constructors  )  const
 

Returns a JS Array of the constructors of this interpreter.

void KJSEmbed::KJSEmbedPart::createActionClient  )  [protected]
 

Sets up the XMLActionClient.

void KJSEmbed::KJSEmbedPart::createBuiltIn KJS::ExecState *  exec,
KJS::Object &  parent
[protected]
 

Creates the built-in objects and methods in the specified parent object normally the global object of the interpreter.

This method is called automatically unless you create the part with a custom interpreter, if you do then you have to call this method yourself if you want the built-ins to be available.

void KJSEmbed::KJSEmbedPart::createInterpreter  )  [protected]
 

Creates the interpreter.

virtual KJS::Value KJSEmbed::KJSEmbedPart::evaluate const QString &  script,
const KJS::Value &  self = KJS::Null()
[virtual, slot]
 

Evaluates the specified string, with the specified value as 'this'.

virtual bool KJSEmbed::KJSEmbedPart::execute KJS::Completion &  result,
const QString &  script,
const KJS::Value &  self
[virtual, slot]
 

Executes the specified string, with the specified value as 'this' and sets result to the completion object returned by the interpreter.

bool KJSEmbed::KJSEmbedPart::execute const QString &  script,
const KJS::Value &  self = KJS::Null()
[slot]
 

Executes the specified string, with the specified value as 'this'.

JSFactory* KJSEmbed::KJSEmbedPart::factory  )  const [inline, slot]
 

Returns the current factory object.

KJS::Value KJSEmbed::KJSEmbedPart::getValue const QString &  valueName  )  const
 

Gets a value from Javascript starting from the global context.

 KJS::Value val = js->getValue("someValue");
 QString myString = val.toString().qstring();

QVariant KJSEmbed::KJSEmbedPart::getVariant const QString &  valueName  )  const
 

Convinence method that wraps around getValue that only handles values that are supported by QVariant.

 QColor value = js->getVariant( "myVar").toColor();

KJS::ExecState* KJSEmbed::KJSEmbedPart::globalExec  )  const [inline, slot]
 

Returns the execution context of the interpreter.

KJS::Object KJSEmbed::KJSEmbedPart::globalObject  )  const [inline]
 

Returns the global object of the interpreter.

KJS::Interpreter* KJSEmbed::KJSEmbedPart::interpreter  )  const [inline, slot]
 

Returns the current interpreter.

bool KJSEmbed::KJSEmbedPart::loadActionSet const QString &  file  )  [slot]
 

Loads the XML actions defined in the specified file to the default XMLActionClient.

QString KJSEmbed::KJSEmbedPart::loadFile const QString &  file  )  [slot]
 

Loads but does not execute the specified script file.

If the first line of the file starts with the string '#!' then that line will be omitted from the returned string.

virtual bool KJSEmbed::KJSEmbedPart::openFile  )  [inline, protected, virtual]
 

Reimplemented to disable file support.

virtual bool KJSEmbed::KJSEmbedPart::openURL const KURL &  url  )  [virtual, slot]
 

Opens a URL.

If the URL has the protocol 'javascript' then it is executed.

KJS::Object KJSEmbed::KJSEmbedPart::partObject  )  const [inline]
 

Returns the JS object of the part.

void KJSEmbed::KJSEmbedPart::putValue const QString &  valueName,
const KJS::Value &  value
 

Sets a value in a Javascript starting from the global context.

Note if this value is not present in the javascript context it will become defined once this method is called.

 KJS::Value val = KJSEmbed::convertToValue(js->globalExec(), QColor("blue"));
 js->putValue("myVar", val);

void KJSEmbed::KJSEmbedPart::putVariant const QString &  valueName,
const QVariant &  value
 

Convinence method that wraps around putValue that only handles values that are supported by QVariant.

 js->putVariant( "myVar", QColor("blue") );

virtual bool KJSEmbed::KJSEmbedPart::runFile const QString &  filename,
const KJS::Value &  self = KJS::Null()
[virtual, slot]
 

Loads and runs the specified file.

int KJSEmbed::KJSEmbedPart::versionMajor  )  const
 

Returns the minor version number of KJSEmbed.

int KJSEmbed::KJSEmbedPart::versionMinor  )  const
 

Returns the major version number of KJSEmbed.

QCString KJSEmbed::KJSEmbedPart::versionString  )  const
 

Returns the version of KJSEmbed.

virtual KJSEmbed::JSConsoleWidget* KJSEmbed::KJSEmbedPart::view  )  [virtual, slot]
 

Returns the view widget, creating one if required.

virtual void KJSEmbed::KJSEmbedPart::virtual_hook int  id,
void *  data
[protected, virtual]
 


The documentation for this class was generated from the following file:
Generated on Sat May 29 03:13:07 2004 for KJSEmbed by doxygen 1.3.2