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

#include <C4Gui.h>

Inheritance diagram for C4GUI::CBContextHandler< CBClass >:
[legend]
Collaboration diagram for C4GUI::CBContextHandler< CBClass >:
[legend]

Public Member Functions

 CBContextHandler (CBClass *pCBTarget, typename DlgCallback< CBClass >::ContextFunc pCallbackFn)
 
virtual bool OnContext (Element *pOnElement, int32_t iX, int32_t iY)
 
virtual C4GUI::ContextMenuOnSubcontext (Element *pOnElement)
 
void Ref ()
 
void DeRef ()
 

Friends

class Dialog
 

Detailed Description

template<class CBClass>
class C4GUI::CBContextHandler< CBClass >

Definition at line 2735 of file C4Gui.h.

Constructor & Destructor Documentation

template<class CBClass>
C4GUI::CBContextHandler< CBClass >::CBContextHandler ( CBClass *  pCBTarget,
typename DlgCallback< CBClass >::ContextFunc  pCallbackFn 
)
inline

Definition at line 2743 of file C4Gui.h.

2744  : ContextHandler(), pCBTarget(pCBTarget), pCallbackFn(pCallbackFn) { }

Member Function Documentation

void C4GUI::ContextHandler::DeRef ( )
inlineinherited

Definition at line 244 of file C4Gui.h.

Referenced by C4GUI::Element::SetContextHandler(), and C4GUI::Element::~Element().

244 { if (!--iRefs) delete this; }

Here is the caller graph for this function:

template<class CBClass>
virtual bool C4GUI::CBContextHandler< CBClass >::OnContext ( Element pOnElement,
int32_t  iX,
int32_t  iY 
)
inlinevirtual

Implements C4GUI::ContextHandler.

Definition at line 2746 of file C4Gui.h.

References C4GUI::Screen::DoContext(), and C4GUI::Element::GetScreen().

2747  {
2748  DlgCallback<CBClass>();
2749  if (!pCBTarget) return false;
2750  // if (!pCallbackFn) return false;
2751  Screen *pScreen = pOnElement->GetScreen();
2752  if (!pScreen) return false;
2753  // let CB func create context menu
2754  ContextMenu *pNewMenu = (pCBTarget->*pCallbackFn)(pOnElement, iX, iY);
2755  if (!pNewMenu) return false;
2756  // open it on screen
2757  pScreen->DoContext(pNewMenu, pOnElement, iX, iY);
2758  // done, success
2759  return true;
2760  }

Here is the call graph for this function:

template<class CBClass>
virtual C4GUI::ContextMenu* C4GUI::CBContextHandler< CBClass >::OnSubcontext ( Element pOnElement)
inlinevirtual

Implements C4GUI::ContextHandler.

Definition at line 2762 of file C4Gui.h.

2763  {
2764  // query directly
2765  return (pCBTarget->*pCallbackFn)(pOnElement, 0, 0);
2766  }
void C4GUI::ContextHandler::Ref ( )
inlineinherited

Definition at line 243 of file C4Gui.h.

Referenced by C4GUI::Element::SetContextHandler().

243 { ++iRefs; }

Here is the caller graph for this function:

Friends And Related Function Documentation

template<class CBClass>
friend class Dialog
friend

Definition at line 2767 of file C4Gui.h.


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