diff options
Diffstat (limited to 'plugins/Skins/SkinLib/V8Script.h')
-rw-r--r-- | plugins/Skins/SkinLib/V8Script.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/plugins/Skins/SkinLib/V8Script.h b/plugins/Skins/SkinLib/V8Script.h new file mode 100644 index 0000000000..b7e1f3f2a6 --- /dev/null +++ b/plugins/Skins/SkinLib/V8Script.h @@ -0,0 +1,46 @@ +#ifndef __V8_SCRIPT_H__
+# define __V8_SCRIPT_H__
+
+#include <v8.h>
+#include <utility>
+#include "V8Wrappers.h"
+
+
+typedef void (*ExceptionCallback)(void *param, const TCHAR *err);
+
+
+class V8Script
+{
+public:
+ static void initializeEngine();
+
+
+ V8Script();
+ ~V8Script();
+
+ bool compile(const TCHAR *source, Dialog *dlg);
+ void dispose();
+
+ bool isValid();
+
+ std::pair<SkinOptions *,DialogState *> configure(Dialog *dlg);
+
+ bool run(DialogState * state, SkinOptions *opts, DialogInfo *info);
+
+ void setExceptionCallback(ExceptionCallback cb, void *param = NULL);
+
+private:
+ v8::Persistent<v8::Context> context;
+ v8::Persistent<v8::Function> configureFunction;
+ v8::Persistent<v8::Function> drawFunction;
+
+ ExceptionCallback exceptionCallback;
+ void *exceptionCallbackParam;
+
+ void reportException(v8::TryCatch *try_catch);
+ void fillWrappers(DialogState *state, SkinOptions *opts, DialogInfo *info, bool configure);
+};
+
+
+
+#endif // __V8_SCRIPT_H__
|