Blender V2.61 - r43446
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes

GHOST_EventManager Class Reference

#include <GHOST_EventManager.h>

List of all members.

Public Member Functions

 GHOST_EventManager ()
virtual ~GHOST_EventManager ()
virtual GHOST_TUns32 getNumEvents ()
virtual GHOST_TUns32 getNumEvents (GHOST_TEventType type)
virtual GHOST_IEventpeekEvent ()
virtual GHOST_TSuccess pushEvent (GHOST_IEvent *event)
virtual bool dispatchEvent (GHOST_IEvent *event)
virtual bool dispatchEvent ()
virtual bool dispatchEvents ()
virtual GHOST_TSuccess addConsumer (GHOST_IEventConsumer *consumer)
virtual GHOST_TSuccess removeConsumer (GHOST_IEventConsumer *consumer)
virtual void removeWindowEvents (GHOST_IWindow *window)
virtual void removeTypeEvents (GHOST_TEventType type, GHOST_IWindow *window=0)

Protected Types

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

Protected Member Functions

virtual GHOST_IEventpopEvent ()
virtual void disposeEvents ()

Protected Attributes

std::deque< GHOST_IEvent * > m_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 50 of file GHOST_EventManager.h.


Member Typedef Documentation

typedef std::vector<GHOST_IEventConsumer*> GHOST_EventManager::TConsumerVector [protected]

A vector with event consumers.

Definition at line 167 of file GHOST_EventManager.h.

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

A stack with events.

Definition at line 161 of file GHOST_EventManager.h.


Constructor & Destructor Documentation

GHOST_EventManager::GHOST_EventManager ( )

Constructor.

Copyright (C) 2001 NaN Technologies B.V.

Author:
Maarten Gribnau
Date:
May 14, 2001

Definition at line 45 of file GHOST_EventManager.cpp.

GHOST_EventManager::~GHOST_EventManager ( ) [virtual]

Destructor.

Definition at line 50 of file GHOST_EventManager.cpp.

References disposeEvents(), and m_consumers.


Member Function Documentation

GHOST_TSuccess GHOST_EventManager::addConsumer ( GHOST_IEventConsumer consumer) [virtual]

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 158 of file GHOST_EventManager.cpp.

References find(), GHOST_ASSERT, GHOST_kFailure, GHOST_kSuccess, and m_consumers.

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

bool GHOST_EventManager::dispatchEvent ( GHOST_IEvent event) [virtual]

Dispatches the given event directly, bypassing the event stack.

Returns:
Indication as to whether any of the consumers handled the event.

Definition at line 109 of file GHOST_EventManager.cpp.

References m_consumers.

bool GHOST_EventManager::dispatchEvent ( ) [virtual]

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

Returns:
Indication as to whether any of the consumers handled the event.

Definition at line 128 of file GHOST_EventManager.cpp.

References popEvent().

Referenced by dispatchEvents().

bool GHOST_EventManager::dispatchEvents ( ) [virtual]

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

Returns:
Indication as to whether any of the consumers handled the events.

Definition at line 140 of file GHOST_EventManager.cpp.

References dispatchEvent(), and getNumEvents().

Referenced by GHOST_System::dispatchEvents().

void GHOST_EventManager::disposeEvents ( ) [protected, virtual]

Removes all events from the stack.

Definition at line 259 of file GHOST_EventManager.cpp.

References GHOST_ASSERT, and m_events.

Referenced by ~GHOST_EventManager().

GHOST_TUns32 GHOST_EventManager::getNumEvents ( ) [virtual]

Returns the number of events currently on the stack.

Returns:
The number of events on the stack.

Definition at line 65 of file GHOST_EventManager.cpp.

References m_events.

Referenced by dispatchEvents().

GHOST_TUns32 GHOST_EventManager::getNumEvents ( GHOST_TEventType  type) [virtual]

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 71 of file GHOST_EventManager.cpp.

References m_events, and p.

GHOST_IEvent * GHOST_EventManager::peekEvent ( ) [virtual]

Return the event at the top of the stack without removal. Do not delete the event!

Returns:
The event at the top of the stack.

Definition at line 84 of file GHOST_EventManager.cpp.

References m_events.

Referenced by popEvent().

GHOST_IEvent * GHOST_EventManager::popEvent ( ) [protected, virtual]

Returns the event at the top of the stack and removes it. Delete the event after use!

Returns:
The event at the top of the stack.

Definition at line 249 of file GHOST_EventManager.cpp.

References m_events, and peekEvent().

Referenced by dispatchEvent().

GHOST_TSuccess GHOST_EventManager::pushEvent ( GHOST_IEvent event) [virtual]

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 94 of file GHOST_EventManager.cpp.

References GHOST_ASSERT, GHOST_kFailure, GHOST_kSuccess, and m_events.

Referenced by GHOST_System::pushEvent(), and GHOST_SystemCarbon::sEventHandlerProc().

GHOST_TSuccess GHOST_EventManager::removeConsumer ( GHOST_IEventConsumer consumer) [virtual]

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 178 of file GHOST_EventManager.cpp.

References find(), GHOST_ASSERT, GHOST_kFailure, GHOST_kSuccess, and m_consumers.

Referenced by GHOST_System::removeEventConsumer().

void GHOST_EventManager::removeTypeEvents ( GHOST_TEventType  type,
GHOST_IWindow window = 0 
) [virtual]

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 223 of file GHOST_EventManager.cpp.

References GHOST_PRINT, and m_events.

void GHOST_EventManager::removeWindowEvents ( GHOST_IWindow window) [virtual]

Removes all events for a window from the stack.

Parameters:
windowThe window to remove events for.

Definition at line 198 of file GHOST_EventManager.cpp.

References GHOST_PRINT, and m_events.

Referenced by GHOST_System::disposeWindow().


Member Data Documentation

The list with event consumers.

Definition at line 170 of file GHOST_EventManager.h.

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

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

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