reflexion 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.doc/ext/reflex/body.cpp +53 -0
  3. data/.doc/ext/reflex/native.cpp +0 -4
  4. data/.doc/ext/reflex/selector.cpp +3 -3
  5. data/.doc/ext/reflex/style.cpp +390 -30
  6. data/.doc/ext/reflex/style_length.cpp +1 -1
  7. data/.doc/ext/reflex/view.cpp +24 -6
  8. data/VERSION +1 -1
  9. data/ext/reflex/body.cpp +59 -0
  10. data/ext/reflex/native.cpp +0 -4
  11. data/ext/reflex/selector.cpp +3 -3
  12. data/ext/reflex/style.cpp +432 -32
  13. data/ext/reflex/style_length.cpp +1 -1
  14. data/ext/reflex/view.cpp +25 -5
  15. data/include/reflex/body.h +16 -0
  16. data/include/reflex/ruby.h +5 -3
  17. data/include/reflex/ruby/style.h +11 -0
  18. data/include/reflex/selector.h +7 -1
  19. data/include/reflex/style.h +93 -27
  20. data/include/reflex/view.h +8 -4
  21. data/lib/reflex.rb +0 -2
  22. data/lib/reflex/body.rb +1 -0
  23. data/lib/reflex/button.rb +1 -0
  24. data/lib/reflex/selector.rb +10 -1
  25. data/lib/reflex/style.rb +15 -0
  26. data/lib/reflex/style_length.rb +1 -1
  27. data/lib/reflex/view.rb +5 -2
  28. data/lib/reflex/window.rb +2 -2
  29. data/samples/reflexion/breakout.rb +4 -9
  30. data/src/body.cpp +61 -0
  31. data/src/ios/event.mm +1 -3
  32. data/src/ios/native_window.mm +3 -20
  33. data/src/ios/opengl_view.mm +1 -1
  34. data/src/ios/window.mm +7 -0
  35. data/src/selector.cpp +38 -16
  36. data/src/style.cpp +515 -161
  37. data/src/view.cpp +371 -242
  38. data/src/world.cpp +8 -0
  39. data/test/test_selector.rb +14 -12
  40. data/test/test_style.rb +11 -6
  41. data/test/test_style_length.rb +5 -6
  42. data/test/test_view.rb +8 -7
  43. metadata +2 -17
  44. data/.doc/ext/reflex/style_length2.cpp +0 -149
  45. data/.doc/ext/reflex/style_length4.cpp +0 -192
  46. data/ext/reflex/style_length2.cpp +0 -157
  47. data/ext/reflex/style_length4.cpp +0 -204
  48. data/include/reflex/ruby/style_length.h +0 -63
  49. data/include/reflex/style_length.h +0 -147
  50. data/lib/reflex/style_length2.rb +0 -34
  51. data/lib/reflex/style_length4.rb +0 -38
  52. data/src/style_length.cpp +0 -341
  53. data/test/test_style_length2.rb +0 -50
  54. data/test/test_style_length4.rb +0 -56
@@ -1,4 +1,4 @@
1
- #include "reflex/ruby/style_length.h"
1
+ #include "reflex/ruby/style.h"
2
2
 
3
3
 
4
4
  #include <rucy.h>
@@ -130,15 +130,17 @@ VALUE remove_style(VALUE self, VALUE style)
130
130
  }
131
131
 
132
132
  static
133
- VALUE get_style(VALUE self)
133
+ VALUE get_style(VALUE self, VALUE selector)
134
134
  {
135
135
  CHECK;
136
- check_arg_count(__FILE__, __LINE__, "View#get_style", argc, 0, 1);
137
136
 
138
- if (argc == 0)
139
- return value(THIS->style());
137
+ Reflex::Style* s = NULL;
138
+ if (selector)
139
+ s = THIS->get_style(to<Reflex::Selector>(selector), true);
140
140
  else
141
- return value(THIS->get_style(to<Reflex::Selector>(argv[0])));
141
+ s = THIS->style(true);
142
+
143
+ return s ? value(*s) : nil();
142
144
  }
143
145
 
144
146
  static
@@ -290,6 +292,20 @@ VALUE get_frame(VALUE self)
290
292
  return value(THIS->frame());
291
293
  }
292
294
 
295
+ static
296
+ VALUE set_zoom(VALUE self, VALUE zoom)
297
+ {
298
+ CHECK;
299
+ THIS->set_zoom(to<float>(zoom));
300
+ }
301
+
302
+ static
303
+ VALUE get_zoom(VALUE self)
304
+ {
305
+ CHECK;
306
+ return value(THIS->zoom());
307
+ }
308
+
293
309
  static
294
310
  VALUE get_angle(VALUE self)
295
311
  {
@@ -621,7 +637,7 @@ Init_view ()
621
637
  rb_define_method(cView, "each_child", RUBY_METHOD_FUNC(each_child), 0);
622
638
  rb_define_method(cView, "add_style", RUBY_METHOD_FUNC(add_style), 1);
623
639
  rb_define_method(cView, "remove_style", RUBY_METHOD_FUNC(remove_style), 1);
624
- rb_define_method(cView, "get_style", RUBY_METHOD_FUNC(get_style), -1);
640
+ rb_define_method(cView, "get_style", RUBY_METHOD_FUNC(get_style), 1);
625
641
  rb_define_method(cView, "find_styles", RUBY_METHOD_FUNC(find_styles), -1);
626
642
  rb_define_method(cView, "each_style", RUBY_METHOD_FUNC(each_style), 0);
627
643
  rb_define_method(cView, "focus", RUBY_METHOD_FUNC(focus), -1);
@@ -640,6 +656,8 @@ Init_view ()
640
656
  rb_define_method(cView, "selector", RUBY_METHOD_FUNC(get_selector), 0);
641
657
  rb_define_private_method(cView, "set_frame", RUBY_METHOD_FUNC(set_frame), 1);
642
658
  rb_define_private_method(cView, "get_frame", RUBY_METHOD_FUNC(get_frame), 0);
659
+ rb_define_method(cView, "zoom=", RUBY_METHOD_FUNC(set_zoom), 1);
660
+ rb_define_method(cView, "zoom", RUBY_METHOD_FUNC(get_zoom), 0);
643
661
  rb_define_method(cView, "angle", RUBY_METHOD_FUNC(get_angle), 0);
644
662
  rb_define_method(cView, "scroll_to", RUBY_METHOD_FUNC(scroll_to), -1);
645
663
  rb_define_method(cView, "scroll_by", RUBY_METHOD_FUNC(scroll_by), -1);
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.10
1
+ 0.1.11
data/ext/reflex/body.cpp CHANGED
@@ -156,6 +156,42 @@ RUCY_DEF0(get_angular_velocity)
156
156
  }
157
157
  RUCY_END
158
158
 
159
+ static
160
+ RUCY_DEF1(apply_force, force)
161
+ {
162
+ CHECK;
163
+ THIS->apply_force(to<Rays::Point&>(force));
164
+ return self;
165
+ }
166
+ RUCY_END
167
+
168
+ static
169
+ RUCY_DEF1(apply_torque, torque)
170
+ {
171
+ CHECK;
172
+ THIS->apply_torque(torque.as_f(true));
173
+ return self;
174
+ }
175
+ RUCY_END
176
+
177
+ static
178
+ RUCY_DEF1(apply_linear_impulse, impulse)
179
+ {
180
+ CHECK;
181
+ THIS->apply_linear_impulse(to<Rays::Point&>(impulse));
182
+ return self;
183
+ }
184
+ RUCY_END
185
+
186
+ static
187
+ RUCY_DEF1(apply_angular_impulse, impulse)
188
+ {
189
+ CHECK;
190
+ THIS->apply_angular_impulse(impulse.as_f(true));
191
+ return self;
192
+ }
193
+ RUCY_END
194
+
159
195
  static
160
196
  RUCY_DEF1(set_density, density)
161
197
  {
@@ -207,6 +243,23 @@ RUCY_DEF0(get_restitution)
207
243
  }
208
244
  RUCY_END
209
245
 
246
+ static
247
+ RUCY_DEF1(set_gravity_scale, scale)
248
+ {
249
+ CHECK;
250
+ THIS->set_gravity_scale(scale.as_f(true));
251
+ return self;
252
+ }
253
+ RUCY_END
254
+
255
+ static
256
+ RUCY_DEF0(get_gravity_scale)
257
+ {
258
+ CHECK;
259
+ return value(THIS->gravity_scale());
260
+ }
261
+ RUCY_END
262
+
210
263
  static
211
264
  RUCY_DEF0(each)
212
265
  {
@@ -245,12 +298,18 @@ Init_body ()
245
298
  cBody.define_method("linear_velocity", get_linear_velocity);
246
299
  cBody.define_method("angular_velocity=", set_angular_velocity);
247
300
  cBody.define_method("angular_velocity", get_angular_velocity);
301
+ cBody.define_method("apply_force", apply_force);
302
+ cBody.define_method("apply_torque", apply_torque);
303
+ cBody.define_method("apply_linear_impulse", apply_linear_impulse);
304
+ cBody.define_method("apply_angular_impulse", apply_angular_impulse);
248
305
  cBody.define_method("density=", set_density);
249
306
  cBody.define_method("density", get_density);
250
307
  cBody.define_method("friction=", set_friction);
251
308
  cBody.define_method("friction", get_friction);
252
309
  cBody.define_method("restitution=", set_restitution);
253
310
  cBody.define_method("restitution", get_restitution);
311
+ cBody.define_method("gravity_scale=", set_gravity_scale);
312
+ cBody.define_method("gravity_scale", get_gravity_scale);
254
313
  cBody.define_method("each", each);
255
314
  }
256
315
 
@@ -10,8 +10,6 @@ void Init_reflex ();
10
10
  void Init_selector ();
11
11
  void Init_style ();
12
12
  void Init_style_length ();
13
- void Init_style_length2 ();
14
- void Init_style_length4 ();
15
13
 
16
14
  void Init_event ();
17
15
  void Init_update_event ();
@@ -56,8 +54,6 @@ extern "C" void
56
54
  Init_selector();
57
55
  Init_style();
58
56
  Init_style_length();
59
- Init_style_length2();
60
- Init_style_length4();
61
57
 
62
58
  Init_event();
63
59
  Init_update_event();
@@ -77,10 +77,10 @@ RUCY_DEF0(each_tag)
77
77
  RUCY_END
78
78
 
79
79
  static
80
- RUCY_DEF1(match, selector)
80
+ RUCY_DEF1(contains, selector)
81
81
  {
82
82
  CHECK;
83
- return value(THIS->match(to<Reflex::Selector&>(selector)));
83
+ return value(THIS->contains(to<Reflex::Selector&>(selector)));
84
84
  }
85
85
  RUCY_END
86
86
 
@@ -108,7 +108,7 @@ Init_selector ()
108
108
  cSelector.define_method("add_tag", add_tag);
109
109
  cSelector.define_method("remove_tag", remove_tag);
110
110
  cSelector.define_method("each_tag", each_tag);
111
- cSelector.define_method("match", match);
111
+ cSelector.define_method("contains", contains);
112
112
  cSelector.define_method("==", equal);
113
113
  }
114
114
 
data/ext/reflex/style.cpp CHANGED
@@ -5,7 +5,6 @@
5
5
  #include "rays/ruby/color.h"
6
6
  #include "rays/ruby/image.h"
7
7
  #include "reflex/ruby/selector.h"
8
- #include "reflex/ruby/style_length.h"
9
8
  #include "defs.h"
10
9
 
11
10
 
@@ -103,7 +102,7 @@ RUCY_DEFN(set_flow)
103
102
  check_arg_count(__FILE__, __LINE__, "Style#set_flow", argc, 1, 2);
104
103
 
105
104
  THIS->set_flow(
106
- argc >= 1 ? (Reflex::Style::Flow) argv[0].as_i() : Reflex::Style::FLOW_DOWN,
105
+ (Reflex::Style::Flow) argv[0].as_i(),
107
106
  argc >= 2 ? (Reflex::Style::Flow) argv[1].as_i() : Reflex::Style::FLOW_NONE);
108
107
  }
109
108
  RUCY_END
@@ -119,10 +118,45 @@ RUCY_DEF0(get_flow)
119
118
  RUCY_END
120
119
 
121
120
  static
122
- RUCY_DEF1(set_size, size)
121
+ RUCY_DEF1(set_width, width)
123
122
  {
124
123
  CHECK;
125
- THIS->set_size(to<Reflex::StyleLength2>(size));
124
+ THIS->set_width(to<Reflex::StyleLength>(width));
125
+ }
126
+ RUCY_END
127
+
128
+ static
129
+ RUCY_DEF0(get_width)
130
+ {
131
+ CHECK;
132
+ return value(THIS->width());
133
+ }
134
+ RUCY_END
135
+
136
+ static
137
+ RUCY_DEF1(set_height, height)
138
+ {
139
+ CHECK;
140
+ THIS->set_height(to<Reflex::StyleLength>(height));
141
+ }
142
+ RUCY_END
143
+
144
+ static
145
+ RUCY_DEF0(get_height)
146
+ {
147
+ CHECK;
148
+ return value(THIS->height());
149
+ }
150
+ RUCY_END
151
+
152
+ static
153
+ RUCY_DEFN(set_size)
154
+ {
155
+ CHECK;
156
+ check_arg_count(__FILE__, __LINE__, "Style#set_size", argc, 1, 2);
157
+
158
+ set_width (self, argv[0]);
159
+ set_height(self, argc >= 2 ? argv[1] : argv[0]);
126
160
  }
127
161
  RUCY_END
128
162
 
@@ -130,15 +164,82 @@ static
130
164
  RUCY_DEF0(get_size)
131
165
  {
132
166
  CHECK;
133
- return value(THIS->size());
167
+ return array(get_width(self), get_height(self));
168
+ }
169
+ RUCY_END
170
+
171
+ static
172
+ RUCY_DEF1(set_left, left)
173
+ {
174
+ CHECK;
175
+ THIS->set_left(to<Reflex::StyleLength>(left));
134
176
  }
135
177
  RUCY_END
136
178
 
137
179
  static
138
- RUCY_DEF1(set_position, position)
180
+ RUCY_DEF0(get_left)
139
181
  {
140
182
  CHECK;
141
- THIS->set_position(to<Reflex::StyleLength4>(position));
183
+ return value(THIS->left());
184
+ }
185
+ RUCY_END
186
+
187
+ static
188
+ RUCY_DEF1(set_top, top)
189
+ {
190
+ CHECK;
191
+ THIS->set_top(to<Reflex::StyleLength>(top));
192
+ }
193
+ RUCY_END
194
+
195
+ static
196
+ RUCY_DEF0(get_top)
197
+ {
198
+ CHECK;
199
+ return value(THIS->top());
200
+ }
201
+ RUCY_END
202
+
203
+ static
204
+ RUCY_DEF1(set_right, right)
205
+ {
206
+ CHECK;
207
+ THIS->set_right(to<Reflex::StyleLength>(right));
208
+ }
209
+ RUCY_END
210
+
211
+ static
212
+ RUCY_DEF0(get_right)
213
+ {
214
+ CHECK;
215
+ return value(THIS->right());
216
+ }
217
+ RUCY_END
218
+
219
+ static
220
+ RUCY_DEF1(set_bottom, bottom)
221
+ {
222
+ CHECK;
223
+ THIS->set_bottom(to<Reflex::StyleLength>(bottom));
224
+ }
225
+ RUCY_END
226
+
227
+ static
228
+ RUCY_DEF0(get_bottom)
229
+ {
230
+ CHECK;
231
+ return value(THIS->bottom());
232
+ }
233
+ RUCY_END
234
+
235
+ static
236
+ RUCY_DEF4(set_position, left, top, right, bottom)
237
+ {
238
+ CHECK;
239
+ set_left (self, left);
240
+ set_top (self, top);
241
+ set_right (self, right);
242
+ set_bottom(self, bottom);
142
243
  }
143
244
  RUCY_END
144
245
 
@@ -146,15 +247,173 @@ static
146
247
  RUCY_DEF0(get_position)
147
248
  {
148
249
  CHECK;
149
- return value(THIS->position());
250
+ return array(
251
+ get_left(self),
252
+ get_top(self),
253
+ get_right(self),
254
+ get_bottom(self));
255
+ }
256
+ RUCY_END
257
+
258
+ static
259
+ RUCY_DEF1(set_offset_left, left)
260
+ {
261
+ CHECK;
262
+ THIS->set_offset_left(to<Reflex::StyleLength>(left));
263
+ }
264
+ RUCY_END
265
+
266
+ static
267
+ RUCY_DEF0(get_offset_left)
268
+ {
269
+ CHECK;
270
+ return value(THIS->offset_left());
271
+ }
272
+ RUCY_END
273
+
274
+ static
275
+ RUCY_DEF1(set_offset_top, top)
276
+ {
277
+ CHECK;
278
+ THIS->set_offset_top(to<Reflex::StyleLength>(top));
279
+ }
280
+ RUCY_END
281
+
282
+ static
283
+ RUCY_DEF0(get_offset_top)
284
+ {
285
+ CHECK;
286
+ return value(THIS->offset_top());
287
+ }
288
+ RUCY_END
289
+
290
+ static
291
+ RUCY_DEF1(set_offset_right, right)
292
+ {
293
+ CHECK;
294
+ THIS->set_offset_right(to<Reflex::StyleLength>(right));
295
+ }
296
+ RUCY_END
297
+
298
+ static
299
+ RUCY_DEF0(get_offset_right)
300
+ {
301
+ CHECK;
302
+ return value(THIS->offset_right());
303
+ }
304
+ RUCY_END
305
+
306
+ static
307
+ RUCY_DEF1(set_offset_bottom, bottom)
308
+ {
309
+ CHECK;
310
+ THIS->set_offset_bottom(to<Reflex::StyleLength>(bottom));
311
+ }
312
+ RUCY_END
313
+
314
+ static
315
+ RUCY_DEF0(get_offset_bottom)
316
+ {
317
+ CHECK;
318
+ return value(THIS->offset_bottom());
319
+ }
320
+ RUCY_END
321
+
322
+ static
323
+ RUCY_DEF4(set_offset, left, top, right, bottom)
324
+ {
325
+ CHECK;
326
+ set_offset_left (self, left);
327
+ set_offset_top (self, top);
328
+ set_offset_right (self, right);
329
+ set_offset_bottom(self, bottom);
330
+ }
331
+ RUCY_END
332
+
333
+ static
334
+ RUCY_DEF0(get_offset)
335
+ {
336
+ CHECK;
337
+ return array(
338
+ get_offset_left(self),
339
+ get_offset_top(self),
340
+ get_offset_right(self),
341
+ get_offset_bottom(self));
342
+ }
343
+ RUCY_END
344
+
345
+ static
346
+ RUCY_DEF1(set_margin_left, left)
347
+ {
348
+ CHECK;
349
+ THIS->set_margin_left(to<Reflex::StyleLength>(left));
350
+ }
351
+ RUCY_END
352
+
353
+ static
354
+ RUCY_DEF0(get_margin_left)
355
+ {
356
+ CHECK;
357
+ return value(THIS->margin_left());
358
+ }
359
+ RUCY_END
360
+
361
+ static
362
+ RUCY_DEF1(set_margin_top, top)
363
+ {
364
+ CHECK;
365
+ THIS->set_margin_top(to<Reflex::StyleLength>(top));
366
+ }
367
+ RUCY_END
368
+
369
+ static
370
+ RUCY_DEF0(get_margin_top)
371
+ {
372
+ CHECK;
373
+ return value(THIS->margin_top());
374
+ }
375
+ RUCY_END
376
+
377
+ static
378
+ RUCY_DEF1(set_margin_right, right)
379
+ {
380
+ CHECK;
381
+ THIS->set_margin_right(to<Reflex::StyleLength>(right));
382
+ }
383
+ RUCY_END
384
+
385
+ static
386
+ RUCY_DEF0(get_margin_right)
387
+ {
388
+ CHECK;
389
+ return value(THIS->margin_right());
150
390
  }
151
391
  RUCY_END
152
392
 
153
393
  static
154
- RUCY_DEF1(set_margin, margin)
394
+ RUCY_DEF1(set_margin_bottom, bottom)
155
395
  {
156
396
  CHECK;
157
- THIS->set_margin(to<Reflex::StyleLength4>(margin));
397
+ THIS->set_margin_bottom(to<Reflex::StyleLength>(bottom));
398
+ }
399
+ RUCY_END
400
+
401
+ static
402
+ RUCY_DEF0(get_margin_bottom)
403
+ {
404
+ CHECK;
405
+ return value(THIS->margin_bottom());
406
+ }
407
+ RUCY_END
408
+
409
+ static
410
+ RUCY_DEF4(set_margin, left, top, right, bottom)
411
+ {
412
+ CHECK;
413
+ set_margin_left (self, left);
414
+ set_margin_top (self, top);
415
+ set_margin_right (self, right);
416
+ set_margin_bottom(self, bottom);
158
417
  }
159
418
  RUCY_END
160
419
 
@@ -162,15 +421,86 @@ static
162
421
  RUCY_DEF0(get_margin)
163
422
  {
164
423
  CHECK;
165
- return value(THIS->margin());
424
+ return array(
425
+ get_margin_left(self),
426
+ get_margin_top(self),
427
+ get_margin_right(self),
428
+ get_margin_bottom(self));
166
429
  }
167
430
  RUCY_END
168
431
 
169
432
  static
170
- RUCY_DEF1(set_padding, padding)
433
+ RUCY_DEF1(set_padding_left, left)
171
434
  {
172
435
  CHECK;
173
- THIS->set_padding(to<Reflex::StyleLength4>(padding));
436
+ THIS->set_padding_left(to<Reflex::StyleLength>(left));
437
+ }
438
+ RUCY_END
439
+
440
+ static
441
+ RUCY_DEF0(get_padding_left)
442
+ {
443
+ CHECK;
444
+ return value(THIS->padding_left());
445
+ }
446
+ RUCY_END
447
+
448
+ static
449
+ RUCY_DEF1(set_padding_top, top)
450
+ {
451
+ CHECK;
452
+ THIS->set_padding_top(to<Reflex::StyleLength>(top));
453
+ }
454
+ RUCY_END
455
+
456
+ static
457
+ RUCY_DEF0(get_padding_top)
458
+ {
459
+ CHECK;
460
+ return value(THIS->padding_top());
461
+ }
462
+ RUCY_END
463
+
464
+ static
465
+ RUCY_DEF1(set_padding_right, right)
466
+ {
467
+ CHECK;
468
+ THIS->set_padding_right(to<Reflex::StyleLength>(right));
469
+ }
470
+ RUCY_END
471
+
472
+ static
473
+ RUCY_DEF0(get_padding_right)
474
+ {
475
+ CHECK;
476
+ return value(THIS->padding_right());
477
+ }
478
+ RUCY_END
479
+
480
+ static
481
+ RUCY_DEF1(set_padding_bottom, bottom)
482
+ {
483
+ CHECK;
484
+ THIS->set_padding_bottom(to<Reflex::StyleLength>(bottom));
485
+ }
486
+ RUCY_END
487
+
488
+ static
489
+ RUCY_DEF0(get_padding_bottom)
490
+ {
491
+ CHECK;
492
+ return value(THIS->padding_bottom());
493
+ }
494
+ RUCY_END
495
+
496
+ static
497
+ RUCY_DEF4(set_padding, left, top, right, bottom)
498
+ {
499
+ CHECK;
500
+ set_padding_left (self, left);
501
+ set_padding_top (self, top);
502
+ set_padding_right (self, right);
503
+ set_padding_bottom(self, bottom);
174
504
  }
175
505
  RUCY_END
176
506
 
@@ -178,39 +508,59 @@ static
178
508
  RUCY_DEF0(get_padding)
179
509
  {
180
510
  CHECK;
181
- return value(THIS->padding());
511
+ return array(
512
+ get_padding_left(self),
513
+ get_padding_top(self),
514
+ get_padding_right(self),
515
+ get_padding_bottom(self));
516
+ }
517
+ RUCY_END
518
+
519
+ static
520
+ RUCY_DEF1(set_fill, color)
521
+ {
522
+ CHECK;
523
+ THIS->set_fill(to<Reflex::Color&>(color));
182
524
  }
183
525
  RUCY_END
184
526
 
185
527
  static
186
- RUCY_DEF1(set_background_color, color)
528
+ RUCY_DEF0(get_fill)
187
529
  {
188
530
  CHECK;
189
- THIS->set_background_color(to<Reflex::Color&>(color));
531
+ return value(THIS->fill());
190
532
  }
191
533
  RUCY_END
192
534
 
193
535
  static
194
- RUCY_DEF0(get_background_color)
536
+ RUCY_DEF1(set_stroke, color)
195
537
  {
196
538
  CHECK;
197
- return value(THIS->background_color());
539
+ THIS->set_stroke(to<Reflex::Color&>(color));
198
540
  }
199
541
  RUCY_END
200
542
 
201
543
  static
202
- RUCY_DEF1(set_background_image, image)
544
+ RUCY_DEF0(get_stroke)
203
545
  {
204
546
  CHECK;
205
- THIS->set_background_image(to<Reflex::Image&>(image));
547
+ return value(THIS->stroke());
206
548
  }
207
549
  RUCY_END
208
550
 
209
551
  static
210
- RUCY_DEF0(get_background_image)
552
+ RUCY_DEF1(set_image, image)
211
553
  {
212
554
  CHECK;
213
- return THIS->background_image() ? value(THIS->background_image()) : nil();
555
+ THIS->set_image(to<Reflex::Image&>(image));
556
+ }
557
+ RUCY_END
558
+
559
+ static
560
+ RUCY_DEF0(get_image)
561
+ {
562
+ CHECK;
563
+ return THIS->image() ? value(THIS->image()) : nil();
214
564
  }
215
565
  RUCY_END
216
566
 
@@ -233,6 +583,7 @@ Init_style ()
233
583
  cStyle = mReflex.define_class("Style");
234
584
  cStyle.define_alloc_func(alloc);
235
585
  cStyle.define_private_method("initialize_copy", initialize_copy);
586
+
236
587
  cStyle.define_method("name=", set_name);
237
588
  cStyle.define_method("name", get_name);
238
589
  cStyle.define_method("add_tag", add_tag);
@@ -240,20 +591,69 @@ Init_style ()
240
591
  cStyle.define_method("each_tag", each_tag);
241
592
  cStyle.define_method("selector=", set_selector);
242
593
  cStyle.define_method("selector", get_selector);
594
+
243
595
  cStyle.define_method("set_flow", set_flow);
244
596
  cStyle.define_method("get_flow", get_flow);
245
- cStyle.define_method("size=", set_size);
246
- cStyle.define_method("size", get_size);
597
+
598
+ cStyle.define_method("width=", set_width);
599
+ cStyle.define_method("width", get_width);
600
+ cStyle.define_method("height=", set_height);
601
+ cStyle.define_method("height", get_height);
602
+ cStyle.define_method("size=", set_size);
603
+ cStyle.define_method("size", get_size);
604
+
605
+ cStyle.define_method("left=", set_left);
606
+ cStyle.define_method("left", get_left);
607
+ cStyle.define_method("top=", set_top);
608
+ cStyle.define_method("top", get_top);
609
+ cStyle.define_method("right=", set_right);
610
+ cStyle.define_method("right", get_right);
611
+ cStyle.define_method("bottom=", set_bottom);
612
+ cStyle.define_method("bottom", get_bottom);
247
613
  cStyle.define_method("position=", set_position);
248
614
  cStyle.define_method("position", get_position);
249
- cStyle.define_method("margin=", set_margin);
250
- cStyle.define_method("margin", get_margin);
251
- cStyle.define_method("padding=", set_padding);
252
- cStyle.define_method("padding", get_padding);
253
- cStyle.define_method("background_color=", set_background_color);
254
- cStyle.define_method("background_color", get_background_color);
255
- cStyle.define_method("background_image=", set_background_image);
256
- cStyle.define_method("background_image", get_background_image);
615
+
616
+ cStyle.define_method("offset_left=", set_offset_left);
617
+ cStyle.define_method("offset_left", get_offset_left);
618
+ cStyle.define_method("offset_top=", set_offset_top);
619
+ cStyle.define_method("offset_top", get_offset_top);
620
+ cStyle.define_method("offset_right=", set_offset_right);
621
+ cStyle.define_method("offset_right", get_offset_right);
622
+ cStyle.define_method("offset_bottom=", set_offset_bottom);
623
+ cStyle.define_method("offset_bottom", get_offset_bottom);
624
+ cStyle.define_method("offset=", set_offset);
625
+ cStyle.define_method("offset", get_offset);
626
+
627
+ cStyle.define_method("margin_left=", set_margin_left);
628
+ cStyle.define_method("margin_left", get_margin_left);
629
+ cStyle.define_method("margin_top=", set_margin_top);
630
+ cStyle.define_method("margin_top", get_margin_top);
631
+ cStyle.define_method("margin_right=", set_margin_right);
632
+ cStyle.define_method("margin_right", get_margin_right);
633
+ cStyle.define_method("margin_bottom=", set_margin_bottom);
634
+ cStyle.define_method("margin_bottom", get_margin_bottom);
635
+ cStyle.define_method("margin=", set_margin);
636
+ cStyle.define_method("margin", get_margin);
637
+
638
+ cStyle.define_method("padding_left=", set_padding_left);
639
+ cStyle.define_method("padding_left", get_padding_left);
640
+ cStyle.define_method("padding_top=", set_padding_top);
641
+ cStyle.define_method("padding_top", get_padding_top);
642
+ cStyle.define_method("padding_right=", set_padding_right);
643
+ cStyle.define_method("padding_right", get_padding_right);
644
+ cStyle.define_method("padding_bottom=", set_padding_bottom);
645
+ cStyle.define_method("padding_bottom", get_padding_bottom);
646
+ cStyle.define_method("padding=", set_padding);
647
+ cStyle.define_method("padding", get_padding);
648
+
649
+ cStyle.define_method("fill=", set_fill);
650
+ cStyle.define_method("fill", get_fill);
651
+ cStyle.define_method("stroke=", set_stroke);
652
+ cStyle.define_method("stroke", get_stroke);
653
+
654
+ cStyle.define_method("image=", set_image);
655
+ cStyle.define_method("image", get_image);
656
+
257
657
  cStyle.define_method("==", equal);
258
658
  cStyle.define_const("FLOW_NONE", Reflex::Style::FLOW_NONE);
259
659
  cStyle.define_const("FLOW_DOWN", Reflex::Style::FLOW_DOWN);