class Poco::XML::EventDispatcher

Overview

This helper class manages event listener subscriptions and event dispatching for AbstractNode. Moreā€¦

#include <EventDispatcher.h>

class EventDispatcher
{
public:
    // structs

    struct EventListenerItem;

    // methods

    void
    addEventListener(
        const XMLString& type,
        EventListener* listener,
        bool useCapture
        );

    void
    removeEventListener(
        const XMLString& type,
        EventListener* listener,
        bool useCapture
        );

    void
    dispatchEvent(Event* evt);

    void
    captureEvent(Event* evt);

    void
    bubbleEvent(Event* evt);
};

Detailed Documentation

This helper class manages event listener subscriptions and event dispatching for AbstractNode.

The EventListener list is managed in such a way that event listeners can be added and removed even from within an EventListener, while events are being dispatched.

Construction

~EventDispatcher()

Destroys the EventDispatcher.

Methods

void
addEventListener(
    const XMLString& type,
    EventListener* listener,
    bool useCapture
    )

Adds an EventListener to the internal list.

void
removeEventListener(
    const XMLString& type,
    EventListener* listener,
    bool useCapture
    )

Removes an EventListener from the internal list.

If a dispatch is currently in progress, the list entry is only marked for deletion. If no dispatch is currently in progress, all EventListeners marked for deletion are removed from the list.

void
dispatchEvent(Event* evt)

Dispatches the event.

Also removes all EventListeners marked for deletion from the event dispatcher list.

void
captureEvent(Event* evt)

Dispatches the event in its capturing phase.

Also removes all EventListeners marked for deletion from the event dispatcher list.

void
bubbleEvent(Event* evt)

Dispatches the event in its bubbling phase.

Also removes all EventListeners marked for deletion from the event dispatcher list.