comparison nodejs/mbfly_njs.cc @ 562:1b6402f07cd4 Android_Skia

Make root coord availabe for Javascript code
author Thinker K.F. Li <thinker@branda.to>
date Mon, 07 Jun 2010 14:45:01 +0800
parents a3c13c2a4792
children c0bc60448913
comparison
equal deleted inserted replaced
561:a3c13c2a4792 562:1b6402f07cd4
48 height = args[2]->Int32Value(); 48 height = args[2]->Int32Value();
49 rt = X_njs_MB_new(display_name, width, height); 49 rt = X_njs_MB_new(display_name, width, height);
50 50
51 self = args.This(); 51 self = args.This();
52 WRAP(self, rt); 52 WRAP(self, rt);
53 xnjsmb_coord_mkroot(self);
53 54
54 X_njs_MB_init_handle_connection(rt); 55 X_njs_MB_init_handle_connection(rt);
55 56
56 return Null(); 57 return Null();
57 } 58 }
60 xnjsmb_handle_connection(const Arguments &args) { 61 xnjsmb_handle_connection(const Arguments &args) {
61 } 62 }
62 63
63 /* @} */ 64 /* @} */
64 65
66 /*! \brief Get rdman associated with the runtime.
67 */
65 redraw_man_t * 68 redraw_man_t *
66 xnjsmb_rt_rdman(Handle<Object> mbrt) { 69 xnjsmb_rt_rdman(Handle<Object> mbrt) {
67 HandleScope scope; 70 HandleScope scope;
68 njs_runtime_t *rt; 71 njs_runtime_t *rt;
69 redraw_man_t *rdman; 72 redraw_man_t *rdman;
82 } 85 }
83 86
84 extern "C" void 87 extern "C" void
85 init(Handle<Object> target) { 88 init(Handle<Object> target) {
86 HandleScope scope; 89 HandleScope scope;
87 Handle<FunctionTemplate> func; 90 Handle<FunctionTemplate> func, mb_rt_func;
88 Handle<ObjectTemplate> rt_obj_temp; 91 Handle<ObjectTemplate> rt_instance_temp, rt_proto_temp;
89 92
90 func = FunctionTemplate::New(hello_func); 93 func = FunctionTemplate::New(hello_func);
91 target->Set(String::New("Hello"), func->GetFunction()); 94 target->Set(String::New("Hello"), func->GetFunction());
92 95
93 func = FunctionTemplate::New(xnjsmb_new); 96 /*
94 target->Set(String::New("mb_rt"), func->GetFunction()); 97 * Initialize template for MadButterfly runtime objects.
95 rt_obj_temp = func->PrototypeTemplate(); 98 */
96 rt_obj_temp->SetInternalFieldCount(1); 99 mb_rt_func = FunctionTemplate::New(xnjsmb_new);
100 mb_rt_func->SetClassName(String::New("mb_rt"));
97 101
102 rt_instance_temp = mb_rt_func->InstanceTemplate();
103 rt_instance_temp->SetInternalFieldCount(1);
104
105 rt_proto_temp = mb_rt_func->PrototypeTemplate();
98 func = FunctionTemplate::New(xnjsmb_coord_new); 106 func = FunctionTemplate::New(xnjsmb_coord_new);
99 SET(rt_obj_temp, "coord_new", func); 107 SET(rt_proto_temp, "coord_new", func);
108
109 target->Set(String::New("mb_rt"), mb_rt_func->GetFunction());
100 } 110 }