reflexion 0.1.19 → 0.1.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/.doc/ext/reflex/contact_event.cpp +6 -6
  3. data/.doc/ext/reflex/event.cpp +9 -1
  4. data/.doc/ext/reflex/focus_event.cpp +6 -6
  5. data/.doc/ext/reflex/key_event.cpp +211 -13
  6. data/.doc/ext/reflex/native.cpp +2 -0
  7. data/.doc/ext/reflex/pointer.cpp +158 -0
  8. data/.doc/ext/reflex/pointer_event.cpp +31 -90
  9. data/.doc/ext/reflex/selector.cpp +8 -0
  10. data/.doc/ext/reflex/view.cpp +57 -0
  11. data/.doc/ext/reflex/window.cpp +41 -0
  12. data/VERSION +1 -1
  13. data/ext/reflex/contact_event.cpp +6 -6
  14. data/ext/reflex/event.cpp +11 -2
  15. data/ext/reflex/focus_event.cpp +6 -6
  16. data/ext/reflex/key_event.cpp +212 -13
  17. data/ext/reflex/native.cpp +2 -0
  18. data/ext/reflex/pointer.cpp +170 -0
  19. data/ext/reflex/pointer_event.cpp +30 -95
  20. data/ext/reflex/selector.cpp +9 -0
  21. data/ext/reflex/view.cpp +67 -3
  22. data/ext/reflex/window.cpp +49 -3
  23. data/include/reflex/defs.h +140 -106
  24. data/include/reflex/event.h +26 -27
  25. data/include/reflex/pointer.h +107 -0
  26. data/include/reflex/ruby/pointer.h +41 -0
  27. data/include/reflex/ruby/view.h +9 -0
  28. data/include/reflex/ruby/window.h +9 -0
  29. data/include/reflex/selector.h +1 -1
  30. data/include/reflex/view.h +6 -4
  31. data/include/reflex/window.h +14 -8
  32. data/lib/reflex/application.rb +3 -3
  33. data/lib/reflex/autoinit.rb +1 -1
  34. data/lib/reflex/button.rb +7 -7
  35. data/lib/reflex/capture_event.rb +7 -7
  36. data/lib/reflex/contact_event.rb +4 -4
  37. data/lib/reflex/draw_event.rb +2 -2
  38. data/lib/reflex/ellipse_shape.rb +2 -2
  39. data/lib/reflex/focus_event.rb +4 -4
  40. data/lib/reflex/frame_event.rb +5 -5
  41. data/lib/reflex/helper.rb +20 -20
  42. data/lib/reflex/image_view.rb +2 -2
  43. data/lib/reflex/key_event.rb +6 -6
  44. data/lib/reflex/model.rb +22 -22
  45. data/lib/reflex/model_owner.rb +7 -7
  46. data/lib/reflex/model_view.rb +1 -1
  47. data/lib/reflex/module.rb +5 -5
  48. data/lib/reflex/pointer.rb +107 -0
  49. data/lib/reflex/pointer_event.rb +16 -54
  50. data/lib/reflex/polygon_shape.rb +2 -2
  51. data/lib/reflex/reflex.rb +3 -3
  52. data/lib/reflex/scroll_event.rb +1 -1
  53. data/lib/reflex/selector.rb +4 -4
  54. data/lib/reflex/shape.rb +13 -13
  55. data/lib/reflex/style.rb +11 -11
  56. data/lib/reflex/style_length.rb +1 -1
  57. data/lib/reflex/text_view.rb +2 -2
  58. data/lib/reflex/timer.rb +2 -2
  59. data/lib/reflex/timer_event.rb +1 -1
  60. data/lib/reflex/update_event.rb +1 -1
  61. data/lib/reflex/view.rb +32 -32
  62. data/lib/reflex/wheel_event.rb +3 -3
  63. data/lib/reflex/window.rb +7 -6
  64. data/lib/reflex.rb +1 -0
  65. data/lib/reflexion.rb +17 -17
  66. data/reflex.gemspec +5 -5
  67. data/samples/reflexion/noise.rb +1 -1
  68. data/samples/tree.rb +1 -1
  69. data/src/event.cpp +189 -37
  70. data/src/event.h +32 -0
  71. data/src/ios/event.h +15 -3
  72. data/src/ios/event.mm +126 -11
  73. data/src/ios/view_controller.mm +50 -22
  74. data/src/ios/window.mm +18 -0
  75. data/src/osx/event.h +14 -3
  76. data/src/osx/event.mm +213 -23
  77. data/src/osx/native_window.mm +84 -17
  78. data/src/osx/window.mm +22 -0
  79. data/src/pointer.cpp +203 -0
  80. data/src/pointer.h +26 -0
  81. data/src/selector.cpp +1 -1
  82. data/src/view.cpp +103 -64
  83. data/src/view.h +0 -4
  84. data/src/window.cpp +334 -98
  85. data/src/window.h +28 -3
  86. data/test/helper.rb +3 -3
  87. data/test/test_application.rb +1 -1
  88. data/test/test_capture_event.rb +6 -6
  89. data/test/test_event.rb +18 -4
  90. data/test/test_has_frame.rb +11 -11
  91. data/test/test_pointer.rb +149 -0
  92. data/test/test_pointer_event.rb +70 -104
  93. data/test/test_reflex.rb +1 -1
  94. data/test/test_selector.rb +15 -8
  95. data/test/test_shape.rb +8 -8
  96. data/test/test_style.rb +13 -13
  97. data/test/test_style_length.rb +5 -5
  98. data/test/test_view.rb +57 -30
  99. data/test/test_window.rb +45 -26
  100. metadata +46 -35
@@ -1,7 +1,9 @@
1
1
  #include "reflex/ruby/event.h"
2
2
 
3
3
 
4
+ #include <vector>
4
5
  #include <rays/ruby/point.h>
6
+ #include "reflex/ruby/pointer.h"
5
7
  #include "defs.h"
6
8
 
7
9
 
@@ -19,23 +21,18 @@ VALUE alloc(VALUE klass)
19
21
  }
20
22
 
21
23
  static
22
- VALUE initialize(VALUE self, VALUE type, VALUE pointer_type, VALUE modifiers, VALUE count, VALUE drag, VALUE positions)
24
+ VALUE initialize(VALUE self)
23
25
  {
24
26
  CHECK;
25
27
 
26
- int size = positions.size();
27
- if (size <= 0 || Reflex::PointerEvent::MAX < size)
28
+ if (argc == 0)
28
29
  argument_error(__FILE__, __LINE__);
29
30
 
30
- THIS->type = (Reflex::PointerEvent::Type) to<int>(type);
31
- THIS->pointer_type = to<uint>(pointer_type);
32
- THIS->modifiers = to<uint>(modifiers);
33
- THIS->count = to<uint>(count);
34
- THIS->drag = to<bool>(drag);
35
- THIS->size = (size_t) size;
31
+ std::vector<Reflex::Pointer> pointers;
32
+ for (size_t i = 0; i < argc; ++i)
33
+ pointers.emplace_back(to<Reflex::Pointer&>(argv[i]));
36
34
 
37
- for (int i = 0; i < size; ++i)
38
- THIS->positions[i] = to<Rays::Point>(positions[i]);
35
+ *THIS = Reflex::PointerEvent(&pointers[0], pointers.size());
39
36
 
40
37
  return rb_call_super(0, NULL);
41
38
  }
@@ -49,88 +46,48 @@ VALUE initialize_copy(VALUE self, VALUE obj)
49
46
  }
50
47
 
51
48
  static
52
- VALUE type(VALUE self)
49
+ VALUE get_size(VALUE self)
53
50
  {
54
51
  CHECK;
55
- return value(THIS->type);
52
+ return value(THIS->size());
56
53
  }
57
54
 
58
55
  static
59
- VALUE pointer_type(VALUE self)
56
+ VALUE is_empty(VALUE self)
60
57
  {
61
58
  CHECK;
62
- return value(THIS->pointer_type);
59
+ return value(THIS->empty());
63
60
  }
64
61
 
65
62
  static
66
- VALUE size(VALUE self)
63
+ VALUE is_captured(VALUE self)
67
64
  {
68
65
  CHECK;
69
- return value(THIS->size);
66
+ return value(THIS->is_captured());
70
67
  }
71
68
 
72
69
  static
73
- VALUE modifiers(VALUE self)
74
- {
75
- CHECK;
76
- return value(THIS->modifiers);
77
- }
78
-
79
- static
80
- VALUE count(VALUE self)
81
- {
82
- CHECK;
83
- return value(THIS->count);
84
- }
85
-
86
- static
87
- VALUE drag(VALUE self)
88
- {
89
- CHECK;
90
- return value(THIS->drag);
91
- }
92
-
93
- static
94
- VALUE capture(VALUE self)
95
- {
96
- CHECK;
97
- return value(THIS->capture);
98
- }
99
-
100
- static
101
- VALUE x(VALUE self)
102
- {
103
- CHECK;
104
- return value(THIS->x);
105
- }
106
-
107
- static
108
- VALUE y(VALUE self)
70
+ VALUE get_at(VALUE self, VALUE index)
109
71
  {
110
72
  CHECK;
111
- return value(THIS->y);
112
- }
113
73
 
114
- static
115
- VALUE position(VALUE self)
116
- {
117
- CHECK;
118
- check_arg_count(__FILE__, __LINE__, "PointerEvent#position", argc, 0, 1);
74
+ int size = (int) THIS->size();
75
+ int i = to<int>(index);
76
+ if (i < -size || size <= i)
77
+ return Qnil;
119
78
 
120
- size_t index = argc >= 1 ? to<int>(argv[0]) : 0;
121
- return value(THIS->position(index));
79
+ return value((*THIS)[i >= 0 ? i : i + size]);
122
80
  }
123
81
 
124
82
  static
125
- VALUE get_at(VALUE self, VALUE index)
83
+ VALUE each(VALUE self)
126
84
  {
127
85
  CHECK;
128
86
 
129
- int i = to<int>(index);
130
- if (i < 0 || THIS->size <= (size_t) i)
131
- index_error(__FILE__, __LINE__);
132
-
133
- return value((*THIS)[i]);
87
+ Value ret;
88
+ for (size_t i = 0, size = THIS->size(); i < size; ++i)
89
+ ret = rb_yield(value((*THIS)[i]));
90
+ return ret;
134
91
  }
135
92
 
136
93
 
@@ -143,29 +100,13 @@ Init_pointer_event ()
143
100
 
144
101
  cPointerEvent = mReflex.define_class("PointerEvent", Reflex::event_class());
145
102
  rb_define_alloc_func(cPointerEvent, alloc);
146
- rb_define_private_method(cPointerEvent, "initialize", RUBY_METHOD_FUNC(initialize), 6);
103
+ rb_define_private_method(cPointerEvent, "initialize", RUBY_METHOD_FUNC(initialize), -1);
147
104
  rb_define_private_method(cPointerEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
148
- rb_define_method(cPointerEvent, "type", RUBY_METHOD_FUNC(type), 0);
149
- rb_define_method(cPointerEvent, "pointer_type", RUBY_METHOD_FUNC(pointer_type), 0);
150
- rb_define_method(cPointerEvent, "size", RUBY_METHOD_FUNC(size), 0);
151
- rb_define_method(cPointerEvent, "modifiers", RUBY_METHOD_FUNC(modifiers), 0);
152
- rb_define_method(cPointerEvent, "count", RUBY_METHOD_FUNC(count), 0);
153
- cPointerEvent.define_method("drag?", drag);
154
- cPointerEvent.define_method("capture?", capture);
155
- rb_define_method(cPointerEvent, "x", RUBY_METHOD_FUNC(x), 0);
156
- rb_define_method(cPointerEvent, "y", RUBY_METHOD_FUNC(y), 0);
157
- rb_define_method(cPointerEvent, "position", RUBY_METHOD_FUNC(position), -1);
158
- cPointerEvent.define_method("[]", get_at);
159
- cPointerEvent.define_const("TYPE_NONE", Reflex::PointerEvent::NONE);
160
- cPointerEvent.define_const("TYPE_DOWN", Reflex::PointerEvent::DOWN);
161
- cPointerEvent.define_const("TYPE_UP", Reflex::PointerEvent::UP);
162
- cPointerEvent.define_const("TYPE_MOVE", Reflex::PointerEvent::MOVE);
163
- cPointerEvent.define_const("POINTER_NONE", Reflex::POINTER_NONE);
164
- cPointerEvent.define_const("POINTER_MOUSE_LEFT", Reflex::POINTER_MOUSE_LEFT);
165
- cPointerEvent.define_const("POINTER_MOUSE_RIGHT", Reflex::POINTER_MOUSE_RIGHT);
166
- cPointerEvent.define_const("POINTER_MOUSE_MIDDLE", Reflex::POINTER_MOUSE_MIDDLE);
167
- cPointerEvent.define_const("POINTER_TOUCH", Reflex::POINTER_TOUCH);
168
- cPointerEvent.define_const("POINTER_PEN", Reflex::POINTER_PEN);
105
+ rb_define_method(cPointerEvent, "size", RUBY_METHOD_FUNC(get_size), 0);
106
+ cPointerEvent.define_method("empty?", is_empty);
107
+ cPointerEvent.define_method("captured?", is_captured);
108
+ cPointerEvent.define_method("[]", get_at);
109
+ rb_define_method(cPointerEvent, "each", RUBY_METHOD_FUNC(each), 0);
169
110
  }
170
111
 
171
112
 
@@ -81,6 +81,13 @@ VALUE each_tag(VALUE self)
81
81
  return ret;
82
82
  }
83
83
 
84
+ static
85
+ VALUE is_empty(VALUE self)
86
+ {
87
+ CHECK;
88
+ return value(C_THIS->empty());
89
+ }
90
+
84
91
  static
85
92
  VALUE contains(VALUE self, VALUE selector)
86
93
  {
@@ -113,6 +120,7 @@ Init_selector ()
113
120
  rb_define_method(cSelector, "clear_tags", RUBY_METHOD_FUNC(clear_tags), 0);
114
121
  cSelector.define_method("tag?", has_tag);
115
122
  rb_define_method(cSelector, "each_tag", RUBY_METHOD_FUNC(each_tag), 0);
123
+ cSelector.define_method("empty?", is_empty);
116
124
  rb_define_method(cSelector, "contains", RUBY_METHOD_FUNC(contains), 1);
117
125
  cSelector.define_method("==", equal);
118
126
  }
@@ -120,6 +120,48 @@ VALUE update_layout(VALUE self)
120
120
  return self;
121
121
  }
122
122
 
123
+ static
124
+ VALUE from_parent(VALUE self, VALUE point)
125
+ {
126
+ CHECK;
127
+ return value(THIS->from_parent(to<Rays::Point>(point)));
128
+ }
129
+
130
+ static
131
+ VALUE to_parent(VALUE self, VALUE point)
132
+ {
133
+ CHECK;
134
+ return value(THIS->to_parent(to<Rays::Point>(point)));
135
+ }
136
+
137
+ static
138
+ VALUE from_window(VALUE self, VALUE point)
139
+ {
140
+ CHECK;
141
+ return value(THIS->from_window(to<Rays::Point>(point)));
142
+ }
143
+
144
+ static
145
+ VALUE to_window(VALUE self, VALUE point)
146
+ {
147
+ CHECK;
148
+ return value(THIS->to_window(to<Rays::Point>(point)));
149
+ }
150
+
151
+ static
152
+ VALUE from_screen(VALUE self, VALUE point)
153
+ {
154
+ CHECK;
155
+ return value(THIS->from_screen(to<Rays::Point>(point)));
156
+ }
157
+
158
+ static
159
+ VALUE to_screen(VALUE self, VALUE point)
160
+ {
161
+ CHECK;
162
+ return value(THIS->to_screen(to<Rays::Point>(point)));
163
+ }
164
+
123
165
  static
124
166
  VALUE add_child(VALUE self, VALUE child)
125
167
  {
@@ -929,6 +971,13 @@ VALUE on_pointer_move(VALUE self, VALUE event)
929
971
  CALL(on_pointer_move(to<Reflex::PointerEvent*>(event)));
930
972
  }
931
973
 
974
+ static
975
+ VALUE on_pointer_cancel(VALUE self, VALUE event)
976
+ {
977
+ CHECK;
978
+ CALL(on_pointer_cancel(to<Reflex::PointerEvent*>(event)));
979
+ }
980
+
932
981
  static
933
982
  VALUE on_wheel(VALUE self, VALUE event)
934
983
  {
@@ -991,6 +1040,13 @@ Init_view ()
991
1040
  rb_define_private_method(cView, "start_timer", RUBY_METHOD_FUNC(start_timer), -1);
992
1041
  rb_define_method(cView, "update_layout", RUBY_METHOD_FUNC(update_layout), 0);
993
1042
 
1043
+ rb_define_method(cView, "from_parent", RUBY_METHOD_FUNC(from_parent), 1);
1044
+ rb_define_method(cView, "to_parent", RUBY_METHOD_FUNC(to_parent), 1);
1045
+ rb_define_method(cView, "from_window", RUBY_METHOD_FUNC(from_window), 1);
1046
+ rb_define_method(cView, "to_window", RUBY_METHOD_FUNC(to_window), 1);
1047
+ rb_define_method(cView, "from_screen", RUBY_METHOD_FUNC(from_screen), 1);
1048
+ rb_define_method(cView, "to_screen", RUBY_METHOD_FUNC(to_screen), 1);
1049
+
994
1050
  rb_define_method(cView, "add_child", RUBY_METHOD_FUNC(add_child), 1);
995
1051
  rb_define_method(cView, "remove_child", RUBY_METHOD_FUNC(remove_child), 1);
996
1052
  rb_define_method(cView, "clear_children", RUBY_METHOD_FUNC(clear_children), 0);
@@ -1093,6 +1149,7 @@ Init_view ()
1093
1149
  rb_define_method(cView, "on_pointer_down", RUBY_METHOD_FUNC(on_pointer_down), 1);
1094
1150
  rb_define_method(cView, "on_pointer_up", RUBY_METHOD_FUNC(on_pointer_up), 1);
1095
1151
  rb_define_method(cView, "on_pointer_move", RUBY_METHOD_FUNC(on_pointer_move), 1);
1152
+ rb_define_method(cView, "on_pointer_cancel", RUBY_METHOD_FUNC(on_pointer_cancel), 1);
1096
1153
  rb_define_method(cView, "on_wheel", RUBY_METHOD_FUNC(on_wheel), 1);
1097
1154
  rb_define_method(cView, "on_capture", RUBY_METHOD_FUNC(on_capture), 1);
1098
1155
  rb_define_method(cView, "on_timer", RUBY_METHOD_FUNC(on_timer), 1);
@@ -54,6 +54,20 @@ VALUE redraw(VALUE self)
54
54
  return self;
55
55
  }
56
56
 
57
+ static
58
+ VALUE from_screen(VALUE self, VALUE point)
59
+ {
60
+ CHECK;
61
+ return value(THIS->from_screen(to<Rays::Point>(point)));
62
+ }
63
+
64
+ static
65
+ VALUE to_screen(VALUE self, VALUE point)
66
+ {
67
+ CHECK;
68
+ return value(THIS->to_screen(to<Rays::Point>(point)));
69
+ }
70
+
57
71
  static
58
72
  VALUE set_title(VALUE self, VALUE title)
59
73
  {
@@ -84,6 +98,21 @@ VALUE get_frame(VALUE self)
84
98
  return value(THIS->frame());
85
99
  }
86
100
 
101
+ static
102
+ VALUE set_resizable(VALUE self, VALUE state)
103
+ {
104
+ CHECK;
105
+ THIS->set_resizable(to<bool>(state));
106
+ return value(THIS->is_resizable());
107
+ }
108
+
109
+ static
110
+ VALUE is_resizable(VALUE self)
111
+ {
112
+ CHECK;
113
+ return value(THIS->is_resizable());
114
+ }
115
+
87
116
  static
88
117
  VALUE hidden(VALUE self)
89
118
  {
@@ -214,6 +243,13 @@ VALUE on_pointer_move(VALUE self, VALUE event)
214
243
  CALL(on_pointer_move(to<Reflex::PointerEvent*>(event)));
215
244
  }
216
245
 
246
+ static
247
+ VALUE on_pointer_cancel(VALUE self, VALUE event)
248
+ {
249
+ CHECK;
250
+ CALL(on_pointer_cancel(to<Reflex::PointerEvent*>(event)));
251
+ }
252
+
217
253
  static
218
254
  VALUE on_wheel(VALUE self, VALUE event)
219
255
  {
@@ -235,10 +271,14 @@ Init_window ()
235
271
  rb_define_method(cWindow, "hide", RUBY_METHOD_FUNC(hide), 0);
236
272
  rb_define_method(cWindow, "close", RUBY_METHOD_FUNC(close), 0);
237
273
  rb_define_method(cWindow, "redraw", RUBY_METHOD_FUNC(redraw), 0);
274
+ rb_define_method(cWindow, "from_screen", RUBY_METHOD_FUNC(from_screen), 1);
275
+ rb_define_method(cWindow, "to_screen", RUBY_METHOD_FUNC(to_screen), 1);
238
276
  rb_define_method(cWindow, "title=", RUBY_METHOD_FUNC(set_title), 1);
239
277
  rb_define_method(cWindow, "title", RUBY_METHOD_FUNC(get_title), 0);
240
278
  rb_define_method(cWindow, "frame=", RUBY_METHOD_FUNC(set_frame), -1);
241
279
  rb_define_method(cWindow, "frame", RUBY_METHOD_FUNC(get_frame), 0);
280
+ rb_define_method(cWindow, "resizable=", RUBY_METHOD_FUNC(set_resizable), 1);
281
+ cWindow.define_method("resizable?", is_resizable);
242
282
  rb_define_method(cWindow, "hidden", RUBY_METHOD_FUNC(hidden), 0);
243
283
  rb_define_method(cWindow, "root", RUBY_METHOD_FUNC(root), 0);
244
284
  rb_define_method(cWindow, "focus", RUBY_METHOD_FUNC(focus), 0);
@@ -257,6 +297,7 @@ Init_window ()
257
297
  rb_define_method(cWindow, "on_pointer_down", RUBY_METHOD_FUNC(on_pointer_down), 1);
258
298
  rb_define_method(cWindow, "on_pointer_up", RUBY_METHOD_FUNC(on_pointer_up), 1);
259
299
  rb_define_method(cWindow, "on_pointer_move", RUBY_METHOD_FUNC(on_pointer_move), 1);
300
+ rb_define_method(cWindow, "on_pointer_cancel", RUBY_METHOD_FUNC(on_pointer_cancel), 1);
260
301
  rb_define_method(cWindow, "on_wheel", RUBY_METHOD_FUNC(on_wheel), 1);
261
302
  }
262
303
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.19
1
+ 0.1.23
@@ -42,7 +42,7 @@ RUCY_DEF1(initialize_copy, obj)
42
42
  RUCY_END
43
43
 
44
44
  static
45
- RUCY_DEF0(type)
45
+ RUCY_DEF0(get_type)
46
46
  {
47
47
  CHECK;
48
48
  return value(THIS->type);
@@ -50,7 +50,7 @@ RUCY_DEF0(type)
50
50
  RUCY_END
51
51
 
52
52
  static
53
- RUCY_DEF0(shape)
53
+ RUCY_DEF0(get_shape)
54
54
  {
55
55
  CHECK;
56
56
  return value(THIS->shape);
@@ -58,7 +58,7 @@ RUCY_DEF0(shape)
58
58
  RUCY_END
59
59
 
60
60
  static
61
- RUCY_DEF0(view)
61
+ RUCY_DEF0(get_view)
62
62
  {
63
63
  CHECK;
64
64
  return value(THIS->view);
@@ -77,9 +77,9 @@ Init_contact_event ()
77
77
  cContactEvent.define_alloc_func(alloc);
78
78
  cContactEvent.define_private_method("initialize", initialize);
79
79
  cContactEvent.define_private_method("initialize_copy", initialize_copy);
80
- cContactEvent.define_method("type", type);
81
- cContactEvent.define_method("shape", shape);
82
- cContactEvent.define_method("view", view);
80
+ cContactEvent.define_method("type", get_type);
81
+ cContactEvent.define_method("shape", get_shape);
82
+ cContactEvent.define_method("view", get_view);
83
83
  cContactEvent.define_const("TYPE_NONE", Reflex::ContactEvent::NONE);
84
84
  cContactEvent.define_const("TYPE_BEGIN", Reflex::ContactEvent::BEGIN);
85
85
  cContactEvent.define_const("TYPE_END", Reflex::ContactEvent::END);
data/ext/reflex/event.cpp CHANGED
@@ -43,6 +43,14 @@ RUCY_DEF0(is_blocked)
43
43
  }
44
44
  RUCY_END
45
45
 
46
+ static
47
+ RUCY_DEF0(get_time)
48
+ {
49
+ CHECK;
50
+ return value(THIS->time());
51
+ }
52
+ RUCY_END
53
+
46
54
 
47
55
  static Class cEvent;
48
56
 
@@ -54,8 +62,9 @@ Init_event ()
54
62
  cEvent = mReflex.define_class("Event");
55
63
  cEvent.define_alloc_func(alloc);
56
64
  cEvent.define_private_method("initialize_copy", initialize_copy);
57
- cEvent.define_method("block", block);
58
- cEvent.define_method("block?", is_blocked);
65
+ cEvent.define_method("block", block);
66
+ cEvent.define_method("blocked?", is_blocked);
67
+ cEvent.define_method("time", get_time);
59
68
  }
60
69
 
61
70
 
@@ -42,7 +42,7 @@ RUCY_DEF1(initialize_copy, obj)
42
42
  RUCY_END
43
43
 
44
44
  static
45
- RUCY_DEF0(type)
45
+ RUCY_DEF0(get_type)
46
46
  {
47
47
  CHECK;
48
48
  return value(THIS->type);
@@ -50,7 +50,7 @@ RUCY_DEF0(type)
50
50
  RUCY_END
51
51
 
52
52
  static
53
- RUCY_DEF0(current)
53
+ RUCY_DEF0(get_current)
54
54
  {
55
55
  CHECK;
56
56
  return THIS->current ? value(THIS->current) : nil();
@@ -58,7 +58,7 @@ RUCY_DEF0(current)
58
58
  RUCY_END
59
59
 
60
60
  static
61
- RUCY_DEF0(last)
61
+ RUCY_DEF0(get_last)
62
62
  {
63
63
  CHECK;
64
64
  return THIS->last ? value(THIS->last) : nil();
@@ -77,9 +77,9 @@ Init_focus_event ()
77
77
  cFocusEvent.define_alloc_func(alloc);
78
78
  cFocusEvent.define_private_method("initialize", initialize);
79
79
  cFocusEvent.define_private_method("initialize_copy", initialize_copy);
80
- cFocusEvent.define_method("type", type);
81
- cFocusEvent.define_method("current", current);
82
- cFocusEvent.define_method("last", last);
80
+ cFocusEvent.define_method("type", get_type);
81
+ cFocusEvent.define_method("current", get_current);
82
+ cFocusEvent.define_method("last", get_last);
83
83
  cFocusEvent.define_const("TYPE_NONE", Reflex::FocusEvent::NONE);
84
84
  cFocusEvent.define_const("TYPE_FOCUS", Reflex::FocusEvent::FOCUS);
85
85
  cFocusEvent.define_const("TYPE_BLUR", Reflex::FocusEvent::BLUR);