LightWrap++
AC++wrapperfortheLightWave3DSDK
lwpanel_handler.h
Go to the documentation of this file.
1 #ifndef LWPP_LWPANEL_HANDLER_H
2 #define LWPP_LWPANEL_HANDLER_H
3 
4 #include "lwpp/panel.h"
5 
6 #pragma warning( push )
7 #pragma warning( disable : 4100 )
8 
9 namespace lwpp
10 {
11 /*
12  * LWPanel related classes
13  */
15  {
16  friend class LWPanel;
17  protected:
19  public:
21  {;}
23  {
24  ;
25  }
27  virtual LWError Options (void)
28  {
29  return 0;
30  }
31  };
32 
33 
34  template <class T>
36  {
37  public:
38  LWPanelAdaptor(const char *name, const char *className, ServerTagInfo tags[])
39  {
40  LWServer::AddPlugin(className, name, Interface, tags);
41  }
42 
43  static LWError Options (LWInstance inst)
44  {
45  T *plugin = static_cast<T *>(inst);
46  return plugin->Options();
47  }
48 
49  static int Interface (int version, GlobalFunc *global, void *loc, void *serverdata)
50  {
51  if ( version < LWINTERFACE_VERSION ) return AFUNC_BADVERSION;
52  try
53  {
54  if (loc)
55  {
56  lwpp::SetSuperGlobal(global);
57  LWInterface *local = static_cast<LWInterface *>(loc);
58  local->panel = 0;
59  local->options = Options;
60  local->command = 0;
61  }
62  return AFUNC_OK;
63  }
64  catch (std::exception &e)
65  {
66  lwpp::LWMessage::Error("An exception occured in LWPanel::Activate():", e.what());
67  return AFUNC_BADAPP;
68  }
69  }
70  };
71 
72 } // end of namespace lwpp
73 
74 #pragma warning( pop )
75 #endif // LWPP_LWPANEL_HANDLER_H