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

#include <C4Gui.h>

Inheritance diagram for C4GUI::DlgKeyCB< TargetClass >:
[legend]
Collaboration diagram for C4GUI::DlgKeyCB< TargetClass >:
[legend]

Public Member Functions

 DlgKeyCB (TargetClass &rTarget, CallbackFunc pFuncDown, CallbackFunc pFuncUp=nullptr, CallbackFunc pFuncPressed=nullptr)
 
virtual bool CheckCondition ()
 
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)
 

Protected Attributes

TargetClass & rTarget
 
CallbackFunc pFuncDown
 
CallbackFunc pFuncUp
 
CallbackFunc pFuncPressed
 
CallbackFunc pFuncMoved
 

Detailed Description

template<class TargetClass>
class C4GUI::DlgKeyCB< TargetClass >

Definition at line 2453 of file C4Gui.h.

Constructor & Destructor Documentation

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

Definition at line 2459 of file C4Gui.h.

2460  : Base(rTarget, pFuncDown, pFuncUp, pFuncPressed) {}
CallbackFunc pFuncDown
CallbackFunc pFuncUp
TargetClass & rTarget
CallbackFunc pFuncPressed

Member Function Documentation

template<class TargetClass >
virtual bool C4GUI::DlgKeyCB< TargetClass >::CheckCondition ( )
inlinevirtual

Reimplemented from C4KeyCB< TargetClass >.

Definition at line 2462 of file C4Gui.h.

References C4KeyCB< TargetClass >::rTarget.

2462 { return Base::rTarget.IsInActiveDlg(true) && Base::rTarget.IsVisible(); }
TargetClass & rTarget
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 >
virtual bool C4KeyCB< TargetClass >::OnKeyEvent ( const C4KeyCodeEx key,
C4KeyEventType  eEv 
)
inlineprotectedvirtualinherited

Implements C4KeyboardCallbackInterface.

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

309  {
310  if (!CheckCondition()) return false;
311  switch (eEv)
312  {
313  case KEYEV_Down: return pFuncDown ? (rTarget.*pFuncDown)() : false;
314  case KEYEV_Up: return pFuncUp ? (rTarget.*pFuncUp)() : false;
315  case KEYEV_Pressed: return pFuncPressed ? (rTarget.*pFuncPressed)() : false;
316  case KEYEV_Moved: return pFuncMoved ? (rTarget.*pFuncMoved)() : false;
317  default: return false;
318  }
319  }
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 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 >
CallbackFunc C4KeyCB< TargetClass >::pFuncDown
protectedinherited

Definition at line 305 of file C4KeyboardInput.h.

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

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

Definition at line 305 of file C4KeyboardInput.h.

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

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

Definition at line 305 of file C4KeyboardInput.h.

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

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

Definition at line 305 of file C4KeyboardInput.h.

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

class C4CustomKey* C4KeyboardCallbackInterface::pOriginalKey
inherited
template<class TargetClass >
TargetClass& C4KeyCB< TargetClass >::rTarget
protectedinherited

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