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 {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 C4KeyCBEx< TargetClass, ParameterType >

Definition at line 353 of file C4KeyboardInput.h.

Member Typedef Documentation

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

Definition at line 356 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 380 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 377 of file C4KeyboardInput.h.

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

377 { 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 , class ParameterType >
bool C4KeyCBEx< TargetClass, ParameterType >::OnKeyEvent ( const C4KeyCodeEx key,
C4KeyEventType  eEv 
)
inlineoverrideprotectedvirtual

Implements C4KeyboardCallbackInterface.

Definition at line 364 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.

365  {
366  if (!CheckCondition()) return false;
367  switch (eEv)
368  {
369  case KEYEV_Down: return pFuncDown ? (rTarget.*pFuncDown)(par) : false;
370  case KEYEV_Up: return pFuncUp ? (rTarget.*pFuncUp)(par) : false;
371  case KEYEV_Pressed: return pFuncPressed ? (rTarget.*pFuncPressed)(par) : false;
372  case KEYEV_Moved: return pFuncMoved ? (rTarget.*pFuncMoved)(par) : false;
373  default: return false;
374  }
375  }
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 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 , class ParameterType >
ParameterType C4KeyCBEx< TargetClass, ParameterType >::par
protected

Definition at line 361 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 {nullptr}
inherited
template<class TargetClass , class ParameterType >
TargetClass& C4KeyCBEx< TargetClass, ParameterType >::rTarget
protected

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