OpenClonk
C4GUI::ControlKeyDlgCB< TargetClass > Class Template Reference

#include <C4Gui.h>

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

Public Member Functions

 ControlKeyDlgCB (Control *pCtrl, TargetClass &rTarget, CallbackFunc pFuncDown, CallbackFunc pFuncUp=nullptr, CallbackFunc pFuncPressed=nullptr)
 
bool CheckCondition () override
 
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
 

Protected Attributes

TargetClass & rTarget
 
CallbackFunc pFuncDown
 
CallbackFunc pFuncUp
 
CallbackFunc pFuncPressed
 
CallbackFunc pFuncMoved
 

Detailed Description

template<class TargetClass>
class C4GUI::ControlKeyDlgCB< TargetClass >

Definition at line 2518 of file C4Gui.h.

Constructor & Destructor Documentation

◆ ControlKeyDlgCB()

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

Definition at line 2525 of file C4Gui.h.

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

Member Function Documentation

◆ CheckCondition()

template<class TargetClass >
bool C4GUI::ControlKeyDlgCB< TargetClass >::CheckCondition ( )
inlineoverridevirtual

Reimplemented from C4KeyCB< TargetClass >.

Definition at line 2528 of file C4Gui.h.

2528 { return pCtrl && pCtrl->IsInActiveDlg(true) && pCtrl->IsVisible(); }
bool IsVisible()
Definition: C4Gui.cpp:201
bool IsInActiveDlg(bool fForKeyboard)
Definition: C4Gui.cpp:435

References C4GUI::Element::IsInActiveDlg(), and C4GUI::Element::IsVisible().

Here is the call 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 C4KeyCB< TargetClass >::OnKeyEvent ( const C4KeyCodeEx key,
C4KeyEventType  eEv 
)
inlineoverrideprotectedvirtualinherited

Implements C4KeyboardCallbackInterface.

Definition at line 303 of file C4KeyboardInput.h.

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

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

Definition at line 300 of file C4KeyboardInput.h.

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

◆ pFuncMoved

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

Definition at line 300 of file C4KeyboardInput.h.

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

◆ pFuncPressed

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

Definition at line 300 of file C4KeyboardInput.h.

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

◆ pFuncUp

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

Definition at line 300 of file C4KeyboardInput.h.

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

◆ pOriginalKey

class C4CustomKey* C4KeyboardCallbackInterface::pOriginalKey {nullptr}
inherited

◆ rTarget

template<class TargetClass >
TargetClass& C4KeyCB< TargetClass >::rTarget
protectedinherited

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