564
|
1 #include <v8.h>
|
|
2 #include "mbfly_njs.h"
|
|
3
|
|
4 extern "C" {
|
|
5 #include <mb.h>
|
|
6 }
|
|
7
|
|
8 using namespace v8;
|
|
9
|
|
10 /*! \defgroup shape_temp Templates for shape and derive.
|
|
11 *
|
|
12 * @{
|
|
13 */
|
|
14 static Persistent<FunctionTemplate> xnjsmb_shape_temp;
|
|
15
|
|
16 static Handle<Value>
|
|
17 xnjsmb_shape_show(const Arguments &args) {
|
|
18 shape_t *sh;
|
|
19 Handle<Object> self;
|
|
20
|
|
21 self = args.This();
|
|
22 sh = (shape_t *)UNWRAP(self);
|
|
23 sh_show(sh);
|
|
24
|
|
25 return Null();
|
|
26 }
|
|
27
|
|
28 static Handle<Value>
|
|
29 xnjsmb_shape_hide(const Arguments &args) {
|
|
30 shape_t *sh;
|
|
31 Handle<Object> self;
|
|
32
|
|
33 self = args.This();
|
|
34 sh = (shape_t *)UNWRAP(self);
|
|
35 sh_hide(sh);
|
|
36
|
|
37 return Null();
|
|
38 }
|
|
39
|
|
40 static void
|
|
41 xnjsmb_init_shape_temp(void) {
|
|
42 Handle<FunctionTemplate> temp;
|
|
43 Handle<ObjectTemplate> proto_temp;
|
|
44 Handle<FunctionTemplate> method_temp;
|
|
45
|
|
46 temp = FunctionTemplate::New();
|
|
47 temp->SetClassName(String::New("shape"));
|
|
48 xnjsmb_shape_temp = Persistent<FunctionTemplate>::New(temp);
|
|
49 proto_temp = temp->PrototypeTemplate();
|
|
50
|
|
51 method_temp = FunctionTemplate::New(xnjsmb_shape_show);
|
|
52 SET(proto_temp, "show", method_temp);
|
|
53 method_temp = FunctionTemplate::New(xnjsmb_shape_hide);
|
|
54 SET(proto_temp, "hide", method_temp);
|
|
55 }
|
|
56
|
|
57 /* @} */
|
|
58
|