reflexion 0.1.23 → 0.1.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.doc/ext/reflex/capture_event.cpp +6 -5
- data/.doc/ext/reflex/contact_event.cpp +14 -12
- data/.doc/ext/reflex/draw_event.cpp +10 -8
- data/.doc/ext/reflex/event.cpp +2 -10
- data/.doc/ext/reflex/focus_event.cpp +14 -13
- data/.doc/ext/reflex/frame_event.cpp +17 -17
- data/.doc/ext/reflex/key_event.cpp +20 -19
- data/.doc/ext/reflex/pointer_event.cpp +1 -1
- data/.doc/ext/reflex/scroll_event.cpp +14 -17
- data/.doc/ext/reflex/timer.cpp +9 -1
- data/.doc/ext/reflex/timer_event.cpp +4 -13
- data/.doc/ext/reflex/update_event.cpp +6 -5
- data/.doc/ext/reflex/wheel_event.cpp +39 -22
- data/VERSION +1 -1
- data/ext/reflex/capture_event.cpp +6 -5
- data/ext/reflex/contact_event.cpp +16 -14
- data/ext/reflex/draw_event.cpp +9 -7
- data/ext/reflex/event.cpp +2 -11
- data/ext/reflex/focus_event.cpp +14 -13
- data/ext/reflex/frame_event.cpp +16 -16
- data/ext/reflex/key_event.cpp +20 -19
- data/ext/reflex/pointer_event.cpp +1 -1
- data/ext/reflex/scroll_event.cpp +15 -18
- data/ext/reflex/timer.cpp +15 -6
- data/ext/reflex/timer_event.cpp +9 -19
- data/ext/reflex/update_event.cpp +6 -5
- data/ext/reflex/wheel_event.cpp +40 -21
- data/include/reflex/event.h +224 -115
- data/include/reflex/shape.h +2 -2
- data/include/reflex/window.h +1 -1
- data/lib/reflex/contact_event.rb +7 -7
- data/lib/reflex/focus_event.rb +8 -8
- data/lib/reflex/key_event.rb +8 -8
- data/lib/reflex/pointer.rb +3 -3
- data/lib/reflex/pointer_event.rb +2 -2
- data/lib/reflex/timer_event.rb +2 -1
- data/lib/reflex/wheel_event.rb +1 -9
- data/lib/reflex/window.rb +1 -1
- data/reflex.gemspec +4 -4
- data/src/event.cpp +630 -76
- data/src/event.h +15 -0
- data/src/image_view.cpp +2 -2
- data/src/ios/app_delegate.h +0 -6
- data/src/ios/app_delegate.mm +1 -0
- data/src/ios/application.mm +6 -0
- data/src/ios/view_controller.mm +15 -9
- data/src/ios/window.mm +2 -4
- data/src/osx/event.h +1 -1
- data/src/osx/event.mm +9 -9
- data/src/osx/native_window.mm +23 -5
- data/src/shape.cpp +11 -13
- data/src/shape.h +1 -1
- data/src/view.cpp +137 -89
- data/src/view.h +5 -6
- data/src/window.cpp +28 -26
- data/src/world.cpp +6 -4
- data/test/test_capture_event.rb +16 -0
- data/test/test_contact_event.rb +40 -0
- data/test/test_draw_event.rb +35 -0
- data/test/test_event.rb +20 -6
- data/test/test_focus_event.rb +34 -0
- data/test/test_frame_event.rb +38 -0
- data/test/test_key_event.rb +33 -0
- data/test/test_pointer.rb +14 -14
- data/test/test_pointer_event.rb +1 -1
- data/test/test_scroll_event.rb +39 -0
- data/test/test_timer_event.rb +38 -0
- data/test/test_update_event.rb +29 -0
- data/test/test_wheel_event.rb +40 -0
- metadata +29 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c0f36ce2f27bdfc704cf1ad8546e18a9acf656ea8c18c16d58a6f50c2a0e037
|
4
|
+
data.tar.gz: f88574b6d37c6a3d6656b185c5ee61708d1c9b5b7492d44732d8774f0027d657
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bc258254bdb5348518da4a25017286cc9b4821008ff219a4e8c87286323e6a3a55c6888b979d1be76d617f9f468700f2d5f0cd65c6bb141734958f02656fac5
|
7
|
+
data.tar.gz: a3bdb07be95f500c100ee3d9dc98defee1d7274ec4ae7f807cfa98c3d15deab74f75dfefb0324c621a9b5f2c141b8a2bad2c886f68b9f68671101638e07c54c6
|
@@ -23,8 +23,9 @@ VALUE initialize(VALUE self, VALUE begin, VALUE end)
|
|
23
23
|
{
|
24
24
|
CHECK;
|
25
25
|
|
26
|
-
THIS
|
27
|
-
|
26
|
+
*THIS = Reflex::CaptureEvent(
|
27
|
+
to<uint>(begin),
|
28
|
+
to<uint>(end));
|
28
29
|
|
29
30
|
return rb_call_super(0, NULL);
|
30
31
|
}
|
@@ -33,7 +34,7 @@ static
|
|
33
34
|
VALUE initialize_copy(VALUE self, VALUE obj)
|
34
35
|
{
|
35
36
|
CHECK;
|
36
|
-
*THIS = to<Reflex::CaptureEvent&>(obj);
|
37
|
+
*THIS = to<Reflex::CaptureEvent&>(obj).dup();
|
37
38
|
return self;
|
38
39
|
}
|
39
40
|
|
@@ -41,14 +42,14 @@ static
|
|
41
42
|
VALUE begin(VALUE self)
|
42
43
|
{
|
43
44
|
CHECK;
|
44
|
-
return value(THIS->begin);
|
45
|
+
return value(THIS->begin());
|
45
46
|
}
|
46
47
|
|
47
48
|
static
|
48
49
|
VALUE end(VALUE self)
|
49
50
|
{
|
50
51
|
CHECK;
|
51
|
-
return value(THIS->end);
|
52
|
+
return value(THIS->end());
|
52
53
|
}
|
53
54
|
|
54
55
|
|
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
#include "reflex/ruby/shape.h"
|
5
5
|
#include "reflex/ruby/view.h"
|
6
|
+
#include "reflex/ruby/shape.h"
|
6
7
|
#include "defs.h"
|
7
8
|
|
8
9
|
|
@@ -20,12 +21,13 @@ VALUE alloc(VALUE klass)
|
|
20
21
|
}
|
21
22
|
|
22
23
|
static
|
23
|
-
VALUE initialize(VALUE self, VALUE
|
24
|
+
VALUE initialize(VALUE self, VALUE action, VALUE shape)
|
24
25
|
{
|
25
26
|
CHECK;
|
26
27
|
|
27
|
-
THIS
|
28
|
-
|
28
|
+
*THIS = Reflex::ContactEvent(
|
29
|
+
(Reflex::ContactEvent::Action) to<uint>(action),
|
30
|
+
to<Reflex::Shape*>(shape));
|
29
31
|
|
30
32
|
return rb_call_super(0, NULL);
|
31
33
|
}
|
@@ -34,29 +36,29 @@ static
|
|
34
36
|
VALUE initialize_copy(VALUE self, VALUE obj)
|
35
37
|
{
|
36
38
|
CHECK;
|
37
|
-
*THIS = to<Reflex::ContactEvent&>(obj);
|
39
|
+
*THIS = to<Reflex::ContactEvent&>(obj).dup();
|
38
40
|
return self;
|
39
41
|
}
|
40
42
|
|
41
43
|
static
|
42
|
-
VALUE
|
44
|
+
VALUE get_action(VALUE self)
|
43
45
|
{
|
44
46
|
CHECK;
|
45
|
-
return value(THIS->
|
47
|
+
return value(THIS->action());
|
46
48
|
}
|
47
49
|
|
48
50
|
static
|
49
51
|
VALUE get_shape(VALUE self)
|
50
52
|
{
|
51
53
|
CHECK;
|
52
|
-
return value(THIS->shape);
|
54
|
+
return value(THIS->shape());
|
53
55
|
}
|
54
56
|
|
55
57
|
static
|
56
58
|
VALUE get_view(VALUE self)
|
57
59
|
{
|
58
60
|
CHECK;
|
59
|
-
return value(THIS->view);
|
61
|
+
return value(THIS->view());
|
60
62
|
}
|
61
63
|
|
62
64
|
|
@@ -71,12 +73,12 @@ Init_contact_event ()
|
|
71
73
|
rb_define_alloc_func(cContactEvent, alloc);
|
72
74
|
rb_define_private_method(cContactEvent, "initialize", RUBY_METHOD_FUNC(initialize), 2);
|
73
75
|
rb_define_private_method(cContactEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
74
|
-
rb_define_method(cContactEvent, "
|
76
|
+
rb_define_method(cContactEvent, "action", RUBY_METHOD_FUNC(get_action), 0);
|
75
77
|
rb_define_method(cContactEvent, "shape", RUBY_METHOD_FUNC(get_shape), 0);
|
76
78
|
rb_define_method(cContactEvent, "view", RUBY_METHOD_FUNC(get_view), 0);
|
77
|
-
cContactEvent.define_const("
|
78
|
-
cContactEvent.define_const("
|
79
|
-
cContactEvent.define_const("
|
79
|
+
cContactEvent.define_const("ACTION_NONE", Reflex::ContactEvent::ACTION_NONE);
|
80
|
+
cContactEvent.define_const("BEGIN", Reflex::ContactEvent::BEGIN);
|
81
|
+
cContactEvent.define_const("END", Reflex::ContactEvent::END);
|
80
82
|
}
|
81
83
|
|
82
84
|
|
@@ -20,11 +20,13 @@ VALUE alloc(VALUE klass)
|
|
20
20
|
}
|
21
21
|
|
22
22
|
static
|
23
|
-
VALUE initialize(VALUE self, VALUE dt)
|
23
|
+
VALUE initialize(VALUE self, VALUE dt, VALUE fps)
|
24
24
|
{
|
25
25
|
CHECK;
|
26
26
|
|
27
|
-
THIS
|
27
|
+
*THIS = Reflex::DrawEvent(
|
28
|
+
to<float>(dt),
|
29
|
+
to<float>(fps));
|
28
30
|
|
29
31
|
return rb_call_super(0, NULL);
|
30
32
|
}
|
@@ -33,7 +35,7 @@ static
|
|
33
35
|
VALUE initialize_copy(VALUE self, VALUE obj)
|
34
36
|
{
|
35
37
|
CHECK;
|
36
|
-
*THIS = to<Reflex::DrawEvent&>(obj);
|
38
|
+
*THIS = to<Reflex::DrawEvent&>(obj).dup();
|
37
39
|
return self;
|
38
40
|
}
|
39
41
|
|
@@ -41,28 +43,28 @@ static
|
|
41
43
|
VALUE painter(VALUE self)
|
42
44
|
{
|
43
45
|
CHECK;
|
44
|
-
return value(THIS->painter);
|
46
|
+
return value(THIS->painter());
|
45
47
|
}
|
46
48
|
|
47
49
|
static
|
48
50
|
VALUE bounds(VALUE self)
|
49
51
|
{
|
50
52
|
CHECK;
|
51
|
-
return value(THIS->bounds);
|
53
|
+
return value(THIS->bounds());
|
52
54
|
}
|
53
55
|
|
54
56
|
static
|
55
57
|
VALUE dt(VALUE self)
|
56
58
|
{
|
57
59
|
CHECK;
|
58
|
-
return value(THIS->dt);
|
60
|
+
return value(THIS->dt());
|
59
61
|
}
|
60
62
|
|
61
63
|
static
|
62
64
|
VALUE fps(VALUE self)
|
63
65
|
{
|
64
66
|
CHECK;
|
65
|
-
return value(THIS->fps);
|
67
|
+
return value(THIS->fps());
|
66
68
|
}
|
67
69
|
|
68
70
|
|
@@ -75,7 +77,7 @@ Init_draw_event ()
|
|
75
77
|
|
76
78
|
cDrawEvent = mReflex.define_class("DrawEvent", Reflex::event_class());
|
77
79
|
rb_define_alloc_func(cDrawEvent, alloc);
|
78
|
-
rb_define_private_method(cDrawEvent, "initialize", RUBY_METHOD_FUNC(initialize),
|
80
|
+
rb_define_private_method(cDrawEvent, "initialize", RUBY_METHOD_FUNC(initialize), 2);
|
79
81
|
rb_define_private_method(cDrawEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
80
82
|
rb_define_method(cDrawEvent, "painter", RUBY_METHOD_FUNC(painter), 0);
|
81
83
|
rb_define_method(cDrawEvent, "bounds", RUBY_METHOD_FUNC(bounds), 0);
|
data/.doc/ext/reflex/event.cpp
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#include "reflex/ruby/event.h"
|
2
2
|
|
3
3
|
|
4
|
+
#include "reflex/exception.h"
|
4
5
|
#include "defs.h"
|
5
6
|
|
6
7
|
|
@@ -14,15 +15,7 @@ RUCY_DEFINE_VALUE_FROM_TO(Reflex::Event)
|
|
14
15
|
static
|
15
16
|
VALUE alloc(VALUE klass)
|
16
17
|
{
|
17
|
-
|
18
|
-
}
|
19
|
-
|
20
|
-
static
|
21
|
-
VALUE initialize_copy(VALUE self, VALUE obj)
|
22
|
-
{
|
23
|
-
CHECK;
|
24
|
-
*THIS = to<Reflex::Event&>(obj);
|
25
|
-
return self;
|
18
|
+
Reflex::reflex_error(__FILE__, __LINE__, "can not instantiate Event class.");
|
26
19
|
}
|
27
20
|
|
28
21
|
static
|
@@ -56,7 +49,6 @@ Init_event ()
|
|
56
49
|
|
57
50
|
cEvent = rb_define_class_under(mReflex, "Event", rb_cObject);
|
58
51
|
rb_define_alloc_func(cEvent, alloc);
|
59
|
-
rb_define_private_method(cEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
60
52
|
rb_define_method(cEvent, "block", RUBY_METHOD_FUNC(block), 0);
|
61
53
|
cEvent.define_method("blocked?", is_blocked);
|
62
54
|
rb_define_method(cEvent, "time", RUBY_METHOD_FUNC(get_time), 0);
|
@@ -19,13 +19,14 @@ VALUE alloc(VALUE klass)
|
|
19
19
|
}
|
20
20
|
|
21
21
|
static
|
22
|
-
VALUE initialize(VALUE self, VALUE
|
22
|
+
VALUE initialize(VALUE self, VALUE action, VALUE current, VALUE last)
|
23
23
|
{
|
24
24
|
CHECK;
|
25
25
|
|
26
|
-
THIS
|
27
|
-
|
28
|
-
|
26
|
+
*THIS = Reflex::FocusEvent(
|
27
|
+
(Reflex::FocusEvent::Action) to<uint>(action),
|
28
|
+
to<Reflex::View*>(current),
|
29
|
+
to<Reflex::View*>(last));
|
29
30
|
|
30
31
|
return rb_call_super(0, NULL);
|
31
32
|
}
|
@@ -34,29 +35,29 @@ static
|
|
34
35
|
VALUE initialize_copy(VALUE self, VALUE obj)
|
35
36
|
{
|
36
37
|
CHECK;
|
37
|
-
*THIS = to<Reflex::FocusEvent&>(obj);
|
38
|
+
*THIS = to<Reflex::FocusEvent&>(obj).dup();
|
38
39
|
return self;
|
39
40
|
}
|
40
41
|
|
41
42
|
static
|
42
|
-
VALUE
|
43
|
+
VALUE get_action(VALUE self)
|
43
44
|
{
|
44
45
|
CHECK;
|
45
|
-
return value(THIS->
|
46
|
+
return value(THIS->action());
|
46
47
|
}
|
47
48
|
|
48
49
|
static
|
49
50
|
VALUE get_current(VALUE self)
|
50
51
|
{
|
51
52
|
CHECK;
|
52
|
-
return THIS->current ? value(THIS->current) : nil();
|
53
|
+
return THIS->current() ? value(THIS->current()) : nil();
|
53
54
|
}
|
54
55
|
|
55
56
|
static
|
56
57
|
VALUE get_last(VALUE self)
|
57
58
|
{
|
58
59
|
CHECK;
|
59
|
-
return THIS->last ? value(THIS->last) : nil();
|
60
|
+
return THIS->last() ? value(THIS->last()) : nil();
|
60
61
|
}
|
61
62
|
|
62
63
|
|
@@ -71,12 +72,12 @@ Init_focus_event ()
|
|
71
72
|
rb_define_alloc_func(cFocusEvent, alloc);
|
72
73
|
rb_define_private_method(cFocusEvent, "initialize", RUBY_METHOD_FUNC(initialize), 3);
|
73
74
|
rb_define_private_method(cFocusEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
74
|
-
rb_define_method(cFocusEvent, "
|
75
|
+
rb_define_method(cFocusEvent, "action", RUBY_METHOD_FUNC(get_action), 0);
|
75
76
|
rb_define_method(cFocusEvent, "current", RUBY_METHOD_FUNC(get_current), 0);
|
76
77
|
rb_define_method(cFocusEvent, "last", RUBY_METHOD_FUNC(get_last), 0);
|
77
|
-
cFocusEvent.define_const("
|
78
|
-
cFocusEvent.define_const("
|
79
|
-
cFocusEvent.define_const("
|
78
|
+
cFocusEvent.define_const("ACTION_NONE", Reflex::FocusEvent::ACTION_NONE);
|
79
|
+
cFocusEvent.define_const("FOCUS", Reflex::FocusEvent::FOCUS);
|
80
|
+
cFocusEvent.define_const("BLUR", Reflex::FocusEvent::BLUR);
|
80
81
|
}
|
81
82
|
|
82
83
|
|
@@ -20,15 +20,15 @@ VALUE alloc(VALUE klass)
|
|
20
20
|
}
|
21
21
|
|
22
22
|
static
|
23
|
-
VALUE initialize(VALUE self, VALUE frame, VALUE dx, VALUE dy, VALUE dwidth, VALUE dheight)
|
23
|
+
VALUE initialize(VALUE self, VALUE frame, VALUE dx, VALUE dy, VALUE dwidth, VALUE dheight, VALUE angle, VALUE dangle)
|
24
24
|
{
|
25
25
|
CHECK;
|
26
26
|
|
27
|
-
THIS
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
*THIS = Reflex::FrameEvent(
|
28
|
+
to<Rays::Bounds>(frame),
|
29
|
+
to<coord>(dx), to<coord>(dy),
|
30
|
+
to<coord>(dwidth), to<coord>(dheight),
|
31
|
+
to<float>(angle), to<float>(dangle));
|
32
32
|
|
33
33
|
return rb_call_super(0, NULL);
|
34
34
|
}
|
@@ -37,7 +37,7 @@ static
|
|
37
37
|
VALUE initialize_copy(VALUE self, VALUE obj)
|
38
38
|
{
|
39
39
|
CHECK;
|
40
|
-
*THIS = to<Reflex::FrameEvent&>(obj);
|
40
|
+
*THIS = to<Reflex::FrameEvent&>(obj).dup();
|
41
41
|
return self;
|
42
42
|
}
|
43
43
|
|
@@ -45,63 +45,63 @@ static
|
|
45
45
|
VALUE frame(VALUE self)
|
46
46
|
{
|
47
47
|
CHECK;
|
48
|
-
return value(THIS->frame);
|
48
|
+
return value(THIS->frame());
|
49
49
|
}
|
50
50
|
|
51
51
|
static
|
52
52
|
VALUE dx(VALUE self)
|
53
53
|
{
|
54
54
|
CHECK;
|
55
|
-
return value(THIS->dx);
|
55
|
+
return value(THIS->dx());
|
56
56
|
}
|
57
57
|
|
58
58
|
static
|
59
59
|
VALUE dy(VALUE self)
|
60
60
|
{
|
61
61
|
CHECK;
|
62
|
-
return value(THIS->dy);
|
62
|
+
return value(THIS->dy());
|
63
63
|
}
|
64
64
|
|
65
65
|
static
|
66
66
|
VALUE dwidth(VALUE self)
|
67
67
|
{
|
68
68
|
CHECK;
|
69
|
-
return value(THIS->dwidth);
|
69
|
+
return value(THIS->dwidth());
|
70
70
|
}
|
71
71
|
|
72
72
|
static
|
73
73
|
VALUE dheight(VALUE self)
|
74
74
|
{
|
75
75
|
CHECK;
|
76
|
-
return value(THIS->dheight);
|
76
|
+
return value(THIS->dheight());
|
77
77
|
}
|
78
78
|
|
79
79
|
static
|
80
80
|
VALUE dposition(VALUE self)
|
81
81
|
{
|
82
82
|
CHECK;
|
83
|
-
return value(Rays::Point(THIS->dx, THIS->dy));
|
83
|
+
return value(Rays::Point(THIS->dx(), THIS->dy()));
|
84
84
|
}
|
85
85
|
|
86
86
|
static
|
87
87
|
VALUE dsize(VALUE self)
|
88
88
|
{
|
89
89
|
CHECK;
|
90
|
-
return value(Rays::Point(THIS->
|
90
|
+
return value(Rays::Point(THIS->dwidth(), THIS->dheight()));
|
91
91
|
}
|
92
92
|
|
93
93
|
static
|
94
94
|
VALUE angle(VALUE self)
|
95
95
|
{
|
96
96
|
CHECK;
|
97
|
-
return value(THIS->angle);
|
97
|
+
return value(THIS->angle());
|
98
98
|
}
|
99
99
|
|
100
100
|
static
|
101
101
|
VALUE dangle(VALUE self)
|
102
102
|
{
|
103
103
|
CHECK;
|
104
|
-
return value(THIS->dangle);
|
104
|
+
return value(THIS->dangle());
|
105
105
|
}
|
106
106
|
|
107
107
|
static
|
@@ -135,7 +135,7 @@ Init_frame_event ()
|
|
135
135
|
|
136
136
|
cFrameEvent = mReflex.define_class("FrameEvent", Reflex::event_class());
|
137
137
|
rb_define_alloc_func(cFrameEvent, alloc);
|
138
|
-
rb_define_private_method(cFrameEvent, "initialize", RUBY_METHOD_FUNC(initialize),
|
138
|
+
rb_define_private_method(cFrameEvent, "initialize", RUBY_METHOD_FUNC(initialize), 7);
|
139
139
|
rb_define_private_method(cFrameEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
140
140
|
rb_define_method(cFrameEvent, "frame", RUBY_METHOD_FUNC(frame), 0);
|
141
141
|
rb_define_method(cFrameEvent, "dx", RUBY_METHOD_FUNC(dx), 0);
|
@@ -18,15 +18,16 @@ VALUE alloc(VALUE klass)
|
|
18
18
|
}
|
19
19
|
|
20
20
|
static
|
21
|
-
VALUE initialize(VALUE self, VALUE
|
21
|
+
VALUE initialize(VALUE self, VALUE action, VALUE chars, VALUE code, VALUE modifiers, VALUE repeat)
|
22
22
|
{
|
23
23
|
CHECK;
|
24
24
|
|
25
|
-
THIS
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
*THIS = Reflex::KeyEvent(
|
26
|
+
(Reflex::KeyEvent::Action) to<uint>(action),
|
27
|
+
chars.c_str(),
|
28
|
+
to<int>(code),
|
29
|
+
to<uint>(modifiers),
|
30
|
+
to<int>(repeat));
|
30
31
|
|
31
32
|
return rb_call_super(0, NULL);
|
32
33
|
}
|
@@ -35,22 +36,22 @@ static
|
|
35
36
|
VALUE initialize_copy(VALUE self, VALUE obj)
|
36
37
|
{
|
37
38
|
CHECK;
|
38
|
-
*THIS = to<Reflex::KeyEvent&>(obj);
|
39
|
+
*THIS = to<Reflex::KeyEvent&>(obj).dup();
|
39
40
|
return self;
|
40
41
|
}
|
41
42
|
|
42
43
|
static
|
43
|
-
VALUE
|
44
|
+
VALUE get_action(VALUE self)
|
44
45
|
{
|
45
46
|
CHECK;
|
46
|
-
return value(THIS->
|
47
|
+
return value(THIS->action());
|
47
48
|
}
|
48
49
|
|
49
50
|
static
|
50
51
|
VALUE get_key(VALUE self)
|
51
52
|
{
|
52
53
|
CHECK;
|
53
|
-
switch (THIS->code)
|
54
|
+
switch (THIS->code())
|
54
55
|
{
|
55
56
|
#define CASE(key) case Reflex::KEY_##key
|
56
57
|
#define SYMBOL1(name) SYMBOL2(_##name, #name)
|
@@ -247,35 +248,35 @@ static
|
|
247
248
|
VALUE get_chars(VALUE self)
|
248
249
|
{
|
249
250
|
CHECK;
|
250
|
-
return value(THIS->chars
|
251
|
+
return value(THIS->chars());
|
251
252
|
}
|
252
253
|
|
253
254
|
static
|
254
255
|
VALUE get_code(VALUE self)
|
255
256
|
{
|
256
257
|
CHECK;
|
257
|
-
return value(THIS->code);
|
258
|
+
return value(THIS->code());
|
258
259
|
}
|
259
260
|
|
260
261
|
static
|
261
262
|
VALUE get_modifiers(VALUE self)
|
262
263
|
{
|
263
264
|
CHECK;
|
264
|
-
return value(THIS->modifiers);
|
265
|
+
return value(THIS->modifiers());
|
265
266
|
}
|
266
267
|
|
267
268
|
static
|
268
269
|
VALUE get_repeat(VALUE self)
|
269
270
|
{
|
270
271
|
CHECK;
|
271
|
-
return value(THIS->repeat);
|
272
|
+
return value(THIS->repeat());
|
272
273
|
}
|
273
274
|
|
274
275
|
static
|
275
276
|
VALUE is_captured(VALUE self)
|
276
277
|
{
|
277
278
|
CHECK;
|
278
|
-
return value(THIS->
|
279
|
+
return value(THIS->is_captured());
|
279
280
|
}
|
280
281
|
|
281
282
|
|
@@ -290,16 +291,16 @@ Init_key_event ()
|
|
290
291
|
rb_define_alloc_func(cKeyEvent, alloc);
|
291
292
|
rb_define_private_method(cKeyEvent, "initialize", RUBY_METHOD_FUNC(initialize), 5);
|
292
293
|
rb_define_private_method(cKeyEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
293
|
-
rb_define_method(cKeyEvent, "
|
294
|
+
rb_define_method(cKeyEvent, "action", RUBY_METHOD_FUNC(get_action), 0);
|
294
295
|
rb_define_method(cKeyEvent, "key", RUBY_METHOD_FUNC(get_key), 0);
|
295
296
|
rb_define_method(cKeyEvent, "chars", RUBY_METHOD_FUNC(get_chars), 0);
|
296
297
|
rb_define_method(cKeyEvent, "code", RUBY_METHOD_FUNC(get_code), 0);
|
297
298
|
rb_define_method(cKeyEvent, "modifiers", RUBY_METHOD_FUNC(get_modifiers), 0);
|
298
299
|
rb_define_method(cKeyEvent, "repeat", RUBY_METHOD_FUNC(get_repeat), 0);
|
299
300
|
cKeyEvent.define_method("captured?", is_captured);
|
300
|
-
cKeyEvent.define_const("
|
301
|
-
cKeyEvent.define_const("
|
302
|
-
cKeyEvent.define_const("
|
301
|
+
cKeyEvent.define_const("ACTION_NONE", Reflex::KeyEvent::ACTION_NONE);
|
302
|
+
cKeyEvent.define_const("DOWN", Reflex::KeyEvent::DOWN);
|
303
|
+
cKeyEvent.define_const("UP", Reflex::KeyEvent::UP);
|
303
304
|
}
|
304
305
|
|
305
306
|
|
@@ -23,12 +23,9 @@ VALUE initialize(VALUE self, VALUE x, VALUE y, VALUE z, VALUE dx, VALUE dy, VALU
|
|
23
23
|
{
|
24
24
|
CHECK;
|
25
25
|
|
26
|
-
THIS
|
27
|
-
|
28
|
-
|
29
|
-
THIS->dx = to<coord>(dx);
|
30
|
-
THIS->dy = to<coord>(dy);
|
31
|
-
THIS->dz = to<coord>(dz);
|
26
|
+
*THIS = Reflex::ScrollEvent(
|
27
|
+
to<coord>( x), to<coord>( y), to<coord>( z),
|
28
|
+
to<coord>(dx), to<coord>(dy), to<coord>(dz));
|
32
29
|
|
33
30
|
return rb_call_super(0, NULL);
|
34
31
|
}
|
@@ -37,7 +34,7 @@ static
|
|
37
34
|
VALUE initialize_copy(VALUE self, VALUE obj)
|
38
35
|
{
|
39
36
|
CHECK;
|
40
|
-
*THIS = to<Reflex::ScrollEvent&>(obj);
|
37
|
+
*THIS = to<Reflex::ScrollEvent&>(obj).dup();
|
41
38
|
return self;
|
42
39
|
}
|
43
40
|
|
@@ -45,56 +42,56 @@ static
|
|
45
42
|
VALUE x(VALUE self)
|
46
43
|
{
|
47
44
|
CHECK;
|
48
|
-
return value(THIS->x);
|
45
|
+
return value(THIS->scroll().x);
|
49
46
|
}
|
50
47
|
|
51
48
|
static
|
52
49
|
VALUE y(VALUE self)
|
53
50
|
{
|
54
51
|
CHECK;
|
55
|
-
return value(THIS->y);
|
52
|
+
return value(THIS->scroll().y);
|
56
53
|
}
|
57
54
|
|
58
55
|
static
|
59
56
|
VALUE z(VALUE self)
|
60
57
|
{
|
61
58
|
CHECK;
|
62
|
-
return value(THIS->z);
|
59
|
+
return value(THIS->scroll().z);
|
63
60
|
}
|
64
61
|
|
65
62
|
static
|
66
63
|
VALUE dx(VALUE self)
|
67
64
|
{
|
68
65
|
CHECK;
|
69
|
-
return value(THIS->
|
66
|
+
return value(THIS->dscroll().x);
|
70
67
|
}
|
71
68
|
|
72
69
|
static
|
73
70
|
VALUE dy(VALUE self)
|
74
71
|
{
|
75
72
|
CHECK;
|
76
|
-
return value(THIS->
|
73
|
+
return value(THIS->dscroll().y);
|
77
74
|
}
|
78
75
|
|
79
76
|
static
|
80
77
|
VALUE dz(VALUE self)
|
81
78
|
{
|
82
79
|
CHECK;
|
83
|
-
return value(THIS->
|
80
|
+
return value(THIS->dscroll().z);
|
84
81
|
}
|
85
82
|
|
86
83
|
static
|
87
84
|
VALUE scroll(VALUE self)
|
88
85
|
{
|
89
86
|
CHECK;
|
90
|
-
return value(
|
87
|
+
return value(THIS->scroll());
|
91
88
|
}
|
92
89
|
|
93
90
|
static
|
94
|
-
VALUE
|
91
|
+
VALUE dscroll(VALUE self)
|
95
92
|
{
|
96
93
|
CHECK;
|
97
|
-
return value(
|
94
|
+
return value(THIS->dscroll());
|
98
95
|
}
|
99
96
|
|
100
97
|
|
@@ -116,7 +113,7 @@ Init_scroll_event ()
|
|
116
113
|
rb_define_method(cScrollEvent, "dy", RUBY_METHOD_FUNC(dy), 0);
|
117
114
|
rb_define_method(cScrollEvent, "dz", RUBY_METHOD_FUNC(dz), 0);
|
118
115
|
rb_define_method(cScrollEvent, "scroll", RUBY_METHOD_FUNC(scroll), 0);
|
119
|
-
rb_define_method(cScrollEvent, "
|
116
|
+
rb_define_method(cScrollEvent, "dscroll", RUBY_METHOD_FUNC(dscroll), 0);
|
120
117
|
}
|
121
118
|
|
122
119
|
|
data/.doc/ext/reflex/timer.cpp
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#include "reflex/ruby/timer.h"
|
2
2
|
|
3
3
|
|
4
|
+
#include "reflex/exception.h"
|
4
5
|
#include "reflex/ruby/view.h"
|
5
6
|
#include "reflex/ruby/selector.h"
|
6
7
|
#include "defs.h"
|
@@ -16,6 +17,12 @@ RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Reflex::Timer)
|
|
16
17
|
#define CALL(fun) RUCY_CALL_SUPER(THIS, fun)
|
17
18
|
|
18
19
|
|
20
|
+
static
|
21
|
+
VALUE alloc(VALUE klass)
|
22
|
+
{
|
23
|
+
Reflex::reflex_error(__FILE__, __LINE__, "can not instantiate Timer class.");
|
24
|
+
}
|
25
|
+
|
19
26
|
static
|
20
27
|
VALUE stop(VALUE self)
|
21
28
|
{
|
@@ -75,13 +82,14 @@ Init_timer ()
|
|
75
82
|
Module mReflex = rb_define_module("Reflex");
|
76
83
|
|
77
84
|
cTimer = rb_define_class_under(mReflex, "Timer", rb_cObject);
|
85
|
+
rb_define_alloc_func(cTimer, alloc);
|
78
86
|
rb_define_method(cTimer, "stop", RUBY_METHOD_FUNC(stop), 0);
|
79
87
|
rb_define_method(cTimer, "owner", RUBY_METHOD_FUNC(get_owner), 0);
|
80
88
|
rb_define_method(cTimer, "id", RUBY_METHOD_FUNC(get_id), 0);
|
81
89
|
rb_define_method(cTimer, "interval", RUBY_METHOD_FUNC(get_interval), 0);
|
82
90
|
rb_define_method(cTimer, "count=", RUBY_METHOD_FUNC(set_count), 1);
|
83
91
|
rb_define_method(cTimer, "count", RUBY_METHOD_FUNC(get_count), 0);
|
84
|
-
cTimer.define_method("
|
92
|
+
cTimer.define_method("finished?", is_finished);
|
85
93
|
|
86
94
|
define_selector_methods<Reflex::Timer>(cTimer);
|
87
95
|
}
|