Castor3D 0.16.0
Multiplatform 3D engine
Public Types | Protected Types | List of all members
castor3d::EventHandler Class Referenceabstract

#include <EventHandler.hpp>

Inheritance diagram for castor3d::EventHandler:
Inheritance graph
[legend]
Collaboration diagram for castor3d::EventHandler:
Collaboration graph
[legend]

Public Types

using ClientMouseFunction = castor::Function< void( MouseEvent const & ) >
 
using ClientKeyboardFunction = castor::Function< void( KeyboardEvent const & ) >
 
using ClientHandlerFunction = castor::Function< void( HandlerEvent const & ) >
 
using EnableFunction = castor::Function< void( bool ) >
 
using OnClientMouseEvent = castor::SignalT< ClientMouseFunction >
 
using OnClientKeyboardEvent = castor::SignalT< ClientKeyboardFunction >
 
using OnClientHandlerEvent = castor::SignalT< ClientHandlerFunction >
 
using OnEnable = castor::SignalT< EnableFunction >
 
using OnClientMouseEventConnection = OnClientMouseEvent::connection
 
using OnClientKeyboardEventConnection = OnClientKeyboardEvent::connection
 
using OnClientHandlerEventConnection = OnClientHandlerEvent::connection
 
using OnEnableConnection = OnEnable::connection
 

Public Member Functions

Mouse events
void pushEvent (MouseEvent const &event)
 Adds a mouse event to the events queue.
 
void connect (MouseEventType event, ClientMouseFunction function)
 Connects a function to a mouse event.
 
bool catchesMouseEvents () const
 Tells if the control catches mouse events.
 
void setCatchesMouseEvents (bool value)
 Sets if the control can catch mouse events.
 
Keyboard events
void pushEvent (KeyboardEvent const &event)
 Adds a keyboard event to the events queue.
 
void connect (KeyboardEventType event, ClientKeyboardFunction function)
 Connects a function to a keyboard event.
 
bool catchesTabKey () const
 Tells if the control catches 'tab' key.
 
bool catchesReturnKey () const
 Tells if the control catches 'return' key.
 
- Public Member Functions inherited from castor::NamedBaseT< T >
 NamedBaseT (T name) noexcept
 Constructor.
 
T const & getName () const noexcept
 Retrieves the name.
 
void rename (T name) noexcept
 

Protected Types

using EventHandlerFunction = castor::Function< void() >
 
using EventQueue = castor::Deque< castor::Pair< UserInputEventSPtr, EventHandlerFunction > >
 

General

OnEnable onEnable
 
 EventHandler (castor::String const &name, bool catchMouseEvents)
 Constructor.
 
virtual ~EventHandler () noexcept
 Destructor.
 
void processEvents ()
 Processes all queued events.
 
bool isEnabled () const
 
void enable ()
 Sets if the control is enabled.
 
void disable ()
 Sets if the control is disabled.
 

Handler events

castor::Array< OnClientMouseEvent, size_t(MouseEventType::eCount) > m_mouseSlots
 
castor::Array< castor::Vector< OnClientMouseEventConnection >, size_t(MouseEventType::eCount) > m_mouseSlotsConnections
 
castor::Array< OnClientKeyboardEvent, size_t(KeyboardEventType::eCount) > m_keyboardSlots
 
castor::Array< castor::Vector< OnClientKeyboardEventConnection >, size_t(KeyboardEventType::eCount) > m_keyboardSlotsConnections
 
castor::Array< OnClientHandlerEvent, size_t(HandlerEventType::eCount) > m_handlerSlots
 
castor::Array< castor::Vector< OnClientHandlerEventConnection >, size_t(HandlerEventType::eCount) > m_handlerSlotsConnections
 
void pushEvent (HandlerEvent const &event)
 Adds a handler event to the events queue.
 
void connect (HandlerEventType event, ClientHandlerFunction function)
 Connects a function to a handler event.
 
void processMouseEvent (MouseEventSPtr event)
 Mouse event processing function.
 
void processKeyboardEvent (KeyboardEventSPtr event)
 Keyboard event processing function.
 
void processHandlerEvent (HandlerEventSPtr event)
 Handler event processing function.
 

Additional Inherited Members

- Protected Attributes inherited from castor::NamedBaseT< T >
m_name
 

Member Typedef Documentation

◆ ClientHandlerFunction

Catcher definition for handler events.

◆ ClientKeyboardFunction

Catcher definition for keyboard events.

◆ ClientMouseFunction

Catcher definition for mouse events.

◆ EnableFunction

Signal function when handler is enabled/disabled.

◆ EventHandlerFunction

◆ EventQueue

◆ OnClientHandlerEvent

Handler event signal definition.

◆ OnClientHandlerEventConnection

using castor3d::EventHandler::OnClientHandlerEventConnection = OnClientHandlerEvent::connection

Handler event signal connection definition.

◆ OnClientKeyboardEvent

Keyboard event signal definition.

◆ OnClientKeyboardEventConnection

using castor3d::EventHandler::OnClientKeyboardEventConnection = OnClientKeyboardEvent::connection

Keyboard event signal connection definition.

◆ OnClientMouseEvent

Mouse event signal definition.

◆ OnClientMouseEventConnection

using castor3d::EventHandler::OnClientMouseEventConnection = OnClientMouseEvent::connection

Mouse event signal connection definition.

◆ OnEnable

Signal when handler is enabled/disabled.

◆ OnEnableConnection

Signal connection when handler is enabled/disabled.

Constructor & Destructor Documentation

◆ EventHandler()

castor3d::EventHandler::EventHandler ( castor::String const & name,
bool catchMouseEvents )
inlineexplicit

Constructor.

Parameters
[in]nameThe handler name.
[in]catchMouseEventsDefines if the event handler catches mouse event.

◆ ~EventHandler()

virtual castor3d::EventHandler::~EventHandler ( )
inlinevirtualnoexcept

Destructor.

References castor::makeUniqueLock().

Here is the call graph for this function:

Member Function Documentation

◆ catchesMouseEvents()

bool castor3d::EventHandler::catchesMouseEvents ( ) const
inline

Tells if the control catches mouse events.

Remarks
A control catches mouse events when it is enabled, and when it explicitly catches it (enabled by default, except for static controls).
Returns
false if the mouse events don't affect the control.

◆ catchesReturnKey()

bool castor3d::EventHandler::catchesReturnKey ( ) const
inline

Tells if the control catches 'return' key.

Remarks
A control catches 'return' key when it is enabled, and when it explicitly catches it (disabled by default).
Returns
false if the 'return' key doesn't affect the control.

◆ catchesTabKey()

bool castor3d::EventHandler::catchesTabKey ( ) const
inline

Tells if the control catches 'tab' key.

Remarks
A control catches 'tab' key when it is enabled, and when it explicitly catches it (disabled by default).
Returns
false if the 'tab' key doesn't affect the control.

◆ connect() [1/3]

void castor3d::EventHandler::connect ( HandlerEventType event,
ClientHandlerFunction function )
inline

Connects a function to a handler event.

Parameters
[in]eventThe event type.
[in]functionThe function.

References connect(), m_handlerSlots, and m_handlerSlotsConnections.

Here is the call graph for this function:

◆ connect() [2/3]

void castor3d::EventHandler::connect ( KeyboardEventType event,
ClientKeyboardFunction function )
inline

Connects a function to a keyboard event.

Parameters
[in]eventThe event type.
[in]functionThe function.

References connect(), m_keyboardSlots, and m_keyboardSlotsConnections.

Here is the call graph for this function:

◆ connect() [3/3]

void castor3d::EventHandler::connect ( MouseEventType event,
ClientMouseFunction function )
inline

Connects a function to a mouse event.

Parameters
[in]eventThe event type.
[in]functionThe function.

References connect(), m_mouseSlots, and m_mouseSlotsConnections.

Referenced by connect(), connect(), connect(), castor3d::NonClientEventHandler< Derived >::connectNC(), castor3d::NonClientEventHandler< Derived >::connectNC(), and castor3d::NonClientEventHandler< Derived >::connectNC().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ disable()

void castor3d::EventHandler::disable ( )
inline

Sets if the control is disabled.

References onEnable.

◆ enable()

void castor3d::EventHandler::enable ( )
inline

Sets if the control is enabled.

References onEnable.

◆ isEnabled()

bool castor3d::EventHandler::isEnabled ( ) const
inline
Returns
false if the control is disabled.

◆ processEvents()

void castor3d::EventHandler::processEvents ( )
inline

Processes all queued events.

◆ processHandlerEvent()

void castor3d::EventHandler::processHandlerEvent ( HandlerEventSPtr event)
inlineprotected

Handler event processing function.

Parameters
[in]eventThe event.

References m_handlerSlots.

Referenced by pushEvent().

Here is the caller graph for this function:

◆ processKeyboardEvent()

void castor3d::EventHandler::processKeyboardEvent ( KeyboardEventSPtr event)
inlineprotected

Keyboard event processing function.

Parameters
[in]eventThe event.

References m_keyboardSlots.

Referenced by pushEvent().

Here is the caller graph for this function:

◆ processMouseEvent()

void castor3d::EventHandler::processMouseEvent ( MouseEventSPtr event)
inlineprotected

Mouse event processing function.

Parameters
[in]eventThe event.

References m_mouseSlots.

Referenced by pushEvent().

Here is the caller graph for this function:

◆ pushEvent() [1/3]

void castor3d::EventHandler::pushEvent ( HandlerEvent const & event)
inline

Adds a handler event to the events queue.

Parameters
[in]eventThe mouse event.

References castor::makeUniqueLock(), and processHandlerEvent().

Here is the call graph for this function:

◆ pushEvent() [2/3]

void castor3d::EventHandler::pushEvent ( KeyboardEvent const & event)
inline

Adds a keyboard event to the events queue.

Parameters
[in]eventThe mouse event.

References castor::makeUniqueLock(), and processKeyboardEvent().

Here is the call graph for this function:

◆ pushEvent() [3/3]

void castor3d::EventHandler::pushEvent ( MouseEvent const & event)
inline

Adds a mouse event to the events queue.

Parameters
[in]eventThe mouse event.

References castor::makeUniqueLock(), and processMouseEvent().

Here is the call graph for this function:

◆ setCatchesMouseEvents()

void castor3d::EventHandler::setCatchesMouseEvents ( bool value)
inline

Sets if the control can catch mouse events.

Parameters
[in]valueThe new value.

Member Data Documentation

◆ m_handlerSlots

castor::Array< OnClientHandlerEvent, size_t( HandlerEventType::eCount ) > castor3d::EventHandler::m_handlerSlots
protected

The handler events slots.

Referenced by connect(), and processHandlerEvent().

◆ m_handlerSlotsConnections

castor::Array< castor::Vector< OnClientHandlerEventConnection >, size_t( HandlerEventType::eCount ) > castor3d::EventHandler::m_handlerSlotsConnections
protected

The handler events slots connections.

Referenced by connect().

◆ m_keyboardSlots

castor::Array< OnClientKeyboardEvent, size_t( KeyboardEventType::eCount ) > castor3d::EventHandler::m_keyboardSlots
protected

The keyboard events slots.

Referenced by connect(), and processKeyboardEvent().

◆ m_keyboardSlotsConnections

castor::Array< castor::Vector< OnClientKeyboardEventConnection >, size_t( KeyboardEventType::eCount ) > castor3d::EventHandler::m_keyboardSlotsConnections
protected

The keyboard events slots connections.

Referenced by connect().

◆ m_mouseSlots

castor::Array< OnClientMouseEvent, size_t( MouseEventType::eCount ) > castor3d::EventHandler::m_mouseSlots
protected

The mouse events slots.

Referenced by connect(), and processMouseEvent().

◆ m_mouseSlotsConnections

castor::Array< castor::Vector< OnClientMouseEventConnection >, size_t( MouseEventType::eCount ) > castor3d::EventHandler::m_mouseSlotsConnections
protected

The mouse events slots connections.

Referenced by connect().

◆ onEnable

OnEnable castor3d::EventHandler::onEnable

Referenced by disable(), and enable().


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