32 static thread_local
ref* upcallTls;
49 static bool up() {
bool ret = ((upcallTls) != NULL); upcallTls = NULL;
return ret; }
52 virtual ~
InterceptorBase() {
if (window.isNotNull()) { window->interceptorClear(); } }
56 virtual void SetRenderOrder(
int renderOrder) { }
58 virtual void setActive(
bool active) { }
59 virtual bool isActive() {
return false; }
79 inline ~
ref() { w->upcallTls = NULL; }
80 inline CGUIWindow* operator->() {
return w->get(); }
100 #define checkedb(methcall) ( window.isNotNull() ? window-> methcall : false ) 101 #define checkedv(methcall) { if (window.isNotNull()) window-> methcall ; } 106 std::string classname;
112 Window* _window,
int windowid) : P(windowid,
""),
113 classname(
"Interceptor<" + std::string(specializedName) +
">")
115 #ifdef ENABLE_XBMC_TRACE_API 116 XBMCAddonUtils::TraceGuard tg;
117 CLog::Log(LOGDEBUG,
"{}NEWADDON constructing {} 0x{:x}", tg.getSpaces(), classname,
118 (long)(((
void*)
this)));
120 window.reset(_window);
121 P::SetLoadType(CGUIWindow::LOAD_ON_GUI_INIT);
125 Window* _window,
int windowid,
126 const char* xmlfile) : P(windowid, xmlfile),
127 classname(
"Interceptor<" + std::string(specializedName) +
">")
129 #ifdef ENABLE_XBMC_TRACE_API 130 XBMCAddonUtils::TraceGuard tg;
131 CLog::Log(LOGDEBUG,
"{}NEWADDON constructing {} 0x{:x}", tg.getSpaces(), classname,
132 (long)(((
void*)
this)));
134 window.reset(_window);
135 P::SetLoadType(CGUIWindow::LOAD_ON_GUI_INIT);
138 #ifdef ENABLE_XBMC_TRACE_API 141 XBMCAddonUtils::TraceGuard tg;
142 CLog::Log(LOGDEBUG,
"{}NEWADDON LIFECYCLE destroying {} 0x{:x}", tg.getSpaces(), classname,
143 (long)(((
void*)
this)));
150 { XBMC_TRACE;
return up() ? P::OnMessage(message) : checkedb(OnMessage(message)); }
151 bool OnAction(
const CAction &action)
override 152 { XBMC_TRACE;
return up() ? P::OnAction(action) : checkedb(OnAction(action)); }
155 bool OnBack(
int actionId)
override 156 { XBMC_TRACE;
return up() ? CGUIWindow::OnBack(actionId) : checkedb(OnBack(actionId)); }
158 void OnDeinitWindow(
int nextWindowID)
override 159 { XBMC_TRACE;
if(
up()) P::OnDeinitWindow(nextWindowID);
else checkedv(OnDeinitWindow(nextWindowID)); }
161 bool IsModalDialog()
const override 164 return checkedb(IsModalDialog());
167 bool IsDialogRunning()
const override 170 return checkedb(IsDialogRunning());
172 bool IsDialog()
const override 175 return checkedb(IsDialog());
177 bool IsMediaWindow()
const override 180 return checkedb(IsMediaWindow());
183 void SetRenderOrder(
int renderOrder)
override { XBMC_TRACE; P::m_renderOrder = renderOrder; }
185 void setActive(
bool active)
override { XBMC_TRACE; P::m_active = active; }
186 bool isActive()
override { XBMC_TRACE;
return P::m_active; }
194 Window* _window,
int windowid) :
199 Window* _window,
int windowid,
200 const char* xmlfile) :
This class is a smart pointer for a Referenced class.
Definition: AddonClass.h:154
These two classes are closely associated with the Interceptor template below.
Definition: WindowInterceptor.h:27
Class encapsulating information regarding a particular user action to be sent to windows and controls...
Definition: Action.h:21
Defining LOG_LIFECYCLE_EVENTS will log all instantiations, deletions and also reference countings (in...
Definition: Addon.cpp:25
Definition: GUIMessage.h:365
Definition: GUIWindow.h:58
Definition: WindowInterceptor.h:189
Guard class.
Definition: WindowInterceptor.h:74
Definition: WindowInterceptor.h:103
static bool up()
Calling up ONCE resets the upcall to to false.
Definition: WindowInterceptor.h:49