9 #pragma warning( push )
10 #pragma warning( disable : 4100 )
17 static void Update (
const char *className, LWInstance inst)
62 inst->create = InstanceAdaptor::Create;
63 inst->destroy = InstanceAdaptor::Destroy;
64 inst->copy = InstanceAdaptor::Copy;
65 inst->load = InstanceAdaptor::Load;
66 inst->save = InstanceAdaptor::Save;
67 inst->descln = InstanceAdaptor::DescLn;
72 static LWInstance Create (
void *priv,
void *context, LWError *err)
76 LWError localErr =
"\0";
77 T *plugin =
new T(priv, context, &localErr);
84 return static_cast<LWInstance
> (plugin);
86 catch (std::exception &e)
88 static LWError error = e.what();
94 static void Destroy (LWInstance instance)
98 T *plugin =
static_cast<T *
>(instance);
101 catch (std::exception &e)
108 static LWError Copy (LWInstance _to, LWInstance _from)
113 T *from = (T *) _from;
117 catch (std::exception &e)
123 static LWError Load (LWInstance instance,
const LWLoadState *ls)
127 T *plugin =
static_cast<T *
>(instance);
130 catch (std::exception &e)
136 static LWError Save (LWInstance instance,
const LWSaveState *ss)
140 T *plugin =
static_cast<T *
>(instance);
143 catch (std::exception &e)
150 static const char *DescLn (LWInstance instance)
154 T *plugin =
static_cast<T *
>(instance);
155 return plugin->DescLn();
157 catch (std::exception &e)
193 inst->useItems = ItemAdaptor::UseItems;
194 inst->changeID = ItemAdaptor::ChangeID;
198 static const LWItemID *UseItems (LWInstance instance)
202 T *plugin =
static_cast<T *
>(instance);
203 return plugin->UseItems();
205 catch (std::exception &e)
212 static void ChangeID (LWInstance instance,
const LWItemID *ids)
216 T *plugin =
static_cast<T *
>(instance);
219 plugin->ChangeID(ids);
222 catch (std::exception &e)
232 #define LWINIT_NONE -1
253 virtual LWError
NewTime(LWFrame frame, LWTime time)
274 inst->init = RenderAdaptor::Init;
275 inst->cleanup = RenderAdaptor::Cleanup;
276 inst->newTime = RenderAdaptor::NewTime;
280 static LWError Init (LWInstance instance,
int mode)
284 T *plugin =
static_cast<T *
>(instance);
285 return plugin->Init(mode);
287 catch (std::exception &e)
292 static void Cleanup (LWInstance instance)
296 T *plugin =
static_cast<T *
>(instance);
299 catch (std::exception &e)
306 static LWError NewTime (LWInstance instance, LWFrame frame, LWTime time)
310 T *plugin =
static_cast<T *
>(instance);
311 return plugin->NewTime(frame, time);
313 catch (std::exception &e)
338 ui->command = InterfaceAdaptor::Command;
342 static LWError Command (LWInstance instance,
const char* command)
344 T *plugin = (T *) instance;
345 return plugin->Command(command);
361 virtual LWXPRefreshCode
DataSet(
unsigned int ,
void *)
371 virtual void ChangeNotify (LWXPanelID ,
unsigned int ,
unsigned int ,
int)
386 virtual void ControlZoom (
unsigned int ,
int ,
int ,
int *,
int )
401 static void LWXPanelControlZoomFunc (LWXPanelID panel,
unsigned int cid,
int x,
int y,
int *region,
int clickcount );
404 static void *
CB_DataGet(LWInstance inst,
unsigned int vid );
407 static LWXPRefreshCode
CB_DataSet(LWInstance inst,
unsigned int vid,
void *value);
416 virtual void CreateViewXPanel(LWXPanelControl *controls, LWXPanelDataDesc *desc, LWXPanelHint *hints = 0,
bool do_destroy =
false);
422 virtual int Interface (
int version, LWInterface *local,
void *serverdata)
440 static int Interface (
int version, GlobalFunc *global,
void *loc,
void *serverdata)
442 if ( version < LWINTERFACE_VERSION )
return AFUNC_BADVERSION;
448 LWInterface *local =
static_cast<LWInterface *
>(loc);
449 T *plugin =
static_cast<T *
>(local->inst);
450 return plugin->Interface(version, local, serverdata);
454 catch (std::exception &e)
464 #define IMPLEMENT_XPANELHANDLER(pluginClass) \
465 class XPanel##pluginClass##Handler : public pluginClass##Handler, public XPanelInterface \
468 XPanel##pluginClass##Handler(void *g, void *context, LWError *err) \
469 : pluginClass##Handler(g, context, err) \
473 #define IMPLEMENT_XPANELADAPTOR(pluginClass, min, max) \
474 template <class T, int minV = min, int maxV = max> class XPanel##pluginClass##Adaptor : public pluginClass##Adaptor<T, minV, maxV>, public XPanelAdaptor<T> \
477 XPanel##pluginClass##Adaptor(const char *name, ServerTagInfo tags[] = 0) \
478 : XPanelAdaptor<T>(name, #pluginClass "Interface", tags), \
479 pluginClass##Adaptor<T, minV, maxV>(name, tags) \
483 #define IMPLEMENT_LWPANELHANDLER(pluginClass) \
484 class LWPanel##pluginClass##Handler : public pluginClass##Handler, public LWPanelInterface \
487 LWPanel##pluginClass##Handler(void *g, void *context, LWError *err) \
488 : pluginClass##Handler(g, context, err) \
492 #define IMPLEMENT_LWPANELADAPTOR(pluginClass, min, max) \
493 template <class T, int minV = min, int maxV = max> class LWPanel##pluginClass##Adaptor : public pluginClass##Adaptor<T, minV, maxV>, public LWPanelAdaptor<T> \
496 LWPanel##pluginClass##Adaptor(const char *name, ServerTagInfo tags[] = 0) \
497 : LWPanelAdaptor<T>(name, #pluginClass "Interface", tags), \
498 pluginClass##Adaptor<T, minV, maxV>(name, tags) \
504 #pragma warning( pop )
505 #endif // LWPP_HANDLER_H