reflexion 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.doc/ext/reflex/application.cpp +54 -39
- data/.doc/ext/reflex/capture_event.cpp +87 -0
- data/.doc/ext/reflex/draw_event.cpp +103 -0
- data/.doc/ext/reflex/event.cpp +73 -0
- data/.doc/ext/reflex/focus_event.cpp +98 -0
- data/.doc/ext/reflex/frame_event.cpp +133 -0
- data/.doc/ext/reflex/image_view.cpp +74 -0
- data/.doc/ext/reflex/key_event.cpp +124 -0
- data/.doc/ext/reflex/native.cpp +45 -6
- data/.doc/ext/reflex/pointer_event.cpp +181 -0
- data/.doc/ext/reflex/reflex.cpp +17 -41
- data/.doc/ext/reflex/scroll_event.cpp +141 -0
- data/.doc/ext/reflex/selector.cpp +135 -0
- data/.doc/ext/reflex/style.cpp +253 -0
- data/.doc/ext/reflex/style_length.cpp +133 -0
- data/.doc/ext/reflex/style_length2.cpp +149 -0
- data/.doc/ext/reflex/style_length4.cpp +192 -0
- data/.doc/ext/reflex/update_event.cpp +77 -0
- data/.doc/ext/reflex/view.cpp +408 -88
- data/.doc/ext/reflex/wheel_event.cpp +146 -0
- data/.doc/ext/reflex/window.cpp +95 -92
- data/Rakefile +6 -5
- data/VERSION +1 -1
- data/ext/reflex/application.cpp +67 -49
- data/ext/reflex/capture_event.cpp +92 -0
- data/ext/reflex/draw_event.cpp +110 -0
- data/ext/reflex/event.cpp +77 -0
- data/ext/reflex/extconf.rb +18 -68
- data/ext/reflex/focus_event.cpp +104 -0
- data/ext/reflex/frame_event.cpp +143 -0
- data/ext/reflex/image_view.cpp +77 -0
- data/ext/reflex/key_event.cpp +133 -0
- data/ext/reflex/native.cpp +45 -6
- data/ext/reflex/pointer_event.cpp +195 -0
- data/ext/reflex/reflex.cpp +21 -47
- data/ext/reflex/scroll_event.cpp +152 -0
- data/ext/reflex/selector.cpp +144 -0
- data/ext/reflex/style.cpp +277 -0
- data/ext/reflex/style_length.cpp +140 -0
- data/ext/reflex/style_length2.cpp +157 -0
- data/ext/reflex/style_length4.cpp +204 -0
- data/ext/reflex/update_event.cpp +81 -0
- data/ext/reflex/view.cpp +469 -114
- data/ext/reflex/wheel_event.cpp +158 -0
- data/ext/reflex/window.cpp +130 -123
- data/include/reflex/application.h +12 -7
- data/include/reflex/defs.h +13 -89
- data/include/reflex/event.h +260 -0
- data/include/reflex/exception.h +17 -11
- data/include/reflex/image_view.h +45 -0
- data/include/reflex/reflex.h +2 -6
- data/include/reflex/ruby/application.h +40 -13
- data/include/reflex/ruby/event.h +72 -0
- data/include/reflex/ruby/image_view.h +25 -0
- data/include/reflex/ruby/selector.h +27 -0
- data/include/reflex/ruby/style.h +27 -0
- data/include/reflex/ruby/style_length.h +37 -0
- data/include/reflex/ruby/view.h +193 -38
- data/include/reflex/ruby/window.h +123 -39
- data/include/reflex/ruby.h +3 -2
- data/include/reflex/selector.h +64 -0
- data/include/reflex/style.h +144 -0
- data/include/reflex/style_length.h +147 -0
- data/include/reflex/view.h +182 -19
- data/include/reflex/window.h +35 -19
- data/include/reflex.h +7 -0
- data/lib/reflex/application.rb +14 -5
- data/lib/reflex/arc_shape.rb +20 -0
- data/lib/reflex/button.rb +75 -0
- data/lib/reflex/capture_event.rb +37 -0
- data/lib/reflex/color.rb +13 -0
- data/lib/reflex/color_space.rb +13 -0
- data/lib/reflex/draw_event.rb +19 -0
- data/lib/reflex/ellipse_shape.rb +20 -0
- data/lib/reflex/ext.rb +1 -1
- data/lib/reflex/flags.rb +18 -0
- data/lib/reflex/focus_event.rb +38 -0
- data/lib/reflex/font.rb +13 -0
- data/lib/reflex/frame_event.rb +42 -0
- data/lib/reflex/helper.rb +87 -30
- data/lib/reflex/image_view.rb +25 -0
- data/lib/reflex/key_event.rb +38 -0
- data/lib/reflex/line_shape.rb +20 -0
- data/lib/reflex/list_view.rb +15 -0
- data/lib/reflex/model.rb +149 -0
- data/lib/reflex/model_owner.rb +57 -0
- data/lib/reflex/model_view.rb +22 -0
- data/lib/reflex/module.rb +11 -7
- data/lib/reflex/pointer_event.rb +85 -0
- data/lib/reflex/rect_shape.rb +20 -0
- data/lib/reflex/reflex.rb +13 -2
- data/lib/reflex/scroll_event.rb +19 -0
- data/lib/reflex/selector.rb +31 -0
- data/lib/reflex/shader.rb +13 -0
- data/lib/reflex/shape.rb +34 -0
- data/lib/reflex/style.rb +55 -0
- data/lib/reflex/style_length.rb +30 -0
- data/lib/reflex/style_length2.rb +34 -0
- data/lib/reflex/style_length4.rb +38 -0
- data/lib/reflex/text_view.rb +55 -0
- data/lib/reflex/update_event.rb +19 -0
- data/lib/reflex/view.rb +38 -4
- data/lib/reflex/wheel_event.rb +19 -0
- data/lib/reflex/window.rb +7 -5
- data/lib/reflex.rb +38 -1
- data/lib/reflexion/include.rb +5 -0
- data/lib/reflexion.rb +100 -0
- data/reflex.gemspec +3 -4
- data/samples/app.rb +13 -0
- data/samples/bats.rb +91 -0
- data/samples/checker.rb +36 -0
- data/{examples/ruby/shapes.rb → samples/fans.rb} +12 -16
- data/samples/fps.rb +46 -0
- data/samples/grid.rb +60 -0
- data/{examples/ruby → samples}/hello.rb +14 -16
- data/samples/image.rb +44 -0
- data/samples/ios/hello/hello/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- data/samples/ios/hello/hello/Images.xcassets/LaunchImage.launchimage/Contents.json +51 -0
- data/samples/ios/hello/hello/en.lproj/InfoPlist.strings +2 -0
- data/samples/ios/hello/hello/hello-Info.plist +47 -0
- data/samples/ios/hello/hello/hello-Prefix.pch +10 -0
- data/samples/ios/hello/hello/main.cpp +79 -0
- data/samples/ios/hello/hello.xcodeproj/project.pbxproj +725 -0
- data/{examples/ruby → samples}/key.rb +11 -14
- data/samples/layout.rb +89 -0
- data/samples/model.rb +86 -0
- data/samples/osx/hello/hello/Images.xcassets/AppIcon.appiconset/Contents.json +58 -0
- data/samples/osx/hello/hello/en.lproj/Credits.rtf +29 -0
- data/samples/osx/hello/hello/en.lproj/InfoPlist.strings +2 -0
- data/samples/osx/hello/hello/hello-Info.plist +32 -0
- data/samples/osx/hello/hello/hello-Prefix.pch +3 -0
- data/samples/osx/hello/hello/main.cpp +79 -0
- data/samples/osx/hello/hello.xcodeproj/project.pbxproj +725 -0
- data/samples/reflexion/hello.rb +24 -0
- data/samples/reflexion/paint.rb +40 -0
- data/samples/reflexion/pulse.rb +34 -0
- data/samples/repl.rb +69 -0
- data/samples/shader.rb +41 -0
- data/samples/shapes.rb +30 -0
- data/{examples/ruby → samples}/text.rb +7 -8
- data/samples/tree.rb +71 -0
- data/samples/views.rb +41 -0
- data/samples/visuals.rb +22 -0
- data/src/event.cpp +225 -0
- data/src/exception.cpp +24 -15
- data/src/image_view.cpp +70 -0
- data/src/ios/app_delegate.h +17 -0
- data/src/ios/app_delegate.mm +120 -0
- data/src/ios/application.mm +116 -0
- data/src/{cocoa/applicationdata.h → ios/application_data.h} +6 -6
- data/src/ios/event.h +26 -0
- data/src/ios/event.mm +31 -0
- data/src/ios/native_window.h +37 -0
- data/src/ios/native_window.mm +220 -0
- data/src/ios/opengl_view.h +13 -0
- data/src/ios/opengl_view.mm +131 -0
- data/src/{cocoa → ios}/reflex.mm +8 -12
- data/src/ios/window.mm +303 -0
- data/src/ios/window_data.h +75 -0
- data/src/osx/app_delegate.h +17 -0
- data/src/{cocoa/cocoaapplication.mm → osx/app_delegate.mm} +90 -48
- data/src/osx/application.mm +132 -0
- data/src/osx/application_data.h +45 -0
- data/src/osx/event.h +42 -0
- data/src/osx/event.mm +112 -0
- data/src/osx/native_window.h +26 -0
- data/src/osx/native_window.mm +322 -0
- data/src/{cocoa/openglview.h → osx/opengl_view.h} +0 -4
- data/src/{cocoa/openglview.mm → osx/opengl_view.mm} +66 -23
- data/src/osx/reflex.mm +50 -0
- data/src/osx/window.mm +308 -0
- data/src/osx/window_data.h +75 -0
- data/src/selector.cpp +121 -0
- data/src/style.cpp +576 -0
- data/src/style_length.cpp +341 -0
- data/src/view.cpp +1228 -129
- data/src/win32/application.cpp +1 -1
- data/src/window.cpp +54 -26
- data/test/helper.rb +8 -4
- data/test/test_capture_event.rb +41 -0
- data/test/test_event.rb +20 -0
- data/test/test_has_frame.rb +45 -0
- data/test/test_model.rb +9 -0
- data/test/test_model_owner.rb +9 -0
- data/test/test_selector.rb +75 -0
- data/test/test_style.rb +70 -0
- data/test/test_style_length.rb +38 -0
- data/test/test_style_length2.rb +50 -0
- data/test/test_style_length4.rb +56 -0
- data/test/test_view.rb +97 -23
- data/test/test_window.rb +54 -46
- metadata +205 -84
- data/.doc/ext/reflex/defs.cpp +0 -8
- data/.doc/ext/reflex/key.cpp +0 -122
- data/.doc/ext/reflex/points.cpp +0 -151
- data/.gitignore +0 -14
- data/ChangeLog +0 -8
- data/examples/hello/.gitignore +0 -2
- data/examples/hello/Rakefile +0 -41
- data/examples/hello/main.cpp +0 -18
- data/examples/ruby/app.rb +0 -13
- data/examples/ruby/checker.rb +0 -41
- data/examples/ruby/fps.rb +0 -49
- data/examples/ruby/grid.rb +0 -65
- data/examples/ruby/views.rb +0 -88
- data/examples/ruby/visuals.rb +0 -27
- data/ext/reflex/defs.cpp +0 -8
- data/ext/reflex/key.cpp +0 -129
- data/ext/reflex/points.cpp +0 -161
- data/include/reflex/ruby/key.h +0 -39
- data/include/reflex/ruby/points.h +0 -39
- data/lib/reflex/visuals/string.rb +0 -53
- data/src/cocoa/application.mm +0 -101
- data/src/cocoa/cocoaapplication.h +0 -21
- data/src/cocoa/cocoawindow.h +0 -46
- data/src/cocoa/cocoawindow.mm +0 -230
- data/src/cocoa/defs.h +0 -34
- data/src/cocoa/defs.mm +0 -87
- data/src/cocoa/window.mm +0 -148
- data/src/cocoa/windowdata.h +0 -56
- data/src/defs.cpp +0 -47
- data/src/helper.h +0 -12
- data/src/reflex.cpp +0 -43
- /data/{README → README.md} +0 -0
@@ -0,0 +1,124 @@
|
|
1
|
+
#include "reflex/ruby/event.h"
|
2
|
+
|
3
|
+
|
4
|
+
#include <rucy.h>
|
5
|
+
#include "defs.h"
|
6
|
+
|
7
|
+
|
8
|
+
using namespace Rucy;
|
9
|
+
|
10
|
+
|
11
|
+
static Class cKeyEvent;
|
12
|
+
|
13
|
+
RUCY_DEFINE_VALUE_FROM_TO(Reflex::KeyEvent, cKeyEvent)
|
14
|
+
|
15
|
+
#define THIS to<Reflex::KeyEvent*>(self)
|
16
|
+
|
17
|
+
#define CHECK RUCY_CHECK_OBJ(Reflex::KeyEvent, cKeyEvent, self)
|
18
|
+
|
19
|
+
|
20
|
+
static
|
21
|
+
VALUE alloc(VALUE klass)
|
22
|
+
{
|
23
|
+
return new_type<Reflex::KeyEvent>(klass);
|
24
|
+
}
|
25
|
+
|
26
|
+
static
|
27
|
+
VALUE initialize(VALUE self)
|
28
|
+
{
|
29
|
+
CHECK;
|
30
|
+
check_arg_count(__FILE__, __LINE__, "KeyEvent#initialize", argc, 0, 1, 2, 3, 4, 5);
|
31
|
+
|
32
|
+
THIS->type = (argc >= 1) ? (Reflex::KeyEvent::Type) to<int>(argv[0]) : Reflex::KeyEvent::NONE;
|
33
|
+
THIS->chars = (argc >= 2) ? argv[1].c_str() : NULL;
|
34
|
+
THIS->code = (argc >= 3) ? to<int>(argv[2]) : Reflex::KEY_NONE;
|
35
|
+
THIS->repeat = (argc >= 4) ? to<int>(argv[3]) : 1;
|
36
|
+
THIS->modifiers = (argc >= 5) ? to<uint>(argv[4]) : (uint) Reflex::MOD_NONE;
|
37
|
+
|
38
|
+
return rb_call_super(0, NULL);
|
39
|
+
}
|
40
|
+
|
41
|
+
static
|
42
|
+
VALUE initialize_copy(VALUE self, VALUE obj)
|
43
|
+
{
|
44
|
+
CHECK;
|
45
|
+
*THIS = to<Reflex::KeyEvent&>(obj);
|
46
|
+
return self;
|
47
|
+
}
|
48
|
+
|
49
|
+
static
|
50
|
+
VALUE get_type(VALUE self)
|
51
|
+
{
|
52
|
+
CHECK;
|
53
|
+
return value(THIS->type);
|
54
|
+
}
|
55
|
+
|
56
|
+
static
|
57
|
+
VALUE chars(VALUE self)
|
58
|
+
{
|
59
|
+
CHECK;
|
60
|
+
return value(THIS->chars.c_str());
|
61
|
+
}
|
62
|
+
|
63
|
+
static
|
64
|
+
VALUE code(VALUE self)
|
65
|
+
{
|
66
|
+
CHECK;
|
67
|
+
return value(THIS->code);
|
68
|
+
}
|
69
|
+
|
70
|
+
static
|
71
|
+
VALUE modifiers(VALUE self)
|
72
|
+
{
|
73
|
+
CHECK;
|
74
|
+
return value(THIS->modifiers);
|
75
|
+
}
|
76
|
+
|
77
|
+
static
|
78
|
+
VALUE repeat(VALUE self)
|
79
|
+
{
|
80
|
+
CHECK;
|
81
|
+
return value(THIS->repeat);
|
82
|
+
}
|
83
|
+
|
84
|
+
static
|
85
|
+
VALUE capture(VALUE self)
|
86
|
+
{
|
87
|
+
CHECK;
|
88
|
+
return value(THIS->capture);
|
89
|
+
}
|
90
|
+
|
91
|
+
|
92
|
+
void
|
93
|
+
Init_key_event ()
|
94
|
+
{
|
95
|
+
Module mReflex = rb_define_module("Reflex");
|
96
|
+
|
97
|
+
cKeyEvent = mReflex.define_class("KeyEvent", Reflex::event_class());
|
98
|
+
rb_define_alloc_func(cKeyEvent, alloc);
|
99
|
+
rb_define_private_method(cKeyEvent, "initialize", RUBY_METHOD_FUNC(initialize), -1);
|
100
|
+
rb_define_private_method(cKeyEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
101
|
+
rb_define_method(cKeyEvent, "get_type", RUBY_METHOD_FUNC(get_type), 0);
|
102
|
+
rb_define_method(cKeyEvent, "chars", RUBY_METHOD_FUNC(chars), 0);
|
103
|
+
rb_define_method(cKeyEvent, "code", RUBY_METHOD_FUNC(code), 0);
|
104
|
+
rb_define_method(cKeyEvent, "modifiers", RUBY_METHOD_FUNC(modifiers), 0);
|
105
|
+
rb_define_method(cKeyEvent, "repeat", RUBY_METHOD_FUNC(repeat), 0);
|
106
|
+
cKeyEvent.define_method("capture?", capture);
|
107
|
+
cKeyEvent.define_const("TYPE_NONE", Reflex::KeyEvent::NONE);
|
108
|
+
cKeyEvent.define_const("TYPE_DOWN", Reflex::KeyEvent::DOWN);
|
109
|
+
cKeyEvent.define_const("TYPE_UP", Reflex::KeyEvent::UP);
|
110
|
+
}
|
111
|
+
|
112
|
+
|
113
|
+
namespace Reflex
|
114
|
+
{
|
115
|
+
|
116
|
+
|
117
|
+
Class
|
118
|
+
key_event_class ()
|
119
|
+
{
|
120
|
+
return cKeyEvent;
|
121
|
+
}
|
122
|
+
|
123
|
+
|
124
|
+
}// Reflex
|
data/.doc/ext/reflex/native.cpp
CHANGED
@@ -6,23 +6,62 @@ using namespace Rucy;
|
|
6
6
|
|
7
7
|
|
8
8
|
void Init_reflex ();
|
9
|
-
|
10
|
-
void
|
9
|
+
|
10
|
+
void Init_selector ();
|
11
|
+
void Init_style ();
|
12
|
+
void Init_style_length ();
|
13
|
+
void Init_style_length2 ();
|
14
|
+
void Init_style_length4 ();
|
15
|
+
|
16
|
+
void Init_event ();
|
17
|
+
void Init_update_event ();
|
18
|
+
void Init_draw_event ();
|
19
|
+
void Init_frame_event ();
|
20
|
+
void Init_scroll_event ();
|
21
|
+
void Init_focus_event ();
|
22
|
+
void Init_key_event ();
|
23
|
+
void Init_pointer_event ();
|
24
|
+
void Init_wheel_event ();
|
25
|
+
void Init_capture_event ();
|
26
|
+
|
11
27
|
void Init_application ();
|
12
28
|
void Init_window ();
|
13
29
|
void Init_view ();
|
14
30
|
|
31
|
+
void Init_image_view ();
|
32
|
+
|
15
33
|
|
16
34
|
extern "C" void
|
17
35
|
Init_native ()
|
18
36
|
{
|
19
|
-
|
20
|
-
|
37
|
+
RUCY_TRY
|
38
|
+
|
39
|
+
Rucy::init();
|
21
40
|
|
22
41
|
Init_reflex();
|
23
|
-
|
24
|
-
|
42
|
+
|
43
|
+
Init_selector();
|
44
|
+
Init_style();
|
45
|
+
Init_style_length();
|
46
|
+
Init_style_length2();
|
47
|
+
Init_style_length4();
|
48
|
+
|
49
|
+
Init_event();
|
50
|
+
Init_update_event();
|
51
|
+
Init_draw_event();
|
52
|
+
Init_frame_event();
|
53
|
+
Init_scroll_event();
|
54
|
+
Init_focus_event();
|
55
|
+
Init_key_event();
|
56
|
+
Init_pointer_event();
|
57
|
+
Init_wheel_event();
|
58
|
+
Init_capture_event();
|
59
|
+
|
25
60
|
Init_application();
|
26
61
|
Init_window();
|
27
62
|
Init_view();
|
63
|
+
|
64
|
+
Init_image_view();
|
65
|
+
|
66
|
+
RUCY_CATCH
|
28
67
|
}
|
@@ -0,0 +1,181 @@
|
|
1
|
+
#include "reflex/ruby/event.h"
|
2
|
+
|
3
|
+
|
4
|
+
#include <rucy.h>
|
5
|
+
#include <rays/ruby/point.h>
|
6
|
+
#include "defs.h"
|
7
|
+
|
8
|
+
|
9
|
+
using namespace Rucy;
|
10
|
+
|
11
|
+
using Reflex::coord;
|
12
|
+
|
13
|
+
|
14
|
+
static Class cPointerEvent;
|
15
|
+
|
16
|
+
RUCY_DEFINE_VALUE_FROM_TO(Reflex::PointerEvent, cPointerEvent)
|
17
|
+
|
18
|
+
#define THIS to<Reflex::PointerEvent*>(self)
|
19
|
+
|
20
|
+
#define CHECK RUCY_CHECK_OBJ(Reflex::PointerEvent, cPointerEvent, self)
|
21
|
+
|
22
|
+
|
23
|
+
static
|
24
|
+
VALUE alloc(VALUE klass)
|
25
|
+
{
|
26
|
+
return new_type<Reflex::PointerEvent>(klass);
|
27
|
+
}
|
28
|
+
|
29
|
+
static
|
30
|
+
VALUE initialize(VALUE self)
|
31
|
+
{
|
32
|
+
CHECK;
|
33
|
+
check_arg_count(__FILE__, __LINE__, "PointerEvent#initialize", argc, 0, 1, 2, 3, 4, 5, 6, 7);
|
34
|
+
|
35
|
+
THIS->type = (argc >= 1) ? (Reflex::PointerEvent::Type) to<int>(argv[0]) : Reflex::PointerEvent::NONE;
|
36
|
+
THIS->pointer_type = (argc >= 2) ? to<uint>(argv[1]) : Reflex::POINTER_NONE;
|
37
|
+
THIS->x = (argc >= 3) ? to<coord>(argv[2]) : 0;
|
38
|
+
THIS->y = (argc >= 4) ? to<coord>(argv[3]) : 0;
|
39
|
+
THIS->size = 1;
|
40
|
+
THIS->modifiers = (argc >= 5) ? to<uint>(argv[4]) : (uint) Reflex::MOD_NONE;
|
41
|
+
THIS->count = (argc >= 6) ? to<uint>(argv[5]) : 0;
|
42
|
+
THIS->drag = (argc >= 7) ? to<bool>(argv[6]) : false;
|
43
|
+
|
44
|
+
return rb_call_super(0, NULL);
|
45
|
+
}
|
46
|
+
|
47
|
+
static
|
48
|
+
VALUE initialize_copy(VALUE self, VALUE obj)
|
49
|
+
{
|
50
|
+
CHECK;
|
51
|
+
*THIS = to<Reflex::PointerEvent&>(obj);
|
52
|
+
return self;
|
53
|
+
}
|
54
|
+
|
55
|
+
static
|
56
|
+
VALUE get_type(VALUE self)
|
57
|
+
{
|
58
|
+
CHECK;
|
59
|
+
return value(THIS->type);
|
60
|
+
}
|
61
|
+
|
62
|
+
static
|
63
|
+
VALUE get_pointer_type(VALUE self)
|
64
|
+
{
|
65
|
+
CHECK;
|
66
|
+
return value(THIS->pointer_type);
|
67
|
+
}
|
68
|
+
|
69
|
+
static
|
70
|
+
VALUE size(VALUE self)
|
71
|
+
{
|
72
|
+
CHECK;
|
73
|
+
return value(THIS->size);
|
74
|
+
}
|
75
|
+
|
76
|
+
static
|
77
|
+
VALUE modifiers(VALUE self)
|
78
|
+
{
|
79
|
+
CHECK;
|
80
|
+
return value(THIS->modifiers);
|
81
|
+
}
|
82
|
+
|
83
|
+
static
|
84
|
+
VALUE count(VALUE self)
|
85
|
+
{
|
86
|
+
CHECK;
|
87
|
+
return value(THIS->count);
|
88
|
+
}
|
89
|
+
|
90
|
+
static
|
91
|
+
VALUE drag(VALUE self)
|
92
|
+
{
|
93
|
+
CHECK;
|
94
|
+
return value(THIS->drag);
|
95
|
+
}
|
96
|
+
|
97
|
+
static
|
98
|
+
VALUE capture(VALUE self)
|
99
|
+
{
|
100
|
+
CHECK;
|
101
|
+
return value(THIS->capture);
|
102
|
+
}
|
103
|
+
|
104
|
+
static
|
105
|
+
VALUE x(VALUE self)
|
106
|
+
{
|
107
|
+
CHECK;
|
108
|
+
return value(THIS->x);
|
109
|
+
}
|
110
|
+
|
111
|
+
static
|
112
|
+
VALUE y(VALUE self)
|
113
|
+
{
|
114
|
+
CHECK;
|
115
|
+
return value(THIS->y);
|
116
|
+
}
|
117
|
+
|
118
|
+
static
|
119
|
+
VALUE position(VALUE self)
|
120
|
+
{
|
121
|
+
CHECK;
|
122
|
+
check_arg_count(__FILE__, __LINE__, "PointerEvent#position", argc, 0, 1);
|
123
|
+
|
124
|
+
size_t index = argc >= 1 ? to<int>(argv[0]) : 0;
|
125
|
+
return value(THIS->position(index));
|
126
|
+
}
|
127
|
+
|
128
|
+
static
|
129
|
+
VALUE array_get(VALUE self, VALUE index)
|
130
|
+
{
|
131
|
+
CHECK;
|
132
|
+
return value((*THIS)[index.to_i()]);
|
133
|
+
}
|
134
|
+
|
135
|
+
|
136
|
+
void
|
137
|
+
Init_pointer_event ()
|
138
|
+
{
|
139
|
+
Module mReflex = rb_define_module("Reflex");
|
140
|
+
|
141
|
+
cPointerEvent = mReflex.define_class("PointerEvent", Reflex::event_class());
|
142
|
+
rb_define_alloc_func(cPointerEvent, alloc);
|
143
|
+
rb_define_private_method(cPointerEvent, "initialize", RUBY_METHOD_FUNC(initialize), -1);
|
144
|
+
rb_define_private_method(cPointerEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
145
|
+
rb_define_method(cPointerEvent, "get_type", RUBY_METHOD_FUNC(get_type), 0);
|
146
|
+
rb_define_method(cPointerEvent, "get_pointer_type", RUBY_METHOD_FUNC(get_pointer_type), 0);
|
147
|
+
rb_define_method(cPointerEvent, "size", RUBY_METHOD_FUNC(size), 0);
|
148
|
+
rb_define_method(cPointerEvent, "modifiers", RUBY_METHOD_FUNC(modifiers), 0);
|
149
|
+
rb_define_method(cPointerEvent, "count", RUBY_METHOD_FUNC(count), 0);
|
150
|
+
cPointerEvent.define_method("drag?", drag);
|
151
|
+
cPointerEvent.define_method("capture?", capture);
|
152
|
+
rb_define_method(cPointerEvent, "x", RUBY_METHOD_FUNC(x), 0);
|
153
|
+
rb_define_method(cPointerEvent, "y", RUBY_METHOD_FUNC(y), 0);
|
154
|
+
rb_define_method(cPointerEvent, "position", RUBY_METHOD_FUNC(position), -1);
|
155
|
+
cPointerEvent.define_method("[]", array_get);
|
156
|
+
cPointerEvent.define_const("TYPE_NONE", Reflex::PointerEvent::NONE);
|
157
|
+
cPointerEvent.define_const("TYPE_DOWN", Reflex::PointerEvent::DOWN);
|
158
|
+
cPointerEvent.define_const("TYPE_UP", Reflex::PointerEvent::UP);
|
159
|
+
cPointerEvent.define_const("TYPE_MOVE", Reflex::PointerEvent::MOVE);
|
160
|
+
cPointerEvent.define_const("POINTER_NONE", Reflex::POINTER_NONE);
|
161
|
+
cPointerEvent.define_const("POINTER_MOUSE_LEFT", Reflex::POINTER_MOUSE_LEFT);
|
162
|
+
cPointerEvent.define_const("POINTER_MOUSE_RIGHT", Reflex::POINTER_MOUSE_RIGHT);
|
163
|
+
cPointerEvent.define_const("POINTER_MOUSE_MIDDLE", Reflex::POINTER_MOUSE_MIDDLE);
|
164
|
+
cPointerEvent.define_const("POINTER_TOUCH", Reflex::POINTER_TOUCH);
|
165
|
+
cPointerEvent.define_const("POINTER_PEN", Reflex::POINTER_PEN);
|
166
|
+
cPointerEvent.define_const("POINTER_TYPE_LAST", Reflex::POINTER_TYPE_LAST);
|
167
|
+
}
|
168
|
+
|
169
|
+
|
170
|
+
namespace Reflex
|
171
|
+
{
|
172
|
+
|
173
|
+
|
174
|
+
Class
|
175
|
+
pointer_event_class ()
|
176
|
+
{
|
177
|
+
return cPointerEvent;
|
178
|
+
}
|
179
|
+
|
180
|
+
|
181
|
+
}// Reflex
|
data/.doc/ext/reflex/reflex.cpp
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#include <rucy.h>
|
2
|
-
#include
|
2
|
+
#include "reflex/reflex.h"
|
3
3
|
#include "defs.h"
|
4
4
|
|
5
5
|
|
@@ -9,53 +9,17 @@ using namespace Rucy;
|
|
9
9
|
static Module mReflex;
|
10
10
|
|
11
11
|
|
12
|
-
namespace Reflex
|
13
|
-
{
|
14
|
-
|
15
|
-
|
16
|
-
Module
|
17
|
-
reflex_module ()
|
18
|
-
{
|
19
|
-
return mReflex;
|
20
|
-
}
|
21
|
-
|
22
|
-
|
23
|
-
}// Reflex
|
24
|
-
|
25
|
-
|
26
12
|
static
|
27
13
|
VALUE init(VALUE self)
|
28
14
|
{
|
29
|
-
|
30
|
-
reflex_error("Reflex::init() failed.");
|
31
|
-
|
15
|
+
Reflex::init();
|
32
16
|
return self;
|
33
17
|
}
|
34
18
|
|
35
19
|
static
|
36
20
|
VALUE fin(VALUE self)
|
37
21
|
{
|
38
|
-
|
39
|
-
reflex_error("Reflex::fin() failed.");
|
40
|
-
|
41
|
-
return self;
|
42
|
-
}
|
43
|
-
|
44
|
-
static
|
45
|
-
VALUE run(VALUE self, VALUE name)
|
46
|
-
{
|
47
|
-
if (!Reflex::run(name ? name.c_str() : NULL))
|
48
|
-
reflex_error("Reflex::run() failed.");
|
49
|
-
|
50
|
-
return self;
|
51
|
-
}
|
52
|
-
|
53
|
-
static
|
54
|
-
VALUE quit(VALUE self)
|
55
|
-
{
|
56
|
-
if (!Reflex::quit())
|
57
|
-
reflex_error("Reflex::quit() failed.");
|
58
|
-
|
22
|
+
Reflex::fin();
|
59
23
|
return self;
|
60
24
|
}
|
61
25
|
|
@@ -66,6 +30,18 @@ Init_reflex ()
|
|
66
30
|
mReflex = rb_define_module("Reflex");
|
67
31
|
mReflex.define_singleton_method("init!", init);
|
68
32
|
mReflex.define_singleton_method("fin!", fin);
|
69
|
-
mReflex.define_singleton_method("run!", run);
|
70
|
-
rb_define_singleton_method(mReflex, "quit", RUBY_METHOD_FUNC(quit), 0);
|
71
33
|
}
|
34
|
+
|
35
|
+
|
36
|
+
namespace Reflex
|
37
|
+
{
|
38
|
+
|
39
|
+
|
40
|
+
Module
|
41
|
+
reflex_module ()
|
42
|
+
{
|
43
|
+
return mReflex;
|
44
|
+
}
|
45
|
+
|
46
|
+
|
47
|
+
}// Reflex
|
@@ -0,0 +1,141 @@
|
|
1
|
+
#include "reflex/ruby/event.h"
|
2
|
+
|
3
|
+
|
4
|
+
#include <rucy.h>
|
5
|
+
#include "rays/ruby/point.h"
|
6
|
+
#include "defs.h"
|
7
|
+
|
8
|
+
|
9
|
+
using namespace Rucy;
|
10
|
+
|
11
|
+
using Reflex::coord;
|
12
|
+
|
13
|
+
|
14
|
+
static Class cScrollEvent;
|
15
|
+
|
16
|
+
RUCY_DEFINE_VALUE_FROM_TO(Reflex::ScrollEvent, cScrollEvent)
|
17
|
+
|
18
|
+
#define THIS to<Reflex::ScrollEvent*>(self)
|
19
|
+
|
20
|
+
#define CHECK RUCY_CHECK_OBJ(Reflex::ScrollEvent, cScrollEvent, self)
|
21
|
+
|
22
|
+
|
23
|
+
static
|
24
|
+
VALUE alloc(VALUE klass)
|
25
|
+
{
|
26
|
+
return new_type<Reflex::ScrollEvent>(klass);
|
27
|
+
}
|
28
|
+
|
29
|
+
static
|
30
|
+
VALUE initialize(VALUE self)
|
31
|
+
{
|
32
|
+
CHECK;
|
33
|
+
check_arg_count(__FILE__, __LINE__, "ScrollEvent#initialize", argc, 0, 1, 2, 3, 4, 5, 6);
|
34
|
+
|
35
|
+
THIS->x = (argc >= 1) ? to<coord>(argv[0]) : 0;
|
36
|
+
THIS->y = (argc >= 2) ? to<coord>(argv[1]) : 0;
|
37
|
+
THIS->z = (argc >= 3) ? to<coord>(argv[2]) : 0;
|
38
|
+
THIS->dx = (argc >= 4) ? to<coord>(argv[3]) : 0;
|
39
|
+
THIS->dy = (argc >= 5) ? to<coord>(argv[4]) : 0;
|
40
|
+
THIS->dz = (argc >= 6) ? to<coord>(argv[5]) : 0;
|
41
|
+
|
42
|
+
return rb_call_super(0, NULL);
|
43
|
+
}
|
44
|
+
|
45
|
+
static
|
46
|
+
VALUE initialize_copy(VALUE self, VALUE obj)
|
47
|
+
{
|
48
|
+
CHECK;
|
49
|
+
*THIS = to<Reflex::ScrollEvent&>(obj);
|
50
|
+
return self;
|
51
|
+
}
|
52
|
+
|
53
|
+
static
|
54
|
+
VALUE x(VALUE self)
|
55
|
+
{
|
56
|
+
CHECK;
|
57
|
+
return value(THIS->x);
|
58
|
+
}
|
59
|
+
|
60
|
+
static
|
61
|
+
VALUE y(VALUE self)
|
62
|
+
{
|
63
|
+
CHECK;
|
64
|
+
return value(THIS->y);
|
65
|
+
}
|
66
|
+
|
67
|
+
static
|
68
|
+
VALUE z(VALUE self)
|
69
|
+
{
|
70
|
+
CHECK;
|
71
|
+
return value(THIS->z);
|
72
|
+
}
|
73
|
+
|
74
|
+
static
|
75
|
+
VALUE dx(VALUE self)
|
76
|
+
{
|
77
|
+
CHECK;
|
78
|
+
return value(THIS->dx);
|
79
|
+
}
|
80
|
+
|
81
|
+
static
|
82
|
+
VALUE dy(VALUE self)
|
83
|
+
{
|
84
|
+
CHECK;
|
85
|
+
return value(THIS->dy);
|
86
|
+
}
|
87
|
+
|
88
|
+
static
|
89
|
+
VALUE dz(VALUE self)
|
90
|
+
{
|
91
|
+
CHECK;
|
92
|
+
return value(THIS->dz);
|
93
|
+
}
|
94
|
+
|
95
|
+
static
|
96
|
+
VALUE scroll(VALUE self)
|
97
|
+
{
|
98
|
+
CHECK;
|
99
|
+
return value(Rays::Point(THIS->x, THIS->y, THIS->z));
|
100
|
+
}
|
101
|
+
|
102
|
+
static
|
103
|
+
VALUE delta(VALUE self)
|
104
|
+
{
|
105
|
+
CHECK;
|
106
|
+
return value(Rays::Point(THIS->dx, THIS->dy, THIS->dz));
|
107
|
+
}
|
108
|
+
|
109
|
+
|
110
|
+
void
|
111
|
+
Init_scroll_event ()
|
112
|
+
{
|
113
|
+
Module mReflex = rb_define_module("Reflex");
|
114
|
+
|
115
|
+
cScrollEvent = mReflex.define_class("ScrollEvent", Reflex::event_class());
|
116
|
+
rb_define_alloc_func(cScrollEvent, alloc);
|
117
|
+
rb_define_private_method(cScrollEvent, "initialize", RUBY_METHOD_FUNC(initialize), -1);
|
118
|
+
rb_define_private_method(cScrollEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
119
|
+
rb_define_method(cScrollEvent, "x", RUBY_METHOD_FUNC(x), 0);
|
120
|
+
rb_define_method(cScrollEvent, "y", RUBY_METHOD_FUNC(y), 0);
|
121
|
+
rb_define_method(cScrollEvent, "z", RUBY_METHOD_FUNC(z), 0);
|
122
|
+
rb_define_method(cScrollEvent, "dx", RUBY_METHOD_FUNC(dx), 0);
|
123
|
+
rb_define_method(cScrollEvent, "dy", RUBY_METHOD_FUNC(dy), 0);
|
124
|
+
rb_define_method(cScrollEvent, "dz", RUBY_METHOD_FUNC(dz), 0);
|
125
|
+
rb_define_method(cScrollEvent, "scroll", RUBY_METHOD_FUNC(scroll), 0);
|
126
|
+
rb_define_method(cScrollEvent, "delta", RUBY_METHOD_FUNC(delta), 0);
|
127
|
+
}
|
128
|
+
|
129
|
+
|
130
|
+
namespace Reflex
|
131
|
+
{
|
132
|
+
|
133
|
+
|
134
|
+
Class
|
135
|
+
scroll_event_class ()
|
136
|
+
{
|
137
|
+
return cScrollEvent;
|
138
|
+
}
|
139
|
+
|
140
|
+
|
141
|
+
}// Reflex
|