Panda3D
Public Member Functions | Static Public Member Functions | List of all members
EventHandler Class Reference

A class to monitor events from the C++ side of things. More...

Inheritance diagram for EventHandler:
TypedObject

Public Member Functions

 __init__ (EventQueue ev_queue)
 
 dispatchEvent (const Event event)
 Calls the hooks assigned to the indicated single event. More...
 
AsyncFuture getFuture (str event_name)
 Returns a pending future that will be marked as done when the event is next fired. More...
 
 processEvents ()
 The main processing loop of the EventHandler. More...
 
 write (Ostream out)
 
- Public Member Functions inherited from TypedObject
TypeHandle getType ()
 
int getTypeIndex ()
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool isExactType (TypeHandle handle)
 Returns true if the current object is the indicated type exactly. More...
 
bool isOfType (TypeHandle handle)
 Returns true if the current object is or derives from the indicated type. More...
 

Static Public Member Functions

static TypeHandle getClassType ()
 
static EventHandler getGlobalEventHandler (EventQueue queue)
 Returns a pointer to the one global EventHandler object. More...
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle getClassType ()
 

Additional Inherited Members

- Public Attributes inherited from TypedObject
TypeHandle type
 Returns the TypeHandle representing this object's type. More...
 

Detailed Description

A class to monitor events from the C++ side of things.

It maintains a set of "hooks", function pointers assigned to event names, and calls the appropriate hooks when the matching event is detected.

This class is not necessary when the hooks are detected and processed entirely by the scripting language, e.g. via Scheme hooks or the messenger in Python.

Member Function Documentation

◆ __init__()

__init__ ( EventQueue  ev_queue)

◆ dispatchEvent()

dispatchEvent ( const Event  event)

Calls the hooks assigned to the indicated single event.

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ getFuture()

AsyncFuture getFuture ( str  event_name)

Returns a pending future that will be marked as done when the event is next fired.

◆ getGlobalEventHandler()

static EventHandler getGlobalEventHandler ( EventQueue  queue)
static

Returns a pointer to the one global EventHandler object.

If the global object has not yet been created, this will create it.

◆ processEvents()

processEvents ( )

The main processing loop of the EventHandler.

This function must be called periodically to service events. Walks through each pending event and calls its assigned hooks.

◆ write()

write ( Ostream  out)