• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

kjsembed

KJSEmbed::JSEventMapper

KJSEmbed::JSEventMapper Class Reference

#include <jseventmapper.h>

List of all members.


Detailed Description

Maintains a map between the types of QEvent and the names of their event handlers.

This class handles all of the built in Qt events. To add your own custom events you can simply call mapper()->addEvent(KJS::Identifier("onMyCustomEvent"), QEvent::User + 1). Then in your javascript you can just do the following:

 var myQObject = new QObjectBinding(this);
 myQObject.onMyCustomEvent = function () { //do stuff ;}

In cases where you need to handle properties on your custom event, you will need to provide a binding to that event and KJSEmbed will create an instance of it for you as the argument in your event handler.

Author:
Richard Moore, rich@kde.org

Ian Reinhart Geiser, geiseri@kde.org

Definition at line 49 of file jseventmapper.h.


Public Member Functions

void addEvent (const KJS::Identifier &name, QEvent::Type t)
KJS::Identifier findEventHandler (QEvent::Type t) const
QEvent::Type findEventType (const KJS::Identifier &name) const
bool isEventHandler (const KJS::Identifier &name) const
virtual ~JSEventMapper ()

Static Public Member Functions

static JSEventMapper * mapper ()

Constructor & Destructor Documentation

KJSEmbed::JSEventMapper::~JSEventMapper (  )  [virtual]

Definition at line 259 of file jseventmapper.cpp.


Member Function Documentation

void KJSEmbed::JSEventMapper::addEvent ( const KJS::Identifier &  name,
QEvent::Type  t 
)

Adds an event to the map.

The event handler has the specified name, and the event has the specified type.

Definition at line 263 of file jseventmapper.cpp.

KJS::Identifier KJSEmbed::JSEventMapper::findEventHandler ( QEvent::Type  t  )  const

Returns the name of the handler method for the specified event type.

Definition at line 279 of file jseventmapper.cpp.

QEvent::Type KJSEmbed::JSEventMapper::findEventType ( const KJS::Identifier &  name  )  const

Returns the type of the events handled by the specified handler.

Definition at line 269 of file jseventmapper.cpp.

bool KJSEmbed::JSEventMapper::isEventHandler ( const KJS::Identifier &  name  )  const

Returns true iff the specified name is the identifier for an event handler.

Definition at line 274 of file jseventmapper.cpp.

JSEventMapper * KJSEmbed::JSEventMapper::mapper (  )  [static]

Return the global event mapper.

Definition at line 284 of file jseventmapper.cpp.


The documentation for this class was generated from the following files:
  • jseventmapper.h
  • jseventmapper.cpp

kjsembed

Skip menu "kjsembed"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal