reflexion 0.5.3 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.doc/ext/reflex/application.cpp +56 -7
- data/.doc/ext/reflex/capture_event.cpp +1 -1
- data/.doc/ext/reflex/chase_constraint.cpp +84 -0
- data/.doc/ext/reflex/clipboard.cpp +65 -0
- data/.doc/ext/reflex/color_event.cpp +76 -0
- data/.doc/ext/reflex/color_picker.cpp +113 -0
- data/.doc/ext/reflex/constraint.cpp +135 -0
- data/.doc/ext/reflex/contact_event.cpp +1 -1
- data/.doc/ext/reflex/control_change_event.cpp +1 -1
- data/.doc/ext/reflex/device.cpp +1 -1
- data/.doc/ext/reflex/device_event.cpp +1 -1
- data/.doc/ext/reflex/draw_event.cpp +1 -1
- data/.doc/ext/reflex/ellipse_shape.cpp +1 -1
- data/.doc/ext/reflex/event.cpp +1 -1
- data/.doc/ext/reflex/file_dialog.cpp +181 -0
- data/.doc/ext/reflex/file_event.cpp +103 -0
- data/.doc/ext/reflex/filter.cpp +1 -1
- data/.doc/ext/reflex/focus_event.cpp +1 -1
- data/.doc/ext/reflex/frame_event.cpp +1 -1
- data/.doc/ext/reflex/gamepad.cpp +48 -0
- data/.doc/ext/reflex/image_view.cpp +1 -1
- data/.doc/ext/reflex/key_event.cpp +1 -274
- data/.doc/ext/reflex/line_shape.cpp +1 -1
- data/.doc/ext/reflex/link_constraint.cpp +178 -0
- data/.doc/ext/reflex/menu.cpp +303 -0
- data/.doc/ext/reflex/midi.cpp +9 -2
- data/.doc/ext/reflex/midi_event.cpp +1 -1
- data/.doc/ext/reflex/motion_event.cpp +1 -1
- data/.doc/ext/reflex/native.cpp +40 -10
- data/.doc/ext/reflex/note_event.cpp +1 -1
- data/.doc/ext/reflex/pin.cpp +156 -0
- data/.doc/ext/reflex/pointer.cpp +3 -1
- data/.doc/ext/reflex/pointer_event.cpp +3 -3
- data/.doc/ext/reflex/polygon_shape.cpp +1 -1
- data/.doc/ext/reflex/rect_shape.cpp +1 -1
- data/.doc/ext/reflex/reflex.cpp +606 -237
- data/.doc/ext/reflex/screen.cpp +27 -1
- data/.doc/ext/reflex/scroll_event.cpp +1 -1
- data/.doc/ext/reflex/selector.cpp +5 -5
- data/.doc/ext/reflex/shape.cpp +1 -1
- data/.doc/ext/reflex/snap_constraint.cpp +125 -0
- data/.doc/ext/reflex/style.cpp +1 -1
- data/.doc/ext/reflex/style_length.cpp +4 -3
- data/.doc/ext/reflex/text_event.cpp +104 -0
- data/.doc/ext/reflex/timer.cpp +1 -1
- data/.doc/ext/reflex/timer_event.cpp +1 -1
- data/.doc/ext/reflex/update_event.cpp +1 -1
- data/.doc/ext/reflex/view.cpp +206 -79
- data/.doc/ext/reflex/wheel_constraint.cpp +142 -0
- data/.doc/ext/reflex/wheel_event.cpp +1 -1
- data/.doc/ext/reflex/window.cpp +282 -31
- data/.github/workflows/release-gem.yml +2 -40
- data/.github/workflows/tag.yml +5 -28
- data/.github/workflows/test.yml +1 -28
- data/ChangeLog.md +79 -0
- data/Gemfile.lock +13 -8
- data/README.md +1 -0
- data/Rakefile +13 -2
- data/Reflex.podspec +2 -2
- data/VERSION +1 -1
- data/ext/reflex/application.cpp +62 -7
- data/ext/reflex/capture_event.cpp +1 -1
- data/ext/reflex/chase_constraint.cpp +89 -0
- data/ext/reflex/clipboard.cpp +69 -0
- data/ext/reflex/color_event.cpp +80 -0
- data/ext/reflex/color_picker.cpp +121 -0
- data/ext/reflex/constraint.cpp +146 -0
- data/ext/reflex/contact_event.cpp +1 -1
- data/ext/reflex/control_change_event.cpp +1 -1
- data/ext/reflex/device.cpp +1 -1
- data/ext/reflex/device_event.cpp +1 -1
- data/ext/reflex/draw_event.cpp +1 -1
- data/ext/reflex/ellipse_shape.cpp +1 -1
- data/ext/reflex/event.cpp +1 -1
- data/ext/reflex/extconf.rb +4 -2
- data/ext/reflex/file_dialog.cpp +194 -0
- data/ext/reflex/file_event.cpp +108 -0
- data/ext/reflex/filter.cpp +1 -1
- data/ext/reflex/focus_event.cpp +1 -1
- data/ext/reflex/frame_event.cpp +1 -1
- data/ext/reflex/gamepad.cpp +50 -0
- data/ext/reflex/image_view.cpp +1 -1
- data/ext/reflex/key_event.cpp +1 -275
- data/ext/reflex/line_shape.cpp +1 -1
- data/ext/reflex/link_constraint.cpp +194 -0
- data/ext/reflex/menu.cpp +331 -0
- data/ext/reflex/midi.cpp +11 -3
- data/ext/reflex/midi_event.cpp +1 -1
- data/ext/reflex/motion_event.cpp +1 -1
- data/ext/reflex/native.cpp +40 -10
- data/ext/reflex/note_event.cpp +1 -1
- data/ext/reflex/pin.cpp +165 -0
- data/ext/reflex/pointer.cpp +3 -1
- data/ext/reflex/pointer_event.cpp +3 -3
- data/ext/reflex/polygon_shape.cpp +1 -1
- data/ext/reflex/rect_shape.cpp +1 -1
- data/ext/reflex/reflex.cpp +608 -237
- data/ext/reflex/screen.cpp +31 -2
- data/ext/reflex/scroll_event.cpp +1 -1
- data/ext/reflex/selector.cpp +5 -5
- data/ext/reflex/selector.h +10 -10
- data/ext/reflex/shape.cpp +1 -1
- data/ext/reflex/snap_constraint.cpp +135 -0
- data/ext/reflex/style.cpp +1 -1
- data/ext/reflex/style_length.cpp +4 -3
- data/ext/reflex/text_event.cpp +111 -0
- data/ext/reflex/timer.cpp +1 -1
- data/ext/reflex/timer_event.cpp +1 -1
- data/ext/reflex/update_event.cpp +1 -1
- data/ext/reflex/view.cpp +236 -96
- data/ext/reflex/wheel_constraint.cpp +154 -0
- data/ext/reflex/wheel_event.cpp +1 -1
- data/ext/reflex/window.cpp +318 -40
- data/include/reflex/application.h +19 -0
- data/include/reflex/clipboard.h +53 -0
- data/include/reflex/color_picker.h +65 -0
- data/include/reflex/constraint.h +275 -0
- data/include/reflex/defs.h +204 -195
- data/include/reflex/event.h +180 -88
- data/include/reflex/file_dialog.h +73 -0
- data/include/reflex/gamepad.h +3 -0
- data/include/reflex/menu.h +120 -0
- data/include/reflex/midi.h +3 -0
- data/include/reflex/pin.h +68 -0
- data/include/reflex/pointer.h +4 -0
- data/include/reflex/reflex.h +2 -0
- data/include/reflex/ruby/application.h +6 -1
- data/include/reflex/ruby/clipboard.h +23 -0
- data/include/reflex/ruby/color_picker.h +89 -0
- data/include/reflex/ruby/constraint.h +94 -0
- data/include/reflex/ruby/event.h +62 -29
- data/include/reflex/ruby/file_dialog.h +89 -0
- data/include/reflex/ruby/gamepad.h +46 -0
- data/include/reflex/ruby/menu.h +103 -0
- data/include/reflex/ruby/pin.h +40 -0
- data/include/reflex/ruby/reflex.h +3 -0
- data/include/reflex/ruby/view.h +123 -39
- data/include/reflex/ruby/window.h +96 -19
- data/include/reflex/ruby.h +3 -0
- data/include/reflex/screen.h +11 -2
- data/include/reflex/view.h +66 -27
- data/include/reflex/window.h +57 -12
- data/include/reflex.h +8 -0
- data/lib/reflex/application.rb +5 -5
- data/lib/reflex/autoinit.rb +3 -1
- data/lib/reflex/button.rb +3 -3
- data/lib/reflex/chase_constraint.rb +15 -0
- data/lib/reflex/clipboard.rb +19 -0
- data/lib/reflex/color_event.rb +16 -0
- data/lib/reflex/color_picker.rb +45 -0
- data/lib/reflex/constraint.rb +29 -0
- data/lib/reflex/control_change_event.rb +17 -0
- data/lib/reflex/extension.rb +1 -1
- data/lib/reflex/file_dialog.rb +70 -0
- data/lib/reflex/file_event.rb +37 -0
- data/lib/reflex/helper.rb +79 -0
- data/lib/reflex/key_event.rb +14 -14
- data/lib/reflex/link_constraint.rb +31 -0
- data/lib/reflex/menu.rb +92 -0
- data/lib/reflex/model.rb +19 -19
- data/lib/reflex/note_event.rb +1 -1
- data/lib/reflex/pin.rb +39 -0
- data/lib/reflex/pointer.rb +30 -1
- data/lib/reflex/pointer_event.rb +13 -2
- data/lib/reflex/reflex.rb +5 -0
- data/lib/reflex/shape.rb +14 -14
- data/lib/reflex/snap_constraint.rb +28 -0
- data/lib/reflex/style.rb +16 -16
- data/lib/reflex/text_event.rb +40 -0
- data/lib/reflex/timer.rb +3 -3
- data/lib/reflex/view.rb +85 -18
- data/lib/reflex/wheel_constraint.rb +28 -0
- data/lib/reflex/wheel_event.rb +19 -1
- data/lib/reflex/window.rb +25 -13
- data/lib/reflex.rb +23 -8
- data/pod.rake +1 -1
- data/reflex.gemspec +4 -4
- data/samples/constraint.rb +152 -0
- data/samples/ime.rb +100 -0
- data/samples/ios/hello/hello.xcodeproj/project.pbxproj +236 -224
- data/samples/menu.rb +32 -0
- data/samples/model.rb +3 -3
- data/samples/test/alert.rb +93 -0
- data/samples/test/always_on.rb +76 -0
- data/samples/test/app_background.rb +51 -0
- data/samples/test/boundary.rb +75 -0
- data/samples/test/callback_exception.rb +101 -0
- data/samples/test/cancel.rb +53 -0
- data/samples/test/color_picker.rb +63 -0
- data/samples/test/file_dialog.rb +102 -0
- data/samples/window_style.rb +156 -0
- data/src/application.cpp +180 -20
- data/src/application.h +95 -5
- data/src/clipboard.cpp +81 -0
- data/src/color_picker.cpp +113 -0
- data/src/color_picker.h +36 -0
- data/src/constraint.cpp +1662 -0
- data/src/constraint.h +64 -0
- data/src/event.cpp +416 -252
- data/src/event.h +13 -2
- data/src/file_dialog.cpp +163 -0
- data/src/file_dialog.h +52 -0
- data/src/gamepad.cpp +42 -5
- data/src/gamepad.h +4 -0
- data/src/ios/app_delegate.mm +5 -3
- data/src/ios/application.mm +29 -0
- data/src/ios/clipboard.mm +44 -0
- data/src/ios/color_picker.mm +19 -0
- data/src/ios/event.h +6 -2
- data/src/ios/event.mm +31 -12
- data/src/ios/file_dialog.mm +21 -0
- data/src/ios/gamepad.mm +4 -4
- data/src/ios/menu.mm +41 -0
- data/src/ios/reflex.mm +8 -0
- data/src/ios/screen.mm +26 -0
- data/src/ios/view_controller.mm +47 -42
- data/src/ios/window.mm +44 -9
- data/src/menu.cpp +387 -0
- data/src/menu.h +81 -0
- data/src/midi.cpp +61 -31
- data/src/osx/app_delegate.h +4 -0
- data/src/osx/app_delegate.mm +168 -139
- data/src/osx/application.mm +103 -5
- data/src/osx/clipboard.mm +45 -0
- data/src/osx/color_picker.mm +112 -0
- data/src/osx/event.h +10 -0
- data/src/osx/event.mm +114 -30
- data/src/osx/file_dialog.mm +168 -0
- data/src/osx/gamepad.mm +2 -2
- data/src/osx/gamepad_hid.mm +1 -1
- data/src/osx/menu.h +25 -0
- data/src/osx/menu.mm +516 -0
- data/src/osx/native_window.h +16 -2
- data/src/osx/native_window.mm +141 -57
- data/src/osx/opengl_view.h +2 -1
- data/src/osx/opengl_view.mm +229 -37
- data/src/osx/reflex.mm +38 -0
- data/src/osx/screen.mm +36 -0
- data/src/osx/window.mm +117 -24
- data/src/pin.cpp +137 -0
- data/src/pointer.cpp +36 -16
- data/src/pointer.h +10 -0
- data/src/rays.h +46 -0
- data/src/sdl/application.cpp +73 -8
- data/src/sdl/clipboard.cpp +39 -0
- data/src/sdl/color_picker.cpp +18 -0
- data/src/sdl/event.cpp +44 -6
- data/src/sdl/event.h +18 -3
- data/src/sdl/file_dialog.cpp +20 -0
- data/src/sdl/gamepad.cpp +3 -7
- data/src/sdl/menu.cpp +40 -0
- data/src/sdl/reflex.cpp +20 -0
- data/src/sdl/screen.cpp +36 -0
- data/src/sdl/window.cpp +168 -37
- data/src/shape.cpp +15 -10
- data/src/view.cpp +583 -233
- data/src/view.h +22 -4
- data/src/vk.h +416 -0
- data/src/win32/application.cpp +167 -12
- data/src/win32/application.h +20 -0
- data/src/win32/clipboard.cpp +210 -0
- data/src/win32/color_picker.cpp +82 -0
- data/src/win32/event.cpp +123 -11
- data/src/win32/event.h +22 -3
- data/src/win32/file_dialog.cpp +226 -0
- data/src/win32/gamepad.cpp +9 -2
- data/src/win32/menu.cpp +490 -0
- data/src/win32/menu.h +35 -0
- data/src/win32/opengl.cpp +2 -9
- data/src/win32/reflex.cpp +44 -3
- data/src/win32/screen.cpp +164 -3
- data/src/win32/screen.h +8 -0
- data/src/win32/tray.cpp +191 -0
- data/src/win32/tray.h +22 -0
- data/src/win32/vk.cpp +11 -0
- data/src/win32/window.cpp +858 -135
- data/src/win32/window.h +9 -0
- data/src/window.cpp +929 -183
- data/src/window.h +77 -33
- data/src/world.cpp +86 -15
- data/src/world.h +9 -2
- data/test/helper.rb +24 -0
- data/test/test_application.rb +101 -1
- data/test/test_chase_constraint.rb +122 -0
- data/test/test_clipboard.rb +54 -0
- data/test/test_color_event.rb +36 -0
- data/test/test_color_picker.rb +62 -0
- data/test/test_constraint.rb +184 -0
- data/test/test_event.rb +1 -1
- data/test/test_file_dialog.rb +48 -0
- data/test/test_file_event.rb +43 -0
- data/test/test_has_text_preedit.rb +54 -0
- data/test/test_key_event.rb +23 -2
- data/test/test_link_constraint.rb +237 -0
- data/test/test_menu.rb +237 -0
- data/test/test_pin.rb +65 -0
- data/test/test_pointer.rb +50 -26
- data/test/test_pointer_event.rb +25 -10
- data/test/test_reflex.rb +36 -0
- data/test/test_screen.rb +24 -2
- data/test/test_snap_constraint.rb +140 -0
- data/test/test_text_event.rb +54 -0
- data/test/test_view.rb +152 -25
- data/test/test_wheel_constraint.rb +125 -0
- data/test/test_wheel_event.rb +24 -10
- data/test/test_window.rb +205 -43
- metadata +154 -10
- data/.github/workflows/utils.rb +0 -127
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5228288ca6eaf922b07a4e5934fc402f16a79261541db581691fdc77df985a41
|
|
4
|
+
data.tar.gz: 9a4918d2d0c66b5aec2dda5b4cf9afd080d9c7fd8ef863517791b2bcf34561f4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6520e51eb23b4215b34116fd37b34fe1a06532e554186bf47ac0b956e5f9a71e97d6c7aae4465550e8d4ed86f763e86f605d2e811959fbe42fe50fb253bcfb67
|
|
7
|
+
data.tar.gz: 371a81c13682e5c6cceda6549fcf2e6378574d3bf4181bcedbf4e09f175a7ba975869d76240692c72ce312de6dc0dec079e11e546aaba4bb86eb0c038c28e085
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#include "reflex/ruby/application.h"
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
#include "reflex/ruby/menu.h"
|
|
4
5
|
#include "reflex/ruby/window.h"
|
|
5
6
|
#include "defs.h"
|
|
6
7
|
|
|
@@ -9,8 +10,8 @@ RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::Application)
|
|
|
9
10
|
|
|
10
11
|
#define THIS to<Reflex::Application*>(self)
|
|
11
12
|
|
|
12
|
-
#define
|
|
13
|
-
#define CHECK
|
|
13
|
+
#define CHECK_PTR RUCY_CHECK_PTR(Reflex::Application, self)
|
|
14
|
+
#define CHECK RUCY_CHECK_OBJ(Reflex::Application, self)
|
|
14
15
|
|
|
15
16
|
#define CALL(fun) RUCY_CALL_SUPER(THIS, fun)
|
|
16
17
|
|
|
@@ -24,7 +25,7 @@ VALUE alloc(VALUE klass)
|
|
|
24
25
|
static
|
|
25
26
|
VALUE start(VALUE self)
|
|
26
27
|
{
|
|
27
|
-
|
|
28
|
+
CHECK_PTR;
|
|
28
29
|
CALL(start());
|
|
29
30
|
return self;
|
|
30
31
|
}
|
|
@@ -52,6 +53,51 @@ VALUE get_name(VALUE self)
|
|
|
52
53
|
return value(THIS->name());
|
|
53
54
|
}
|
|
54
55
|
|
|
56
|
+
static
|
|
57
|
+
VALUE set_menu(VALUE self, VALUE menu)
|
|
58
|
+
{
|
|
59
|
+
CHECK;
|
|
60
|
+
THIS->set_menu(menu ? to<Reflex::Menu*>(menu) : NULL);
|
|
61
|
+
return menu;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static
|
|
65
|
+
VALUE get_menu(VALUE self)
|
|
66
|
+
{
|
|
67
|
+
CHECK;
|
|
68
|
+
return value(THIS->menu());
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
static
|
|
72
|
+
VALUE set_background(VALUE self, VALUE state)
|
|
73
|
+
{
|
|
74
|
+
CHECK;
|
|
75
|
+
THIS->set_background(to<bool>(state));
|
|
76
|
+
return state;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
static
|
|
80
|
+
VALUE is_background(VALUE self)
|
|
81
|
+
{
|
|
82
|
+
CHECK;
|
|
83
|
+
return value(THIS->background());
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
static
|
|
87
|
+
VALUE set_background_menu(VALUE self, VALUE menu)
|
|
88
|
+
{
|
|
89
|
+
CHECK;
|
|
90
|
+
THIS->set_background_menu(menu ? to<Reflex::Menu*>(menu) : NULL);
|
|
91
|
+
return menu;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
static
|
|
95
|
+
VALUE get_background_menu(VALUE self)
|
|
96
|
+
{
|
|
97
|
+
CHECK;
|
|
98
|
+
return value(THIS->background_menu());
|
|
99
|
+
}
|
|
100
|
+
|
|
55
101
|
static
|
|
56
102
|
VALUE each_window(VALUE self)
|
|
57
103
|
{
|
|
@@ -59,7 +105,7 @@ VALUE each_window(VALUE self)
|
|
|
59
105
|
|
|
60
106
|
Value ret;
|
|
61
107
|
for (auto it = THIS->window_begin(), end = THIS->window_end(); it != end; ++it)
|
|
62
|
-
ret =
|
|
108
|
+
ret = yield(value(it->get()));
|
|
63
109
|
return ret;
|
|
64
110
|
}
|
|
65
111
|
|
|
@@ -68,9 +114,6 @@ VALUE on_start(VALUE self, VALUE event)
|
|
|
68
114
|
{
|
|
69
115
|
CHECK;
|
|
70
116
|
|
|
71
|
-
RUCY_SYM(call_start_block);
|
|
72
|
-
self.call(call_start_block);
|
|
73
|
-
|
|
74
117
|
CALL(on_start(to<Reflex::Event*>(event)));
|
|
75
118
|
}
|
|
76
119
|
|
|
@@ -136,6 +179,12 @@ Init_reflex_application ()
|
|
|
136
179
|
rb_define_method(cApplication, "quit", RUBY_METHOD_FUNC(quit), 0);
|
|
137
180
|
rb_define_method(cApplication, "name=", RUBY_METHOD_FUNC(set_name), 1);
|
|
138
181
|
rb_define_method(cApplication, "name", RUBY_METHOD_FUNC(get_name), 0);
|
|
182
|
+
rb_define_method(cApplication, "menu=", RUBY_METHOD_FUNC(set_menu), 1);
|
|
183
|
+
rb_define_method(cApplication, "menu", RUBY_METHOD_FUNC(get_menu), 0);
|
|
184
|
+
rb_define_method(cApplication, "background=", RUBY_METHOD_FUNC(set_background), 1);
|
|
185
|
+
cApplication.define_method("background?", is_background);
|
|
186
|
+
rb_define_method(cApplication, "background_menu=", RUBY_METHOD_FUNC(set_background_menu), 1);
|
|
187
|
+
rb_define_method(cApplication, "background_menu", RUBY_METHOD_FUNC(get_background_menu), 0);
|
|
139
188
|
rb_define_method(cApplication, "each_window", RUBY_METHOD_FUNC(each_window), 0);
|
|
140
189
|
rb_define_method(cApplication, "on_start", RUBY_METHOD_FUNC(on_start), 1);
|
|
141
190
|
rb_define_method(cApplication, "on_quit", RUBY_METHOD_FUNC(on_quit), 1);
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#include "reflex/ruby/constraint.h"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
#include <rays/ruby/point.h>
|
|
5
|
+
#include "reflex/exception.h"
|
|
6
|
+
#include "reflex/ruby/pin.h"
|
|
7
|
+
#include "reflex/ruby/view.h"
|
|
8
|
+
#include "defs.h"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::ChaseConstraint)
|
|
12
|
+
|
|
13
|
+
#define THIS to<Reflex::ChaseConstraint*>(self)
|
|
14
|
+
|
|
15
|
+
#define CHECK RUCY_CHECK_PTR(Reflex::ChaseConstraint, self)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
static
|
|
19
|
+
VALUE alloc(VALUE klass)
|
|
20
|
+
{
|
|
21
|
+
Reflex::reflex_error(
|
|
22
|
+
__FILE__, __LINE__, "can not instantiate ChaseConstraint class");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static
|
|
26
|
+
VALUE set_target(VALUE self)
|
|
27
|
+
{
|
|
28
|
+
CHECK;
|
|
29
|
+
THIS->set_target(to<Reflex::Pin>(argc, argv));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static
|
|
33
|
+
VALUE get_target(VALUE self)
|
|
34
|
+
{
|
|
35
|
+
CHECK;
|
|
36
|
+
return value(THIS->target());
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static
|
|
40
|
+
VALUE set_force(VALUE self, VALUE max_force)
|
|
41
|
+
{
|
|
42
|
+
CHECK;
|
|
43
|
+
if (max_force.is_nil())
|
|
44
|
+
THIS->clear_force();
|
|
45
|
+
else
|
|
46
|
+
THIS->set_force(to<float>(max_force));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static
|
|
50
|
+
VALUE get_force(VALUE self)
|
|
51
|
+
{
|
|
52
|
+
CHECK;
|
|
53
|
+
return THIS->has_force() ? value(THIS->force()) : nil();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
static Class cChaseConstraint;
|
|
58
|
+
|
|
59
|
+
void
|
|
60
|
+
Init_reflex_chase_constraint ()
|
|
61
|
+
{
|
|
62
|
+
Module mReflex = rb_define_module("Reflex");
|
|
63
|
+
|
|
64
|
+
cChaseConstraint = mReflex.define_class("ChaseConstraint", Reflex::constraint_class());
|
|
65
|
+
rb_define_alloc_func(cChaseConstraint, alloc);
|
|
66
|
+
rb_define_method(cChaseConstraint, "target=", RUBY_METHOD_FUNC(set_target), -1);
|
|
67
|
+
rb_define_method(cChaseConstraint, "target", RUBY_METHOD_FUNC(get_target), 0);
|
|
68
|
+
rb_define_method(cChaseConstraint, "force=", RUBY_METHOD_FUNC(set_force), 1);
|
|
69
|
+
rb_define_method(cChaseConstraint, "force", RUBY_METHOD_FUNC(get_force), 0);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
namespace Reflex
|
|
74
|
+
{
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
Class
|
|
78
|
+
chase_constraint_class ()
|
|
79
|
+
{
|
|
80
|
+
return cChaseConstraint;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
}// Reflex
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#include "reflex/ruby/clipboard.h"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
#include "reflex/exception.h"
|
|
5
|
+
#include "defs.h"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
static
|
|
9
|
+
VALUE alloc(VALUE klass)
|
|
10
|
+
{
|
|
11
|
+
Reflex::reflex_error(__FILE__, __LINE__, "can not instantiate Clipboard class.");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static
|
|
15
|
+
VALUE set_text(VALUE self, VALUE text)
|
|
16
|
+
{
|
|
17
|
+
Reflex::Clipboard clipboard;
|
|
18
|
+
if (!text.is_nil()) clipboard.set_text(text.c_str());
|
|
19
|
+
Reflex::set_clipboard(clipboard);
|
|
20
|
+
return text;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static
|
|
24
|
+
VALUE get_text(VALUE self)
|
|
25
|
+
{
|
|
26
|
+
Reflex::Clipboard clipboard = Reflex::get_clipboard();
|
|
27
|
+
const char* text = clipboard.text();
|
|
28
|
+
return text ? value(text) : nil();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static
|
|
32
|
+
VALUE clear(VALUE self)
|
|
33
|
+
{
|
|
34
|
+
Reflex::set_clipboard(Reflex::Clipboard());
|
|
35
|
+
return self;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
static Class cClipboard;
|
|
40
|
+
|
|
41
|
+
void
|
|
42
|
+
Init_reflex_clipboard ()
|
|
43
|
+
{
|
|
44
|
+
Module mReflex = rb_define_module("Reflex");
|
|
45
|
+
|
|
46
|
+
cClipboard = rb_define_class_under(mReflex, "Clipboard", rb_cObject);
|
|
47
|
+
rb_define_alloc_func(cClipboard, alloc);
|
|
48
|
+
rb_define_singleton_method(cClipboard, "text=", RUBY_METHOD_FUNC(set_text), 1);
|
|
49
|
+
rb_define_singleton_method(cClipboard, "text", RUBY_METHOD_FUNC(get_text), 0);
|
|
50
|
+
rb_define_singleton_method(cClipboard, "clear", RUBY_METHOD_FUNC(clear), 0);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
namespace Reflex
|
|
55
|
+
{
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
Class
|
|
59
|
+
clipboard_class ()
|
|
60
|
+
{
|
|
61
|
+
return cClipboard;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
}// Reflex
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#include "reflex/ruby/event.h"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
#include <rays/ruby/color.h>
|
|
5
|
+
#include "defs.h"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
RUCY_DEFINE_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::ColorEvent)
|
|
9
|
+
|
|
10
|
+
#define THIS to<Reflex::ColorEvent*>(self)
|
|
11
|
+
|
|
12
|
+
#define CHECK RUCY_CHECK_PTR(Reflex::ColorEvent, self)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
static
|
|
16
|
+
VALUE alloc(VALUE klass)
|
|
17
|
+
{
|
|
18
|
+
return new_type<Reflex::ColorEvent>(klass);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static
|
|
22
|
+
VALUE initialize(VALUE self, VALUE color)
|
|
23
|
+
{
|
|
24
|
+
CHECK;
|
|
25
|
+
|
|
26
|
+
if (color.is_nil())
|
|
27
|
+
argument_error(__FILE__, __LINE__);
|
|
28
|
+
|
|
29
|
+
*THIS = Reflex::ColorEvent(to<Rays::Color>(color));
|
|
30
|
+
|
|
31
|
+
return rb_call_super(0, NULL);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static
|
|
35
|
+
VALUE initialize_copy(VALUE self, VALUE obj)
|
|
36
|
+
{
|
|
37
|
+
CHECK;
|
|
38
|
+
*THIS = to<Reflex::ColorEvent&>(obj).dup();
|
|
39
|
+
return self;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static
|
|
43
|
+
VALUE get_color(VALUE self)
|
|
44
|
+
{
|
|
45
|
+
CHECK;
|
|
46
|
+
return value(THIS->color());
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
static Class cColorEvent;
|
|
51
|
+
|
|
52
|
+
void
|
|
53
|
+
Init_reflex_color_event ()
|
|
54
|
+
{
|
|
55
|
+
Module mReflex = rb_define_module("Reflex");
|
|
56
|
+
|
|
57
|
+
cColorEvent = mReflex.define_class("ColorEvent", Reflex::event_class());
|
|
58
|
+
rb_define_alloc_func(cColorEvent, alloc);
|
|
59
|
+
rb_define_private_method(cColorEvent, "initialize", RUBY_METHOD_FUNC(initialize), 1);
|
|
60
|
+
rb_define_private_method(cColorEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
|
61
|
+
rb_define_method(cColorEvent, "color", RUBY_METHOD_FUNC(get_color), 0);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
namespace Reflex
|
|
66
|
+
{
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
Class
|
|
70
|
+
color_event_class ()
|
|
71
|
+
{
|
|
72
|
+
return cColorEvent;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
}// Reflex
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
#include "reflex/ruby/color_picker.h"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
#include <rays/ruby/color.h>
|
|
5
|
+
#include "reflex/ruby/window.h"
|
|
6
|
+
#include "defs.h"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::ColorPicker)
|
|
10
|
+
|
|
11
|
+
#define THIS to<Reflex::ColorPicker*>(self)
|
|
12
|
+
|
|
13
|
+
#define CHECK RUCY_CHECK_OBJ(Reflex::ColorPicker, self)
|
|
14
|
+
|
|
15
|
+
#define CALL(fun) RUCY_CALL_SUPER(THIS, fun)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
static
|
|
19
|
+
VALUE alloc(VALUE klass)
|
|
20
|
+
{
|
|
21
|
+
return value(new Reflex::RubyColorPicker<Reflex::ColorPicker>, klass);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static
|
|
25
|
+
VALUE pick_color(VALUE self, VALUE initial)
|
|
26
|
+
{
|
|
27
|
+
CHECK;
|
|
28
|
+
|
|
29
|
+
if (initial.is_nil())
|
|
30
|
+
THIS->pick_color();
|
|
31
|
+
else
|
|
32
|
+
THIS->pick_color(to<Rays::Color>(initial));
|
|
33
|
+
return self;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static
|
|
37
|
+
VALUE set_owner(VALUE self, VALUE owner)
|
|
38
|
+
{
|
|
39
|
+
CHECK;
|
|
40
|
+
THIS->set_owner(owner.is_nil() ? NULL : to<Reflex::Window*>(owner));
|
|
41
|
+
return owner;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static
|
|
45
|
+
VALUE get_owner(VALUE self)
|
|
46
|
+
{
|
|
47
|
+
CHECK;
|
|
48
|
+
return value(THIS->owner());
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static
|
|
52
|
+
VALUE set_alpha(VALUE self, VALUE state)
|
|
53
|
+
{
|
|
54
|
+
CHECK;
|
|
55
|
+
THIS->set_alpha(to<bool>(state));
|
|
56
|
+
return state;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
static
|
|
60
|
+
VALUE is_alpha(VALUE self)
|
|
61
|
+
{
|
|
62
|
+
CHECK;
|
|
63
|
+
return value(THIS->alpha());
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static
|
|
67
|
+
VALUE on_color(VALUE self, VALUE event)
|
|
68
|
+
{
|
|
69
|
+
CHECK;
|
|
70
|
+
|
|
71
|
+
CALL(on_color(to<Reflex::ColorEvent*>(event)));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
static
|
|
75
|
+
VALUE on_close(VALUE self, VALUE event)
|
|
76
|
+
{
|
|
77
|
+
CHECK;
|
|
78
|
+
|
|
79
|
+
CALL(on_close(to<Reflex::Event*>(event)));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
static Class cColorPicker;
|
|
84
|
+
|
|
85
|
+
void
|
|
86
|
+
Init_reflex_color_picker ()
|
|
87
|
+
{
|
|
88
|
+
Module mReflex = rb_define_module("Reflex");
|
|
89
|
+
|
|
90
|
+
cColorPicker = rb_define_class_under(mReflex, "ColorPicker", rb_cObject);
|
|
91
|
+
rb_define_alloc_func(cColorPicker, alloc);
|
|
92
|
+
cColorPicker.define_method("pick_color!", pick_color);
|
|
93
|
+
rb_define_method(cColorPicker, "owner=", RUBY_METHOD_FUNC(set_owner), 1);
|
|
94
|
+
rb_define_method(cColorPicker, "owner", RUBY_METHOD_FUNC(get_owner), 0);
|
|
95
|
+
rb_define_method(cColorPicker, "alpha=", RUBY_METHOD_FUNC(set_alpha), 1);
|
|
96
|
+
cColorPicker.define_method("alpha?", is_alpha);
|
|
97
|
+
rb_define_method(cColorPicker, "on_color", RUBY_METHOD_FUNC(on_color), 1);
|
|
98
|
+
rb_define_method(cColorPicker, "on_close", RUBY_METHOD_FUNC(on_close), 1);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
namespace Reflex
|
|
103
|
+
{
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
Class
|
|
107
|
+
color_picker_class ()
|
|
108
|
+
{
|
|
109
|
+
return cColorPicker;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
}// Reflex
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
#include "reflex/ruby/constraint.h"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
#include <rays/ruby/point.h>
|
|
5
|
+
#include "reflex/exception.h"
|
|
6
|
+
#include "reflex/ruby/view.h"
|
|
7
|
+
#include "reflex/ruby/pin.h"
|
|
8
|
+
#include "defs.h"
|
|
9
|
+
#include "selector.h"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::Constraint)
|
|
13
|
+
|
|
14
|
+
#define THIS to<Reflex::Constraint*>(self)
|
|
15
|
+
|
|
16
|
+
#define CHECK RUCY_CHECK_PTR(Reflex::Constraint, self)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
static
|
|
20
|
+
VALUE alloc(VALUE klass)
|
|
21
|
+
{
|
|
22
|
+
Reflex::reflex_error(
|
|
23
|
+
__FILE__, __LINE__, "can not instantiate Constraint class");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static
|
|
27
|
+
VALUE remove(VALUE self)
|
|
28
|
+
{
|
|
29
|
+
CHECK;
|
|
30
|
+
THIS->remove();
|
|
31
|
+
return self;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static
|
|
35
|
+
VALUE get_pin(VALUE self, VALUE index)
|
|
36
|
+
{
|
|
37
|
+
CHECK;
|
|
38
|
+
return value(THIS->pin(to<int>(index)));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static
|
|
42
|
+
VALUE set_spring(VALUE self, VALUE hertz)
|
|
43
|
+
{
|
|
44
|
+
CHECK;
|
|
45
|
+
THIS->set_spring(hertz ? to<float>(hertz) : 0);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static
|
|
49
|
+
VALUE get_spring(VALUE self)
|
|
50
|
+
{
|
|
51
|
+
CHECK;
|
|
52
|
+
float hertz = THIS->spring();
|
|
53
|
+
return hertz > 0 ? value(hertz) : nil();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static
|
|
57
|
+
VALUE set_damping(VALUE self, VALUE ratio)
|
|
58
|
+
{
|
|
59
|
+
CHECK;
|
|
60
|
+
THIS->set_damping(to<float>(ratio));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static
|
|
64
|
+
VALUE get_damping(VALUE self)
|
|
65
|
+
{
|
|
66
|
+
CHECK;
|
|
67
|
+
return value(THIS->damping());
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static
|
|
71
|
+
VALUE set_collide(VALUE self, VALUE state)
|
|
72
|
+
{
|
|
73
|
+
CHECK;
|
|
74
|
+
THIS->set_collide(to<bool>(state));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
static
|
|
78
|
+
VALUE can_collide(VALUE self)
|
|
79
|
+
{
|
|
80
|
+
CHECK;
|
|
81
|
+
return value(THIS->can_collide());
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static
|
|
85
|
+
VALUE is_removed(VALUE self)
|
|
86
|
+
{
|
|
87
|
+
CHECK;
|
|
88
|
+
return value(THIS->is_removed());
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
static
|
|
92
|
+
VALUE is_active(VALUE self)
|
|
93
|
+
{
|
|
94
|
+
CHECK;
|
|
95
|
+
return value(THIS->operator bool());
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
static Class cConstraint;
|
|
100
|
+
|
|
101
|
+
void
|
|
102
|
+
Init_reflex_constraint ()
|
|
103
|
+
{
|
|
104
|
+
Module mReflex = rb_define_module("Reflex");
|
|
105
|
+
|
|
106
|
+
cConstraint = rb_define_class_under(mReflex, "Constraint", rb_cObject);
|
|
107
|
+
rb_define_alloc_func(cConstraint, alloc);
|
|
108
|
+
rb_define_method(cConstraint, "remove", RUBY_METHOD_FUNC(remove), 0);
|
|
109
|
+
rb_define_private_method(cConstraint, "get_pin", RUBY_METHOD_FUNC(get_pin), 1);
|
|
110
|
+
rb_define_method(cConstraint, "spring=", RUBY_METHOD_FUNC(set_spring), 1);
|
|
111
|
+
rb_define_method(cConstraint, "spring", RUBY_METHOD_FUNC(get_spring), 0);
|
|
112
|
+
rb_define_method(cConstraint, "damping=", RUBY_METHOD_FUNC(set_damping), 1);
|
|
113
|
+
rb_define_method(cConstraint, "damping", RUBY_METHOD_FUNC(get_damping), 0);
|
|
114
|
+
rb_define_method(cConstraint, "collide=", RUBY_METHOD_FUNC(set_collide), 1);
|
|
115
|
+
cConstraint.define_method("collide?", can_collide);
|
|
116
|
+
cConstraint.define_method("removed?", is_removed);
|
|
117
|
+
cConstraint.define_method("active?", is_active);
|
|
118
|
+
|
|
119
|
+
define_selector_methods<Reflex::Constraint>(cConstraint);
|
|
120
|
+
define_wrapper_equality_methods<Reflex::Constraint>(cConstraint);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
namespace Reflex
|
|
125
|
+
{
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
Class
|
|
129
|
+
constraint_class ()
|
|
130
|
+
{
|
|
131
|
+
return cConstraint;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
}// Reflex
|
|
@@ -8,7 +8,7 @@ RUCY_DEFINE_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::ControlChangeEvent)
|
|
|
8
8
|
|
|
9
9
|
#define THIS to<Reflex::ControlChangeEvent*>(self)
|
|
10
10
|
|
|
11
|
-
#define CHECK
|
|
11
|
+
#define CHECK RUCY_CHECK_PTR(Reflex::ControlChangeEvent, self)
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
static
|
data/.doc/ext/reflex/device.cpp
CHANGED
|
@@ -8,7 +8,7 @@ RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::EllipseShape)
|
|
|
8
8
|
|
|
9
9
|
#define THIS to<Reflex::EllipseShape*>(self)
|
|
10
10
|
|
|
11
|
-
#define CHECK
|
|
11
|
+
#define CHECK RUCY_CHECK_PTR(Reflex::EllipseShape, self)
|
|
12
12
|
|
|
13
13
|
#define CALL(fun) RUCY_CALL_SUPER(THIS, fun)
|
|
14
14
|
|