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
data/src/event.h
CHANGED
|
@@ -12,6 +12,18 @@ namespace Reflex
|
|
|
12
12
|
{
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
enum
|
|
16
|
+
{
|
|
17
|
+
|
|
18
|
+
WHEEL_PIXELS_PER_LINE = 16,
|
|
19
|
+
|
|
20
|
+
WHEEL_LINES_PER_NOTCH = 3,
|
|
21
|
+
|
|
22
|
+
WHEEL_PIXELS_PER_NOTCH = WHEEL_PIXELS_PER_LINE * WHEEL_LINES_PER_NOTCH
|
|
23
|
+
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
|
|
15
27
|
void DrawEvent_set_view (DrawEvent* pthis, View* view);
|
|
16
28
|
|
|
17
29
|
void DrawEvent_set_painter (DrawEvent* pthis, Painter* painter);
|
|
@@ -42,8 +54,7 @@ namespace Reflex
|
|
|
42
54
|
void PointerEvent_update_for_child_view (
|
|
43
55
|
PointerEvent* pthis, const View* view);
|
|
44
56
|
|
|
45
|
-
void
|
|
46
|
-
PointerEvent* pthis, const View* view);
|
|
57
|
+
void PointerEvent_to_view_coord (PointerEvent* pthis, const View* view);
|
|
47
58
|
|
|
48
59
|
|
|
49
60
|
void WheelEvent_set_position (WheelEvent* pthis, const Point& position);
|
data/src/file_dialog.cpp
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
#include "file_dialog.h"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
#include "reflex/exception.h"
|
|
5
|
+
#include "application.h"
|
|
6
|
+
#include "window.h"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
namespace Reflex
|
|
10
|
+
{
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
void
|
|
14
|
+
FileDialog_call_file_event (FileDialog* dialog, FileEvent* event)
|
|
15
|
+
{
|
|
16
|
+
if (!dialog)
|
|
17
|
+
argument_error(__FILE__, __LINE__);
|
|
18
|
+
if (!event)
|
|
19
|
+
argument_error(__FILE__, __LINE__);
|
|
20
|
+
|
|
21
|
+
Application_guard([&]()
|
|
22
|
+
{
|
|
23
|
+
dialog->on_file(event);
|
|
24
|
+
if (event->is_blocked()) return;
|
|
25
|
+
|
|
26
|
+
if (dialog->owner())
|
|
27
|
+
Window_call_file_event(dialog->owner(), event);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
void
|
|
32
|
+
FileDialog_call_cancel_event (FileDialog* dialog, Event* event)
|
|
33
|
+
{
|
|
34
|
+
if (!dialog)
|
|
35
|
+
argument_error(__FILE__, __LINE__);
|
|
36
|
+
if (!event)
|
|
37
|
+
argument_error(__FILE__, __LINE__);
|
|
38
|
+
|
|
39
|
+
Application_guard([&]()
|
|
40
|
+
{
|
|
41
|
+
dialog->on_cancel(event);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
FileDialog::FileDialog ()
|
|
47
|
+
{
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
FileDialog::~FileDialog ()
|
|
51
|
+
{
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
void
|
|
55
|
+
FileDialog::open_file (const char* dir)
|
|
56
|
+
{
|
|
57
|
+
FileDialog_show(this, Data::OPEN_FILE, dir, NULL);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
void
|
|
61
|
+
FileDialog::open_files (const char* dir)
|
|
62
|
+
{
|
|
63
|
+
FileDialog_show(this, Data::OPEN_FILES, dir, NULL);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
void
|
|
67
|
+
FileDialog::open_directory (const char* dir)
|
|
68
|
+
{
|
|
69
|
+
FileDialog_show(this, Data::OPEN_DIRECTORY, dir, NULL);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
void
|
|
73
|
+
FileDialog::save_file (const char* dir, const char* name)
|
|
74
|
+
{
|
|
75
|
+
FileDialog_show(this, Data::SAVE_FILE, dir, name);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
void
|
|
79
|
+
FileDialog::set_owner (Window* window)
|
|
80
|
+
{
|
|
81
|
+
self->owner = window;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
Window*
|
|
85
|
+
FileDialog::owner ()
|
|
86
|
+
{
|
|
87
|
+
return self->owner;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const Window*
|
|
91
|
+
FileDialog::owner () const
|
|
92
|
+
{
|
|
93
|
+
return const_cast<FileDialog*>(this)->owner();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
void
|
|
97
|
+
FileDialog::set_title (const char* title)
|
|
98
|
+
{
|
|
99
|
+
if (!title)
|
|
100
|
+
argument_error(__FILE__, __LINE__);
|
|
101
|
+
|
|
102
|
+
self->title = title;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const char*
|
|
106
|
+
FileDialog::title () const
|
|
107
|
+
{
|
|
108
|
+
return self->title;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
static String
|
|
112
|
+
to_extension (const String& extension)
|
|
113
|
+
{
|
|
114
|
+
size_t start = extension.find_first_not_of('.');
|
|
115
|
+
if (start == String::npos)
|
|
116
|
+
argument_error(__FILE__, __LINE__);
|
|
117
|
+
|
|
118
|
+
String result = extension.substr(start);
|
|
119
|
+
if (result.find_first_of("*?[]/\\;") != String::npos)
|
|
120
|
+
argument_error(__FILE__, __LINE__);
|
|
121
|
+
|
|
122
|
+
return result;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
void
|
|
126
|
+
FileDialog::set_extensions (const StringList& extensions)
|
|
127
|
+
{
|
|
128
|
+
StringList list;
|
|
129
|
+
for (const auto& extension : extensions)
|
|
130
|
+
list.emplace_back(to_extension(extension));
|
|
131
|
+
|
|
132
|
+
self->extensions = list;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const StringList&
|
|
136
|
+
FileDialog::extensions () const
|
|
137
|
+
{
|
|
138
|
+
return self->extensions;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
void
|
|
142
|
+
FileDialog::on_file (FileEvent* e)
|
|
143
|
+
{
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
void
|
|
147
|
+
FileDialog::on_cancel (Event* e)
|
|
148
|
+
{
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
FileDialog::operator bool () const
|
|
152
|
+
{
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
bool
|
|
157
|
+
FileDialog::operator ! () const
|
|
158
|
+
{
|
|
159
|
+
return !operator bool();
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
}// Reflex
|
data/src/file_dialog.h
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// -*- c++ -*-
|
|
2
|
+
#pragma once
|
|
3
|
+
#ifndef __REFLEX_SRC_FILE_DIALOG_H__
|
|
4
|
+
#define __REFLEX_SRC_FILE_DIALOG_H__
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
#include "reflex/file_dialog.h"
|
|
8
|
+
#include "reflex/window.h"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
namespace Reflex
|
|
12
|
+
{
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
struct FileDialog::Data
|
|
16
|
+
{
|
|
17
|
+
|
|
18
|
+
enum Mode
|
|
19
|
+
{
|
|
20
|
+
|
|
21
|
+
OPEN_FILE = 0,
|
|
22
|
+
|
|
23
|
+
OPEN_FILES,
|
|
24
|
+
|
|
25
|
+
OPEN_DIRECTORY,
|
|
26
|
+
|
|
27
|
+
SAVE_FILE
|
|
28
|
+
|
|
29
|
+
};// Mode
|
|
30
|
+
|
|
31
|
+
Xot::WeakRef<Window> owner;
|
|
32
|
+
|
|
33
|
+
String title;
|
|
34
|
+
|
|
35
|
+
StringList extensions;
|
|
36
|
+
|
|
37
|
+
};// FileDialog::Data
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
void FileDialog_show (
|
|
41
|
+
FileDialog* dialog, FileDialog::Data::Mode mode,
|
|
42
|
+
const char* dir, const char* name);
|
|
43
|
+
|
|
44
|
+
void FileDialog_call_file_event (FileDialog* dialog, FileEvent* event);
|
|
45
|
+
|
|
46
|
+
void FileDialog_call_cancel_event (FileDialog* dialog, Event* event);
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
}// Reflex
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
#endif//EOH
|
data/src/gamepad.cpp
CHANGED
|
@@ -40,6 +40,32 @@ namespace Reflex
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
|
|
43
|
+
static bool initialized = false;
|
|
44
|
+
|
|
45
|
+
void
|
|
46
|
+
Gamepad_init (Application* app)
|
|
47
|
+
{
|
|
48
|
+
if (!app)
|
|
49
|
+
argument_error(__FILE__, __LINE__);
|
|
50
|
+
|
|
51
|
+
if (initialized) return;
|
|
52
|
+
|
|
53
|
+
initialized = true;
|
|
54
|
+
Gamepad_init_native(app);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
void
|
|
58
|
+
Gamepad_fin (Application* app)
|
|
59
|
+
{
|
|
60
|
+
if (!app)
|
|
61
|
+
argument_error(__FILE__, __LINE__);
|
|
62
|
+
|
|
63
|
+
if (!initialized) return;
|
|
64
|
+
|
|
65
|
+
Gamepad_fin_native(app);
|
|
66
|
+
initialized = false;
|
|
67
|
+
}
|
|
68
|
+
|
|
43
69
|
static Gamepad::List gamepads;
|
|
44
70
|
|
|
45
71
|
void
|
|
@@ -50,7 +76,7 @@ namespace Reflex
|
|
|
50
76
|
|
|
51
77
|
gamepads.emplace_back(gamepad);
|
|
52
78
|
|
|
53
|
-
|
|
79
|
+
Application_call_device_connect_event(app, gamepad);
|
|
54
80
|
}
|
|
55
81
|
|
|
56
82
|
void
|
|
@@ -61,16 +87,17 @@ namespace Reflex
|
|
|
61
87
|
auto it = std::find(gamepads.begin(), gamepads.end(), gamepad);
|
|
62
88
|
if (it == gamepads.end()) return;
|
|
63
89
|
|
|
64
|
-
|
|
65
|
-
|
|
90
|
+
Gamepad::Ref ref = *it;
|
|
66
91
|
gamepads.erase(it);
|
|
92
|
+
|
|
93
|
+
Application_call_device_disconnect_event(app, ref);
|
|
67
94
|
}
|
|
68
95
|
|
|
69
96
|
void
|
|
70
97
|
Gamepad_remove_all (Application* app)
|
|
71
98
|
{
|
|
72
|
-
|
|
73
|
-
Gamepad_remove(app,
|
|
99
|
+
while (!gamepads.empty())
|
|
100
|
+
Gamepad_remove(app, gamepads.back());
|
|
74
101
|
}
|
|
75
102
|
|
|
76
103
|
Gamepad*
|
|
@@ -123,6 +150,16 @@ namespace Reflex
|
|
|
123
150
|
return gamepad_create_fun ? gamepad_create_fun() : new Gamepad();
|
|
124
151
|
}
|
|
125
152
|
|
|
153
|
+
void
|
|
154
|
+
enable_gamepad ()
|
|
155
|
+
{
|
|
156
|
+
Application* app_ = app();
|
|
157
|
+
if (!app_)
|
|
158
|
+
invalid_state_error(__FILE__, __LINE__);
|
|
159
|
+
|
|
160
|
+
Gamepad_init(app_);
|
|
161
|
+
}
|
|
162
|
+
|
|
126
163
|
|
|
127
164
|
Gamepad::Gamepad ()
|
|
128
165
|
{
|
data/src/gamepad.h
CHANGED
data/src/ios/app_delegate.mm
CHANGED
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
return YES;
|
|
77
77
|
|
|
78
78
|
Reflex::Event e;
|
|
79
|
-
|
|
79
|
+
Application_call_start_event(application, &e);
|
|
80
80
|
started = true;
|
|
81
81
|
|
|
82
82
|
return !e.is_blocked();
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
|
|
110
110
|
Reflex::MotionEvent e(
|
|
111
111
|
Reflex::Point(motion.gravity.x, -motion.gravity.y, motion.gravity.z));
|
|
112
|
-
application
|
|
112
|
+
Application_call_motion_event(application, &e);
|
|
113
113
|
}
|
|
114
114
|
];
|
|
115
115
|
|
|
@@ -147,12 +147,14 @@
|
|
|
147
147
|
if (self->application)
|
|
148
148
|
{
|
|
149
149
|
Reflex::Event e;
|
|
150
|
-
|
|
150
|
+
Application_call_quit_event(self->application, &e);
|
|
151
151
|
if (e.is_blocked())
|
|
152
152
|
{
|
|
153
153
|
Reflex::not_implemented_error(
|
|
154
154
|
__FILE__, __LINE__, "blocking to quit is not supported.");
|
|
155
155
|
}
|
|
156
|
+
|
|
157
|
+
Application_cleanup(self->application);
|
|
156
158
|
}
|
|
157
159
|
|
|
158
160
|
[self unbind];
|
data/src/ios/application.mm
CHANGED
|
@@ -28,6 +28,35 @@ namespace Reflex
|
|
|
28
28
|
return new ApplicationData();
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
String
|
|
32
|
+
Application_get_default_name ()
|
|
33
|
+
{
|
|
34
|
+
NSBundle* bundle = NSBundle.mainBundle;
|
|
35
|
+
NSString* name = [bundle objectForInfoDictionaryKey: @"CFBundleDisplayName"];
|
|
36
|
+
if (!name) name = [bundle objectForInfoDictionaryKey: @"CFBundleName"];
|
|
37
|
+
return name ? name.UTF8String : "";
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
void
|
|
41
|
+
Application_stop (Application* app)
|
|
42
|
+
{
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
void
|
|
46
|
+
Application_set_menu (Application* app, Menu* menu)
|
|
47
|
+
{
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
void
|
|
51
|
+
Application_set_background (Application* app, bool state)
|
|
52
|
+
{
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
void
|
|
56
|
+
Application_set_background_menu (Application* app, Menu* menu)
|
|
57
|
+
{
|
|
58
|
+
}
|
|
59
|
+
|
|
31
60
|
ApplicationData&
|
|
32
61
|
Application_get_data (Application* app)
|
|
33
62
|
{
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// -*- objc -*-
|
|
2
|
+
#include "reflex/clipboard.h"
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
#import <UIKit/UIKit.h>
|
|
6
|
+
#include "reflex/exception.h"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
namespace Reflex
|
|
10
|
+
{
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
void
|
|
14
|
+
set_clipboard (const Clipboard& clipboard)
|
|
15
|
+
{
|
|
16
|
+
const char* text = clipboard.text();
|
|
17
|
+
NSString* nstext = nil;
|
|
18
|
+
if (text)
|
|
19
|
+
{
|
|
20
|
+
nstext = [NSString stringWithUTF8String: text];
|
|
21
|
+
if (!nstext)
|
|
22
|
+
argument_error(__FILE__, __LINE__);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
UIPasteboard* pasteboard = UIPasteboard.generalPasteboard;
|
|
26
|
+
pasteboard.items = @[];
|
|
27
|
+
|
|
28
|
+
if (nstext) pasteboard.string = nstext;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
Clipboard
|
|
32
|
+
get_clipboard ()
|
|
33
|
+
{
|
|
34
|
+
Clipboard clipboard;
|
|
35
|
+
|
|
36
|
+
NSString* nstext = UIPasteboard.generalPasteboard.string;
|
|
37
|
+
const char* text = nstext ? nstext.UTF8String : NULL;
|
|
38
|
+
if (text) clipboard.set_text(text);
|
|
39
|
+
|
|
40
|
+
return clipboard;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
}// Reflex
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// -*- objc -*-
|
|
2
|
+
#include "../color_picker.h"
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
#include "reflex/exception.h"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
namespace Reflex
|
|
9
|
+
{
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
void
|
|
13
|
+
ColorPicker_show (ColorPicker* picker, const Color* initial)
|
|
14
|
+
{
|
|
15
|
+
not_implemented_error(__FILE__, __LINE__);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
}// Reflex
|
data/src/ios/event.h
CHANGED
|
@@ -28,9 +28,13 @@ namespace Reflex
|
|
|
28
28
|
|
|
29
29
|
public:
|
|
30
30
|
|
|
31
|
-
NativePointerEvent (
|
|
31
|
+
NativePointerEvent (
|
|
32
|
+
UIView* view, UIHoverGestureRecognizer* recognizer,
|
|
33
|
+
NSSet* touches, UIEvent* event);
|
|
32
34
|
|
|
33
|
-
NativePointerEvent (
|
|
35
|
+
NativePointerEvent (
|
|
36
|
+
UIView* view, UIHoverGestureRecognizer* recognizer,
|
|
37
|
+
Pointer::Action action, bool pen);
|
|
34
38
|
|
|
35
39
|
};// NativePointerEvent
|
|
36
40
|
|
data/src/ios/event.mm
CHANGED
|
@@ -79,12 +79,12 @@ namespace Reflex
|
|
|
79
79
|
to_modifiers (NSInteger flags)
|
|
80
80
|
{
|
|
81
81
|
return
|
|
82
|
-
(flags & UIKeyModifierAlphaShift
|
|
83
|
-
(flags & UIKeyModifierShift
|
|
84
|
-
(flags & UIKeyModifierControl
|
|
85
|
-
(flags & UIKeyModifierAlternate
|
|
86
|
-
(flags & UIKeyModifierCommand
|
|
87
|
-
(flags & UIKeyModifierNumericPad
|
|
82
|
+
(flags & UIKeyModifierAlphaShift ? MOD_CAPS : 0) |
|
|
83
|
+
(flags & UIKeyModifierShift ? MOD_SHIFT : 0) |
|
|
84
|
+
(flags & UIKeyModifierControl ? MOD_CONTROL : 0) |
|
|
85
|
+
(flags & UIKeyModifierAlternate ? MOD_ALT : 0) |
|
|
86
|
+
(flags & UIKeyModifierCommand ? MOD_COMMAND : 0) |
|
|
87
|
+
(flags & UIKeyModifierNumericPad ? MOD_NUMPAD : 0);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
static uint
|
|
@@ -124,8 +124,11 @@ namespace Reflex
|
|
|
124
124
|
|
|
125
125
|
|
|
126
126
|
NativePointerEvent::NativePointerEvent (
|
|
127
|
-
|
|
127
|
+
UIView* view, UIHoverGestureRecognizer* recognizer,
|
|
128
|
+
NSSet* touches, UIEvent* event)
|
|
128
129
|
{
|
|
130
|
+
assert(view && recognizer);
|
|
131
|
+
|
|
129
132
|
for (UITouch* touch in touches)
|
|
130
133
|
{
|
|
131
134
|
Pointer::Action action = get_action(touch);
|
|
@@ -141,7 +144,14 @@ namespace Reflex
|
|
|
141
144
|
action == Pointer::MOVE,
|
|
142
145
|
touch.timestamp);
|
|
143
146
|
|
|
144
|
-
if (
|
|
147
|
+
if ((type & Pointer::PEN))
|
|
148
|
+
{
|
|
149
|
+
// keying the pencil's touch on the hover recognizer unifies it with
|
|
150
|
+
// its hover pointer, so they act as one pointer across the
|
|
151
|
+
// hover <-> touch transitions.
|
|
152
|
+
Pointer_set_system_id(&pointer, (Pointer::ID) recognizer);
|
|
153
|
+
}
|
|
154
|
+
else if (!(type & Pointer::MOUSE))
|
|
145
155
|
Pointer_set_system_id(&pointer, (Pointer::ID) touch);
|
|
146
156
|
|
|
147
157
|
if (action != Pointer::DOWN)
|
|
@@ -156,20 +166,29 @@ namespace Reflex
|
|
|
156
166
|
}
|
|
157
167
|
|
|
158
168
|
NativePointerEvent::NativePointerEvent (
|
|
159
|
-
|
|
169
|
+
UIView* view, UIHoverGestureRecognizer* recognizer,
|
|
170
|
+
Pointer::Action action, bool pen)
|
|
160
171
|
{
|
|
161
|
-
assert(
|
|
172
|
+
assert(view && recognizer);
|
|
173
|
+
|
|
174
|
+
uint type = pen ? Pointer::PEN : Pointer::MOUSE;
|
|
162
175
|
|
|
163
176
|
Pointer pointer(
|
|
164
177
|
0,
|
|
165
|
-
|
|
166
|
-
|
|
178
|
+
type,
|
|
179
|
+
action,
|
|
167
180
|
to_point([recognizer locationInView: view]),
|
|
168
181
|
get_modifiers(nil),
|
|
169
182
|
0,
|
|
170
183
|
false,
|
|
171
184
|
Xot::time());
|
|
172
185
|
|
|
186
|
+
if (type & Pointer::PEN)
|
|
187
|
+
{
|
|
188
|
+
Pointer_set_system_id(&pointer, (Pointer::ID) recognizer);
|
|
189
|
+
Pointer_set_floatable(&pointer, true);
|
|
190
|
+
}
|
|
191
|
+
|
|
173
192
|
if (pointer)
|
|
174
193
|
PointerEvent_add_pointer(this, pointer);
|
|
175
194
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// -*- objc -*-
|
|
2
|
+
#include "../file_dialog.h"
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
#include "reflex/exception.h"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
namespace Reflex
|
|
9
|
+
{
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
void
|
|
13
|
+
FileDialog_show (
|
|
14
|
+
FileDialog* dialog, FileDialog::Data::Mode mode,
|
|
15
|
+
const char* dir, const char* name)
|
|
16
|
+
{
|
|
17
|
+
not_implemented_error(__FILE__, __LINE__);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
}// Reflex
|
data/src/ios/gamepad.mm
CHANGED
|
@@ -258,7 +258,7 @@ namespace Reflex
|
|
|
258
258
|
|
|
259
259
|
static id disconnect_observer = nil;
|
|
260
260
|
|
|
261
|
-
void
|
|
261
|
+
static void
|
|
262
262
|
init_gamepad (Application* app)
|
|
263
263
|
{
|
|
264
264
|
if (connect_observer || disconnect_observer)
|
|
@@ -280,7 +280,7 @@ namespace Reflex
|
|
|
280
280
|
add_gamepad(app, c);
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
void
|
|
283
|
+
static void
|
|
284
284
|
fin_gamepad (Application* app)
|
|
285
285
|
{
|
|
286
286
|
if (!connect_observer || !disconnect_observer)
|
|
@@ -297,13 +297,13 @@ namespace Reflex
|
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
void
|
|
300
|
-
|
|
300
|
+
Gamepad_init_native (Application* app)
|
|
301
301
|
{
|
|
302
302
|
init_gamepad(app);
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
void
|
|
306
|
-
|
|
306
|
+
Gamepad_fin_native (Application* app)
|
|
307
307
|
{
|
|
308
308
|
fin_gamepad(app);
|
|
309
309
|
|
data/src/ios/menu.mm
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// -*- objc -*-
|
|
2
|
+
#include "../menu.h"
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
namespace Reflex
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Menu::Data*
|
|
10
|
+
Menu_create_data ()
|
|
11
|
+
{
|
|
12
|
+
return new Menu::Data();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
void
|
|
16
|
+
Menu_validate_shortcut_modifiers (uint modifiers)
|
|
17
|
+
{
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
void
|
|
21
|
+
Menu_update (Menu* menu)
|
|
22
|
+
{
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
void
|
|
26
|
+
Menu_popup (Menu* menu, View* view, coord x, coord y)
|
|
27
|
+
{
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
void
|
|
31
|
+
Menu_child_added (Menu* parent, Menu* child, int index)
|
|
32
|
+
{
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
void
|
|
36
|
+
Menu_child_removed (Menu* parent, Menu* child)
|
|
37
|
+
{
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
}// Reflex
|
data/src/ios/reflex.mm
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
#include "reflex/exception.h"
|
|
6
|
+
#include "../vk.h"
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
namespace Reflex
|
|
@@ -36,5 +37,12 @@ namespace Reflex
|
|
|
36
37
|
global::pool = nil;
|
|
37
38
|
}
|
|
38
39
|
|
|
40
|
+
void
|
|
41
|
+
alert (const char* message, const char* title)
|
|
42
|
+
{
|
|
43
|
+
// UIAlertController only presents asynchronously
|
|
44
|
+
not_implemented_error(__FILE__, __LINE__);
|
|
45
|
+
}
|
|
46
|
+
|
|
39
47
|
|
|
40
48
|
}// Reflex
|