reflexion 0.1.20 → 0.1.24
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 +18 -16
- data/.doc/ext/reflex/draw_event.cpp +10 -8
- data/.doc/ext/reflex/event.cpp +10 -10
- data/.doc/ext/reflex/focus_event.cpp +18 -17
- data/.doc/ext/reflex/frame_event.cpp +17 -17
- data/.doc/ext/reflex/key_event.cpp +227 -28
- data/.doc/ext/reflex/native.cpp +2 -0
- data/.doc/ext/reflex/pointer.cpp +158 -0
- data/.doc/ext/reflex/pointer_event.cpp +32 -91
- data/.doc/ext/reflex/scroll_event.cpp +14 -17
- data/.doc/ext/reflex/selector.cpp +8 -0
- 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/view.cpp +57 -0
- data/.doc/ext/reflex/wheel_event.cpp +39 -22
- data/.doc/ext/reflex/window.cpp +41 -0
- data/VERSION +1 -1
- data/ext/reflex/capture_event.cpp +6 -5
- data/ext/reflex/contact_event.cpp +18 -16
- data/ext/reflex/draw_event.cpp +9 -7
- data/ext/reflex/event.cpp +11 -11
- data/ext/reflex/focus_event.cpp +18 -17
- data/ext/reflex/frame_event.cpp +16 -16
- data/ext/reflex/key_event.cpp +228 -28
- data/ext/reflex/native.cpp +2 -0
- data/ext/reflex/pointer.cpp +170 -0
- data/ext/reflex/pointer_event.cpp +31 -96
- data/ext/reflex/scroll_event.cpp +15 -18
- data/ext/reflex/selector.cpp +9 -0
- 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/view.cpp +67 -3
- data/ext/reflex/wheel_event.cpp +40 -21
- data/ext/reflex/window.cpp +49 -3
- data/include/reflex/defs.h +140 -106
- data/include/reflex/event.h +232 -124
- data/include/reflex/pointer.h +107 -0
- data/include/reflex/ruby/pointer.h +41 -0
- data/include/reflex/ruby/view.h +9 -0
- data/include/reflex/ruby/window.h +9 -0
- data/include/reflex/selector.h +1 -1
- data/include/reflex/shape.h +2 -2
- data/include/reflex/view.h +6 -4
- data/include/reflex/window.h +14 -8
- data/lib/reflex/application.rb +3 -3
- data/lib/reflex/autoinit.rb +1 -1
- data/lib/reflex/button.rb +7 -7
- data/lib/reflex/capture_event.rb +7 -7
- data/lib/reflex/contact_event.rb +10 -10
- data/lib/reflex/draw_event.rb +2 -2
- data/lib/reflex/ellipse_shape.rb +2 -2
- data/lib/reflex/focus_event.rb +11 -11
- data/lib/reflex/frame_event.rb +5 -5
- data/lib/reflex/helper.rb +20 -20
- data/lib/reflex/image_view.rb +2 -2
- data/lib/reflex/key_event.rb +12 -12
- data/lib/reflex/model.rb +22 -22
- data/lib/reflex/model_owner.rb +7 -7
- data/lib/reflex/model_view.rb +1 -1
- data/lib/reflex/module.rb +5 -5
- data/lib/reflex/pointer.rb +107 -0
- data/lib/reflex/pointer_event.rb +16 -54
- data/lib/reflex/polygon_shape.rb +2 -2
- data/lib/reflex/reflex.rb +3 -3
- data/lib/reflex/scroll_event.rb +1 -1
- data/lib/reflex/selector.rb +4 -4
- data/lib/reflex/shape.rb +13 -13
- data/lib/reflex/style.rb +11 -11
- data/lib/reflex/style_length.rb +1 -1
- data/lib/reflex/text_view.rb +2 -2
- data/lib/reflex/timer.rb +2 -2
- data/lib/reflex/timer_event.rb +3 -2
- data/lib/reflex/update_event.rb +1 -1
- data/lib/reflex/view.rb +32 -32
- data/lib/reflex/wheel_event.rb +2 -10
- data/lib/reflex/window.rb +8 -7
- data/lib/reflex.rb +1 -0
- data/lib/reflexion.rb +17 -17
- data/reflex.gemspec +5 -5
- data/samples/reflexion/noise.rb +1 -1
- data/samples/tree.rb +1 -1
- data/src/event.cpp +792 -86
- data/src/event.h +47 -0
- data/src/image_view.cpp +2 -2
- data/src/ios/event.h +15 -3
- data/src/ios/event.mm +126 -11
- data/src/ios/view_controller.mm +51 -23
- data/src/ios/window.mm +18 -0
- data/src/osx/event.h +15 -4
- data/src/osx/event.mm +214 -24
- data/src/osx/native_window.mm +85 -18
- data/src/osx/window.mm +22 -0
- data/src/pointer.cpp +203 -0
- data/src/pointer.h +26 -0
- data/src/selector.cpp +1 -1
- data/src/shape.cpp +11 -13
- data/src/shape.h +1 -1
- data/src/view.cpp +205 -118
- data/src/view.h +5 -10
- data/src/window.cpp +346 -104
- data/src/window.h +28 -3
- data/src/world.cpp +6 -4
- data/test/helper.rb +3 -3
- data/test/test_application.rb +1 -1
- data/test/test_capture_event.rb +22 -6
- data/test/test_contact_event.rb +40 -0
- data/test/test_draw_event.rb +35 -0
- data/test/test_event.rb +33 -5
- data/test/test_focus_event.rb +34 -0
- data/test/test_frame_event.rb +38 -0
- data/test/test_has_frame.rb +11 -11
- data/test/test_key_event.rb +33 -0
- data/test/test_pointer.rb +149 -0
- data/test/test_pointer_event.rb +70 -104
- data/test/test_reflex.rb +1 -1
- data/test/test_scroll_event.rb +39 -0
- data/test/test_selector.rb +15 -8
- data/test/test_shape.rb +8 -8
- data/test/test_style.rb +13 -13
- data/test/test_style_length.rb +5 -5
- data/test/test_timer_event.rb +38 -0
- data/test/test_update_event.rb +29 -0
- data/test/test_view.rb +57 -30
- data/test/test_wheel_event.rb +40 -0
- data/test/test_window.rb +45 -26
- metadata +64 -35
@@ -0,0 +1,170 @@
|
|
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
|
+
RUCY_DEF_ALLOC(alloc, klass)
|
17
|
+
{
|
18
|
+
return new_type<Reflex::Pointer>(klass);
|
19
|
+
}
|
20
|
+
RUCY_END
|
21
|
+
|
22
|
+
static
|
23
|
+
RUCY_DEF8(initialize,
|
24
|
+
id, type, action, position, modifiers, click_count, drag, time)
|
25
|
+
{
|
26
|
+
CHECK;
|
27
|
+
|
28
|
+
*THIS = Reflex::Pointer(
|
29
|
+
to<Reflex::Pointer::ID>(id),
|
30
|
+
to<uint>(type),
|
31
|
+
(Reflex::Pointer::Action) to<int>(action),
|
32
|
+
to<Rays::Point>(position),
|
33
|
+
to<uint>(modifiers),
|
34
|
+
to<uint>(click_count),
|
35
|
+
to<bool>(drag),
|
36
|
+
to<double>(time));
|
37
|
+
return self;
|
38
|
+
}
|
39
|
+
RUCY_END
|
40
|
+
|
41
|
+
static
|
42
|
+
RUCY_DEF1(initialize_copy, obj)
|
43
|
+
{
|
44
|
+
CHECK;
|
45
|
+
*THIS = to<Reflex::Pointer&>(obj);
|
46
|
+
return self;
|
47
|
+
}
|
48
|
+
RUCY_END
|
49
|
+
|
50
|
+
static
|
51
|
+
RUCY_DEF0(get_id)
|
52
|
+
{
|
53
|
+
CHECK;
|
54
|
+
return value(THIS->id());
|
55
|
+
}
|
56
|
+
RUCY_END
|
57
|
+
|
58
|
+
static
|
59
|
+
RUCY_DEF0(get_type)
|
60
|
+
{
|
61
|
+
CHECK;
|
62
|
+
return value(THIS->type());
|
63
|
+
}
|
64
|
+
RUCY_END
|
65
|
+
|
66
|
+
static
|
67
|
+
RUCY_DEF0(get_action)
|
68
|
+
{
|
69
|
+
CHECK;
|
70
|
+
return value(THIS->action());
|
71
|
+
}
|
72
|
+
RUCY_END
|
73
|
+
|
74
|
+
static
|
75
|
+
RUCY_DEF0(get_position)
|
76
|
+
{
|
77
|
+
CHECK;
|
78
|
+
return value(THIS->position());
|
79
|
+
}
|
80
|
+
RUCY_END
|
81
|
+
|
82
|
+
static
|
83
|
+
RUCY_DEF0(get_modifiers)
|
84
|
+
{
|
85
|
+
CHECK;
|
86
|
+
return value(THIS->modifiers());
|
87
|
+
}
|
88
|
+
RUCY_END
|
89
|
+
|
90
|
+
static
|
91
|
+
RUCY_DEF0(get_click_count)
|
92
|
+
{
|
93
|
+
CHECK;
|
94
|
+
return value(THIS->click_count());
|
95
|
+
}
|
96
|
+
RUCY_END
|
97
|
+
|
98
|
+
static
|
99
|
+
RUCY_DEF0(is_drag)
|
100
|
+
{
|
101
|
+
CHECK;
|
102
|
+
return value(THIS->is_drag());
|
103
|
+
}
|
104
|
+
RUCY_END
|
105
|
+
|
106
|
+
static
|
107
|
+
RUCY_DEF0(get_time)
|
108
|
+
{
|
109
|
+
CHECK;
|
110
|
+
return value(THIS->time());
|
111
|
+
}
|
112
|
+
RUCY_END
|
113
|
+
|
114
|
+
static
|
115
|
+
RUCY_DEF0(get_prev)
|
116
|
+
{
|
117
|
+
CHECK;
|
118
|
+
return value(THIS->prev());
|
119
|
+
}
|
120
|
+
RUCY_END
|
121
|
+
|
122
|
+
|
123
|
+
static Class cPointer;
|
124
|
+
|
125
|
+
void
|
126
|
+
Init_pointer ()
|
127
|
+
{
|
128
|
+
Module mReflex = define_module("Reflex");
|
129
|
+
|
130
|
+
cPointer = mReflex.define_class("Pointer");
|
131
|
+
cPointer.define_alloc_func(alloc);
|
132
|
+
cPointer.define_private_method("initialize", initialize);
|
133
|
+
cPointer.define_private_method("initialize_copy", initialize_copy);
|
134
|
+
cPointer.define_method("id", get_id);
|
135
|
+
cPointer.define_private_method("get_type", get_type);
|
136
|
+
cPointer.define_private_method("get_action", get_action);
|
137
|
+
cPointer.define_method("position", get_position);
|
138
|
+
cPointer.define_method("modifiers", get_modifiers);
|
139
|
+
cPointer.define_method("click_count", get_click_count);
|
140
|
+
cPointer.define_method("drag?", is_drag);
|
141
|
+
cPointer.define_method("time", get_time);
|
142
|
+
cPointer.define_method("prev", get_prev);
|
143
|
+
cPointer.define_const("TYPE_NONE", Reflex::Pointer::TYPE_NONE);
|
144
|
+
cPointer.define_const("MOUSE", Reflex::Pointer::MOUSE);
|
145
|
+
cPointer.define_const("MOUSE_LEFT", Reflex::Pointer::MOUSE_LEFT);
|
146
|
+
cPointer.define_const("MOUSE_RIGHT", Reflex::Pointer::MOUSE_RIGHT);
|
147
|
+
cPointer.define_const("MOUSE_MIDDLE", Reflex::Pointer::MOUSE_MIDDLE);
|
148
|
+
cPointer.define_const("TOUCH", Reflex::Pointer::TOUCH);
|
149
|
+
cPointer.define_const("PEN", Reflex::Pointer::PEN);
|
150
|
+
cPointer.define_const("ACTION_NONE", Reflex::Pointer::ACTION_NONE);
|
151
|
+
cPointer.define_const("DOWN", Reflex::Pointer::DOWN);
|
152
|
+
cPointer.define_const("UP", Reflex::Pointer::UP);
|
153
|
+
cPointer.define_const("MOVE", Reflex::Pointer::MOVE);
|
154
|
+
cPointer.define_const("CANCEL", Reflex::Pointer::CANCEL);
|
155
|
+
cPointer.define_const("STAY", Reflex::Pointer::STAY);
|
156
|
+
}
|
157
|
+
|
158
|
+
|
159
|
+
namespace Reflex
|
160
|
+
{
|
161
|
+
|
162
|
+
|
163
|
+
Class
|
164
|
+
pointer_class ()
|
165
|
+
{
|
166
|
+
return cPointer;
|
167
|
+
}
|
168
|
+
|
169
|
+
|
170
|
+
}// Reflex
|
@@ -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
|
|
@@ -20,23 +22,18 @@ RUCY_DEF_ALLOC(alloc, klass)
|
|
20
22
|
RUCY_END
|
21
23
|
|
22
24
|
static
|
23
|
-
|
25
|
+
RUCY_DEFN(initialize)
|
24
26
|
{
|
25
27
|
CHECK;
|
26
28
|
|
27
|
-
|
28
|
-
if (size <= 0 || Reflex::PointerEvent::MAX < size)
|
29
|
+
if (argc == 0)
|
29
30
|
argument_error(__FILE__, __LINE__);
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
THIS->count = to<uint>(count);
|
35
|
-
THIS->drag = to<bool>(drag);
|
36
|
-
THIS->size = (size_t) size;
|
32
|
+
std::vector<Reflex::Pointer> pointers;
|
33
|
+
for (size_t i = 0; i < argc; ++i)
|
34
|
+
pointers.emplace_back(to<Reflex::Pointer&>(argv[i]));
|
37
35
|
|
38
|
-
|
39
|
-
THIS->positions[i] = to<Rays::Point>(positions[i]);
|
36
|
+
*THIS = Reflex::PointerEvent(&pointers[0], pointers.size());
|
40
37
|
|
41
38
|
return rb_call_super(0, NULL);
|
42
39
|
}
|
@@ -46,104 +43,58 @@ static
|
|
46
43
|
RUCY_DEF1(initialize_copy, obj)
|
47
44
|
{
|
48
45
|
CHECK;
|
49
|
-
*THIS = to<Reflex::PointerEvent&>(obj);
|
46
|
+
*THIS = to<Reflex::PointerEvent&>(obj).dup();
|
50
47
|
return self;
|
51
48
|
}
|
52
49
|
RUCY_END
|
53
50
|
|
54
51
|
static
|
55
|
-
RUCY_DEF0(
|
52
|
+
RUCY_DEF0(get_size)
|
56
53
|
{
|
57
54
|
CHECK;
|
58
|
-
return value(THIS->
|
55
|
+
return value(THIS->size());
|
59
56
|
}
|
60
57
|
RUCY_END
|
61
58
|
|
62
59
|
static
|
63
|
-
RUCY_DEF0(
|
60
|
+
RUCY_DEF0(is_empty)
|
64
61
|
{
|
65
62
|
CHECK;
|
66
|
-
return value(THIS->
|
63
|
+
return value(THIS->empty());
|
67
64
|
}
|
68
65
|
RUCY_END
|
69
66
|
|
70
67
|
static
|
71
|
-
RUCY_DEF0(
|
68
|
+
RUCY_DEF0(is_captured)
|
72
69
|
{
|
73
70
|
CHECK;
|
74
|
-
return value(THIS->
|
71
|
+
return value(THIS->is_captured());
|
75
72
|
}
|
76
73
|
RUCY_END
|
77
74
|
|
78
75
|
static
|
79
|
-
|
80
|
-
{
|
81
|
-
CHECK;
|
82
|
-
return value(THIS->modifiers);
|
83
|
-
}
|
84
|
-
RUCY_END
|
85
|
-
|
86
|
-
static
|
87
|
-
RUCY_DEF0(count)
|
88
|
-
{
|
89
|
-
CHECK;
|
90
|
-
return value(THIS->count);
|
91
|
-
}
|
92
|
-
RUCY_END
|
93
|
-
|
94
|
-
static
|
95
|
-
RUCY_DEF0(drag)
|
96
|
-
{
|
97
|
-
CHECK;
|
98
|
-
return value(THIS->drag);
|
99
|
-
}
|
100
|
-
RUCY_END
|
101
|
-
|
102
|
-
static
|
103
|
-
RUCY_DEF0(capture)
|
104
|
-
{
|
105
|
-
CHECK;
|
106
|
-
return value(THIS->capture);
|
107
|
-
}
|
108
|
-
RUCY_END
|
109
|
-
|
110
|
-
static
|
111
|
-
RUCY_DEF0(x)
|
112
|
-
{
|
113
|
-
CHECK;
|
114
|
-
return value(THIS->x);
|
115
|
-
}
|
116
|
-
RUCY_END
|
117
|
-
|
118
|
-
static
|
119
|
-
RUCY_DEF0(y)
|
76
|
+
RUCY_DEF1(get_at, index)
|
120
77
|
{
|
121
78
|
CHECK;
|
122
|
-
return value(THIS->y);
|
123
|
-
}
|
124
|
-
RUCY_END
|
125
79
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
check_arg_count(__FILE__, __LINE__, "PointerEvent#position", argc, 0, 1);
|
80
|
+
int size = (int) THIS->size();
|
81
|
+
int i = to<int>(index);
|
82
|
+
if (i < -size || size <= i)
|
83
|
+
return Qnil;
|
131
84
|
|
132
|
-
|
133
|
-
return value(THIS->position(index));
|
85
|
+
return value((*THIS)[i >= 0 ? i : i + size]);
|
134
86
|
}
|
135
87
|
RUCY_END
|
136
88
|
|
137
89
|
static
|
138
|
-
|
90
|
+
RUCY_DEF0(each)
|
139
91
|
{
|
140
92
|
CHECK;
|
141
93
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
return value((*THIS)[i]);
|
94
|
+
Value ret;
|
95
|
+
for (size_t i = 0, size = THIS->size(); i < size; ++i)
|
96
|
+
ret = rb_yield(value((*THIS)[i]));
|
97
|
+
return ret;
|
147
98
|
}
|
148
99
|
RUCY_END
|
149
100
|
|
@@ -159,27 +110,11 @@ Init_pointer_event ()
|
|
159
110
|
cPointerEvent.define_alloc_func(alloc);
|
160
111
|
cPointerEvent.define_private_method("initialize", initialize);
|
161
112
|
cPointerEvent.define_private_method("initialize_copy", initialize_copy);
|
162
|
-
cPointerEvent.define_method("
|
163
|
-
cPointerEvent.define_method("
|
164
|
-
cPointerEvent.define_method("
|
165
|
-
cPointerEvent.define_method("
|
166
|
-
cPointerEvent.define_method("
|
167
|
-
cPointerEvent.define_method("drag?", drag);
|
168
|
-
cPointerEvent.define_method("capture?", capture);
|
169
|
-
cPointerEvent.define_method("x", x);
|
170
|
-
cPointerEvent.define_method("y", y);
|
171
|
-
cPointerEvent.define_method("position", position);
|
172
|
-
cPointerEvent.define_method("[]", get_at);
|
173
|
-
cPointerEvent.define_const("TYPE_NONE", Reflex::PointerEvent::NONE);
|
174
|
-
cPointerEvent.define_const("TYPE_DOWN", Reflex::PointerEvent::DOWN);
|
175
|
-
cPointerEvent.define_const("TYPE_UP", Reflex::PointerEvent::UP);
|
176
|
-
cPointerEvent.define_const("TYPE_MOVE", Reflex::PointerEvent::MOVE);
|
177
|
-
cPointerEvent.define_const("POINTER_NONE", Reflex::POINTER_NONE);
|
178
|
-
cPointerEvent.define_const("POINTER_MOUSE_LEFT", Reflex::POINTER_MOUSE_LEFT);
|
179
|
-
cPointerEvent.define_const("POINTER_MOUSE_RIGHT", Reflex::POINTER_MOUSE_RIGHT);
|
180
|
-
cPointerEvent.define_const("POINTER_MOUSE_MIDDLE", Reflex::POINTER_MOUSE_MIDDLE);
|
181
|
-
cPointerEvent.define_const("POINTER_TOUCH", Reflex::POINTER_TOUCH);
|
182
|
-
cPointerEvent.define_const("POINTER_PEN", Reflex::POINTER_PEN);
|
113
|
+
cPointerEvent.define_method("size", get_size);
|
114
|
+
cPointerEvent.define_method("empty?", is_empty);
|
115
|
+
cPointerEvent.define_method("captured?", is_captured);
|
116
|
+
cPointerEvent.define_method("[]", get_at);
|
117
|
+
cPointerEvent.define_method("each", each);
|
183
118
|
}
|
184
119
|
|
185
120
|
|
data/ext/reflex/scroll_event.cpp
CHANGED
@@ -24,12 +24,9 @@ RUCY_DEF6(initialize, x, y, z, dx, dy, dz)
|
|
24
24
|
{
|
25
25
|
CHECK;
|
26
26
|
|
27
|
-
THIS
|
28
|
-
|
29
|
-
|
30
|
-
THIS->dx = to<coord>(dx);
|
31
|
-
THIS->dy = to<coord>(dy);
|
32
|
-
THIS->dz = to<coord>(dz);
|
27
|
+
*THIS = Reflex::ScrollEvent(
|
28
|
+
to<coord>( x), to<coord>( y), to<coord>( z),
|
29
|
+
to<coord>(dx), to<coord>(dy), to<coord>(dz));
|
33
30
|
|
34
31
|
return rb_call_super(0, NULL);
|
35
32
|
}
|
@@ -39,7 +36,7 @@ static
|
|
39
36
|
RUCY_DEF1(initialize_copy, obj)
|
40
37
|
{
|
41
38
|
CHECK;
|
42
|
-
*THIS = to<Reflex::ScrollEvent&>(obj);
|
39
|
+
*THIS = to<Reflex::ScrollEvent&>(obj).dup();
|
43
40
|
return self;
|
44
41
|
}
|
45
42
|
RUCY_END
|
@@ -48,7 +45,7 @@ static
|
|
48
45
|
RUCY_DEF0(x)
|
49
46
|
{
|
50
47
|
CHECK;
|
51
|
-
return value(THIS->x);
|
48
|
+
return value(THIS->scroll().x);
|
52
49
|
}
|
53
50
|
RUCY_END
|
54
51
|
|
@@ -56,7 +53,7 @@ static
|
|
56
53
|
RUCY_DEF0(y)
|
57
54
|
{
|
58
55
|
CHECK;
|
59
|
-
return value(THIS->y);
|
56
|
+
return value(THIS->scroll().y);
|
60
57
|
}
|
61
58
|
RUCY_END
|
62
59
|
|
@@ -64,7 +61,7 @@ static
|
|
64
61
|
RUCY_DEF0(z)
|
65
62
|
{
|
66
63
|
CHECK;
|
67
|
-
return value(THIS->z);
|
64
|
+
return value(THIS->scroll().z);
|
68
65
|
}
|
69
66
|
RUCY_END
|
70
67
|
|
@@ -72,7 +69,7 @@ static
|
|
72
69
|
RUCY_DEF0(dx)
|
73
70
|
{
|
74
71
|
CHECK;
|
75
|
-
return value(THIS->
|
72
|
+
return value(THIS->dscroll().x);
|
76
73
|
}
|
77
74
|
RUCY_END
|
78
75
|
|
@@ -80,7 +77,7 @@ static
|
|
80
77
|
RUCY_DEF0(dy)
|
81
78
|
{
|
82
79
|
CHECK;
|
83
|
-
return value(THIS->
|
80
|
+
return value(THIS->dscroll().y);
|
84
81
|
}
|
85
82
|
RUCY_END
|
86
83
|
|
@@ -88,7 +85,7 @@ static
|
|
88
85
|
RUCY_DEF0(dz)
|
89
86
|
{
|
90
87
|
CHECK;
|
91
|
-
return value(THIS->
|
88
|
+
return value(THIS->dscroll().z);
|
92
89
|
}
|
93
90
|
RUCY_END
|
94
91
|
|
@@ -96,15 +93,15 @@ static
|
|
96
93
|
RUCY_DEF0(scroll)
|
97
94
|
{
|
98
95
|
CHECK;
|
99
|
-
return value(
|
96
|
+
return value(THIS->scroll());
|
100
97
|
}
|
101
98
|
RUCY_END
|
102
99
|
|
103
100
|
static
|
104
|
-
RUCY_DEF0(
|
101
|
+
RUCY_DEF0(dscroll)
|
105
102
|
{
|
106
103
|
CHECK;
|
107
|
-
return value(
|
104
|
+
return value(THIS->dscroll());
|
108
105
|
}
|
109
106
|
RUCY_END
|
110
107
|
|
@@ -126,8 +123,8 @@ Init_scroll_event ()
|
|
126
123
|
cScrollEvent.define_method("dx", dx);
|
127
124
|
cScrollEvent.define_method("dy", dy);
|
128
125
|
cScrollEvent.define_method("dz", dz);
|
129
|
-
cScrollEvent.define_method("scroll",
|
130
|
-
cScrollEvent.define_method("
|
126
|
+
cScrollEvent.define_method( "scroll", scroll);
|
127
|
+
cScrollEvent.define_method("dscroll", dscroll);
|
131
128
|
}
|
132
129
|
|
133
130
|
|
data/ext/reflex/selector.cpp
CHANGED
@@ -90,6 +90,14 @@ RUCY_DEF0(each_tag)
|
|
90
90
|
}
|
91
91
|
RUCY_END
|
92
92
|
|
93
|
+
static
|
94
|
+
RUCY_DEF0(is_empty)
|
95
|
+
{
|
96
|
+
CHECK;
|
97
|
+
return value(C_THIS->empty());
|
98
|
+
}
|
99
|
+
RUCY_END
|
100
|
+
|
93
101
|
static
|
94
102
|
RUCY_DEF1(contains, selector)
|
95
103
|
{
|
@@ -124,6 +132,7 @@ Init_selector ()
|
|
124
132
|
cSelector.define_method("clear_tags", clear_tags);
|
125
133
|
cSelector.define_method("tag?", has_tag);
|
126
134
|
cSelector.define_method("each_tag", each_tag);
|
135
|
+
cSelector.define_method("empty?", is_empty);
|
127
136
|
cSelector.define_method("contains", contains);
|
128
137
|
cSelector.define_method("==", equal);
|
129
138
|
}
|
data/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,13 @@ 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
|
+
RUCY_DEF_ALLOC(alloc, klass)
|
22
|
+
{
|
23
|
+
Reflex::reflex_error(__FILE__, __LINE__, "can not instantiate Timer class.");
|
24
|
+
}
|
25
|
+
RUCY_END
|
26
|
+
|
19
27
|
static
|
20
28
|
RUCY_DEF0(stop)
|
21
29
|
{
|
@@ -82,13 +90,14 @@ Init_timer ()
|
|
82
90
|
Module mReflex = define_module("Reflex");
|
83
91
|
|
84
92
|
cTimer = mReflex.define_class("Timer");
|
93
|
+
cTimer.define_alloc_func(alloc);
|
85
94
|
cTimer.define_method("stop", stop);
|
86
|
-
cTimer.define_method("owner",
|
87
|
-
cTimer.define_method("id",
|
88
|
-
cTimer.define_method("interval",
|
89
|
-
cTimer.define_method("count=",
|
90
|
-
cTimer.define_method("count",
|
91
|
-
cTimer.define_method("
|
95
|
+
cTimer.define_method("owner", get_owner);
|
96
|
+
cTimer.define_method("id", get_id);
|
97
|
+
cTimer.define_method("interval", get_interval);
|
98
|
+
cTimer.define_method("count=", set_count);
|
99
|
+
cTimer.define_method("count", get_count);
|
100
|
+
cTimer.define_method("finished?", is_finished);
|
92
101
|
|
93
102
|
define_selector_methods<Reflex::Timer>(cTimer);
|
94
103
|
}
|
data/ext/reflex/timer_event.cpp
CHANGED
@@ -25,7 +25,7 @@ RUCY_DEF1(initialize, timer)
|
|
25
25
|
{
|
26
26
|
CHECK;
|
27
27
|
|
28
|
-
THIS
|
28
|
+
*THIS = Reflex::TimerEvent(to<Reflex::Timer*>(timer));
|
29
29
|
|
30
30
|
return rb_call_super(0, NULL);
|
31
31
|
}
|
@@ -35,7 +35,7 @@ static
|
|
35
35
|
RUCY_DEF1(initialize_copy, obj)
|
36
36
|
{
|
37
37
|
CHECK;
|
38
|
-
*THIS = to<Reflex::TimerEvent&>(obj);
|
38
|
+
*THIS = to<Reflex::TimerEvent&>(obj).dup();
|
39
39
|
return self;
|
40
40
|
}
|
41
41
|
RUCY_END
|
@@ -44,7 +44,7 @@ static
|
|
44
44
|
RUCY_DEF0(timer)
|
45
45
|
{
|
46
46
|
CHECK;
|
47
|
-
return value(THIS->timer);
|
47
|
+
return value(THIS->timer());
|
48
48
|
}
|
49
49
|
RUCY_END
|
50
50
|
|
@@ -72,15 +72,6 @@ RUCY_DEF0(interval)
|
|
72
72
|
}
|
73
73
|
RUCY_END
|
74
74
|
|
75
|
-
static
|
76
|
-
RUCY_DEF1(set_count, count)
|
77
|
-
{
|
78
|
-
CHECK;
|
79
|
-
THIS->set_count(to<int>(count));
|
80
|
-
return count;
|
81
|
-
}
|
82
|
-
RUCY_END
|
83
|
-
|
84
75
|
static
|
85
76
|
RUCY_DEF0(count)
|
86
77
|
{
|
@@ -109,13 +100,12 @@ Init_timer_event ()
|
|
109
100
|
cTimerEvent.define_alloc_func(alloc);
|
110
101
|
cTimerEvent.define_private_method("initialize", initialize);
|
111
102
|
cTimerEvent.define_private_method("initialize_copy", initialize_copy);
|
112
|
-
cTimerEvent.define_method("timer",
|
113
|
-
cTimerEvent.define_method("owner",
|
114
|
-
cTimerEvent.define_method("id",
|
115
|
-
cTimerEvent.define_method("interval",
|
116
|
-
cTimerEvent.define_method("count
|
117
|
-
cTimerEvent.define_method("
|
118
|
-
cTimerEvent.define_method("finish?", is_finished);
|
103
|
+
cTimerEvent.define_method("timer", timer);
|
104
|
+
cTimerEvent.define_method("owner", owner);
|
105
|
+
cTimerEvent.define_method("id", id);
|
106
|
+
cTimerEvent.define_method("interval", interval);
|
107
|
+
cTimerEvent.define_method("count", count);
|
108
|
+
cTimerEvent.define_method("finished?", is_finished);
|
119
109
|
}
|
120
110
|
|
121
111
|
|
data/ext/reflex/update_event.cpp
CHANGED
@@ -23,8 +23,9 @@ RUCY_DEF2(initialize, now, dt)
|
|
23
23
|
{
|
24
24
|
CHECK;
|
25
25
|
|
26
|
-
THIS
|
27
|
-
|
26
|
+
*THIS = Reflex::UpdateEvent(
|
27
|
+
to<double>(now),
|
28
|
+
to<float>(dt));
|
28
29
|
|
29
30
|
return rb_call_super(0, NULL);
|
30
31
|
}
|
@@ -34,7 +35,7 @@ static
|
|
34
35
|
RUCY_DEF1(initialize_copy, obj)
|
35
36
|
{
|
36
37
|
CHECK;
|
37
|
-
*THIS = to<Reflex::UpdateEvent&>(obj);
|
38
|
+
*THIS = to<Reflex::UpdateEvent&>(obj).dup();
|
38
39
|
return self;
|
39
40
|
}
|
40
41
|
RUCY_END
|
@@ -43,7 +44,7 @@ static
|
|
43
44
|
RUCY_DEF0(now)
|
44
45
|
{
|
45
46
|
CHECK;
|
46
|
-
return value(THIS->now);
|
47
|
+
return value(THIS->now());
|
47
48
|
}
|
48
49
|
RUCY_END
|
49
50
|
|
@@ -51,7 +52,7 @@ static
|
|
51
52
|
RUCY_DEF0(dt)
|
52
53
|
{
|
53
54
|
CHECK;
|
54
|
-
return value(THIS->dt);
|
55
|
+
return value(THIS->dt());
|
55
56
|
}
|
56
57
|
RUCY_END
|
57
58
|
|