Blender V2.61 - r43446
|
#include <GHOST_EventManager.h>
Public Member Functions | |
GHOST_EventManager () | |
virtual | ~GHOST_EventManager () |
virtual GHOST_TUns32 | getNumEvents () |
virtual GHOST_TUns32 | getNumEvents (GHOST_TEventType type) |
virtual GHOST_IEvent * | peekEvent () |
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_IEvent * | popEvent () |
virtual void | disposeEvents () |
Protected Attributes | |
std::deque< GHOST_IEvent * > | m_events |
TConsumerVector | m_consumers |
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.
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.
GHOST_EventManager::GHOST_EventManager | ( | ) |
Constructor.
Copyright (C) 2001 NaN Technologies B.V.
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.
GHOST_TSuccess GHOST_EventManager::addConsumer | ( | GHOST_IEventConsumer * | consumer | ) | [virtual] |
Adds a consumer to the list of event consumers.
consumer | The consumer added to the list. |
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.
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.
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.
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.
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.
type | The type of events to be counted. |
Definition at line 71 of file GHOST_EventManager.cpp.
GHOST_IEvent * GHOST_EventManager::peekEvent | ( | ) | [virtual] |
Return the event at the top of the stack without removal. Do not delete the event!
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!
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!
event | The 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.
consumer | The consumer removed from the list. |
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.
type | The type of events to be removed. |
window | The 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.
window | The 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().
TConsumerVector GHOST_EventManager::m_consumers [protected] |
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 event stack.
Definition at line 164 of file GHOST_EventManager.h.
Referenced by disposeEvents(), getNumEvents(), peekEvent(), popEvent(), pushEvent(), removeTypeEvents(), and removeWindowEvents().