OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4KeyCB< TargetClass > Class Template Reference

#include <C4KeyboardInput.h>

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

Public Types

typedef bool(TargetClass::* CallbackFunc )()
 

Public Member Functions

 C4KeyCB (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 C4KeyCB< TargetClass >

Definition at line 291 of file C4KeyboardInput.h.

Member Typedef Documentation

template<class TargetClass >
typedef bool(TargetClass::* C4KeyCB< TargetClass >::CallbackFunc)()

Definition at line 294 of file C4KeyboardInput.h.

Constructor & Destructor Documentation

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

Definition at line 317 of file C4KeyboardInput.h.

CallbackFunc pFuncDown
CallbackFunc pFuncMoved
CallbackFunc pFuncUp
TargetClass & rTarget
CallbackFunc pFuncPressed

Member Function Documentation

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

Reimplemented in C4GUI::ControlKeyDlgCB< TargetClass >, C4GUI::ControlKeyCB< TargetClass >, and C4GUI::DlgKeyCB< TargetClass >.

Definition at line 314 of file C4KeyboardInput.h.

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

314 { return true; }

Here is the caller graph for this function:

void C4KeyboardCallbackInterface::Deref ( )
inlineinherited

Definition at line 282 of file C4KeyboardInput.h.

Referenced by C4CustomKey::KillCallbacks().

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

Here is the caller graph for this function:

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

Definition at line 287 of file C4KeyboardInput.h.

References C4KeyboardCallbackInterface::pOriginalKey.

Referenced by C4KeyboardCallbackInterfaceHasOriginalKey().

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

Here is the caller graph for this function:

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

Implements C4KeyboardCallbackInterface.

Definition at line 301 of file C4KeyboardInput.h.

References C4KeyCB< TargetClass >::CheckCondition(), KEYEV_Down, KEYEV_Moved, KEYEV_Pressed, KEYEV_Up, C4KeyCB< TargetClass >::pFuncDown, C4KeyCB< TargetClass >::pFuncMoved, C4KeyCB< TargetClass >::pFuncPressed, and C4KeyCB< TargetClass >::pFuncUp.

302  {
303  if (!CheckCondition()) return false;
304  switch (eEv)
305  {
306  case KEYEV_Down: return pFuncDown ? (rTarget.*pFuncDown)() : false;
307  case KEYEV_Up: return pFuncUp ? (rTarget.*pFuncUp)() : false;
308  case KEYEV_Pressed: return pFuncPressed ? (rTarget.*pFuncPressed)() : false;
309  case KEYEV_Moved: return pFuncMoved ? (rTarget.*pFuncMoved)() : false;
310  default: return false;
311  }
312  }
CallbackFunc pFuncDown
CallbackFunc pFuncMoved
virtual bool CheckCondition()
CallbackFunc pFuncUp
TargetClass & rTarget
CallbackFunc pFuncPressed

Here is the call graph for this function:

void C4KeyboardCallbackInterface::Ref ( )
inlineinherited

Definition at line 281 of file C4KeyboardInput.h.

Referenced by C4CustomKey::C4CustomKey().

281 { ++iRef; }

Here is the caller graph for this function:

Member Data Documentation

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

Definition at line 298 of file C4KeyboardInput.h.

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

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

Definition at line 298 of file C4KeyboardInput.h.

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

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

Definition at line 298 of file C4KeyboardInput.h.

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

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

Definition at line 298 of file C4KeyboardInput.h.

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

class C4CustomKey* C4KeyboardCallbackInterface::pOriginalKey {nullptr}
inherited
template<class TargetClass >
TargetClass& C4KeyCB< TargetClass >::rTarget
protected

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