reflexion 0.5.2 → 0.6.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 +19 -1
- data/.doc/ext/reflex/chase_constraint.cpp +84 -0
- data/.doc/ext/reflex/clipboard.cpp +65 -0
- data/.doc/ext/reflex/constraint.cpp +135 -0
- data/.doc/ext/reflex/key_event.cpp +6 -6
- data/.doc/ext/reflex/link_constraint.cpp +178 -0
- data/.doc/ext/reflex/menu.cpp +302 -0
- data/.doc/ext/reflex/native.cpp +22 -4
- data/.doc/ext/reflex/pin.cpp +156 -0
- data/.doc/ext/reflex/pointer.cpp +2 -0
- data/.doc/ext/reflex/pointer_event.cpp +1 -1
- data/.doc/ext/reflex/reflex.cpp +42 -7
- data/.doc/ext/reflex/selector.cpp +4 -4
- data/.doc/ext/reflex/snap_constraint.cpp +125 -0
- data/.doc/ext/reflex/style_length.cpp +3 -2
- data/.doc/ext/reflex/view.cpp +96 -23
- data/.doc/ext/reflex/wheel_constraint.cpp +142 -0
- data/.doc/ext/reflex/window.cpp +59 -17
- data/.github/workflows/release-gem.yml +10 -1
- data/.github/workflows/test.yml +9 -0
- data/ChangeLog.md +30 -0
- data/README.md +1 -0
- data/VERSION +1 -1
- data/ext/reflex/application.cpp +21 -1
- data/ext/reflex/chase_constraint.cpp +89 -0
- data/ext/reflex/clipboard.cpp +69 -0
- data/ext/reflex/constraint.cpp +146 -0
- data/ext/reflex/key_event.cpp +6 -6
- data/ext/reflex/link_constraint.cpp +194 -0
- data/ext/reflex/menu.cpp +330 -0
- data/ext/reflex/native.cpp +22 -4
- data/ext/reflex/pin.cpp +165 -0
- data/ext/reflex/pointer.cpp +2 -0
- data/ext/reflex/pointer_event.cpp +1 -1
- data/ext/reflex/reflex.cpp +42 -7
- data/ext/reflex/selector.cpp +4 -4
- data/ext/reflex/selector.h +1 -1
- data/ext/reflex/snap_constraint.cpp +135 -0
- data/ext/reflex/style_length.cpp +3 -2
- data/ext/reflex/view.cpp +117 -37
- data/ext/reflex/wheel_constraint.cpp +154 -0
- data/ext/reflex/window.cpp +65 -18
- data/include/reflex/application.h +9 -0
- data/include/reflex/clipboard.h +53 -0
- data/include/reflex/constraint.h +275 -0
- data/include/reflex/defs.h +204 -195
- data/include/reflex/event.h +2 -0
- data/include/reflex/menu.h +120 -0
- data/include/reflex/pin.h +68 -0
- data/include/reflex/pointer.h +4 -0
- data/include/reflex/ruby/clipboard.h +23 -0
- data/include/reflex/ruby/constraint.h +94 -0
- data/include/reflex/ruby/menu.h +103 -0
- data/include/reflex/ruby/pin.h +40 -0
- data/include/reflex/ruby/view.h +36 -0
- data/include/reflex/ruby/window.h +36 -18
- data/include/reflex/view.h +39 -12
- data/include/reflex/window.h +17 -4
- data/include/reflex.h +5 -0
- data/lib/reflex/chase_constraint.rb +15 -0
- data/lib/reflex/clipboard.rb +19 -0
- data/lib/reflex/constraint.rb +29 -0
- data/lib/reflex/extension.rb +1 -1
- data/lib/reflex/helper.rb +28 -0
- data/lib/reflex/key_event.rb +7 -12
- data/lib/reflex/link_constraint.rb +31 -0
- data/lib/reflex/menu.rb +76 -0
- data/lib/reflex/pin.rb +39 -0
- data/lib/reflex/pointer.rb +18 -0
- data/lib/reflex/pointer_event.rb +1 -1
- data/lib/reflex/snap_constraint.rb +28 -0
- data/lib/reflex/view.rb +56 -4
- data/lib/reflex/wheel_constraint.rb +28 -0
- data/lib/reflex/wheel_event.rb +9 -0
- data/lib/reflex.rb +15 -6
- data/pod.rake +4 -2
- data/reflex.gemspec +3 -3
- data/samples/constraint.rb +152 -0
- data/samples/menu.rb +29 -0
- data/src/application.cpp +21 -2
- data/src/application.h +5 -0
- data/src/clipboard.cpp +81 -0
- data/src/constraint.cpp +1662 -0
- data/src/constraint.h +64 -0
- data/src/event.cpp +7 -1
- data/src/event.h +1 -2
- data/src/ios/application.mm +5 -0
- data/src/ios/clipboard.mm +44 -0
- data/src/ios/event.h +6 -2
- data/src/ios/event.mm +31 -12
- data/src/ios/menu.mm +36 -0
- data/src/ios/view_controller.mm +45 -12
- data/src/ios/window.mm +6 -0
- data/src/menu.cpp +325 -0
- data/src/menu.h +65 -0
- data/src/osx/app_delegate.mm +74 -125
- data/src/osx/application.mm +16 -0
- data/src/osx/clipboard.mm +45 -0
- data/src/osx/event.mm +40 -10
- data/src/osx/menu.h +25 -0
- data/src/osx/menu.mm +372 -0
- data/src/osx/native_window.mm +27 -0
- data/src/osx/opengl_view.mm +51 -0
- data/src/osx/window.mm +11 -0
- data/src/pin.cpp +137 -0
- data/src/pointer.cpp +27 -16
- data/src/pointer.h +6 -0
- data/src/sdl/application.cpp +5 -0
- data/src/sdl/clipboard.cpp +39 -0
- data/src/sdl/event.cpp +20 -3
- data/src/sdl/event.h +6 -3
- data/src/sdl/menu.cpp +35 -0
- data/src/sdl/window.cpp +26 -8
- data/src/view.cpp +313 -52
- data/src/view.h +18 -2
- data/src/win32/application.cpp +5 -0
- data/src/win32/clipboard.cpp +210 -0
- data/src/win32/event.cpp +11 -1
- data/src/win32/event.h +2 -0
- data/src/win32/menu.cpp +352 -0
- data/src/win32/menu.h +27 -0
- data/src/win32/window.cpp +62 -0
- data/src/win32/window.h +3 -0
- data/src/window.cpp +235 -22
- data/src/window.h +13 -2
- data/src/world.cpp +77 -14
- data/src/world.h +9 -2
- data/test/helper.rb +7 -0
- data/test/test_application.rb +11 -0
- data/test/test_chase_constraint.rb +124 -0
- data/test/test_clipboard.rb +54 -0
- data/test/test_constraint.rb +186 -0
- data/test/test_key_event.rb +6 -0
- data/test/test_link_constraint.rb +239 -0
- data/test/test_menu.rb +207 -0
- data/test/test_pin.rb +65 -0
- data/test/test_pointer.rb +23 -9
- data/test/test_pointer_event.rb +1 -1
- data/test/test_snap_constraint.rb +142 -0
- data/test/test_view.rb +113 -23
- data/test/test_wheel_constraint.rb +127 -0
- data/test/test_wheel_event.rb +15 -9
- data/test/test_window.rb +10 -0
- metadata +82 -8
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// -*- c++ -*-
|
|
2
|
+
#pragma once
|
|
3
|
+
#ifndef __REFLEX_RUBY_CLIPBOARD_H__
|
|
4
|
+
#define __REFLEX_RUBY_CLIPBOARD_H__
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
#include <rucy/class.h>
|
|
8
|
+
#include <rucy/extension.h>
|
|
9
|
+
#include <reflex/clipboard.h>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
namespace Reflex
|
|
13
|
+
{
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
REFLEX_EXPORT Rucy::Class clipboard_class ();
|
|
17
|
+
// class Reflex::Clipboard
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
}// Reflex
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
#endif//EOH
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// -*- c++ -*-
|
|
2
|
+
#pragma once
|
|
3
|
+
#ifndef __REFLEX_RUBY_CONSTRAINT_H__
|
|
4
|
+
#define __REFLEX_RUBY_CONSTRAINT_H__
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
#include <rucy/class.h>
|
|
8
|
+
#include <rucy/extension.h>
|
|
9
|
+
#include <reflex/constraint.h>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
RUCY_DECLARE_WRAPPER_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::Constraint)
|
|
13
|
+
|
|
14
|
+
RUCY_DECLARE_WRAPPER_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::SnapConstraint)
|
|
15
|
+
|
|
16
|
+
RUCY_DECLARE_WRAPPER_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::LinkConstraint)
|
|
17
|
+
|
|
18
|
+
RUCY_DECLARE_WRAPPER_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::WheelConstraint)
|
|
19
|
+
|
|
20
|
+
RUCY_DECLARE_WRAPPER_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::ChaseConstraint)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
namespace Reflex
|
|
24
|
+
{
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
template <typename T>
|
|
28
|
+
class RubyConstraint : public Rucy::ClassWrapper<T> {};
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
REFLEX_EXPORT Rucy::Class constraint_class ();
|
|
32
|
+
// class Reflex::Constraint
|
|
33
|
+
|
|
34
|
+
REFLEX_EXPORT Rucy::Class snap_constraint_class ();
|
|
35
|
+
// class Reflex::SnapConstraint
|
|
36
|
+
|
|
37
|
+
REFLEX_EXPORT Rucy::Class link_constraint_class ();
|
|
38
|
+
// class Reflex::LinkConstraint
|
|
39
|
+
|
|
40
|
+
REFLEX_EXPORT Rucy::Class wheel_constraint_class ();
|
|
41
|
+
// class Reflex::WheelConstraint
|
|
42
|
+
|
|
43
|
+
REFLEX_EXPORT Rucy::Class chase_constraint_class ();
|
|
44
|
+
// class Reflex::ChaseConstraint
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
}// Reflex
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
namespace Rucy
|
|
51
|
+
{
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
template <> inline Class
|
|
55
|
+
get_ruby_class<Reflex::Constraint> ()
|
|
56
|
+
{
|
|
57
|
+
return Reflex::constraint_class();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
template <> inline Class
|
|
61
|
+
get_ruby_class<Reflex::SnapConstraint> ()
|
|
62
|
+
{
|
|
63
|
+
return Reflex::snap_constraint_class();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
template <> inline Class
|
|
67
|
+
get_ruby_class<Reflex::LinkConstraint> ()
|
|
68
|
+
{
|
|
69
|
+
return Reflex::link_constraint_class();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
template <> inline Class
|
|
73
|
+
get_ruby_class<Reflex::WheelConstraint> ()
|
|
74
|
+
{
|
|
75
|
+
return Reflex::wheel_constraint_class();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
template <> inline Class
|
|
79
|
+
get_ruby_class<Reflex::ChaseConstraint> ()
|
|
80
|
+
{
|
|
81
|
+
return Reflex::chase_constraint_class();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
inline Value
|
|
85
|
+
value (Reflex::Constraint::Ref& ref, Value klass = Reflex::constraint_class())
|
|
86
|
+
{
|
|
87
|
+
return value(ref.get(), klass);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
}// Rucy
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
#endif//EOH
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// -*- c++ -*-
|
|
2
|
+
#pragma once
|
|
3
|
+
#ifndef __REFLEX_RUBY_MENU_H__
|
|
4
|
+
#define __REFLEX_RUBY_MENU_H__
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
#include <rucy/class.h>
|
|
8
|
+
#include <rucy/extension.h>
|
|
9
|
+
#include <reflex/menu.h>
|
|
10
|
+
#include <reflex/ruby/event.h>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
RUCY_DECLARE_WRAPPER_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::Menu)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
namespace Reflex
|
|
17
|
+
{
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
REFLEX_EXPORT Rucy::Class menu_class ();
|
|
21
|
+
// class Reflex::Menu
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
template <typename T>
|
|
25
|
+
class RubyMenu : public Rucy::ClassWrapper<T>
|
|
26
|
+
{
|
|
27
|
+
|
|
28
|
+
typedef Rucy::ClassWrapper<T> Super;
|
|
29
|
+
|
|
30
|
+
public:
|
|
31
|
+
|
|
32
|
+
virtual void on_show (Event* e)
|
|
33
|
+
{
|
|
34
|
+
RUCY_SYM(on_show);
|
|
35
|
+
if (this->is_overridable())
|
|
36
|
+
this->value.call(on_show, Rucy::value(e));
|
|
37
|
+
else
|
|
38
|
+
Super::on_show(e);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
virtual void on_hide (Event* e)
|
|
42
|
+
{
|
|
43
|
+
RUCY_SYM(on_hide);
|
|
44
|
+
if (this->is_overridable())
|
|
45
|
+
this->value.call(on_hide, Rucy::value(e));
|
|
46
|
+
else
|
|
47
|
+
Super::on_hide(e);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
virtual void on_open_submenu (Event* e)
|
|
51
|
+
{
|
|
52
|
+
RUCY_SYM(on_open_submenu);
|
|
53
|
+
if (this->is_overridable())
|
|
54
|
+
this->value.call(on_open_submenu, Rucy::value(e));
|
|
55
|
+
else
|
|
56
|
+
Super::on_open_submenu(e);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
virtual void on_close_submenu (Event* e)
|
|
60
|
+
{
|
|
61
|
+
RUCY_SYM(on_close_submenu);
|
|
62
|
+
if (this->is_overridable())
|
|
63
|
+
this->value.call(on_close_submenu, Rucy::value(e));
|
|
64
|
+
else
|
|
65
|
+
Super::on_close_submenu(e);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
virtual void on_click (Event* e)
|
|
69
|
+
{
|
|
70
|
+
RUCY_SYM(on_click);
|
|
71
|
+
if (this->is_overridable())
|
|
72
|
+
this->value.call(on_click, Rucy::value(e));
|
|
73
|
+
else
|
|
74
|
+
Super::on_click(e);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
};// RubyMenu
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
}// Reflex
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
namespace Rucy
|
|
84
|
+
{
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
template <> inline Class
|
|
88
|
+
get_ruby_class<Reflex::Menu> ()
|
|
89
|
+
{
|
|
90
|
+
return Reflex::menu_class();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
inline Value
|
|
94
|
+
value (Reflex::Menu::Ref& ref, Value klass = Reflex::menu_class())
|
|
95
|
+
{
|
|
96
|
+
return value(ref.get(), klass);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
}// Rucy
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
#endif//EOH
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// -*- c++ -*-
|
|
2
|
+
#pragma once
|
|
3
|
+
#ifndef __REFLEX_RUBY_PIN_H__
|
|
4
|
+
#define __REFLEX_RUBY_PIN_H__
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
#include <rucy/class.h>
|
|
8
|
+
#include <rucy/extension.h>
|
|
9
|
+
#include <reflex/pin.h>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
RUCY_DECLARE_VALUE_OR_ARRAY_FROM_TO(REFLEX_EXPORT, Reflex::Pin)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace Reflex
|
|
16
|
+
{
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
REFLEX_EXPORT Rucy::Class pin_class ();
|
|
20
|
+
// class Reflex::Pin
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
}// Reflex
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
namespace Rucy
|
|
27
|
+
{
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
template <> inline Class
|
|
31
|
+
get_ruby_class<Reflex::Pin> ()
|
|
32
|
+
{
|
|
33
|
+
return Reflex::pin_class();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
}// Rucy
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
#endif//EOH
|
data/include/reflex/ruby/view.h
CHANGED
|
@@ -59,6 +59,24 @@ namespace Reflex
|
|
|
59
59
|
Super::on_detach(e);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
virtual void on_activate (Event* e)
|
|
63
|
+
{
|
|
64
|
+
RUCY_SYM(on_activate);
|
|
65
|
+
if (this->is_overridable())
|
|
66
|
+
this->value.call(on_activate, Rucy::value(e));
|
|
67
|
+
else
|
|
68
|
+
Super::on_activate(e);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
virtual void on_deactivate (Event* e)
|
|
72
|
+
{
|
|
73
|
+
RUCY_SYM(on_deactivate);
|
|
74
|
+
if (this->is_overridable())
|
|
75
|
+
this->value.call(on_deactivate, Rucy::value(e));
|
|
76
|
+
else
|
|
77
|
+
Super::on_deactivate(e);
|
|
78
|
+
}
|
|
79
|
+
|
|
62
80
|
virtual void on_show (Event* e)
|
|
63
81
|
{
|
|
64
82
|
RUCY_SYM(on_show);
|
|
@@ -221,6 +239,24 @@ namespace Reflex
|
|
|
221
239
|
Super::on_pointer_cancel(e);
|
|
222
240
|
}
|
|
223
241
|
|
|
242
|
+
virtual void on_pointer_enter (PointerEvent* e)
|
|
243
|
+
{
|
|
244
|
+
RUCY_SYM(on_pointer_enter);
|
|
245
|
+
if (this->is_overridable())
|
|
246
|
+
this->value.call(on_pointer_enter, Rucy::value(e));
|
|
247
|
+
else
|
|
248
|
+
Super::on_pointer_enter(e);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
virtual void on_pointer_leave (PointerEvent* e)
|
|
252
|
+
{
|
|
253
|
+
RUCY_SYM(on_pointer_leave);
|
|
254
|
+
if (this->is_overridable())
|
|
255
|
+
this->value.call(on_pointer_leave, Rucy::value(e));
|
|
256
|
+
else
|
|
257
|
+
Super::on_pointer_leave(e);
|
|
258
|
+
}
|
|
259
|
+
|
|
224
260
|
virtual void on_wheel (WheelEvent* e)
|
|
225
261
|
{
|
|
226
262
|
RUCY_SYM(on_wheel);
|
|
@@ -29,24 +29,6 @@ namespace Reflex
|
|
|
29
29
|
|
|
30
30
|
public:
|
|
31
31
|
|
|
32
|
-
virtual void on_activate (Event* e)
|
|
33
|
-
{
|
|
34
|
-
RUCY_SYM(on_activate);
|
|
35
|
-
if (this->is_overridable())
|
|
36
|
-
this->value.call(on_activate, Rucy::value(e));
|
|
37
|
-
else
|
|
38
|
-
return Super::on_activate(e);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
virtual void on_deactivate (Event* e)
|
|
42
|
-
{
|
|
43
|
-
RUCY_SYM(on_deactivate);
|
|
44
|
-
if (this->is_overridable())
|
|
45
|
-
this->value.call(on_deactivate, Rucy::value(e));
|
|
46
|
-
else
|
|
47
|
-
return Super::on_deactivate(e);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
32
|
virtual void on_show (Event* e)
|
|
51
33
|
{
|
|
52
34
|
RUCY_SYM(on_show);
|
|
@@ -74,6 +56,24 @@ namespace Reflex
|
|
|
74
56
|
return Super::on_close(e);
|
|
75
57
|
}
|
|
76
58
|
|
|
59
|
+
virtual void on_activate (Event* e)
|
|
60
|
+
{
|
|
61
|
+
RUCY_SYM(on_activate);
|
|
62
|
+
if (this->is_overridable())
|
|
63
|
+
this->value.call(on_activate, Rucy::value(e));
|
|
64
|
+
else
|
|
65
|
+
return Super::on_activate(e);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
virtual void on_deactivate (Event* e)
|
|
69
|
+
{
|
|
70
|
+
RUCY_SYM(on_deactivate);
|
|
71
|
+
if (this->is_overridable())
|
|
72
|
+
this->value.call(on_deactivate, Rucy::value(e));
|
|
73
|
+
else
|
|
74
|
+
return Super::on_deactivate(e);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
77
|
virtual void on_update (UpdateEvent* e)
|
|
78
78
|
{
|
|
79
79
|
RUCY_SYM(on_update);
|
|
@@ -182,6 +182,24 @@ namespace Reflex
|
|
|
182
182
|
Super::on_pointer_cancel(e);
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
+
virtual void on_pointer_enter (PointerEvent* e)
|
|
186
|
+
{
|
|
187
|
+
RUCY_SYM(on_pointer_enter);
|
|
188
|
+
if (this->is_overridable())
|
|
189
|
+
this->value.call(on_pointer_enter, Rucy::value(e));
|
|
190
|
+
else
|
|
191
|
+
Super::on_pointer_enter(e);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
virtual void on_pointer_leave (PointerEvent* e)
|
|
195
|
+
{
|
|
196
|
+
RUCY_SYM(on_pointer_leave);
|
|
197
|
+
if (this->is_overridable())
|
|
198
|
+
this->value.call(on_pointer_leave, Rucy::value(e));
|
|
199
|
+
else
|
|
200
|
+
Super::on_pointer_leave(e);
|
|
201
|
+
}
|
|
202
|
+
|
|
185
203
|
virtual void on_wheel (WheelEvent* e)
|
|
186
204
|
{
|
|
187
205
|
RUCY_SYM(on_wheel);
|
data/include/reflex/view.h
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
#include <reflex/selector.h>
|
|
16
16
|
#include <reflex/style.h>
|
|
17
17
|
#include <reflex/shape.h>
|
|
18
|
+
#include <reflex/constraint.h>
|
|
18
19
|
#include <reflex/event.h>
|
|
19
20
|
|
|
20
21
|
|
|
@@ -38,23 +39,29 @@ namespace Reflex
|
|
|
38
39
|
|
|
39
40
|
typedef Xot::Ref<This> Ref;
|
|
40
41
|
|
|
41
|
-
typedef std::vector<Ref>
|
|
42
|
+
typedef std::vector<Ref> ChildList;
|
|
42
43
|
|
|
43
|
-
typedef std::vector<Style>
|
|
44
|
+
typedef std::vector<Style> StyleList;
|
|
44
45
|
|
|
45
|
-
typedef std::vector<Shape::Ref>
|
|
46
|
+
typedef std::vector<Shape::Ref> ShapeList;
|
|
46
47
|
|
|
47
|
-
typedef
|
|
48
|
+
typedef std::vector<Constraint::Ref> ConstraintList;
|
|
48
49
|
|
|
49
|
-
typedef ChildList::
|
|
50
|
+
typedef ChildList:: iterator child_iterator;
|
|
50
51
|
|
|
51
|
-
typedef
|
|
52
|
+
typedef ChildList:: const_iterator const_child_iterator;
|
|
52
53
|
|
|
53
|
-
typedef StyleList::
|
|
54
|
+
typedef StyleList:: iterator style_iterator;
|
|
54
55
|
|
|
55
|
-
typedef
|
|
56
|
+
typedef StyleList:: const_iterator const_style_iterator;
|
|
56
57
|
|
|
57
|
-
typedef ShapeList::
|
|
58
|
+
typedef ShapeList:: iterator shape_iterator;
|
|
59
|
+
|
|
60
|
+
typedef ShapeList:: const_iterator const_shape_iterator;
|
|
61
|
+
|
|
62
|
+
typedef ConstraintList:: iterator constraint_iterator;
|
|
63
|
+
|
|
64
|
+
typedef ConstraintList::const_iterator const_constraint_iterator;
|
|
58
65
|
|
|
59
66
|
enum Flag
|
|
60
67
|
{
|
|
@@ -122,7 +129,7 @@ namespace Reflex
|
|
|
122
129
|
|
|
123
130
|
virtual Point to_screen (const Point& point) const;
|
|
124
131
|
|
|
125
|
-
virtual void add_child (View* child);
|
|
132
|
+
virtual void add_child (View* child, int index = -1);
|
|
126
133
|
|
|
127
134
|
virtual void remove_child (View* child);
|
|
128
135
|
|
|
@@ -171,7 +178,7 @@ namespace Reflex
|
|
|
171
178
|
|
|
172
179
|
virtual const Shape* shape () const;
|
|
173
180
|
|
|
174
|
-
virtual void add_shape (Shape* shape);
|
|
181
|
+
virtual void add_shape (Shape* shape, int index = -1);
|
|
175
182
|
|
|
176
183
|
virtual void remove_shape (Shape* shape);
|
|
177
184
|
|
|
@@ -187,6 +194,18 @@ namespace Reflex
|
|
|
187
194
|
|
|
188
195
|
virtual const_shape_iterator shape_end () const;
|
|
189
196
|
|
|
197
|
+
virtual void clear_constraints ();
|
|
198
|
+
|
|
199
|
+
virtual ConstraintList find_constraints (const Selector& selector) const;
|
|
200
|
+
|
|
201
|
+
virtual constraint_iterator constraint_begin ();
|
|
202
|
+
|
|
203
|
+
virtual const_constraint_iterator constraint_begin () const;
|
|
204
|
+
|
|
205
|
+
virtual constraint_iterator constraint_end ();
|
|
206
|
+
|
|
207
|
+
virtual const_constraint_iterator constraint_end () const;
|
|
208
|
+
|
|
190
209
|
virtual void set_filter (Filter* filter);
|
|
191
210
|
|
|
192
211
|
virtual Filter* filter ();
|
|
@@ -313,7 +332,7 @@ namespace Reflex
|
|
|
313
332
|
//
|
|
314
333
|
virtual void create_world (float pixels_per_meter);
|
|
315
334
|
|
|
316
|
-
virtual void update_world (
|
|
335
|
+
virtual void update_world ();
|
|
317
336
|
|
|
318
337
|
virtual float meter2pixel (float meter = 1, bool create_world = true);
|
|
319
338
|
|
|
@@ -344,6 +363,10 @@ namespace Reflex
|
|
|
344
363
|
|
|
345
364
|
virtual void on_detach (Event* e);
|
|
346
365
|
|
|
366
|
+
virtual void on_activate (Event* e);
|
|
367
|
+
|
|
368
|
+
virtual void on_deactivate (Event* e);
|
|
369
|
+
|
|
347
370
|
virtual void on_show (Event* e);
|
|
348
371
|
|
|
349
372
|
virtual void on_hide (Event* e);
|
|
@@ -380,6 +403,10 @@ namespace Reflex
|
|
|
380
403
|
|
|
381
404
|
virtual void on_pointer_cancel (PointerEvent* e);
|
|
382
405
|
|
|
406
|
+
virtual void on_pointer_enter (PointerEvent* e);
|
|
407
|
+
|
|
408
|
+
virtual void on_pointer_leave (PointerEvent* e);
|
|
409
|
+
|
|
383
410
|
virtual void on_wheel (WheelEvent* e);
|
|
384
411
|
|
|
385
412
|
virtual void on_midi (MIDIEvent* e);
|
data/include/reflex/window.h
CHANGED
|
@@ -18,6 +18,7 @@ namespace Reflex
|
|
|
18
18
|
{
|
|
19
19
|
|
|
20
20
|
|
|
21
|
+
class Menu;
|
|
21
22
|
class View;
|
|
22
23
|
|
|
23
24
|
|
|
@@ -65,6 +66,8 @@ namespace Reflex
|
|
|
65
66
|
|
|
66
67
|
virtual Point to_screen (const Point& point) const;
|
|
67
68
|
|
|
69
|
+
virtual bool active () const;
|
|
70
|
+
|
|
68
71
|
virtual void set_title (const char* title);
|
|
69
72
|
|
|
70
73
|
virtual const char* title () const;
|
|
@@ -75,6 +78,12 @@ namespace Reflex
|
|
|
75
78
|
|
|
76
79
|
virtual Bounds frame () const;
|
|
77
80
|
|
|
81
|
+
virtual void set_menu (Menu* menu);
|
|
82
|
+
|
|
83
|
+
virtual Menu* menu ();
|
|
84
|
+
|
|
85
|
+
virtual const Menu* menu () const;
|
|
86
|
+
|
|
78
87
|
virtual void set_flag (uint flags);
|
|
79
88
|
|
|
80
89
|
virtual uint flags () const;
|
|
@@ -99,16 +108,16 @@ namespace Reflex
|
|
|
99
108
|
|
|
100
109
|
virtual const Painter* painter () const;
|
|
101
110
|
|
|
102
|
-
virtual void on_activate (Event* e);
|
|
103
|
-
|
|
104
|
-
virtual void on_deactivate (Event* e);
|
|
105
|
-
|
|
106
111
|
virtual void on_show (Event* e);
|
|
107
112
|
|
|
108
113
|
virtual void on_hide (Event* e);
|
|
109
114
|
|
|
110
115
|
virtual void on_close (Event* e);
|
|
111
116
|
|
|
117
|
+
virtual void on_activate (Event* e);
|
|
118
|
+
|
|
119
|
+
virtual void on_deactivate (Event* e);
|
|
120
|
+
|
|
112
121
|
virtual void on_update (UpdateEvent* e);
|
|
113
122
|
|
|
114
123
|
virtual void on_draw (DrawEvent* e);
|
|
@@ -133,6 +142,10 @@ namespace Reflex
|
|
|
133
142
|
|
|
134
143
|
virtual void on_pointer_cancel (PointerEvent* e);
|
|
135
144
|
|
|
145
|
+
virtual void on_pointer_enter (PointerEvent* e);
|
|
146
|
+
|
|
147
|
+
virtual void on_pointer_leave (PointerEvent* e);
|
|
148
|
+
|
|
136
149
|
virtual void on_wheel (WheelEvent* e);
|
|
137
150
|
|
|
138
151
|
virtual void on_midi (MIDIEvent* e);
|
data/include/reflex.h
CHANGED
|
@@ -15,14 +15,19 @@
|
|
|
15
15
|
#include <reflex/style.h>
|
|
16
16
|
#include <reflex/timer.h>
|
|
17
17
|
#include <reflex/shape.h>
|
|
18
|
+
#include <reflex/pin.h>
|
|
19
|
+
#include <reflex/constraint.h>
|
|
18
20
|
#include <reflex/filter.h>
|
|
19
21
|
|
|
20
22
|
#include <reflex/application.h>
|
|
21
23
|
#include <reflex/window.h>
|
|
22
24
|
#include <reflex/view.h>
|
|
25
|
+
#include <reflex/menu.h>
|
|
23
26
|
#include <reflex/screen.h>
|
|
24
27
|
|
|
25
28
|
#include <reflex/device.h>
|
|
29
|
+
#include <reflex/midi.h>
|
|
30
|
+
#include <reflex/gamepad.h>
|
|
26
31
|
|
|
27
32
|
#include <reflex/image_view.h>
|
|
28
33
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'xot/setter'
|
|
2
|
+
require 'xot/universal_accessor'
|
|
3
|
+
require 'reflex/ext'
|
|
4
|
+
require 'reflex/helper'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Reflex
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Constraint
|
|
11
|
+
|
|
12
|
+
include Xot::Setter
|
|
13
|
+
include HasTags
|
|
14
|
+
|
|
15
|
+
def pins()
|
|
16
|
+
[get_pin(0), get_pin(1)]
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def views()
|
|
20
|
+
pins.map(&:view)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
universal_accessor :name, :selector,
|
|
24
|
+
:spring, :damping, collide: {reader: :collide?}
|
|
25
|
+
|
|
26
|
+
end# Constraint
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
end# Reflex
|
data/lib/reflex/extension.rb
CHANGED
data/lib/reflex/helper.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'xot/universal_accessor'
|
|
2
|
+
require 'reflex/ext'
|
|
2
3
|
require 'reflex/point'
|
|
3
4
|
require 'reflex/bounds'
|
|
4
5
|
|
|
@@ -6,6 +7,33 @@ require 'reflex/bounds'
|
|
|
6
7
|
module Reflex
|
|
7
8
|
|
|
8
9
|
|
|
10
|
+
MODIFIER_SYMBOLS = {
|
|
11
|
+
shift: MOD_SHIFT,
|
|
12
|
+
control: MOD_CONTROL,
|
|
13
|
+
alt: MOD_ALT,
|
|
14
|
+
win: MOD_WIN,
|
|
15
|
+
option: MOD_OPTION,
|
|
16
|
+
command: MOD_COMMAND,
|
|
17
|
+
help: MOD_HELP,
|
|
18
|
+
function: MOD_FUNCTION,
|
|
19
|
+
numpad: MOD_NUMPAD,
|
|
20
|
+
caps: MOD_CAPS,
|
|
21
|
+
scroll: MOD_SCROLL
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
SHORTCUT_MODIFIER_SYMBOLS = MODIFIER_SYMBOLS.slice(
|
|
25
|
+
:shift,
|
|
26
|
+
:control,
|
|
27
|
+
:alt,
|
|
28
|
+
:option,
|
|
29
|
+
:command)
|
|
30
|
+
|
|
31
|
+
LOCK_MODIFIER_SYMBOLS = MODIFIER_SYMBOLS.slice(
|
|
32
|
+
:numpad,
|
|
33
|
+
:caps,
|
|
34
|
+
:scroll)
|
|
35
|
+
|
|
36
|
+
|
|
9
37
|
module HasFrame
|
|
10
38
|
|
|
11
39
|
def move_to(*args)
|