Mercurial > MadButterfly
comparison nodejs/shapes.cc @ 690:86c6ebf1de25
Add JS binding for sh_rect_t
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sat, 07 Aug 2010 23:00:16 +0800 |
parents | a05a4a27ff46 |
children | dd1f3382d6a4 |
comparison
equal
deleted
inserted
replaced
689:a05a4a27ff46 | 690:86c6ebf1de25 |
---|---|
87 | 87 |
88 if(sh_get_coord(sh)) | 88 if(sh_get_coord(sh)) |
89 rdman_shape_changed(rdman, sh); | 89 rdman_shape_changed(rdman, sh); |
90 } | 90 } |
91 | 91 |
92 static void | |
93 xnjsmb_sh_rect_set(shape_t *sh, Handle<Object> self, float x, float y, | |
94 float w, float h, float rx, float ry) { | |
95 Handle<Object> rt; | |
96 redraw_man_t *rdman; | |
97 | |
98 sh_rect_set(sh, x, y, w, h, rx, ry); | |
99 | |
100 /* | |
101 * Mark changed. | |
102 */ | |
103 rt = GET(self, "mbrt")->ToObject(); | |
104 ASSERT(rt != NULL); | |
105 rdman = xnjsmb_rt_rdman(rt); | |
106 | |
107 if(sh_get_coord(sh)) | |
108 rdman_shape_changed(rdman, sh); | |
109 } | |
110 | |
92 /* @} */ | 111 /* @} */ |
93 | 112 |
94 #include "shapes-inc.h" | 113 #include "shapes-inc.h" |
95 | 114 |
96 /*! \defgroup xnjsmb_shapes_wraps Exported wrapper makers for shapes | 115 /*! \defgroup xnjsmb_shapes_wraps Exported wrapper makers for shapes |
114 Handle<Value> | 133 Handle<Value> |
115 export_xnjsmb_auto_image_new(shape_t *sh) { | 134 export_xnjsmb_auto_image_new(shape_t *sh) { |
116 return xnjsmb_auto_image_new(sh); | 135 return xnjsmb_auto_image_new(sh); |
117 } | 136 } |
118 | 137 |
138 Handle<Value> | |
139 export_xnjsmb_auto_rect_new(shape_t *sh) { | |
140 return xnjsmb_auto_rect_new(sh); | |
141 } | |
142 | |
119 /* @} */ | 143 /* @} */ |
120 | 144 |
121 /*! \defgroup xnjsmb_shapes_cons Constructor of shapes | 145 /*! \defgroup xnjsmb_shapes_cons Constructor of shapes |
122 * \ingroup xnjsmb_shapes | 146 * \ingroup xnjsmb_shapes |
123 * | 147 * |
150 redraw_man_t *rdman; | 174 redraw_man_t *rdman; |
151 shape_t *sh; | 175 shape_t *sh; |
152 | 176 |
153 rdman = X_njs_MB_rdman(rt); | 177 rdman = X_njs_MB_rdman(rt); |
154 sh = rdman_shape_image_new(rdman, x, y, w, h); | 178 sh = rdman_shape_image_new(rdman, x, y, w, h); |
179 | |
180 return sh; | |
181 } | |
182 | |
183 shape_t * | |
184 xnjsmb_rect_new(njs_runtime_t *rt, float x, float y, float w, float h, | |
185 float rx, float ry, const char **err) { | |
186 redraw_man_t *rdman; | |
187 shape_t *sh; | |
188 | |
189 rdman = X_njs_MB_rdman(rt); | |
190 sh = rdman_shape_rect_new(rdman, x, y, w, h, rx, ry); | |
191 if(sh == NULL) { | |
192 *err = "Can not create a sh_rect_t"; | |
193 return NULL; | |
194 } | |
155 | 195 |
156 return sh; | 196 return sh; |
157 } | 197 } |
158 | 198 |
159 /* @} */ | 199 /* @} */ |
172 if(temp_init_flag == 0) { | 212 if(temp_init_flag == 0) { |
173 xnjsmb_auto_shape_init(); | 213 xnjsmb_auto_shape_init(); |
174 xnjsmb_auto_path_init(); | 214 xnjsmb_auto_path_init(); |
175 xnjsmb_auto_stext_init(); | 215 xnjsmb_auto_stext_init(); |
176 xnjsmb_auto_image_init(); | 216 xnjsmb_auto_image_init(); |
217 xnjsmb_auto_rect_init(); | |
177 temp_init_flag = 1; | 218 temp_init_flag = 1; |
178 } | 219 } |
179 return; | 220 return; |
180 } | 221 } |