reflexion 0.6.0 → 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 +37 -6
- data/.doc/ext/reflex/capture_event.cpp +1 -1
- data/.doc/ext/reflex/chase_constraint.cpp +1 -1
- data/.doc/ext/reflex/clipboard.cpp +1 -1
- data/.doc/ext/reflex/color_event.cpp +76 -0
- data/.doc/ext/reflex/color_picker.cpp +113 -0
- data/.doc/ext/reflex/constraint.cpp +1 -1
- 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 +1 -1
- data/.doc/ext/reflex/menu.cpp +6 -5
- 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 +18 -6
- data/.doc/ext/reflex/note_event.cpp +1 -1
- data/.doc/ext/reflex/pin.cpp +1 -1
- data/.doc/ext/reflex/pointer.cpp +1 -1
- data/.doc/ext/reflex/pointer_event.cpp +2 -2
- data/.doc/ext/reflex/polygon_shape.cpp +1 -1
- data/.doc/ext/reflex/rect_shape.cpp +1 -1
- data/.doc/ext/reflex/reflex.cpp +566 -232
- data/.doc/ext/reflex/screen.cpp +27 -1
- data/.doc/ext/reflex/scroll_event.cpp +1 -1
- data/.doc/ext/reflex/selector.cpp +1 -1
- data/.doc/ext/reflex/shape.cpp +1 -1
- data/.doc/ext/reflex/snap_constraint.cpp +1 -1
- data/.doc/ext/reflex/style.cpp +1 -1
- data/.doc/ext/reflex/style_length.cpp +1 -1
- 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 +110 -56
- data/.doc/ext/reflex/wheel_constraint.cpp +1 -1
- data/.doc/ext/reflex/wheel_event.cpp +1 -1
- data/.doc/ext/reflex/window.cpp +226 -17
- data/.github/workflows/release-gem.yml +2 -49
- data/.github/workflows/tag.yml +5 -28
- data/.github/workflows/test.yml +1 -37
- data/ChangeLog.md +54 -0
- data/Gemfile.lock +13 -8
- data/Rakefile +13 -2
- data/Reflex.podspec +2 -2
- data/VERSION +1 -1
- data/ext/reflex/application.cpp +41 -6
- data/ext/reflex/capture_event.cpp +1 -1
- data/ext/reflex/chase_constraint.cpp +1 -1
- data/ext/reflex/clipboard.cpp +1 -1
- data/ext/reflex/color_event.cpp +80 -0
- data/ext/reflex/color_picker.cpp +121 -0
- data/ext/reflex/constraint.cpp +1 -1
- 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 +1 -1
- data/ext/reflex/menu.cpp +8 -7
- 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 +18 -6
- data/ext/reflex/note_event.cpp +1 -1
- data/ext/reflex/pin.cpp +1 -1
- data/ext/reflex/pointer.cpp +1 -1
- data/ext/reflex/pointer_event.cpp +2 -2
- data/ext/reflex/polygon_shape.cpp +1 -1
- data/ext/reflex/rect_shape.cpp +1 -1
- data/ext/reflex/reflex.cpp +568 -232
- data/ext/reflex/screen.cpp +31 -2
- data/ext/reflex/scroll_event.cpp +1 -1
- data/ext/reflex/selector.cpp +1 -1
- data/ext/reflex/selector.h +9 -9
- data/ext/reflex/shape.cpp +1 -1
- data/ext/reflex/snap_constraint.cpp +1 -1
- data/ext/reflex/style.cpp +1 -1
- data/ext/reflex/style_length.cpp +1 -1
- 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 +121 -61
- data/ext/reflex/wheel_constraint.cpp +1 -1
- data/ext/reflex/wheel_event.cpp +1 -1
- data/ext/reflex/window.cpp +256 -25
- data/include/reflex/application.h +10 -0
- data/include/reflex/color_picker.h +65 -0
- data/include/reflex/event.h +178 -88
- data/include/reflex/file_dialog.h +73 -0
- data/include/reflex/gamepad.h +3 -0
- data/include/reflex/menu.h +3 -3
- data/include/reflex/midi.h +3 -0
- data/include/reflex/reflex.h +2 -0
- data/include/reflex/ruby/application.h +6 -1
- data/include/reflex/ruby/color_picker.h +89 -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/reflex.h +3 -0
- data/include/reflex/ruby/view.h +92 -44
- data/include/reflex/ruby/window.h +60 -1
- data/include/reflex/ruby.h +3 -0
- data/include/reflex/screen.h +11 -2
- data/include/reflex/view.h +28 -16
- data/include/reflex/window.h +40 -8
- data/include/reflex.h +3 -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/color_event.rb +16 -0
- data/lib/reflex/color_picker.rb +45 -0
- data/lib/reflex/control_change_event.rb +17 -0
- data/lib/reflex/file_dialog.rb +70 -0
- data/lib/reflex/file_event.rb +37 -0
- data/lib/reflex/helper.rb +58 -7
- data/lib/reflex/key_event.rb +9 -4
- data/lib/reflex/menu.rb +17 -1
- data/lib/reflex/model.rb +19 -19
- data/lib/reflex/note_event.rb +1 -1
- data/lib/reflex/pointer.rb +14 -3
- data/lib/reflex/pointer_event.rb +12 -1
- data/lib/reflex/reflex.rb +5 -0
- data/lib/reflex/shape.rb +14 -14
- 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 +29 -14
- data/lib/reflex/wheel_event.rb +12 -3
- data/lib/reflex/window.rb +25 -13
- data/lib/reflex.rb +8 -2
- data/reflex.gemspec +4 -4
- data/samples/ime.rb +100 -0
- data/samples/ios/hello/hello.xcodeproj/project.pbxproj +236 -224
- data/samples/menu.rb +4 -1
- 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 +159 -18
- data/src/application.h +92 -7
- data/src/color_picker.cpp +113 -0
- data/src/color_picker.h +36 -0
- data/src/event.cpp +410 -252
- data/src/event.h +12 -0
- 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 +24 -0
- data/src/ios/color_picker.mm +19 -0
- data/src/ios/file_dialog.mm +21 -0
- data/src/ios/gamepad.mm +4 -4
- data/src/ios/menu.mm +5 -0
- data/src/ios/reflex.mm +8 -0
- data/src/ios/screen.mm +26 -0
- data/src/ios/view_controller.mm +2 -30
- data/src/ios/window.mm +38 -9
- data/src/menu.cpp +66 -4
- data/src/menu.h +17 -1
- data/src/midi.cpp +61 -31
- data/src/osx/app_delegate.h +4 -0
- data/src/osx/app_delegate.mm +102 -22
- data/src/osx/application.mm +88 -6
- data/src/osx/color_picker.mm +112 -0
- data/src/osx/event.h +10 -0
- data/src/osx/event.mm +84 -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.mm +177 -33
- data/src/osx/native_window.h +16 -2
- data/src/osx/native_window.mm +114 -57
- data/src/osx/opengl_view.h +2 -1
- data/src/osx/opengl_view.mm +184 -43
- data/src/osx/reflex.mm +38 -0
- data/src/osx/screen.mm +36 -0
- data/src/osx/window.mm +106 -24
- data/src/pointer.cpp +13 -4
- data/src/pointer.h +4 -0
- data/src/rays.h +46 -0
- data/src/sdl/application.cpp +68 -8
- data/src/sdl/color_picker.cpp +18 -0
- data/src/sdl/event.cpp +24 -3
- data/src/sdl/event.h +12 -0
- data/src/sdl/file_dialog.cpp +20 -0
- data/src/sdl/gamepad.cpp +3 -7
- data/src/sdl/menu.cpp +5 -0
- data/src/sdl/reflex.cpp +20 -0
- data/src/sdl/screen.cpp +36 -0
- data/src/sdl/window.cpp +142 -29
- data/src/shape.cpp +15 -10
- data/src/view.cpp +287 -198
- data/src/view.h +4 -2
- data/src/vk.h +416 -0
- data/src/win32/application.cpp +162 -12
- data/src/win32/application.h +20 -0
- data/src/win32/color_picker.cpp +82 -0
- data/src/win32/event.cpp +114 -12
- data/src/win32/event.h +21 -4
- data/src/win32/file_dialog.cpp +226 -0
- data/src/win32/gamepad.cpp +9 -2
- data/src/win32/menu.cpp +191 -53
- data/src/win32/menu.h +9 -1
- 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 +809 -148
- data/src/win32/window.h +6 -0
- data/src/window.cpp +718 -185
- data/src/window.h +66 -33
- data/src/world.cpp +9 -1
- data/test/helper.rb +17 -0
- data/test/test_application.rb +90 -1
- data/test/test_chase_constraint.rb +1 -3
- data/test/test_color_event.rb +36 -0
- data/test/test_color_picker.rb +62 -0
- data/test/test_constraint.rb +2 -4
- 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 +20 -5
- data/test/test_link_constraint.rb +1 -3
- data/test/test_menu.rb +40 -10
- data/test/test_pointer.rb +33 -23
- data/test/test_pointer_event.rb +24 -9
- data/test/test_reflex.rb +36 -0
- data/test/test_screen.rb +24 -2
- data/test/test_snap_constraint.rb +1 -3
- data/test/test_text_event.rb +54 -0
- data/test/test_view.rb +41 -4
- data/test/test_wheel_constraint.rb +1 -3
- data/test/test_wheel_event.rb +13 -5
- data/test/test_window.rb +196 -44
- metadata +80 -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);
|
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,11 +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
|
+
|
|
31
45
|
void
|
|
32
46
|
Application_set_menu (Application* app, Menu* menu)
|
|
33
47
|
{
|
|
34
48
|
}
|
|
35
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
|
+
|
|
36
60
|
ApplicationData&
|
|
37
61
|
Application_get_data (Application* app)
|
|
38
62
|
{
|
|
@@ -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
|
|
@@ -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
CHANGED
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
|
data/src/ios/screen.mm
CHANGED
|
@@ -37,6 +37,15 @@ namespace Reflex
|
|
|
37
37
|
{
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
String
|
|
41
|
+
Screen::name () const
|
|
42
|
+
{
|
|
43
|
+
if (!*this)
|
|
44
|
+
invalid_state_error(__FILE__, __LINE__);
|
|
45
|
+
|
|
46
|
+
return "";
|
|
47
|
+
}
|
|
48
|
+
|
|
40
49
|
Bounds
|
|
41
50
|
Screen::frame () const
|
|
42
51
|
{
|
|
@@ -47,6 +56,15 @@ namespace Reflex
|
|
|
47
56
|
return Bounds(b.origin.x, b.origin.y, b.size.width, b.size.height);
|
|
48
57
|
}
|
|
49
58
|
|
|
59
|
+
float
|
|
60
|
+
Screen::pixel_density () const
|
|
61
|
+
{
|
|
62
|
+
if (!*this)
|
|
63
|
+
invalid_state_error(__FILE__, __LINE__);
|
|
64
|
+
|
|
65
|
+
return self->screen.nativeScale;
|
|
66
|
+
}
|
|
67
|
+
|
|
50
68
|
Screen::operator bool () const
|
|
51
69
|
{
|
|
52
70
|
return self->screen;
|
|
@@ -58,5 +76,13 @@ namespace Reflex
|
|
|
58
76
|
return !operator bool();
|
|
59
77
|
}
|
|
60
78
|
|
|
79
|
+
Screen::List
|
|
80
|
+
Screen::all ()
|
|
81
|
+
{
|
|
82
|
+
Screen s;
|
|
83
|
+
Screen_initialize(&s, UIScreen.mainScreen);
|
|
84
|
+
return {s};
|
|
85
|
+
}
|
|
86
|
+
|
|
61
87
|
|
|
62
88
|
}// Reflex
|
data/src/ios/view_controller.mm
CHANGED
|
@@ -428,11 +428,8 @@ ReflexViewController_get_show_fun ()
|
|
|
428
428
|
|
|
429
429
|
Window_call_update_event(win);
|
|
430
430
|
|
|
431
|
-
if (win->self->
|
|
432
|
-
{
|
|
431
|
+
if (Xot::check_and_remove_flag(&win->self->flags, Reflex::Window::Data::REDRAW))
|
|
433
432
|
[self.reflexView setNeedsDisplay];
|
|
434
|
-
win->self->redraw = false;
|
|
435
|
-
}
|
|
436
433
|
}
|
|
437
434
|
|
|
438
435
|
- (void) glkView: (GLKView*) view drawInRect: (CGRect) rect
|
|
@@ -463,32 +460,7 @@ ReflexViewController_get_show_fun ()
|
|
|
463
460
|
|
|
464
461
|
- (void) viewDidResize
|
|
465
462
|
{
|
|
466
|
-
|
|
467
|
-
if (!win) return;
|
|
468
|
-
|
|
469
|
-
Rays::Bounds b = win->frame();
|
|
470
|
-
Rays::Point dpos = b.position() - win->self->prev_position;
|
|
471
|
-
Rays::Point dsize = b.size() - win->self->prev_size;
|
|
472
|
-
win->self->prev_position = b.position();
|
|
473
|
-
win->self->prev_size = b.size();
|
|
474
|
-
|
|
475
|
-
if (dpos == 0 && dsize == 0) return;
|
|
476
|
-
|
|
477
|
-
Reflex::FrameEvent e(b, dpos.x, dpos.y, 0, dsize.x, dsize.y, 0);
|
|
478
|
-
if (dpos != 0) win->on_move(&e);
|
|
479
|
-
if (dsize != 0)
|
|
480
|
-
{
|
|
481
|
-
Rays::Bounds b = win->frame();
|
|
482
|
-
b.move_to(0, 0);
|
|
483
|
-
|
|
484
|
-
if (win->painter())
|
|
485
|
-
win->painter()->canvas(b, win->painter()->pixel_density());
|
|
486
|
-
|
|
487
|
-
if (win->root())
|
|
488
|
-
View_set_frame(win->root(), b);
|
|
489
|
-
|
|
490
|
-
win->on_resize(&e);
|
|
491
|
-
}
|
|
463
|
+
Window_call_frame_event(self.window);
|
|
492
464
|
}
|
|
493
465
|
|
|
494
466
|
#if 0
|
data/src/ios/window.mm
CHANGED
|
@@ -224,8 +224,8 @@ namespace Reflex
|
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
void
|
|
228
|
-
|
|
227
|
+
static void
|
|
228
|
+
set_orientation_mask (UIViewController* vc, UIInterfaceOrientationMask mask)
|
|
229
229
|
{
|
|
230
230
|
if (mask == g_orientation_mask) return;
|
|
231
231
|
|
|
@@ -233,12 +233,6 @@ namespace Reflex
|
|
|
233
233
|
update_orientation_mask(vc, mask);
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
UIInterfaceOrientationMask
|
|
237
|
-
Window_get_orientation_mask ()
|
|
238
|
-
{
|
|
239
|
-
return g_orientation_mask;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
236
|
static UIInterfaceOrientationMask
|
|
243
237
|
flags_to_orientation_mask (uint flags)
|
|
244
238
|
{
|
|
@@ -266,7 +260,31 @@ namespace Reflex
|
|
|
266
260
|
if (Xot::has_flag(flags, Window::FLAG_MINIMIZABLE))
|
|
267
261
|
argument_error(__FILE__, __LINE__, "FLAG_MINIMIZABLE is not supported");
|
|
268
262
|
|
|
269
|
-
|
|
263
|
+
if (Xot::has_flag(flags, Window::FLAG_TITLEBAR_BUTTONS))
|
|
264
|
+
argument_error(__FILE__, __LINE__, "FLAG_TITLEBAR_BUTTONS is not supported");
|
|
265
|
+
|
|
266
|
+
if (Xot::has_flag(flags, Window::FLAG_TITLEBAR_BACKGROUND))
|
|
267
|
+
argument_error(__FILE__, __LINE__, "FLAG_TITLEBAR_BACKGROUND is not supported");
|
|
268
|
+
|
|
269
|
+
if (Xot::has_flag(flags, Window::FLAG_UNLISTED))
|
|
270
|
+
argument_error(__FILE__, __LINE__, "FLAG_UNLISTED is not supported");
|
|
271
|
+
|
|
272
|
+
if (Xot::has_flag(flags, Window::FLAG_SHADOW))
|
|
273
|
+
argument_error(__FILE__, __LINE__, "FLAG_SHADOW is not supported");
|
|
274
|
+
|
|
275
|
+
if (Xot::has_flag(flags, Window::FLAG_TRANSPARENT))
|
|
276
|
+
argument_error(__FILE__, __LINE__, "FLAG_TRANSPARENT is not supported");
|
|
277
|
+
|
|
278
|
+
if (Xot::has_flag(flags, Window::FLAG_ALWAYS_ON_TOP))
|
|
279
|
+
argument_error(__FILE__, __LINE__, "FLAG_ALWAYS_ON_TOP is not supported");
|
|
280
|
+
|
|
281
|
+
if (Xot::has_flag(flags, Window::FLAG_ALWAYS_ON_BOTTOM))
|
|
282
|
+
argument_error(__FILE__, __LINE__, "FLAG_ALWAYS_ON_BOTTOM is not supported");
|
|
283
|
+
|
|
284
|
+
if (Xot::has_flag(flags, Window::FLAG_POINTER_THROUGH))
|
|
285
|
+
argument_error(__FILE__, __LINE__, "FLAG_POINTER_THROUGH is not supported");
|
|
286
|
+
|
|
287
|
+
set_orientation_mask(
|
|
270
288
|
get_vc(window),
|
|
271
289
|
flags_to_orientation_mask(flags & (Window::FLAG_PORTRAIT | Window::FLAG_LANDSCAPE)));
|
|
272
290
|
}
|
|
@@ -277,5 +295,16 @@ namespace Reflex
|
|
|
277
295
|
return UIScreen.mainScreen.nativeScale;
|
|
278
296
|
}
|
|
279
297
|
|
|
298
|
+
void
|
|
299
|
+
Window_set_pointer_through (Window* window, bool through)
|
|
300
|
+
{
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
bool
|
|
304
|
+
Window_is_pointer_over_and_uncovered (Point* position, const Window& window)
|
|
305
|
+
{
|
|
306
|
+
return false;
|
|
307
|
+
}
|
|
308
|
+
|
|
280
309
|
|
|
281
310
|
}// Reflex
|