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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 677d72a43f7a17301138300a14b259ef99688cff51ffc78dd9b5e265f3dd1138
4
- data.tar.gz: e1d7f5ab950ef7bb9a48fb429fbf4345efda40097b5f4fb1f5da435baa4c1565
3
+ metadata.gz: 5c9de459b494d9ab8e2e94e53a26b0fd9d363a1c66dd442894d0385827634849
4
+ data.tar.gz: 26858625a7e25d0cbba85d7a054ab9426c526997d0eb2ed704b125ee93ba436c
5
5
  SHA512:
6
- metadata.gz: c51257ea8fe427fe3c2631ee394c98280c1cd22e40608d341908e8878f9efcb7d0c3dadb89e9759b43d924f9dcb0e9630ccfe28a2fb54016b5888d9123a23312
7
- data.tar.gz: dcd652695bb9af96a7dce764b796672ee94682b0dc86e3bee3b2e4840f293ecf45a7a8bd97d64dc948730365945afbb80c8f4d7c03edc8f52ddcd0d44d5b64e7
6
+ metadata.gz: 6c0e16849f3de4b39cfe8270f8208b0e6e1f2cae808e3a678f4b79bad2d9a397f741e78474670350de327e54c91fe64f199f6b2dc437635950147a0f91610e5a
7
+ data.tar.gz: 2c38f9a17ec2a0d8a81f067b3326c0dca5bc970d86735ac503238eb458ac8ed8c452bc32042ee96f4a109e78742a8b3107d48237775e4090a08885905e378709
@@ -39,21 +39,21 @@ VALUE initialize_copy(VALUE self, VALUE obj)
39
39
  }
40
40
 
41
41
  static
42
- VALUE type(VALUE self)
42
+ VALUE get_type(VALUE self)
43
43
  {
44
44
  CHECK;
45
45
  return value(THIS->type);
46
46
  }
47
47
 
48
48
  static
49
- VALUE shape(VALUE self)
49
+ VALUE get_shape(VALUE self)
50
50
  {
51
51
  CHECK;
52
52
  return value(THIS->shape);
53
53
  }
54
54
 
55
55
  static
56
- VALUE view(VALUE self)
56
+ VALUE get_view(VALUE self)
57
57
  {
58
58
  CHECK;
59
59
  return value(THIS->view);
@@ -71,9 +71,9 @@ Init_contact_event ()
71
71
  rb_define_alloc_func(cContactEvent, alloc);
72
72
  rb_define_private_method(cContactEvent, "initialize", RUBY_METHOD_FUNC(initialize), 2);
73
73
  rb_define_private_method(cContactEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
74
- rb_define_method(cContactEvent, "type", RUBY_METHOD_FUNC(type), 0);
75
- rb_define_method(cContactEvent, "shape", RUBY_METHOD_FUNC(shape), 0);
76
- rb_define_method(cContactEvent, "view", RUBY_METHOD_FUNC(view), 0);
74
+ rb_define_method(cContactEvent, "type", RUBY_METHOD_FUNC(get_type), 0);
75
+ rb_define_method(cContactEvent, "shape", RUBY_METHOD_FUNC(get_shape), 0);
76
+ rb_define_method(cContactEvent, "view", RUBY_METHOD_FUNC(get_view), 0);
77
77
  cContactEvent.define_const("TYPE_NONE", Reflex::ContactEvent::NONE);
78
78
  cContactEvent.define_const("TYPE_BEGIN", Reflex::ContactEvent::BEGIN);
79
79
  cContactEvent.define_const("TYPE_END", Reflex::ContactEvent::END);
@@ -39,6 +39,13 @@ VALUE is_blocked(VALUE self)
39
39
  return value(THIS->is_blocked());
40
40
  }
41
41
 
42
+ static
43
+ VALUE get_time(VALUE self)
44
+ {
45
+ CHECK;
46
+ return value(THIS->time());
47
+ }
48
+
42
49
 
43
50
  static Class cEvent;
44
51
 
@@ -51,7 +58,8 @@ Init_event ()
51
58
  rb_define_alloc_func(cEvent, alloc);
52
59
  rb_define_private_method(cEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
53
60
  rb_define_method(cEvent, "block", RUBY_METHOD_FUNC(block), 0);
54
- cEvent.define_method("block?", is_blocked);
61
+ cEvent.define_method("blocked?", is_blocked);
62
+ rb_define_method(cEvent, "time", RUBY_METHOD_FUNC(get_time), 0);
55
63
  }
56
64
 
57
65
 
@@ -39,21 +39,21 @@ VALUE initialize_copy(VALUE self, VALUE obj)
39
39
  }
40
40
 
41
41
  static
42
- VALUE type(VALUE self)
42
+ VALUE get_type(VALUE self)
43
43
  {
44
44
  CHECK;
45
45
  return value(THIS->type);
46
46
  }
47
47
 
48
48
  static
49
- VALUE current(VALUE self)
49
+ VALUE get_current(VALUE self)
50
50
  {
51
51
  CHECK;
52
52
  return THIS->current ? value(THIS->current) : nil();
53
53
  }
54
54
 
55
55
  static
56
- VALUE last(VALUE self)
56
+ VALUE get_last(VALUE self)
57
57
  {
58
58
  CHECK;
59
59
  return THIS->last ? value(THIS->last) : nil();
@@ -71,9 +71,9 @@ Init_focus_event ()
71
71
  rb_define_alloc_func(cFocusEvent, alloc);
72
72
  rb_define_private_method(cFocusEvent, "initialize", RUBY_METHOD_FUNC(initialize), 3);
73
73
  rb_define_private_method(cFocusEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
74
- rb_define_method(cFocusEvent, "type", RUBY_METHOD_FUNC(type), 0);
75
- rb_define_method(cFocusEvent, "current", RUBY_METHOD_FUNC(current), 0);
76
- rb_define_method(cFocusEvent, "last", RUBY_METHOD_FUNC(last), 0);
74
+ rb_define_method(cFocusEvent, "type", RUBY_METHOD_FUNC(get_type), 0);
75
+ rb_define_method(cFocusEvent, "current", RUBY_METHOD_FUNC(get_current), 0);
76
+ rb_define_method(cFocusEvent, "last", RUBY_METHOD_FUNC(get_last), 0);
77
77
  cFocusEvent.define_const("TYPE_NONE", Reflex::FocusEvent::NONE);
78
78
  cFocusEvent.define_const("TYPE_FOCUS", Reflex::FocusEvent::FOCUS);
79
79
  cFocusEvent.define_const("TYPE_BLUR", Reflex::FocusEvent::BLUR);
@@ -40,45 +40,242 @@ VALUE initialize_copy(VALUE self, VALUE obj)
40
40
  }
41
41
 
42
42
  static
43
- VALUE type(VALUE self)
43
+ VALUE get_type(VALUE self)
44
44
  {
45
45
  CHECK;
46
46
  return value(THIS->type);
47
47
  }
48
48
 
49
49
  static
50
- VALUE chars(VALUE self)
50
+ VALUE get_key(VALUE self)
51
+ {
52
+ CHECK;
53
+ switch (THIS->code)
54
+ {
55
+ #define CASE(key) case Reflex::KEY_##key
56
+ #define SYMBOL1(name) SYMBOL2(_##name, #name)
57
+ #define SYMBOL2(var, sym) {RUCY_SYMBOL(var, sym); return var.value();}
58
+
59
+ CASE(A): SYMBOL1(a);
60
+ CASE(B): SYMBOL1(b);
61
+ CASE(C): SYMBOL1(c);
62
+ CASE(D): SYMBOL1(d);
63
+ CASE(E): SYMBOL1(e);
64
+ CASE(F): SYMBOL1(f);
65
+ CASE(G): SYMBOL1(g);
66
+ CASE(H): SYMBOL1(h);
67
+ CASE(I): SYMBOL1(i);
68
+ CASE(J): SYMBOL1(j);
69
+ CASE(K): SYMBOL1(k);
70
+ CASE(L): SYMBOL1(l);
71
+ CASE(M): SYMBOL1(m);
72
+ CASE(N): SYMBOL1(n);
73
+ CASE(O): SYMBOL1(o);
74
+ CASE(P): SYMBOL1(p);
75
+ CASE(Q): SYMBOL1(q);
76
+ CASE(R): SYMBOL1(r);
77
+ CASE(S): SYMBOL1(s);
78
+ CASE(T): SYMBOL1(t);
79
+ CASE(U): SYMBOL1(u);
80
+ CASE(V): SYMBOL1(v);
81
+ CASE(W): SYMBOL1(w);
82
+ CASE(X): SYMBOL1(x);
83
+ CASE(Y): SYMBOL1(y);
84
+ CASE(Z): SYMBOL1(z);
85
+
86
+ CASE(0):
87
+ CASE(NUM_0): SYMBOL1(0);
88
+ CASE(1):
89
+ CASE(NUM_1): SYMBOL1(1);
90
+ CASE(2):
91
+ CASE(NUM_2): SYMBOL1(2);
92
+ CASE(3):
93
+ CASE(NUM_3): SYMBOL1(3);
94
+ CASE(4):
95
+ CASE(NUM_4): SYMBOL1(4);
96
+ CASE(5):
97
+ CASE(NUM_5): SYMBOL1(5);
98
+ CASE(6):
99
+ CASE(NUM_6): SYMBOL1(6);
100
+ CASE(7):
101
+ CASE(NUM_7): SYMBOL1(7);
102
+ CASE(8):
103
+ CASE(NUM_8): SYMBOL1(8);
104
+ CASE(9):
105
+ CASE(NUM_9): SYMBOL1(9);
106
+
107
+ CASE(MINUS): SYMBOL1(minus);
108
+ CASE(EQUAL): SYMBOL1(equal);
109
+ CASE(COMMA): SYMBOL1(comma);
110
+ CASE(PERIOD): SYMBOL1(period);
111
+ CASE(SEMICOLON): SYMBOL1(semicolon);
112
+ CASE(QUOTE): SYMBOL1(quote);
113
+ CASE(SLASH): SYMBOL1(slash);
114
+ CASE(BACKSLASH): SYMBOL1(backslash);
115
+ CASE(UNDERSCORE): SYMBOL1(underscore);
116
+ CASE(GRAVE): SYMBOL1(grave);
117
+ CASE(YEN): SYMBOL1(yen);
118
+ CASE(LBRACKET): SYMBOL1(lbracket);
119
+ CASE(RBRACKET): SYMBOL1(rbracket);
120
+
121
+ CASE(ENTER):
122
+ CASE(RETURN): SYMBOL1(enter);
123
+ CASE(SPACE): SYMBOL1(space);
124
+ CASE(TAB): SYMBOL1(tab);
125
+ CASE(DELETE): SYMBOL2(_delete, "delete");
126
+ CASE(BACKSPACE): SYMBOL1(backspace);
127
+ //CASE(INSERT): SYMBOL1(insert);
128
+ CASE(ESCAPE): SYMBOL1(escape);
129
+
130
+ CASE(LEFT): SYMBOL1(left);
131
+ CASE(RIGHT): SYMBOL1(right);
132
+ CASE(UP): SYMBOL1(up);
133
+ CASE(DOWN): SYMBOL1(down);
134
+ CASE(HOME): SYMBOL1(home);
135
+ CASE(END): SYMBOL1(end);
136
+ CASE(PAGEUP): SYMBOL1(pageup);
137
+ CASE(PAGEDOWN): SYMBOL1(pagedown);
138
+
139
+ CASE(LSHIFT):
140
+ CASE(RSHIFT): SYMBOL1(shift);
141
+ CASE(LCONTROL):
142
+ CASE(RCONTROL): SYMBOL1(control);
143
+ //CASE(LALT):
144
+ //CASE(RALT): SYMBOL1(alt);
145
+ //CASE(LWIN):
146
+ //CASE(RWIN): SYMBOL1(win);
147
+ CASE(LCOMMAND):
148
+ CASE(RCOMMAND): SYMBOL1(command);
149
+ CASE(LOPTION):
150
+ CASE(ROPTION): SYMBOL1(option);
151
+ CASE(FUNCTION): SYMBOL1(function);
152
+
153
+ CASE(F1): SYMBOL1(f1);
154
+ CASE(F2): SYMBOL1(f2);
155
+ CASE(F3): SYMBOL1(f3);
156
+ CASE(F4): SYMBOL1(f4);
157
+ CASE(F5): SYMBOL1(f5);
158
+ CASE(F6): SYMBOL1(f6);
159
+ CASE(F7): SYMBOL1(f7);
160
+ CASE(F8): SYMBOL1(f8);
161
+ CASE(F9): SYMBOL1(f9);
162
+ CASE(F10): SYMBOL1(f10);
163
+ CASE(F11): SYMBOL1(f11);
164
+ CASE(F12): SYMBOL1(f12);
165
+ CASE(F13): SYMBOL1(f13);
166
+ CASE(F14): SYMBOL1(f14);
167
+ CASE(F15): SYMBOL1(f15);
168
+ CASE(F16): SYMBOL1(f16);
169
+ CASE(F17): SYMBOL1(f17);
170
+ CASE(F18): SYMBOL1(f18);
171
+ CASE(F19): SYMBOL1(f19);
172
+ CASE(F20): SYMBOL1(f20);
173
+ //CASE(F21): SYMBOL1(f21);
174
+ //CASE(F22): SYMBOL1(f22);
175
+ //CASE(F23): SYMBOL1(f23);
176
+ //CASE(F24): SYMBOL1(f24);
177
+
178
+ CASE(NUM_PLUS): SYMBOL1(plus);
179
+ CASE(NUM_MINUS): SYMBOL1(minus);
180
+ CASE(NUM_MULTIPLY): SYMBOL1(multiply);
181
+ CASE(NUM_DIVIDE): SYMBOL1(divide);
182
+ CASE(NUM_EQUAL): SYMBOL1(equal);
183
+ CASE(NUM_COMMA): SYMBOL1(comma);
184
+ CASE(NUM_DECIMAL): SYMBOL1(decimal);
185
+ CASE(NUM_CLEAR): SYMBOL1(clear);
186
+
187
+ CASE(CAPSLOCK): SYMBOL1(capslock);
188
+ //CASE(NUMLOCK): SYMBOL1(numlock);
189
+ //CASE(SCROLLLOCK): SYMBOL1(scrolllock);
190
+
191
+ //CASE(PRINTSCREEN): SYMBOL1(printscreen);
192
+ //CASE(PAUSE): SYMBOL1(pause);
193
+ //CASE(BREAK): SYMBOL2(_break, "break");
194
+ CASE(SECTION): SYMBOL1(section);
195
+ CASE(HELP): SYMBOL1(help);
196
+
197
+ CASE(IME_EISU): SYMBOL1(eisu);
198
+ CASE(IME_KANA): SYMBOL1(kana);
199
+ //CASE(IME_KANJI): SYMBOL1(kanji);
200
+ //CASE(IME_JUNJA): SYMBOL1(junja);
201
+ //CASE(IME_PROCESS): SYMBOL1(process);
202
+ //CASE(IME_ACCEPT): SYMBOL1(accept);
203
+ //CASE(IME_FINAL): SYMBOL2(_final, "final");
204
+ //CASE(IME_CONVERT): SYMBOL1(convert);
205
+ //CASE(IME_NONCONVERT): SYMBOL1(nonconvert);
206
+ //CASE(IME_MODECHANGE): SYMBOL1(mode_change);
207
+
208
+ CASE(VOLUME_UP): SYMBOL1(volume_up);
209
+ CASE(VOLUME_DOWN): SYMBOL1(volume_down);
210
+ CASE(MUTE): SYMBOL1(mute);
211
+
212
+ //CASE(SLEEP): SYMBOL1(sleep);
213
+ //CASE(EXEC): SYMBOL1(exec);
214
+ //CASE(PRINT): SYMBOL1(print);
215
+ //CASE(APPS): SYMBOL1(apps);
216
+ //CASE(SELECT): SYMBOL1(select);
217
+ //CASE(CLEAR): SYMBOL1(clear);
218
+ //CASE(PLAY): SYMBOL1(play);
219
+ //CASE(ZOOM): SYMBOL1(zoom);
220
+
221
+ //CASE(BROWSER_BACK): SYMBOL1(browser_back);
222
+ //CASE(BROWSER_FORWARD): SYMBOL1(browser_forward);
223
+ //CASE(BROWSER_REFRESH): SYMBOL1(browser_refresh);
224
+ //CASE(BROWSER_STOP): SYMBOL1(browser_stop);
225
+ //CASE(BROWSER_SEARCH): SYMBOL1(browser_search);
226
+ //CASE(BROWSER_FAVORITES): SYMBOL1(browser_favorites);
227
+ //CASE(BROWSER_HOME): SYMBOL1(browser_home);
228
+
229
+ //CASE(MEDIA_NEXT_TRACK): SYMBOL1(media_next);
230
+ //CASE(MEDIA_PREV_TRACK): SYMBOL1(media_prev);
231
+ //CASE(MEDIA_STOP): SYMBOL1(media_stop);
232
+ //CASE(MEDIA_PLAY_PAUSE): SYMBOL1(media_play_stop);
233
+
234
+ //CASE(LAUNCH_MAIL): SYMBOL1(launch_mail);
235
+ //CASE(LAUNCH_MEDIA_SELECT): SYMBOL1(launch_media_select);
236
+ //CASE(LAUNCH_APP1): SYMBOL1(launch_app1);
237
+ //CASE(LAUNCH_APP2): SYMBOL1(launch_app2);
238
+
239
+ #undef CASE
240
+ #undef SYMBOL1
241
+ #undef SYMBOL2
242
+ }
243
+ return nil();
244
+ }
245
+
246
+ static
247
+ VALUE get_chars(VALUE self)
51
248
  {
52
249
  CHECK;
53
250
  return value(THIS->chars.c_str());
54
251
  }
55
252
 
56
253
  static
57
- VALUE code(VALUE self)
254
+ VALUE get_code(VALUE self)
58
255
  {
59
256
  CHECK;
60
257
  return value(THIS->code);
61
258
  }
62
259
 
63
260
  static
64
- VALUE modifiers(VALUE self)
261
+ VALUE get_modifiers(VALUE self)
65
262
  {
66
263
  CHECK;
67
264
  return value(THIS->modifiers);
68
265
  }
69
266
 
70
267
  static
71
- VALUE repeat(VALUE self)
268
+ VALUE get_repeat(VALUE self)
72
269
  {
73
270
  CHECK;
74
271
  return value(THIS->repeat);
75
272
  }
76
273
 
77
274
  static
78
- VALUE capture(VALUE self)
275
+ VALUE is_captured(VALUE self)
79
276
  {
80
277
  CHECK;
81
- return value(THIS->capture);
278
+ return value(THIS->captured);
82
279
  }
83
280
 
84
281
 
@@ -93,12 +290,13 @@ Init_key_event ()
93
290
  rb_define_alloc_func(cKeyEvent, alloc);
94
291
  rb_define_private_method(cKeyEvent, "initialize", RUBY_METHOD_FUNC(initialize), 5);
95
292
  rb_define_private_method(cKeyEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
96
- rb_define_method(cKeyEvent, "type", RUBY_METHOD_FUNC(type), 0);
97
- rb_define_method(cKeyEvent, "chars", RUBY_METHOD_FUNC(chars), 0);
98
- rb_define_method(cKeyEvent, "code", RUBY_METHOD_FUNC(code), 0);
99
- rb_define_method(cKeyEvent, "modifiers", RUBY_METHOD_FUNC(modifiers), 0);
100
- rb_define_method(cKeyEvent, "repeat", RUBY_METHOD_FUNC(repeat), 0);
101
- cKeyEvent.define_method("capture?", capture);
293
+ rb_define_method(cKeyEvent, "type", RUBY_METHOD_FUNC(get_type), 0);
294
+ rb_define_method(cKeyEvent, "key", RUBY_METHOD_FUNC(get_key), 0);
295
+ rb_define_method(cKeyEvent, "chars", RUBY_METHOD_FUNC(get_chars), 0);
296
+ rb_define_method(cKeyEvent, "code", RUBY_METHOD_FUNC(get_code), 0);
297
+ rb_define_method(cKeyEvent, "modifiers", RUBY_METHOD_FUNC(get_modifiers), 0);
298
+ rb_define_method(cKeyEvent, "repeat", RUBY_METHOD_FUNC(get_repeat), 0);
299
+ cKeyEvent.define_method("captured?", is_captured);
102
300
  cKeyEvent.define_const("TYPE_NONE", Reflex::KeyEvent::NONE);
103
301
  cKeyEvent.define_const("TYPE_DOWN", Reflex::KeyEvent::DOWN);
104
302
  cKeyEvent.define_const("TYPE_UP", Reflex::KeyEvent::UP);
@@ -17,6 +17,7 @@ void Init_frame_event ();
17
17
  void Init_scroll_event ();
18
18
  void Init_focus_event ();
19
19
  void Init_key_event ();
20
+ void Init_pointer ();
20
21
  void Init_pointer_event ();
21
22
  void Init_wheel_event ();
22
23
  void Init_capture_event ();
@@ -63,6 +64,7 @@ extern "C" void
63
64
  Init_scroll_event();
64
65
  Init_focus_event();
65
66
  Init_key_event();
67
+ Init_pointer();
66
68
  Init_pointer_event();
67
69
  Init_wheel_event();
68
70
  Init_capture_event();
@@ -0,0 +1,158 @@
1
+ #include "reflex/ruby/pointer.h"
2
+
3
+
4
+ #include <rays/ruby/point.h>
5
+ #include "defs.h"
6
+
7
+
8
+ RUCY_DEFINE_VALUE_FROM_TO(Reflex::Pointer)
9
+
10
+ #define THIS to<Reflex::Pointer*>(self)
11
+
12
+ #define CHECK RUCY_CHECK_OBJ(Reflex::Pointer, self)
13
+
14
+
15
+ static
16
+ VALUE alloc(VALUE klass)
17
+ {
18
+ return new_type<Reflex::Pointer>(klass);
19
+ }
20
+
21
+ static
22
+ VALUE initialize(VALUE self, VALUE
23
+ id, VALUE type, VALUE action, VALUE position, VALUE modifiers, VALUE click_count, VALUE drag, VALUE time)
24
+ {
25
+ CHECK;
26
+
27
+ *THIS = Reflex::Pointer(
28
+ to<Reflex::Pointer::ID>(id),
29
+ to<uint>(type),
30
+ (Reflex::Pointer::Action) to<int>(action),
31
+ to<Rays::Point>(position),
32
+ to<uint>(modifiers),
33
+ to<uint>(click_count),
34
+ to<bool>(drag),
35
+ to<double>(time));
36
+ return self;
37
+ }
38
+
39
+ static
40
+ VALUE initialize_copy(VALUE self, VALUE obj)
41
+ {
42
+ CHECK;
43
+ *THIS = to<Reflex::Pointer&>(obj);
44
+ return self;
45
+ }
46
+
47
+ static
48
+ VALUE get_id(VALUE self)
49
+ {
50
+ CHECK;
51
+ return value(THIS->id());
52
+ }
53
+
54
+ static
55
+ VALUE get_type(VALUE self)
56
+ {
57
+ CHECK;
58
+ return value(THIS->type());
59
+ }
60
+
61
+ static
62
+ VALUE get_action(VALUE self)
63
+ {
64
+ CHECK;
65
+ return value(THIS->action());
66
+ }
67
+
68
+ static
69
+ VALUE get_position(VALUE self)
70
+ {
71
+ CHECK;
72
+ return value(THIS->position());
73
+ }
74
+
75
+ static
76
+ VALUE get_modifiers(VALUE self)
77
+ {
78
+ CHECK;
79
+ return value(THIS->modifiers());
80
+ }
81
+
82
+ static
83
+ VALUE get_click_count(VALUE self)
84
+ {
85
+ CHECK;
86
+ return value(THIS->click_count());
87
+ }
88
+
89
+ static
90
+ VALUE is_drag(VALUE self)
91
+ {
92
+ CHECK;
93
+ return value(THIS->is_drag());
94
+ }
95
+
96
+ static
97
+ VALUE get_time(VALUE self)
98
+ {
99
+ CHECK;
100
+ return value(THIS->time());
101
+ }
102
+
103
+ static
104
+ VALUE get_prev(VALUE self)
105
+ {
106
+ CHECK;
107
+ return value(THIS->prev());
108
+ }
109
+
110
+
111
+ static Class cPointer;
112
+
113
+ void
114
+ Init_pointer ()
115
+ {
116
+ Module mReflex = rb_define_module("Reflex");
117
+
118
+ cPointer = rb_define_class_under(mReflex, "Pointer", rb_cObject);
119
+ rb_define_alloc_func(cPointer, alloc);
120
+ rb_define_private_method(cPointer, "initialize", RUBY_METHOD_FUNC(initialize), 8);
121
+ rb_define_private_method(cPointer, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
122
+ rb_define_method(cPointer, "id", RUBY_METHOD_FUNC(get_id), 0);
123
+ rb_define_private_method(cPointer, "get_type", RUBY_METHOD_FUNC(get_type), 0);
124
+ rb_define_private_method(cPointer, "get_action", RUBY_METHOD_FUNC(get_action), 0);
125
+ rb_define_method(cPointer, "position", RUBY_METHOD_FUNC(get_position), 0);
126
+ rb_define_method(cPointer, "modifiers", RUBY_METHOD_FUNC(get_modifiers), 0);
127
+ rb_define_method(cPointer, "click_count", RUBY_METHOD_FUNC(get_click_count), 0);
128
+ cPointer.define_method("drag?", is_drag);
129
+ rb_define_method(cPointer, "time", RUBY_METHOD_FUNC(get_time), 0);
130
+ rb_define_method(cPointer, "prev", RUBY_METHOD_FUNC(get_prev), 0);
131
+ cPointer.define_const("TYPE_NONE", Reflex::Pointer::TYPE_NONE);
132
+ cPointer.define_const("MOUSE", Reflex::Pointer::MOUSE);
133
+ cPointer.define_const("MOUSE_LEFT", Reflex::Pointer::MOUSE_LEFT);
134
+ cPointer.define_const("MOUSE_RIGHT", Reflex::Pointer::MOUSE_RIGHT);
135
+ cPointer.define_const("MOUSE_MIDDLE", Reflex::Pointer::MOUSE_MIDDLE);
136
+ cPointer.define_const("TOUCH", Reflex::Pointer::TOUCH);
137
+ cPointer.define_const("PEN", Reflex::Pointer::PEN);
138
+ cPointer.define_const("ACTION_NONE", Reflex::Pointer::ACTION_NONE);
139
+ cPointer.define_const("DOWN", Reflex::Pointer::DOWN);
140
+ cPointer.define_const("UP", Reflex::Pointer::UP);
141
+ cPointer.define_const("MOVE", Reflex::Pointer::MOVE);
142
+ cPointer.define_const("CANCEL", Reflex::Pointer::CANCEL);
143
+ cPointer.define_const("STAY", Reflex::Pointer::STAY);
144
+ }
145
+
146
+
147
+ namespace Reflex
148
+ {
149
+
150
+
151
+ Class
152
+ pointer_class ()
153
+ {
154
+ return cPointer;
155
+ }
156
+
157
+
158
+ }// Reflex