InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IScriptEventTarget Class Referenceabstract

#include <IScriptEventTarget.h>

Inheritance diagram for IScriptEventTarget:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_ISCRIPTEVENTTARGET }
 
enum  InitCallbackType { kPreDispatch, kPostDispatch }
 
typedef void(* InitEventCallback )(IScriptEvent *e, InitCallbackType t, void *privateData)
 

Public Member Functions

virtual void DispatchScriptEvent (ScriptElementID eventID, InitEventCallback initCallback=nil, void *privateData=nil)=0
 
virtual bool16 WillTriggerEventListeners (const PMString &eventType, bool16 bubbles) const =0
 
virtual int32 GetNumEventListeners () const =0
 
virtual int32 GetNumEventListeners (const PMString &eventType) const =0
 
virtual IScriptEventListenerQueryNthEventListener (int32 n) const =0
 
virtual IScriptEventListenerQueryNthEventListener (int32 n, const PMString &eventType) const =0
 
virtual void GetEventListeners (ScriptEventListenerList &eventListeners) const =0
 
virtual void GetEventListeners (ScriptEventListenerList &eventListeners, const PMString &eventType) const =0
 
virtual bool16 AddEventListener (IScriptEventListener *eventListener)=0
 
virtual bool16 RemoveEventListener (IScriptEventListener *eventListener)=0
 
virtual IScriptEventListenerQueryMatchingEventListener (const PMString &eventType, const ScriptData &handler) const =0
 
virtual void SetBusy (const PMString &eventType, bool16 bBusy)=0
 
virtual bool16 IsBusy () const =0
 
virtual int32 GetNumEvents (const ScriptID &type, const RequestContext &context) const =0
 
virtual IScriptEventQueryNthEvent (int32 n, const ScriptID &type, const RequestContext &context) const =0
 
virtual void PushEvent (IScriptEvent *e)=0
 
virtual IScriptEventPopEvent ()=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

Any object that can be the target of attachable events in scripting should aggregate this interface to the same boss as its IID_ISCRIPT.

Member Enumeration Documentation

Some events have additional properties that must be initialized prior to dispatch, or used to update the object model after the event finishes propagation. In this case, pass an InitEventCallback function to DispatchScriptEvent. The IScriptEvent interface on the initialized event will be passed to this function before and after propagation.

A good example of this is a MutationEvent. See .h.

Member Function Documentation

virtual bool16 IScriptEventTarget::AddEventListener (IScriptEventListenereventListener)
pure virtual

Register an event listener on this target, unless one already exists with the same parameters on this target.

Parameters
eventListeneris the listener to add IN
Returns
whether the event listener was added
virtual void IScriptEventTarget::DispatchScriptEvent (ScriptElementID eventID,
InitEventCallback initCallback = nil,
void * privateData = nil 
)
pure virtual

Dispatch an attachable event

Parameters
eventID- ID of the event
initCallback- function to call before and after the event is dispatched
privateData- private data to pass to the InitEventCallback function
Returns
- none, but if default action is canceled by an event handler, sets the global error code to kCancel
virtual void IScriptEventTarget::GetEventListeners (ScriptEventListenerListeventListeners) const
pure virtual

Return every event listener registered on this target. The order of event listeners is arbitrary.

Parameters
eventListenersis the array of listeners OUT
virtual void IScriptEventTarget::GetEventListeners (ScriptEventListenerListeventListeners,
const PMStringeventType 
) const
pure virtual

Return every event listener registered on this target for a particular event type. The order of event listeners is arbitrary.

Parameters
eventListenersis the array of listeners OUT
eventTypeis the event type IN
virtual int32 IScriptEventTarget::GetNumEventListeners () const
pure virtual

Get the number of event listeners registered on this target

virtual int32 IScriptEventTarget::GetNumEventListeners (const PMStringeventType) const
pure virtual

Get the number of event listeners registered on this target for a particular event type

Parameters
eventTypeis the event type IN
virtual int32 IScriptEventTarget::GetNumEvents (const ScriptIDtype,
const RequestContextcontext 
) const
pure virtual

Get the number of active events on this target of a particular event type

Parameters
typeof events (to get all events, pass c_Event) IN
contextis the script request context IN
Returns
the number of events
virtual bool16 IScriptEventTarget::IsBusy () const
pure virtual

Is this object the target of a propagating event

Returns
kTrue if so, kFalse if not
virtual IScriptEvent* IScriptEventTarget::PopEvent ()
pure virtual

For INTERNAL USE ONLY by implementations of IScriptEventTarget::DispatchScriptEvent(). Remove an event from this target.

Returns
the event
virtual void IScriptEventTarget::PushEvent (IScriptEvente)
pure virtual

For INTERNAL USE ONLY by implementations of IScriptEventTarget::DispatchScriptEvent(). Add an event to this target.

Parameters
theevent IN
virtual IScriptEventListener* IScriptEventTarget::QueryMatchingEventListener (const PMStringeventType,
const ScriptDatahandler 
) const
pure virtual

Find a matching event listener, if one exists with the same parameters on this target.

Parameters
eventTypeis the event type for which the listener is registered IN
handleris the registered callback IN
Returns
the matching event listener, or nil if none
virtual IScriptEvent* IScriptEventTarget::QueryNthEvent (int32 n,
const ScriptIDtype,
const RequestContextcontext 
) const
pure virtual

Return the nth active event on this target of a particular event type

Parameters
nis the index of the desired event IN
typeof events (to get all events, pass c_Event) IN
contextis the script request context IN
Returns
the nth event
virtual IScriptEventListener* IScriptEventTarget::QueryNthEventListener (int32 n) const
pure virtual

Return the nth event listener registered on this target. The order of event listeners is arbitrary.

Parameters
nis the index of the desired listener IN
Returns
the nth listener or nil if none
virtual IScriptEventListener* IScriptEventTarget::QueryNthEventListener (int32 n,
const PMStringeventType 
) const
pure virtual

Return the nth event listener registered on this target for a particular event type. The order of event listeners is arbitrary.

Parameters
nis the index of the desired listener IN
eventTypeis the event type IN
Returns
the nth listener or nil if none
virtual bool16 IScriptEventTarget::RemoveEventListener (IScriptEventListenereventListener)
pure virtual

Remove an event listener from this target, if one exists with the same parameters on this target.

Parameters
eventListeneris the listener to remove IN
Returns
whether the event listener was removed
virtual void IScriptEventTarget::SetBusy (const PMStringeventType,
bool16 bBusy 
)
pure virtual

For INTERNAL USE ONLY by implementations of IScriptEventTarget::DispatchScriptEvent(). Increment/decrement the busy count for event listeners of a given type on this target.

Parameters
eventTypeis the event type that is busy IN
bBusyis kTrue to increment, kFalse to decrement IN
virtual bool16 IScriptEventTarget::WillTriggerEventListeners (const PMStringeventType,
bool16 bubbles 
) const
pure virtual

Checks whether an event listener is registered with this event target object or any of its ancestors for the specified event type.

Parameters
eventTypeis the event type IN
bubblespass kTrue if the event bubbles and you want to check for event listeners on this target's ancestors