OpenClonk
C4KeyCBPassKey< TargetClass > Class Template Reference

#include <C4KeyboardInput.h>

Inheritance diagram for C4KeyCBPassKey< TargetClass >:
[legend]
Collaboration diagram for C4KeyCBPassKey< TargetClass >:
[legend]

Public Types

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

Public Member Functions

 C4KeyCBPassKey (TargetClass &rTarget, 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
 

Detailed Description

template<class TargetClass>
class C4KeyCBPassKey< TargetClass >

Definition at line 324 of file C4KeyboardInput.h.

Member Typedef Documentation

◆ CallbackFunc

template<class TargetClass >
typedef bool(TargetClass::* C4KeyCBPassKey< TargetClass >::CallbackFunc) (const C4KeyCodeEx &key)

Definition at line 327 of file C4KeyboardInput.h.

Constructor & Destructor Documentation

◆ C4KeyCBPassKey()

template<class TargetClass >
C4KeyCBPassKey< TargetClass >::C4KeyCBPassKey ( TargetClass &  rTarget,
CallbackFunc  pFuncDown,
CallbackFunc  pFuncUp = nullptr,
CallbackFunc  pFuncPressed = nullptr,
CallbackFunc  pFuncMoved = nullptr 
)
inline

Definition at line 350 of file C4KeyboardInput.h.

Member Function Documentation

◆ CheckCondition()

template<class TargetClass >
virtual bool C4KeyCBPassKey< TargetClass >::CheckCondition ( )
inlineprotectedvirtual

Reimplemented in C4GUI::DlgKeyCBPassKey< TargetClass >.

Definition at line 347 of file C4KeyboardInput.h.

347 { return true; }

Referenced by C4KeyCBPassKey< TargetClass >::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 >
bool C4KeyCBPassKey< TargetClass >::OnKeyEvent ( const C4KeyCodeEx key,
C4KeyEventType  eEv 
)
inlineoverrideprotectedvirtual

Implements C4KeyboardCallbackInterface.

Definition at line 334 of file C4KeyboardInput.h.

335  {
336  if (!CheckCondition()) return false;
337  switch (eEv)
338  {
339  case KEYEV_Down: return pFuncDown ? (rTarget.*pFuncDown)(key) : false;
340  case KEYEV_Up: return pFuncUp ? (rTarget.*pFuncUp)(key) : false;
341  case KEYEV_Pressed: return pFuncPressed ? (rTarget.*pFuncPressed)(key) : false;
342  case KEYEV_Moved: return pFuncMoved ? (rTarget.*pFuncMoved)(key) : false;
343  default: return false;
344  }
345  }
@ KEYEV_Up
@ KEYEV_Pressed
@ KEYEV_Moved
@ KEYEV_Down
virtual bool CheckCondition()

References C4KeyCBPassKey< TargetClass >::CheckCondition(), KEYEV_Down, KEYEV_Moved, KEYEV_Pressed, KEYEV_Up, C4KeyCBPassKey< TargetClass >::pFuncDown, C4KeyCBPassKey< TargetClass >::pFuncMoved, C4KeyCBPassKey< TargetClass >::pFuncPressed, C4KeyCBPassKey< TargetClass >::pFuncUp, and C4KeyCBPassKey< TargetClass >::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

◆ pFuncDown

template<class TargetClass >
CallbackFunc C4KeyCBPassKey< TargetClass >::pFuncDown
protected

Definition at line 331 of file C4KeyboardInput.h.

Referenced by C4KeyCBPassKey< TargetClass >::OnKeyEvent().

◆ pFuncMoved

template<class TargetClass >
CallbackFunc C4KeyCBPassKey< TargetClass >::pFuncMoved
protected

Definition at line 331 of file C4KeyboardInput.h.

Referenced by C4KeyCBPassKey< TargetClass >::OnKeyEvent().

◆ pFuncPressed

template<class TargetClass >
CallbackFunc C4KeyCBPassKey< TargetClass >::pFuncPressed
protected

Definition at line 331 of file C4KeyboardInput.h.

Referenced by C4KeyCBPassKey< TargetClass >::OnKeyEvent().

◆ pFuncUp

template<class TargetClass >
CallbackFunc C4KeyCBPassKey< TargetClass >::pFuncUp
protected

Definition at line 331 of file C4KeyboardInput.h.

Referenced by C4KeyCBPassKey< TargetClass >::OnKeyEvent().

◆ pOriginalKey

class C4CustomKey* C4KeyboardCallbackInterface::pOriginalKey {nullptr}
inherited

◆ rTarget

template<class TargetClass >
TargetClass& C4KeyCBPassKey< TargetClass >::rTarget
protected

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