OpenClonk
C4KeyCBExPassKey< TargetClass, ParameterType > Class Template Reference

#include <C4KeyboardInput.h>

Inheritance diagram for C4KeyCBExPassKey< TargetClass, ParameterType >:
[legend]
Collaboration diagram for C4KeyCBExPassKey< TargetClass, ParameterType >:
[legend]

Public Types

typedef bool(TargetClass::* CallbackFunc) (const C4KeyCodeEx &key, const ParameterType &par)
 

Public Member Functions

 C4KeyCBExPassKey (TargetClass &rTarget, const ParameterType &par, CallbackFunc pFuncDown, CallbackFunc pFuncUp=nullptr, CallbackFunc pFuncPressed=nullptr, CallbackFunc pFuncMoved=nullptr)
 
void Ref ()
 
void Deref ()
 
bool IsOriginalKey (const class C4CustomKey *pCheckKey) const
 

Public Attributes

class C4CustomKeypOriginalKey {nullptr}
 

Protected Member Functions

bool OnKeyEvent (const C4KeyCodeEx &key, C4KeyEventType eEv) override
 
virtual bool CheckCondition ()
 

Protected Attributes

TargetClass & rTarget
 
CallbackFunc pFuncDown
 
CallbackFunc pFuncUp
 
CallbackFunc pFuncPressed
 
CallbackFunc pFuncMoved
 
ParameterType par
 

Detailed Description

template<class TargetClass, class ParameterType>
class C4KeyCBExPassKey< TargetClass, ParameterType >

Definition at line 386 of file C4KeyboardInput.h.

Member Typedef Documentation

◆ CallbackFunc

template<class TargetClass , class ParameterType >
typedef bool(TargetClass::* C4KeyCBExPassKey< TargetClass, ParameterType >::CallbackFunc) (const C4KeyCodeEx &key, const ParameterType &par)

Definition at line 389 of file C4KeyboardInput.h.

Constructor & Destructor Documentation

◆ C4KeyCBExPassKey()

template<class TargetClass , class ParameterType >
C4KeyCBExPassKey< TargetClass, ParameterType >::C4KeyCBExPassKey ( TargetClass &  rTarget,
const ParameterType &  par,
CallbackFunc  pFuncDown,
CallbackFunc  pFuncUp = nullptr,
CallbackFunc  pFuncPressed = nullptr,
CallbackFunc  pFuncMoved = nullptr 
)
inline

Definition at line 413 of file C4KeyboardInput.h.

Member Function Documentation

◆ CheckCondition()

template<class TargetClass , class ParameterType >
virtual bool C4KeyCBExPassKey< TargetClass, ParameterType >::CheckCondition ( )
inlineprotectedvirtual

Reimplemented in C4GUI::ControlKeyCBExPassKey< TargetClass, ParameterType >.

Definition at line 410 of file C4KeyboardInput.h.

410 { return true; }

Referenced by C4KeyCBExPassKey< TargetClass, ParameterType >::OnKeyEvent().

Here is the caller graph for this function:

◆ Deref()

void C4KeyboardCallbackInterface::Deref ( )
inlineinherited

Definition at line 284 of file C4KeyboardInput.h.

284 { if (!--iRef) delete this; }

Referenced by C4CustomKey::KillCallbacks().

Here is the caller graph for this function:

◆ IsOriginalKey()

bool C4KeyboardCallbackInterface::IsOriginalKey ( const class C4CustomKey pCheckKey) const
inlineinherited

Definition at line 289 of file C4KeyboardInput.h.

289 { return pCheckKey == pOriginalKey; }
class C4CustomKey * pOriginalKey

References C4KeyboardCallbackInterface::pOriginalKey.

◆ OnKeyEvent()

template<class TargetClass , class ParameterType >
bool C4KeyCBExPassKey< TargetClass, ParameterType >::OnKeyEvent ( const C4KeyCodeEx key,
C4KeyEventType  eEv 
)
inlineoverrideprotectedvirtual

Implements C4KeyboardCallbackInterface.

Definition at line 397 of file C4KeyboardInput.h.

398  {
399  if (!CheckCondition()) return false;
400  switch (eEv)
401  {
402  case KEYEV_Down: return pFuncDown ? (rTarget.*pFuncDown)(key, par) : false;
403  case KEYEV_Up: return pFuncUp ? (rTarget.*pFuncUp)(key, par) : false;
404  case KEYEV_Pressed: return pFuncPressed ? (rTarget.*pFuncPressed)(key, par) : false;
405  case KEYEV_Moved: return pFuncMoved ? (rTarget.*pFuncMoved)(key, par) : false;
406  default: return false;
407  }
408  }
@ KEYEV_Up
@ KEYEV_Pressed
@ KEYEV_Moved
@ KEYEV_Down
virtual bool CheckCondition()

References C4KeyCBExPassKey< TargetClass, ParameterType >::CheckCondition(), KEYEV_Down, KEYEV_Moved, KEYEV_Pressed, KEYEV_Up, C4KeyCBExPassKey< TargetClass, ParameterType >::par, C4KeyCBExPassKey< TargetClass, ParameterType >::pFuncDown, C4KeyCBExPassKey< TargetClass, ParameterType >::pFuncMoved, C4KeyCBExPassKey< TargetClass, ParameterType >::pFuncPressed, C4KeyCBExPassKey< TargetClass, ParameterType >::pFuncUp, and C4KeyCBExPassKey< TargetClass, ParameterType >::rTarget.

Here is the call graph for this function:

◆ Ref()

void C4KeyboardCallbackInterface::Ref ( )
inlineinherited

Definition at line 283 of file C4KeyboardInput.h.

283 { ++iRef; }

Referenced by C4CustomKey::C4CustomKey().

Here is the caller graph for this function:

Member Data Documentation

◆ par

template<class TargetClass , class ParameterType >
ParameterType C4KeyCBExPassKey< TargetClass, ParameterType >::par
protected

◆ pFuncDown

template<class TargetClass , class ParameterType >
CallbackFunc C4KeyCBExPassKey< TargetClass, ParameterType >::pFuncDown
protected

◆ pFuncMoved

template<class TargetClass , class ParameterType >
CallbackFunc C4KeyCBExPassKey< TargetClass, ParameterType >::pFuncMoved
protected

◆ pFuncPressed

template<class TargetClass , class ParameterType >
CallbackFunc C4KeyCBExPassKey< TargetClass, ParameterType >::pFuncPressed
protected

◆ pFuncUp

template<class TargetClass , class ParameterType >
CallbackFunc C4KeyCBExPassKey< TargetClass, ParameterType >::pFuncUp
protected

◆ pOriginalKey

class C4CustomKey* C4KeyboardCallbackInterface::pOriginalKey {nullptr}
inherited

◆ rTarget

template<class TargetClass , class ParameterType >
TargetClass& C4KeyCBExPassKey< TargetClass, ParameterType >::rTarget
protected

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