Blender  V3.3
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
GHOST_EventManager Class Reference

#include <GHOST_EventManager.h>

Public Member Functions

 GHOST_EventManager ()
 
 ~GHOST_EventManager ()
 
uint32_t getNumEvents ()
 
uint32_t getNumEvents (GHOST_TEventType type)
 
GHOST_TSuccess pushEvent (GHOST_IEvent *event)
 
void dispatchEvent (GHOST_IEvent *event)
 
void dispatchEvent ()
 
void dispatchEvents ()
 
GHOST_TSuccess addConsumer (GHOST_IEventConsumer *consumer)
 
GHOST_TSuccess removeConsumer (GHOST_IEventConsumer *consumer)
 
void removeWindowEvents (GHOST_IWindow *window)
 
void removeTypeEvents (GHOST_TEventType type, GHOST_IWindow *window=NULL)
 

Protected Types

typedef std::deque< GHOST_IEvent * > TEventStack
 
typedef std::vector< GHOST_IEventConsumer * > TConsumerVector
 

Protected Member Functions

void disposeEvents ()
 

Protected Attributes

std::deque< GHOST_IEvent * > m_events
 
std::deque< GHOST_IEvent * > m_handled_events
 
TConsumerVector m_consumers
 

Detailed Description

Manages an event stack and a list of event consumers. The stack works on a FIFO (First In First Out) basis. Events are pushed on the front of the stack and retrieved from the back. Ownership of the event is transferred to the event manager as soon as an event is pushed. Ownership of the event is transferred from the event manager as soon as an event is popped. Events can be dispatched to the event consumers.

Definition at line 24 of file GHOST_EventManager.h.

Member Typedef Documentation

◆ TConsumerVector

A vector with event consumers.

Definition at line 117 of file GHOST_EventManager.h.

◆ TEventStack

typedef std::deque<GHOST_IEvent *> GHOST_EventManager::TEventStack
protected

A stack with events.

Definition at line 110 of file GHOST_EventManager.h.

Constructor & Destructor Documentation

◆ GHOST_EventManager()

GHOST_EventManager::GHOST_EventManager ( )

Constructor.

Copyright (C) 2001 NaN Technologies B.V.

Definition at line 16 of file GHOST_EventManager.cpp.

◆ ~GHOST_EventManager()

GHOST_EventManager::~GHOST_EventManager ( )

Destructor.

Definition at line 20 of file GHOST_EventManager.cpp.

References disposeEvents(), and m_consumers.

Member Function Documentation

◆ addConsumer()

GHOST_TSuccess GHOST_EventManager::addConsumer ( GHOST_IEventConsumer consumer)

Adds a consumer to the list of event consumers.

Parameters
consumerThe consumer added to the list.
Returns
Indication as to whether addition has succeeded.

Definition at line 90 of file GHOST_EventManager.cpp.

References GHOST_ASSERT, GHOST_kFailure, GHOST_kSuccess, and m_consumers.

Referenced by GHOST_System::addEventConsumer(), and GHOST_System::init().

◆ dispatchEvent() [1/2]

void GHOST_EventManager::dispatchEvent ( )

Dispatches the event at the back of the stack. The event will be removed from the stack.

Definition at line 72 of file GHOST_EventManager.cpp.

References m_events, and m_handled_events.

Referenced by dispatchEvents().

◆ dispatchEvent() [2/2]

void GHOST_EventManager::dispatchEvent ( GHOST_IEvent event)

Dispatches the given event directly, bypassing the event stack.

Definition at line 63 of file GHOST_EventManager.cpp.

References m_consumers.

◆ dispatchEvents()

void GHOST_EventManager::dispatchEvents ( )

Dispatches all the events on the stack. The event stack will be empty afterwards.

Definition at line 81 of file GHOST_EventManager.cpp.

References dispatchEvent(), disposeEvents(), and m_events.

Referenced by GHOST_System::dispatchEvents().

◆ disposeEvents()

void GHOST_EventManager::disposeEvents ( )
protected

Removes all events from the stack.

Definition at line 173 of file GHOST_EventManager.cpp.

References GHOST_ASSERT, m_events, and m_handled_events.

Referenced by dispatchEvents(), and ~GHOST_EventManager().

◆ getNumEvents() [1/2]

uint32_t GHOST_EventManager::getNumEvents ( )

Returns the number of events currently on the stack.

Returns
The number of events on the stack.

Definition at line 32 of file GHOST_EventManager.cpp.

References m_events.

Referenced by GHOST_SystemWin32::processEvents(), and GHOST_SystemWayland::processEvents().

◆ getNumEvents() [2/2]

uint32_t GHOST_EventManager::getNumEvents ( GHOST_TEventType  type)

Returns the number of events of a certain type currently on the stack.

Parameters
typeThe type of events to be counted.
Returns
The number of events on the stack of this type.

Definition at line 37 of file GHOST_EventManager.cpp.

References m_events, and type.

◆ pushEvent()

GHOST_TSuccess GHOST_EventManager::pushEvent ( GHOST_IEvent event)

Pushes an event on the stack. To dispatch it, call dispatchEvent() or dispatchEvents(). Do not delete the event!

Parameters
eventThe event to push on the stack.

Definition at line 49 of file GHOST_EventManager.cpp.

References GHOST_ASSERT, GHOST_kFailure, GHOST_kSuccess, and m_events.

Referenced by GHOST_System::pushEvent().

◆ removeConsumer()

GHOST_TSuccess GHOST_EventManager::removeConsumer ( GHOST_IEventConsumer consumer)

Removes a consumer from the list of event consumers.

Parameters
consumerThe consumer removed from the list.
Returns
Indication as to whether removal has succeeded.

Definition at line 110 of file GHOST_EventManager.cpp.

References GHOST_ASSERT, GHOST_kFailure, GHOST_kSuccess, and m_consumers.

Referenced by GHOST_System::removeEventConsumer().

◆ removeTypeEvents()

void GHOST_EventManager::removeTypeEvents ( GHOST_TEventType  type,
GHOST_IWindow window = NULL 
)

Removes all events of a certain type from the stack. The window parameter is optional. If non-null, the routine will remove events only associated with that window.

Parameters
typeThe type of events to be removed.
windowThe window to remove the events for.

Definition at line 151 of file GHOST_EventManager.cpp.

References GHOST_PRINT, m_events, and type.

Referenced by GHOST_SystemWin32::s_wndProc().

◆ removeWindowEvents()

void GHOST_EventManager::removeWindowEvents ( GHOST_IWindow window)

Removes all events for a window from the stack.

Parameters
windowThe window to remove events for.

Definition at line 129 of file GHOST_EventManager.cpp.

References GHOST_PRINT, and m_events.

Referenced by GHOST_System::disposeWindow().

Member Data Documentation

◆ m_consumers

TConsumerVector GHOST_EventManager::m_consumers
protected

The list with event consumers.

Definition at line 120 of file GHOST_EventManager.h.

Referenced by addConsumer(), dispatchEvent(), removeConsumer(), and ~GHOST_EventManager().

◆ m_events

std::deque<GHOST_IEvent *> GHOST_EventManager::m_events
protected

◆ m_handled_events

std::deque<GHOST_IEvent *> GHOST_EventManager::m_handled_events
protected

Definition at line 114 of file GHOST_EventManager.h.

Referenced by dispatchEvent(), and disposeEvents().


The documentation for this class was generated from the following files: