janela 0.1.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.
Files changed (80) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +95 -0
  3. package/bin/janela.mjs +271 -0
  4. package/package.json +43 -0
  5. package/runtime/janela.ts +193 -0
  6. package/shim/wvshim.cc +201 -0
  7. package/templates/index.html +48 -0
  8. package/templates/janela.conf.json +10 -0
  9. package/templates/main.ts +37 -0
  10. package/vendor-webview/LICENSE +22 -0
  11. package/vendor-webview/core/include/webview/api.h +251 -0
  12. package/vendor-webview/core/include/webview/backends.hh +40 -0
  13. package/vendor-webview/core/include/webview/c_api_impl.hh +258 -0
  14. package/vendor-webview/core/include/webview/detail/backends/cocoa_webkit.hh +626 -0
  15. package/vendor-webview/core/include/webview/detail/backends/gtk_webkitgtk.hh +355 -0
  16. package/vendor-webview/core/include/webview/detail/backends/win32_edge.hh +909 -0
  17. package/vendor-webview/core/include/webview/detail/basic_result.hh +119 -0
  18. package/vendor-webview/core/include/webview/detail/engine_base.hh +382 -0
  19. package/vendor-webview/core/include/webview/detail/exceptions.hh +42 -0
  20. package/vendor-webview/core/include/webview/detail/json.hh +337 -0
  21. package/vendor-webview/core/include/webview/detail/native_library.hh +170 -0
  22. package/vendor-webview/core/include/webview/detail/optional.hh +118 -0
  23. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSApplication.hh +107 -0
  24. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSBundle.hh +56 -0
  25. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSEvent.hh +71 -0
  26. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSInvocation.hh +66 -0
  27. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSMethodSignature.hh +52 -0
  28. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSNotification.hh +51 -0
  29. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSNumber.hh +53 -0
  30. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSObject.hh +51 -0
  31. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSOpenPanel.hh +71 -0
  32. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSPoint.hh +53 -0
  33. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSRect.hh +53 -0
  34. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSSavePanel.hh +52 -0
  35. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSSize.hh +53 -0
  36. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSString.hh +87 -0
  37. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSURL.hh +63 -0
  38. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSURLRequest.hh +52 -0
  39. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSValue.hh +56 -0
  40. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSView.hh +91 -0
  41. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/NSWindow.hh +137 -0
  42. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/cocoa.hh +59 -0
  43. package/vendor-webview/core/include/webview/detail/platform/darwin/cocoa/types.hh +49 -0
  44. package/vendor-webview/core/include/webview/detail/platform/darwin/objc/Class.hh +55 -0
  45. package/vendor-webview/core/include/webview/detail/platform/darwin/objc/autoreleasepool.hh +70 -0
  46. package/vendor-webview/core/include/webview/detail/platform/darwin/objc/invoke.hh +75 -0
  47. package/vendor-webview/core/include/webview/detail/platform/darwin/objc/memory.hh +57 -0
  48. package/vendor-webview/core/include/webview/detail/platform/darwin/objc/objc.hh +47 -0
  49. package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKOpenPanelParameters.hh +57 -0
  50. package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKScriptMessage.hh +51 -0
  51. package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKUserContentController.hh +61 -0
  52. package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKUserScript.hh +71 -0
  53. package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKWebView.hh +108 -0
  54. package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/WKWebViewConfiguration.hh +60 -0
  55. package/vendor-webview/core/include/webview/detail/platform/darwin/webkit/webkit.hh +46 -0
  56. package/vendor-webview/core/include/webview/detail/platform/linux/gtk/compat.hh +137 -0
  57. package/vendor-webview/core/include/webview/detail/platform/linux/webkitgtk/compat.hh +142 -0
  58. package/vendor-webview/core/include/webview/detail/platform/linux/webkitgtk/dmabuf.hh +167 -0
  59. package/vendor-webview/core/include/webview/detail/platform/windows/com_init_wrapper.hh +126 -0
  60. package/vendor-webview/core/include/webview/detail/platform/windows/dpi.hh +161 -0
  61. package/vendor-webview/core/include/webview/detail/platform/windows/dwmapi.hh +67 -0
  62. package/vendor-webview/core/include/webview/detail/platform/windows/iid.hh +78 -0
  63. package/vendor-webview/core/include/webview/detail/platform/windows/ntdll.hh +58 -0
  64. package/vendor-webview/core/include/webview/detail/platform/windows/reg_key.hh +135 -0
  65. package/vendor-webview/core/include/webview/detail/platform/windows/shcore.hh +59 -0
  66. package/vendor-webview/core/include/webview/detail/platform/windows/theme.hh +76 -0
  67. package/vendor-webview/core/include/webview/detail/platform/windows/user32.hh +90 -0
  68. package/vendor-webview/core/include/webview/detail/platform/windows/version.hh +151 -0
  69. package/vendor-webview/core/include/webview/detail/platform/windows/webview2/loader.hh +391 -0
  70. package/vendor-webview/core/include/webview/detail/user_script.hh +76 -0
  71. package/vendor-webview/core/include/webview/detail/utility/string.hh +99 -0
  72. package/vendor-webview/core/include/webview/errors.h +67 -0
  73. package/vendor-webview/core/include/webview/errors.hh +85 -0
  74. package/vendor-webview/core/include/webview/json_deprecated.hh +61 -0
  75. package/vendor-webview/core/include/webview/macros.h +123 -0
  76. package/vendor-webview/core/include/webview/types.h +81 -0
  77. package/vendor-webview/core/include/webview/types.hh +48 -0
  78. package/vendor-webview/core/include/webview/version.h +67 -0
  79. package/vendor-webview/core/include/webview/webview.h +32 -0
  80. package/vendor-webview/core/include/webview.h +15 -0
@@ -0,0 +1,107 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2017 Serge Zaitsev
5
+ * Copyright (c) 2022 Steffen André Langnes
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ #ifndef WEBVIEW_PLATFORM_DARWIN_COCOA_NSAPPLICATION_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_COCOA_NSAPPLICATION_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
34
+
35
+ #include "../objc/objc.hh"
36
+ #include "NSString.hh"
37
+
38
+ namespace webview {
39
+ namespace detail {
40
+ namespace cocoa {
41
+
42
+ enum NSApplicationActivationPolicy : NSInteger {
43
+ NSApplicationActivationPolicyRegular = 0
44
+ };
45
+
46
+ enum NSEventMask : NSUInteger { NSEventMaskAny = NSUIntegerMax };
47
+
48
+ enum NSModalResponse : NSInteger { NSModalResponseOK = 1 };
49
+
50
+ namespace NSRunLoopMode {
51
+ inline id NSDefaultRunLoopMode() {
52
+ return NSString_stringWithUTF8String("kCFRunLoopDefaultMode");
53
+ }
54
+ } // namespace NSRunLoopMode
55
+
56
+ inline void NSApplication_set_delegate(id self, id delegate) {
57
+ objc::msg_send<void>(self, objc::selector("setDelegate:"), delegate);
58
+ }
59
+
60
+ inline void NSApplication_run(id self) {
61
+ objc::msg_send<void>(self, objc::selector("run"));
62
+ }
63
+
64
+ inline void NSApplication_stop(id self, id sender = nullptr) {
65
+ objc::msg_send<void>(self, objc::selector("stop:"), sender);
66
+ }
67
+
68
+ inline id NSApplication_get_sharedApplication() {
69
+ return objc::msg_send<id>(objc::get_class("NSApplication"),
70
+ objc::selector("sharedApplication"));
71
+ }
72
+
73
+ inline void NSApplication_sendEvent(id self, id event) {
74
+ objc::msg_send<void>(self, objc::selector("sendEvent:"), event);
75
+ }
76
+
77
+ inline id NSApplication_nextEventMatchingMask(id self, NSEventMask mask,
78
+ id expiration, id mode,
79
+ bool dequeue) {
80
+ return objc::msg_send<id>(
81
+ self, objc::selector("nextEventMatchingMask:untilDate:inMode:dequeue:"),
82
+ mask, expiration, mode, dequeue);
83
+ }
84
+
85
+ inline void
86
+ NSApplication_setActivationPolicy(id self,
87
+ NSApplicationActivationPolicy policy) {
88
+ objc::msg_send<void>(self, objc::selector("setActivationPolicy:"), policy);
89
+ }
90
+
91
+ inline void NSApplication_activateIgnoringOtherApps(id self, bool ignore) {
92
+ objc::msg_send<void>(self, objc::selector("activateIgnoringOtherApps:"),
93
+ static_cast<BOOL>(ignore));
94
+ }
95
+
96
+ inline void NSApplication_postEvent(id self, id event, bool at_start) {
97
+ objc::msg_send<void>(self, objc::selector("postEvent:atStart:"), event,
98
+ static_cast<BOOL>(at_start));
99
+ }
100
+
101
+ } // namespace cocoa
102
+ } // namespace detail
103
+ } // namespace webview
104
+
105
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
106
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
107
+ #endif // WEBVIEW_PLATFORM_DARWIN_COCOA_NSAPPLICATION_HH
@@ -0,0 +1,56 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2017 Serge Zaitsev
5
+ * Copyright (c) 2022 Steffen André Langnes
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ #ifndef WEBVIEW_PLATFORM_DARWIN_COCOA_NSBUNDLE_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_COCOA_NSBUNDLE_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
34
+
35
+ #include "../objc/objc.hh"
36
+
37
+ namespace webview {
38
+ namespace detail {
39
+ namespace cocoa {
40
+
41
+ inline id NSBundle_get_mainBundle() {
42
+ return objc::msg_send<id>(objc::get_class("NSBundle"),
43
+ objc::selector("mainBundle"));
44
+ }
45
+
46
+ inline id NSBundle_get_bundlePath(id self) {
47
+ return objc::msg_send<id>(self, objc::selector("bundlePath"));
48
+ }
49
+
50
+ } // namespace cocoa
51
+ } // namespace detail
52
+ } // namespace webview
53
+
54
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
55
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
56
+ #endif // WEBVIEW_PLATFORM_DARWIN_COCOA_NSBUNDLE_HH
@@ -0,0 +1,71 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2017 Serge Zaitsev
5
+ * Copyright (c) 2022 Steffen André Langnes
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ #ifndef WEBVIEW_PLATFORM_DARWIN_COCOA_NSEVENT_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_COCOA_NSEVENT_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
34
+
35
+ #include "../objc/objc.hh"
36
+ #include "NSPoint.hh"
37
+ #include "types.hh"
38
+
39
+ namespace webview {
40
+ namespace detail {
41
+ namespace cocoa {
42
+
43
+ enum NSEventType : NSUInteger {
44
+ // For macOS 10.12+; replaces NSApplicationDefined (macOS 10.0–10.12)
45
+ // with the same value
46
+ NSEventTypeApplicationDefined = 15
47
+ };
48
+
49
+ enum NSEventModifierFlags : NSUInteger {};
50
+
51
+ inline id NSEvent_otherEventWithType(NSEventType type, NSPoint location,
52
+ NSEventModifierFlags modifier_flags,
53
+ NSTimeInterval timestamp,
54
+ NSInteger window_number, id context,
55
+ short subtype, NSInteger data1,
56
+ NSInteger data2) {
57
+ return objc::msg_send<id>(
58
+ objc::get_class("NSEvent"),
59
+ objc::selector("otherEventWithType:location:modifierFlags:timestamp:"
60
+ "windowNumber:context:subtype:data1:data2:"),
61
+ type, location, modifier_flags, timestamp, window_number, context,
62
+ subtype, data1, data2);
63
+ }
64
+
65
+ } // namespace cocoa
66
+ } // namespace detail
67
+ } // namespace webview
68
+
69
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
70
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
71
+ #endif // WEBVIEW_PLATFORM_DARWIN_COCOA_NSEVENT_HH
@@ -0,0 +1,66 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2017 Serge Zaitsev
5
+ * Copyright (c) 2022 Steffen André Langnes
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ #ifndef WEBVIEW_PLATFORM_DARWIN_COCOA_NSINVOCATION_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_COCOA_NSINVOCATION_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
34
+
35
+ #include "../objc/objc.hh"
36
+
37
+ namespace webview {
38
+ namespace detail {
39
+ namespace cocoa {
40
+
41
+ inline id NSInvocation_invocationWithMethodSignature(id sig) {
42
+ return objc::msg_send<id>(objc::get_class("NSInvocation"),
43
+ objc::selector("invocationWithMethodSignature:"),
44
+ sig);
45
+ }
46
+
47
+ inline void NSInvocation_set_target(id self, id target) {
48
+ objc::msg_send<void>(self, objc::selector("setTarget:"), target);
49
+ }
50
+
51
+ inline void NSInvocation_setArgument(id self, void *location, NSInteger index) {
52
+ objc::msg_send<void>(self, objc::selector("setArgument:atIndex:"), location,
53
+ index);
54
+ }
55
+
56
+ inline void NSInvocation_invoke(id self) {
57
+ objc::msg_send<void>(self, objc::selector("invoke"));
58
+ }
59
+
60
+ } // namespace cocoa
61
+ } // namespace detail
62
+ } // namespace webview
63
+
64
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
65
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
66
+ #endif // WEBVIEW_PLATFORM_DARWIN_COCOA_NSInvocation_HH
@@ -0,0 +1,52 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2017 Serge Zaitsev
5
+ * Copyright (c) 2022 Steffen André Langnes
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ #ifndef WEBVIEW_PLATFORM_DARWIN_COCOA_NSMETHODSIGNATURE_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_COCOA_NSMETHODSIGNATURE_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
34
+
35
+ #include "../objc/objc.hh"
36
+
37
+ namespace webview {
38
+ namespace detail {
39
+ namespace cocoa {
40
+
41
+ inline id NSMethodSignature_signatureWithObjCTypes(const char *types) {
42
+ return objc::msg_send<id>(objc::get_class("NSMethodSignature"),
43
+ objc::selector("signatureWithObjCTypes:"), types);
44
+ }
45
+
46
+ } // namespace cocoa
47
+ } // namespace detail
48
+ } // namespace webview
49
+
50
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
51
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
52
+ #endif // WEBVIEW_PLATFORM_DARWIN_COCOA_NSMETHODSIGNATURE_HH
@@ -0,0 +1,51 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2017 Serge Zaitsev
5
+ * Copyright (c) 2022 Steffen André Langnes
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ #ifndef WEBVIEW_PLATFORM_DARWIN_COCOA_NSNOTIFICATION_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_COCOA_NSNOTIFICATION_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
34
+
35
+ #include "../objc/objc.hh"
36
+
37
+ namespace webview {
38
+ namespace detail {
39
+ namespace cocoa {
40
+
41
+ inline id NSNotification_get_object(id self) {
42
+ return objc::msg_send<id>(self, objc::selector("object"));
43
+ }
44
+
45
+ } // namespace cocoa
46
+ } // namespace detail
47
+ } // namespace webview
48
+
49
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
50
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
51
+ #endif // WEBVIEW_PLATFORM_DARWIN_COCOA_NSNOTIFICATION_HH
@@ -0,0 +1,53 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2017 Serge Zaitsev
5
+ * Copyright (c) 2022 Steffen André Langnes
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ #ifndef WEBVIEW_PLATFORM_DARWIN_COCOA_NSNUMBER_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_COCOA_NSNUMBER_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
34
+
35
+ #include "../objc/objc.hh"
36
+
37
+ namespace webview {
38
+ namespace detail {
39
+ namespace cocoa {
40
+
41
+ inline id NSNumber_numberWithBool(bool value) {
42
+ return objc::msg_send<id>(objc::get_class("NSNumber"),
43
+ objc::selector("numberWithBool:"),
44
+ static_cast<BOOL>(value));
45
+ }
46
+
47
+ } // namespace cocoa
48
+ } // namespace detail
49
+ } // namespace webview
50
+
51
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
52
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
53
+ #endif // WEBVIEW_PLATFORM_DARWIN_COCOA_NSNUMBER_HH
@@ -0,0 +1,51 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2017 Serge Zaitsev
5
+ * Copyright (c) 2022 Steffen André Langnes
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ #ifndef WEBVIEW_PLATFORM_DARWIN_COCOA_NSOBJECT_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_COCOA_NSOBJECT_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
34
+
35
+ #include "../objc/objc.hh"
36
+
37
+ namespace webview {
38
+ namespace detail {
39
+ namespace cocoa {
40
+
41
+ inline void NSObject_setValue_forKey(id self, id value, id key) {
42
+ objc::msg_send<void>(self, objc::selector("setValue:forKey:"), value, key);
43
+ }
44
+
45
+ } // namespace cocoa
46
+ } // namespace detail
47
+ } // namespace webview
48
+
49
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
50
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
51
+ #endif // WEBVIEW_PLATFORM_DARWIN_COCOA_NSOBJECT_HH
@@ -0,0 +1,71 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2017 Serge Zaitsev
5
+ * Copyright (c) 2022 Steffen André Langnes
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ #ifndef WEBVIEW_PLATFORM_DARWIN_COCOA_NSOPENPANEL_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_COCOA_NSOPENPANEL_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
34
+
35
+ #include "../objc/objc.hh"
36
+
37
+ namespace webview {
38
+ namespace detail {
39
+ namespace cocoa {
40
+
41
+ inline id NSOpenPanel_openPanel() {
42
+ return objc::msg_send<id>(objc::get_class("NSOpenPanel"),
43
+ objc::selector("openPanel"));
44
+ }
45
+
46
+ inline void NSOpenPanel_set_canChooseFiles(id self, bool value) {
47
+ objc::msg_send<void>(self, objc::selector("setCanChooseFiles:"),
48
+ static_cast<BOOL>(value));
49
+ }
50
+
51
+ inline void NSOpenPanel_set_canChooseDirectories(id self, bool value) {
52
+ objc::msg_send<void>(self, objc::selector("setCanChooseDirectories:"),
53
+ static_cast<BOOL>(value));
54
+ }
55
+
56
+ inline void NSOpenPanel_set_allowsMultipleSelection(id self, bool value) {
57
+ objc::msg_send<void>(self, objc::selector("setAllowsMultipleSelection:"),
58
+ static_cast<BOOL>(value));
59
+ }
60
+
61
+ inline id NSOpenPanel_get_URLs(id self) {
62
+ return objc::msg_send<id>(self, objc::selector("URLs"));
63
+ }
64
+
65
+ } // namespace cocoa
66
+ } // namespace detail
67
+ } // namespace webview
68
+
69
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
70
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
71
+ #endif // WEBVIEW_PLATFORM_DARWIN_COCOA_NSOPENPANEL_HH
@@ -0,0 +1,53 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2017 Serge Zaitsev
5
+ * Copyright (c) 2022 Steffen André Langnes
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ #ifndef WEBVIEW_PLATFORM_DARWIN_COCOA_NSPOINT_HH
27
+ #define WEBVIEW_PLATFORM_DARWIN_COCOA_NSPOINT_HH
28
+
29
+ #if defined(__cplusplus) && !defined(WEBVIEW_HEADER)
30
+
31
+ #include "../../../../macros.h"
32
+
33
+ #if defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
34
+
35
+ #include <CoreGraphics/CoreGraphics.h>
36
+
37
+ namespace webview {
38
+ namespace detail {
39
+ namespace cocoa {
40
+
41
+ using NSPoint = CGPoint;
42
+
43
+ constexpr inline NSPoint NSPointMake(CGFloat x, CGFloat y) {
44
+ return CGPointMake(x, y);
45
+ }
46
+
47
+ } // namespace cocoa
48
+ } // namespace detail
49
+ } // namespace webview
50
+
51
+ #endif // defined(WEBVIEW_PLATFORM_DARWIN) && defined(WEBVIEW_COCOA)
52
+ #endif // defined(__cplusplus) && !defined(WEBVIEW_HEADER)
53
+ #endif // WEBVIEW_PLATFORM_DARWIN_COCOA_NSPOINT_HH