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

#include <C4KeyboardInput.h>

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

Public Types

typedef bool(TargetClass::* CallbackFunc )(ParameterType par)
 

Public Member Functions

 C4KeyCBEx (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
 

Protected Member Functions

virtual bool OnKeyEvent (const C4KeyCodeEx &key, C4KeyEventType eEv)
 
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 C4KeyCBEx< TargetClass, ParameterType >

Definition at line 360 of file C4KeyboardInput.h.

Member Typedef Documentation

template<class TargetClass , class ParameterType >
typedef bool(TargetClass::* C4KeyCBEx< TargetClass, ParameterType >::CallbackFunc)(ParameterType par)

Definition at line 363 of file C4KeyboardInput.h.

Constructor & Destructor Documentation

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

Definition at line 387 of file C4KeyboardInput.h.

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

Member Function Documentation

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

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

Definition at line 384 of file C4KeyboardInput.h.

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

384 { return true; }

Here is the caller graph for this function:

void C4KeyboardCallbackInterface::Deref ( )
inlineinherited

Definition at line 289 of file C4KeyboardInput.h.

Referenced by C4CustomKey::KillCallbacks().

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

Here is the caller graph for this function:

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

Definition at line 294 of file C4KeyboardInput.h.

References C4KeyboardCallbackInterface::pOriginalKey.

Referenced by C4KeyboardCallbackInterfaceHasOriginalKey().

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

Here is the caller graph for this function:

template<class TargetClass , class ParameterType >
virtual bool C4KeyCBEx< TargetClass, ParameterType >::OnKeyEvent ( const C4KeyCodeEx key,
C4KeyEventType  eEv 
)
inlineprotectedvirtual

Implements C4KeyboardCallbackInterface.

Definition at line 371 of file C4KeyboardInput.h.

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

372  {
373  if (!CheckCondition()) return false;
374  switch (eEv)
375  {
376  case KEYEV_Down: return pFuncDown ? (rTarget.*pFuncDown)(par) : false;
377  case KEYEV_Up: return pFuncUp ? (rTarget.*pFuncUp)(par) : false;
378  case KEYEV_Pressed: return pFuncPressed ? (rTarget.*pFuncPressed)(par) : false;
379  case KEYEV_Moved: return pFuncMoved ? (rTarget.*pFuncMoved)(par) : false;
380  default: return false;
381  }
382  }
CallbackFunc pFuncUp
CallbackFunc pFuncMoved
ParameterType par
CallbackFunc pFuncPressed
virtual bool CheckCondition()
TargetClass & rTarget
CallbackFunc pFuncDown

Here is the call graph for this function:

void C4KeyboardCallbackInterface::Ref ( )
inlineinherited

Definition at line 288 of file C4KeyboardInput.h.

Referenced by C4CustomKey::C4CustomKey().

288 { ++iRef; }

Here is the caller graph for this function:

Member Data Documentation

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

Definition at line 368 of file C4KeyboardInput.h.

template<class TargetClass , class ParameterType >
CallbackFunc C4KeyCBEx< TargetClass, ParameterType >::pFuncDown
protected
template<class TargetClass , class ParameterType >
CallbackFunc C4KeyCBEx< TargetClass, ParameterType >::pFuncMoved
protected
template<class TargetClass , class ParameterType >
CallbackFunc C4KeyCBEx< TargetClass, ParameterType >::pFuncPressed
protected
template<class TargetClass , class ParameterType >
CallbackFunc C4KeyCBEx< TargetClass, ParameterType >::pFuncUp
protected
class C4CustomKey* C4KeyboardCallbackInterface::pOriginalKey
inherited
template<class TargetClass , class ParameterType >
TargetClass& C4KeyCBEx< TargetClass, ParameterType >::rTarget
protected

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