1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9use objc2_foundation::*;
10
11use crate::*;
12
13extern "C" {
14 pub static WebElementDOMNodeKey: Option<&'static NSString>;
16}
17
18extern "C" {
19 pub static WebElementFrameKey: Option<&'static NSString>;
21}
22
23extern "C" {
24 pub static WebElementImageAltStringKey: Option<&'static NSString>;
26}
27
28extern "C" {
29 pub static WebElementImageKey: Option<&'static NSString>;
31}
32
33extern "C" {
34 pub static WebElementImageRectKey: Option<&'static NSString>;
36}
37
38extern "C" {
39 pub static WebElementImageURLKey: Option<&'static NSString>;
41}
42
43extern "C" {
44 pub static WebElementIsSelectedKey: Option<&'static NSString>;
46}
47
48extern "C" {
49 pub static WebElementLinkURLKey: Option<&'static NSString>;
51}
52
53extern "C" {
54 pub static WebElementLinkTargetFrameKey: Option<&'static NSString>;
56}
57
58extern "C" {
59 pub static WebElementLinkTitleKey: Option<&'static NSString>;
61}
62
63extern "C" {
64 pub static WebElementLinkLabelKey: Option<&'static NSString>;
66}
67
68extern "C" {
69 pub static WebViewProgressStartedNotification: Option<&'static NSString>;
71}
72
73extern "C" {
74 pub static WebViewProgressEstimateChangedNotification: Option<&'static NSString>;
76}
77
78extern "C" {
79 pub static WebViewProgressFinishedNotification: Option<&'static NSString>;
81}
82
83extern_class!(
84 #[unsafe(super(NSView, NSResponder, NSObject))]
86 #[derive(Debug, PartialEq, Eq, Hash)]
87 #[cfg(feature = "objc2-app-kit")]
88 #[cfg(target_os = "macos")]
89 #[deprecated = "No longer supported; please adopt WKWebView."]
90 pub struct WebView;
91);
92
93#[cfg(feature = "objc2-app-kit")]
94#[cfg(target_os = "macos")]
95unsafe impl NSAccessibility for WebView {}
96
97#[cfg(feature = "objc2-app-kit")]
98#[cfg(target_os = "macos")]
99unsafe impl NSAccessibilityElementProtocol for WebView {}
100
101#[cfg(feature = "objc2-app-kit")]
102#[cfg(target_os = "macos")]
103unsafe impl NSAnimatablePropertyContainer for WebView {}
104
105#[cfg(feature = "objc2-app-kit")]
106#[cfg(target_os = "macos")]
107unsafe impl NSAppearanceCustomization for WebView {}
108
109#[cfg(feature = "objc2-app-kit")]
110#[cfg(target_os = "macos")]
111unsafe impl NSCoding for WebView {}
112
113#[cfg(feature = "objc2-app-kit")]
114#[cfg(target_os = "macos")]
115unsafe impl NSDraggingDestination for WebView {}
116
117#[cfg(feature = "objc2-app-kit")]
118#[cfg(target_os = "macos")]
119unsafe impl NSObjectProtocol for WebView {}
120
121#[cfg(feature = "objc2-app-kit")]
122#[cfg(target_os = "macos")]
123unsafe impl NSUserInterfaceItemIdentification for WebView {}
124
125#[cfg(feature = "objc2-app-kit")]
126#[cfg(target_os = "macos")]
127impl WebView {
128 extern_methods!(
129 #[deprecated = "No longer supported; please adopt WKWebView."]
135 #[unsafe(method(canShowMIMEType:))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn canShowMIMEType(mime_type: Option<&NSString>, mtm: MainThreadMarker) -> bool;
138
139 #[deprecated = "No longer supported; please adopt WKWebView."]
145 #[unsafe(method(canShowMIMETypeAsHTML:))]
146 #[unsafe(method_family = none)]
147 pub unsafe fn canShowMIMETypeAsHTML(
148 mime_type: Option<&NSString>,
149 mtm: MainThreadMarker,
150 ) -> bool;
151
152 #[deprecated = "No longer supported; please adopt WKWebView."]
155 #[unsafe(method(MIMETypesShownAsHTML))]
156 #[unsafe(method_family = none)]
157 pub unsafe fn MIMETypesShownAsHTML(mtm: MainThreadMarker) -> Option<Retained<NSArray>>;
158
159 #[deprecated = "No longer supported; please adopt WKWebView."]
164 #[unsafe(method(setMIMETypesShownAsHTML:))]
165 #[unsafe(method_family = none)]
166 pub unsafe fn setMIMETypesShownAsHTML(mime_types: Option<&NSArray>, mtm: MainThreadMarker);
167
168 #[deprecated = "No longer supported; please adopt WKWebView."]
177 #[unsafe(method(URLFromPasteboard:))]
178 #[unsafe(method_family = none)]
179 pub unsafe fn URLFromPasteboard(
180 pasteboard: Option<&NSPasteboard>,
181 mtm: MainThreadMarker,
182 ) -> Option<Retained<NSURL>>;
183
184 #[deprecated = "No longer supported; please adopt WKWebView."]
193 #[unsafe(method(URLTitleFromPasteboard:))]
194 #[unsafe(method_family = none)]
195 pub unsafe fn URLTitleFromPasteboard(
196 pasteboard: Option<&NSPasteboard>,
197 mtm: MainThreadMarker,
198 ) -> Option<Retained<NSString>>;
199
200 #[deprecated = "No longer supported; please adopt WKWebView."]
204 #[unsafe(method(registerURLSchemeAsLocal:))]
205 #[unsafe(method_family = none)]
206 pub unsafe fn registerURLSchemeAsLocal(scheme: Option<&NSString>, mtm: MainThreadMarker);
207
208 #[deprecated = "No longer supported; please adopt WKWebView."]
223 #[unsafe(method(initWithFrame:frameName:groupName:))]
224 #[unsafe(method_family = init)]
225 pub unsafe fn initWithFrame_frameName_groupName(
226 this: Allocated<Self>,
227 frame: NSRect,
228 frame_name: Option<&NSString>,
229 group_name: Option<&NSString>,
230 ) -> Option<Retained<Self>>;
231
232 #[deprecated = "No longer supported; please adopt WKWebView."]
241 #[unsafe(method(close))]
242 #[unsafe(method_family = none)]
243 pub unsafe fn close(&self);
244
245 #[deprecated = "No longer supported; please adopt WKWebView."]
249 #[unsafe(method(shouldCloseWithWindow))]
250 #[unsafe(method_family = none)]
251 pub unsafe fn shouldCloseWithWindow(&self) -> bool;
252
253 #[deprecated = "No longer supported; please adopt WKWebView."]
255 #[unsafe(method(setShouldCloseWithWindow:))]
256 #[unsafe(method_family = none)]
257 pub unsafe fn setShouldCloseWithWindow(&self, should_close_with_window: bool);
258
259 #[cfg(feature = "WebUIDelegate")]
260 #[deprecated = "No longer supported; please adopt WKWebView."]
262 #[unsafe(method(UIDelegate))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn UIDelegate(&self) -> Option<Retained<ProtocolObject<dyn WebUIDelegate>>>;
265
266 #[cfg(feature = "WebUIDelegate")]
267 #[deprecated = "No longer supported; please adopt WKWebView."]
269 #[unsafe(method(setUIDelegate:))]
270 #[unsafe(method_family = none)]
271 pub unsafe fn setUIDelegate(&self, ui_delegate: Option<&ProtocolObject<dyn WebUIDelegate>>);
272
273 #[cfg(feature = "WebResourceLoadDelegate")]
274 #[deprecated = "No longer supported; please adopt WKWebView."]
276 #[unsafe(method(resourceLoadDelegate))]
277 #[unsafe(method_family = none)]
278 pub unsafe fn resourceLoadDelegate(
279 &self,
280 ) -> Option<Retained<ProtocolObject<dyn WebResourceLoadDelegate>>>;
281
282 #[cfg(feature = "WebResourceLoadDelegate")]
283 #[deprecated = "No longer supported; please adopt WKWebView."]
285 #[unsafe(method(setResourceLoadDelegate:))]
286 #[unsafe(method_family = none)]
287 pub unsafe fn setResourceLoadDelegate(
288 &self,
289 resource_load_delegate: Option<&ProtocolObject<dyn WebResourceLoadDelegate>>,
290 );
291
292 #[cfg(feature = "WebDownload")]
293 #[deprecated = "No longer supported; please adopt WKWebView."]
295 #[unsafe(method(downloadDelegate))]
296 #[unsafe(method_family = none)]
297 pub unsafe fn downloadDelegate(
298 &self,
299 ) -> Option<Retained<ProtocolObject<dyn WebDownloadDelegate>>>;
300
301 #[cfg(feature = "WebDownload")]
302 #[deprecated = "No longer supported; please adopt WKWebView."]
304 #[unsafe(method(setDownloadDelegate:))]
305 #[unsafe(method_family = none)]
306 pub unsafe fn setDownloadDelegate(
307 &self,
308 download_delegate: Option<&ProtocolObject<dyn WebDownloadDelegate>>,
309 );
310
311 #[cfg(feature = "WebFrameLoadDelegate")]
312 #[deprecated = "No longer supported; please adopt WKWebView."]
314 #[unsafe(method(frameLoadDelegate))]
315 #[unsafe(method_family = none)]
316 pub unsafe fn frameLoadDelegate(
317 &self,
318 ) -> Option<Retained<ProtocolObject<dyn WebFrameLoadDelegate>>>;
319
320 #[cfg(feature = "WebFrameLoadDelegate")]
321 #[deprecated = "No longer supported; please adopt WKWebView."]
323 #[unsafe(method(setFrameLoadDelegate:))]
324 #[unsafe(method_family = none)]
325 pub unsafe fn setFrameLoadDelegate(
326 &self,
327 frame_load_delegate: Option<&ProtocolObject<dyn WebFrameLoadDelegate>>,
328 );
329
330 #[cfg(feature = "WebPolicyDelegate")]
331 #[deprecated = "No longer supported; please adopt WKWebView."]
333 #[unsafe(method(policyDelegate))]
334 #[unsafe(method_family = none)]
335 pub unsafe fn policyDelegate(
336 &self,
337 ) -> Option<Retained<ProtocolObject<dyn WebPolicyDelegate>>>;
338
339 #[cfg(feature = "WebPolicyDelegate")]
340 #[deprecated = "No longer supported; please adopt WKWebView."]
342 #[unsafe(method(setPolicyDelegate:))]
343 #[unsafe(method_family = none)]
344 pub unsafe fn setPolicyDelegate(
345 &self,
346 policy_delegate: Option<&ProtocolObject<dyn WebPolicyDelegate>>,
347 );
348
349 #[cfg(feature = "WebFrame")]
350 #[deprecated = "No longer supported; please adopt WKWebView."]
354 #[unsafe(method(mainFrame))]
355 #[unsafe(method_family = none)]
356 pub unsafe fn mainFrame(&self) -> Option<Retained<WebFrame>>;
357
358 #[cfg(feature = "WebFrame")]
359 #[deprecated = "No longer supported; please adopt WKWebView."]
364 #[unsafe(method(selectedFrame))]
365 #[unsafe(method_family = none)]
366 pub unsafe fn selectedFrame(&self) -> Option<Retained<WebFrame>>;
367
368 #[cfg(feature = "WebBackForwardList")]
369 #[deprecated = "No longer supported; please adopt WKWebView."]
371 #[unsafe(method(backForwardList))]
372 #[unsafe(method_family = none)]
373 pub unsafe fn backForwardList(&self) -> Option<Retained<WebBackForwardList>>;
374
375 #[deprecated = "No longer supported; please adopt WKWebView."]
379 #[unsafe(method(setMaintainsBackForwardList:))]
380 #[unsafe(method_family = none)]
381 pub unsafe fn setMaintainsBackForwardList(&self, flag: bool);
382
383 #[deprecated = "No longer supported; please adopt WKWebView."]
387 #[unsafe(method(goBack))]
388 #[unsafe(method_family = none)]
389 pub unsafe fn goBack(&self) -> bool;
390
391 #[deprecated = "No longer supported; please adopt WKWebView."]
395 #[unsafe(method(goForward))]
396 #[unsafe(method_family = none)]
397 pub unsafe fn goForward(&self) -> bool;
398
399 #[cfg(feature = "WebHistoryItem")]
400 #[deprecated = "No longer supported; please adopt WKWebView."]
404 #[unsafe(method(goToBackForwardItem:))]
405 #[unsafe(method_family = none)]
406 pub unsafe fn goToBackForwardItem(&self, item: Option<&WebHistoryItem>) -> bool;
407
408 #[deprecated = "No longer supported; please adopt WKWebView."]
410 #[unsafe(method(textSizeMultiplier))]
411 #[unsafe(method_family = none)]
412 pub unsafe fn textSizeMultiplier(&self) -> c_float;
413
414 #[deprecated = "No longer supported; please adopt WKWebView."]
416 #[unsafe(method(setTextSizeMultiplier:))]
417 #[unsafe(method_family = none)]
418 pub unsafe fn setTextSizeMultiplier(&self, text_size_multiplier: c_float);
419
420 #[deprecated = "No longer supported; please adopt WKWebView."]
422 #[unsafe(method(applicationNameForUserAgent))]
423 #[unsafe(method_family = none)]
424 pub unsafe fn applicationNameForUserAgent(&self) -> Retained<NSString>;
425
426 #[deprecated = "No longer supported; please adopt WKWebView."]
428 #[unsafe(method(setApplicationNameForUserAgent:))]
429 #[unsafe(method_family = none)]
430 pub unsafe fn setApplicationNameForUserAgent(
431 &self,
432 application_name_for_user_agent: Option<&NSString>,
433 );
434
435 #[deprecated = "No longer supported; please adopt WKWebView."]
442 #[unsafe(method(customUserAgent))]
443 #[unsafe(method_family = none)]
444 pub unsafe fn customUserAgent(&self) -> Retained<NSString>;
445
446 #[deprecated = "No longer supported; please adopt WKWebView."]
448 #[unsafe(method(setCustomUserAgent:))]
449 #[unsafe(method_family = none)]
450 pub unsafe fn setCustomUserAgent(&self, custom_user_agent: Option<&NSString>);
451
452 #[deprecated = "No longer supported; please adopt WKWebView."]
458 #[unsafe(method(userAgentForURL:))]
459 #[unsafe(method_family = none)]
460 pub unsafe fn userAgentForURL(&self, url: Option<&NSURL>) -> Option<Retained<NSString>>;
461
462 #[deprecated = "No longer supported; please adopt WKWebView."]
464 #[unsafe(method(supportsTextEncoding))]
465 #[unsafe(method_family = none)]
466 pub unsafe fn supportsTextEncoding(&self) -> bool;
467
468 #[deprecated = "No longer supported; please adopt WKWebView."]
477 #[unsafe(method(customTextEncodingName))]
478 #[unsafe(method_family = none)]
479 pub unsafe fn customTextEncodingName(&self) -> Retained<NSString>;
480
481 #[deprecated = "No longer supported; please adopt WKWebView."]
483 #[unsafe(method(setCustomTextEncodingName:))]
484 #[unsafe(method_family = none)]
485 pub unsafe fn setCustomTextEncodingName(
486 &self,
487 custom_text_encoding_name: Option<&NSString>,
488 );
489
490 #[deprecated = "No longer supported; please adopt WKWebView."]
495 #[unsafe(method(mediaStyle))]
496 #[unsafe(method_family = none)]
497 pub unsafe fn mediaStyle(&self) -> Retained<NSString>;
498
499 #[deprecated = "No longer supported; please adopt WKWebView."]
501 #[unsafe(method(setMediaStyle:))]
502 #[unsafe(method_family = none)]
503 pub unsafe fn setMediaStyle(&self, media_style: Option<&NSString>);
504
505 #[deprecated = "No longer supported; please adopt WKWebView."]
509 #[unsafe(method(stringByEvaluatingJavaScriptFromString:))]
510 #[unsafe(method_family = none)]
511 pub unsafe fn stringByEvaluatingJavaScriptFromString(
512 &self,
513 script: Option<&NSString>,
514 ) -> Option<Retained<NSString>>;
515
516 #[cfg(feature = "WebScriptObject")]
517 #[deprecated = "No longer supported; please adopt WKWebView."]
520 #[unsafe(method(windowScriptObject))]
521 #[unsafe(method_family = none)]
522 pub unsafe fn windowScriptObject(&self) -> Option<Retained<WebScriptObject>>;
523
524 #[cfg(feature = "WebPreferences")]
525 #[deprecated = "No longer supported; please adopt WKWebView."]
530 #[unsafe(method(preferences))]
531 #[unsafe(method_family = none)]
532 pub unsafe fn preferences(&self) -> Option<Retained<WebPreferences>>;
533
534 #[cfg(feature = "WebPreferences")]
535 #[deprecated = "No longer supported; please adopt WKWebView."]
537 #[unsafe(method(setPreferences:))]
538 #[unsafe(method_family = none)]
539 pub unsafe fn setPreferences(&self, preferences: Option<&WebPreferences>);
540
541 #[deprecated = "No longer supported; please adopt WKWebView."]
545 #[unsafe(method(preferencesIdentifier))]
546 #[unsafe(method_family = none)]
547 pub unsafe fn preferencesIdentifier(&self) -> Retained<NSString>;
548
549 #[deprecated = "No longer supported; please adopt WKWebView."]
551 #[unsafe(method(setPreferencesIdentifier:))]
552 #[unsafe(method_family = none)]
553 pub unsafe fn setPreferencesIdentifier(&self, preferences_identifier: Option<&NSString>);
554
555 #[deprecated = "No longer supported; please adopt WKWebView."]
561 #[unsafe(method(hostWindow))]
562 #[unsafe(method_family = none)]
563 pub unsafe fn hostWindow(&self) -> Option<Retained<NSWindow>>;
564
565 #[deprecated = "No longer supported; please adopt WKWebView."]
567 #[unsafe(method(setHostWindow:))]
568 #[unsafe(method_family = none)]
569 pub unsafe fn setHostWindow(&self, host_window: Option<&NSWindow>);
570
571 #[deprecated = "No longer supported; please adopt WKWebView."]
582 #[unsafe(method(searchFor:direction:caseSensitive:wrap:))]
583 #[unsafe(method_family = none)]
584 pub unsafe fn searchFor_direction_caseSensitive_wrap(
585 &self,
586 string: Option<&NSString>,
587 forward: bool,
588 case_flag: bool,
589 wrap_flag: bool,
590 ) -> bool;
591
592 #[deprecated = "No longer supported; please adopt WKWebView."]
604 #[unsafe(method(registerViewClass:representationClass:forMIMEType:))]
605 #[unsafe(method_family = none)]
606 pub unsafe fn registerViewClass_representationClass_forMIMEType(
607 view_class: Option<&AnyClass>,
608 representation_class: Option<&AnyClass>,
609 mime_type: Option<&NSString>,
610 mtm: MainThreadMarker,
611 );
612
613 #[deprecated = "No longer supported; please adopt WKWebView."]
617 #[unsafe(method(groupName))]
618 #[unsafe(method_family = none)]
619 pub unsafe fn groupName(&self) -> Retained<NSString>;
620
621 #[deprecated = "No longer supported; please adopt WKWebView."]
623 #[unsafe(method(setGroupName:))]
624 #[unsafe(method_family = none)]
625 pub unsafe fn setGroupName(&self, group_name: Option<&NSString>);
626
627 #[deprecated = "No longer supported; please adopt WKWebView."]
635 #[unsafe(method(estimatedProgress))]
636 #[unsafe(method_family = none)]
637 pub unsafe fn estimatedProgress(&self) -> c_double;
638
639 #[deprecated = "No longer supported; please adopt WKWebView."]
641 #[unsafe(method(isLoading))]
642 #[unsafe(method_family = none)]
643 pub unsafe fn isLoading(&self) -> bool;
644
645 #[deprecated = "No longer supported; please adopt WKWebView."]
649 #[unsafe(method(elementAtPoint:))]
650 #[unsafe(method_family = none)]
651 pub unsafe fn elementAtPoint(&self, point: NSPoint) -> Option<Retained<NSDictionary>>;
652
653 #[deprecated = "No longer supported; please adopt WKWebView."]
655 #[unsafe(method(pasteboardTypesForSelection))]
656 #[unsafe(method_family = none)]
657 pub unsafe fn pasteboardTypesForSelection(&self) -> Retained<NSArray>;
658
659 #[deprecated = "No longer supported; please adopt WKWebView."]
665 #[unsafe(method(writeSelectionWithPasteboardTypes:toPasteboard:))]
666 #[unsafe(method_family = none)]
667 pub unsafe fn writeSelectionWithPasteboardTypes_toPasteboard(
668 &self,
669 types: Option<&NSArray>,
670 pasteboard: Option<&NSPasteboard>,
671 );
672
673 #[deprecated = "No longer supported; please adopt WKWebView."]
677 #[unsafe(method(pasteboardTypesForElement:))]
678 #[unsafe(method_family = none)]
679 pub unsafe fn pasteboardTypesForElement(
680 &self,
681 element: Option<&NSDictionary>,
682 ) -> Option<Retained<NSArray>>;
683
684 #[deprecated = "No longer supported; please adopt WKWebView."]
692 #[unsafe(method(writeElement:withPasteboardTypes:toPasteboard:))]
693 #[unsafe(method_family = none)]
694 pub unsafe fn writeElement_withPasteboardTypes_toPasteboard(
695 &self,
696 element: Option<&NSDictionary>,
697 types: Option<&NSArray>,
698 pasteboard: Option<&NSPasteboard>,
699 );
700
701 #[deprecated = "No longer supported; please adopt WKWebView."]
706 #[unsafe(method(moveDragCaretToPoint:))]
707 #[unsafe(method_family = none)]
708 pub unsafe fn moveDragCaretToPoint(&self, point: NSPoint);
709
710 #[deprecated = "No longer supported; please adopt WKWebView."]
712 #[unsafe(method(removeDragCaret))]
713 #[unsafe(method_family = none)]
714 pub unsafe fn removeDragCaret(&self);
715
716 #[deprecated = "No longer supported; please adopt WKWebView."]
718 #[unsafe(method(drawsBackground))]
719 #[unsafe(method_family = none)]
720 pub unsafe fn drawsBackground(&self) -> bool;
721
722 #[deprecated = "No longer supported; please adopt WKWebView."]
724 #[unsafe(method(setDrawsBackground:))]
725 #[unsafe(method_family = none)]
726 pub unsafe fn setDrawsBackground(&self, draws_background: bool);
727
728 #[deprecated = "No longer supported; please adopt WKWebView."]
734 #[unsafe(method(shouldUpdateWhileOffscreen))]
735 #[unsafe(method_family = none)]
736 pub unsafe fn shouldUpdateWhileOffscreen(&self) -> bool;
737
738 #[deprecated = "No longer supported; please adopt WKWebView."]
740 #[unsafe(method(setShouldUpdateWhileOffscreen:))]
741 #[unsafe(method_family = none)]
742 pub unsafe fn setShouldUpdateWhileOffscreen(&self, should_update_while_offscreen: bool);
743
744 #[deprecated = "No longer supported; please adopt WKWebView."]
746 #[unsafe(method(mainFrameURL))]
747 #[unsafe(method_family = none)]
748 pub unsafe fn mainFrameURL(&self) -> Retained<NSString>;
749
750 #[deprecated = "No longer supported; please adopt WKWebView."]
752 #[unsafe(method(setMainFrameURL:))]
753 #[unsafe(method_family = none)]
754 pub unsafe fn setMainFrameURL(&self, main_frame_url: Option<&NSString>);
755
756 #[cfg(all(
757 feature = "DOMDocument",
758 feature = "DOMNode",
759 feature = "DOMObject",
760 feature = "WebScriptObject"
761 ))]
762 #[deprecated = "No longer supported; please adopt WKWebView."]
764 #[unsafe(method(mainFrameDocument))]
765 #[unsafe(method_family = none)]
766 pub unsafe fn mainFrameDocument(&self) -> Option<Retained<DOMDocument>>;
767
768 #[deprecated = "No longer supported; please adopt WKWebView."]
770 #[unsafe(method(mainFrameTitle))]
771 #[unsafe(method_family = none)]
772 pub unsafe fn mainFrameTitle(&self) -> Retained<NSString>;
773
774 #[deprecated = "No longer supported; please adopt WKWebView."]
776 #[unsafe(method(mainFrameIcon))]
777 #[unsafe(method_family = none)]
778 pub unsafe fn mainFrameIcon(&self) -> Option<Retained<NSImage>>;
779 );
780}
781
782#[cfg(feature = "objc2-app-kit")]
784#[cfg(target_os = "macos")]
785impl WebView {
786 extern_methods!(
787 #[unsafe(method(initWithFrame:))]
788 #[unsafe(method_family = init)]
789 pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
790
791 #[unsafe(method(initWithCoder:))]
792 #[unsafe(method_family = init)]
793 pub unsafe fn initWithCoder(
794 this: Allocated<Self>,
795 coder: &NSCoder,
796 ) -> Option<Retained<Self>>;
797 );
798}
799
800#[cfg(feature = "objc2-app-kit")]
802#[cfg(target_os = "macos")]
803impl WebView {
804 extern_methods!(
805 #[unsafe(method(init))]
806 #[unsafe(method_family = init)]
807 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
808 );
809}
810
811#[cfg(feature = "objc2-app-kit")]
813#[cfg(target_os = "macos")]
814impl WebView {
815 extern_methods!(
816 #[unsafe(method(new))]
817 #[unsafe(method_family = new)]
818 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
819 );
820}
821
822#[cfg(feature = "objc2-app-kit")]
824#[cfg(target_os = "macos")]
825impl WebView {
826 extern_methods!(
827 #[deprecated = "No longer supported; please adopt WKWebView."]
828 #[unsafe(method(takeStringURLFrom:))]
829 #[unsafe(method_family = none)]
830 pub unsafe fn takeStringURLFrom(&self, sender: Option<&AnyObject>);
831
832 #[deprecated = "No longer supported; please adopt WKWebView."]
833 #[unsafe(method(stopLoading:))]
834 #[unsafe(method_family = none)]
835 pub unsafe fn stopLoading(&self, sender: Option<&AnyObject>);
836
837 #[deprecated = "No longer supported; please adopt WKWebView."]
838 #[unsafe(method(reload:))]
839 #[unsafe(method_family = none)]
840 pub unsafe fn reload(&self, sender: Option<&AnyObject>);
841
842 #[deprecated = "No longer supported; please adopt WKWebView."]
843 #[unsafe(method(reloadFromOrigin:))]
844 #[unsafe(method_family = none)]
845 pub unsafe fn reloadFromOrigin(&self, sender: Option<&AnyObject>);
846
847 #[deprecated = "No longer supported; please adopt WKWebView."]
848 #[unsafe(method(canGoBack))]
849 #[unsafe(method_family = none)]
850 pub unsafe fn canGoBack(&self) -> bool;
851
852 #[deprecated = "No longer supported; please adopt WKWebView."]
853 #[unsafe(method(goBack:))]
854 #[unsafe(method_family = none)]
855 pub unsafe fn goBack_(&self, sender: Option<&AnyObject>);
856
857 #[deprecated = "No longer supported; please adopt WKWebView."]
858 #[unsafe(method(canGoForward))]
859 #[unsafe(method_family = none)]
860 pub unsafe fn canGoForward(&self) -> bool;
861
862 #[deprecated = "No longer supported; please adopt WKWebView."]
863 #[unsafe(method(goForward:))]
864 #[unsafe(method_family = none)]
865 pub unsafe fn goForward_(&self, sender: Option<&AnyObject>);
866
867 #[deprecated = "No longer supported; please adopt WKWebView."]
868 #[unsafe(method(canMakeTextLarger))]
869 #[unsafe(method_family = none)]
870 pub unsafe fn canMakeTextLarger(&self) -> bool;
871
872 #[deprecated = "No longer supported; please adopt WKWebView."]
873 #[unsafe(method(makeTextLarger:))]
874 #[unsafe(method_family = none)]
875 pub unsafe fn makeTextLarger(&self, sender: Option<&AnyObject>);
876
877 #[deprecated = "No longer supported; please adopt WKWebView."]
878 #[unsafe(method(canMakeTextSmaller))]
879 #[unsafe(method_family = none)]
880 pub unsafe fn canMakeTextSmaller(&self) -> bool;
881
882 #[deprecated = "No longer supported; please adopt WKWebView."]
883 #[unsafe(method(makeTextSmaller:))]
884 #[unsafe(method_family = none)]
885 pub unsafe fn makeTextSmaller(&self, sender: Option<&AnyObject>);
886
887 #[deprecated = "No longer supported; please adopt WKWebView."]
888 #[unsafe(method(canMakeTextStandardSize))]
889 #[unsafe(method_family = none)]
890 pub unsafe fn canMakeTextStandardSize(&self) -> bool;
891
892 #[deprecated = "No longer supported; please adopt WKWebView."]
893 #[unsafe(method(makeTextStandardSize:))]
894 #[unsafe(method_family = none)]
895 pub unsafe fn makeTextStandardSize(&self, sender: Option<&AnyObject>);
896
897 #[deprecated = "No longer supported; please adopt WKWebView."]
898 #[unsafe(method(toggleContinuousSpellChecking:))]
899 #[unsafe(method_family = none)]
900 pub unsafe fn toggleContinuousSpellChecking(&self, sender: Option<&AnyObject>);
901
902 #[deprecated = "No longer supported; please adopt WKWebView."]
903 #[unsafe(method(toggleSmartInsertDelete:))]
904 #[unsafe(method_family = none)]
905 pub unsafe fn toggleSmartInsertDelete(&self, sender: Option<&AnyObject>);
906 );
907}
908
909#[cfg(feature = "objc2-app-kit")]
910#[cfg(target_os = "macos")]
911unsafe impl NSUserInterfaceValidations for WebView {}
912
913extern "C" {
914 pub static WebViewDidBeginEditingNotification: Option<&'static NSString>;
916}
917
918extern "C" {
919 pub static WebViewDidChangeNotification: Option<&'static NSString>;
921}
922
923extern "C" {
924 pub static WebViewDidEndEditingNotification: Option<&'static NSString>;
926}
927
928extern "C" {
929 pub static WebViewDidChangeTypingStyleNotification: Option<&'static NSString>;
931}
932
933extern "C" {
934 pub static WebViewDidChangeSelectionNotification: Option<&'static NSString>;
936}
937
938#[cfg(feature = "objc2-app-kit")]
940#[cfg(target_os = "macos")]
941impl WebView {
942 extern_methods!(
943 #[cfg(all(
944 feature = "DOMCSSStyleDeclaration",
945 feature = "DOMElement",
946 feature = "DOMNode",
947 feature = "DOMObject",
948 feature = "WebScriptObject"
949 ))]
950 #[deprecated = "No longer supported; please adopt WKWebView."]
951 #[unsafe(method(computedStyleForElement:pseudoElement:))]
952 #[unsafe(method_family = none)]
953 pub unsafe fn computedStyleForElement_pseudoElement(
954 &self,
955 element: Option<&DOMElement>,
956 pseudo_element: Option<&NSString>,
957 ) -> Option<Retained<DOMCSSStyleDeclaration>>;
958 );
959}
960
961#[cfg(feature = "objc2-app-kit")]
963#[cfg(target_os = "macos")]
964impl WebView {
965 extern_methods!(
966 #[cfg(all(
967 feature = "DOMObject",
968 feature = "DOMRange",
969 feature = "WebScriptObject"
970 ))]
971 #[deprecated = "No longer supported; please adopt WKWebView."]
972 #[unsafe(method(editableDOMRangeForPoint:))]
973 #[unsafe(method_family = none)]
974 pub unsafe fn editableDOMRangeForPoint(&self, point: NSPoint)
975 -> Option<Retained<DOMRange>>;
976
977 #[cfg(all(
978 feature = "DOMObject",
979 feature = "DOMRange",
980 feature = "WebScriptObject"
981 ))]
982 #[deprecated = "No longer supported; please adopt WKWebView."]
983 #[unsafe(method(setSelectedDOMRange:affinity:))]
984 #[unsafe(method_family = none)]
985 pub unsafe fn setSelectedDOMRange_affinity(
986 &self,
987 range: Option<&DOMRange>,
988 selection_affinity: NSSelectionAffinity,
989 );
990
991 #[cfg(all(
992 feature = "DOMObject",
993 feature = "DOMRange",
994 feature = "WebScriptObject"
995 ))]
996 #[deprecated = "No longer supported; please adopt WKWebView."]
997 #[unsafe(method(selectedDOMRange))]
998 #[unsafe(method_family = none)]
999 pub unsafe fn selectedDOMRange(&self) -> Option<Retained<DOMRange>>;
1000
1001 #[deprecated = "No longer supported; please adopt WKWebView."]
1002 #[unsafe(method(selectionAffinity))]
1003 #[unsafe(method_family = none)]
1004 pub unsafe fn selectionAffinity(&self) -> NSSelectionAffinity;
1005
1006 #[deprecated = "No longer supported; please adopt WKWebView."]
1007 #[unsafe(method(maintainsInactiveSelection))]
1008 #[unsafe(method_family = none)]
1009 pub unsafe fn maintainsInactiveSelection(&self) -> bool;
1010
1011 #[deprecated = "No longer supported; please adopt WKWebView."]
1012 #[unsafe(method(isEditable))]
1013 #[unsafe(method_family = none)]
1014 pub unsafe fn isEditable(&self) -> bool;
1015
1016 #[deprecated = "No longer supported; please adopt WKWebView."]
1018 #[unsafe(method(setEditable:))]
1019 #[unsafe(method_family = none)]
1020 pub unsafe fn setEditable(&self, editable: bool);
1021
1022 #[cfg(all(
1023 feature = "DOMCSSStyleDeclaration",
1024 feature = "DOMObject",
1025 feature = "WebScriptObject"
1026 ))]
1027 #[deprecated = "No longer supported; please adopt WKWebView."]
1028 #[unsafe(method(typingStyle))]
1029 #[unsafe(method_family = none)]
1030 pub unsafe fn typingStyle(&self) -> Option<Retained<DOMCSSStyleDeclaration>>;
1031
1032 #[cfg(all(
1033 feature = "DOMCSSStyleDeclaration",
1034 feature = "DOMObject",
1035 feature = "WebScriptObject"
1036 ))]
1037 #[deprecated = "No longer supported; please adopt WKWebView."]
1039 #[unsafe(method(setTypingStyle:))]
1040 #[unsafe(method_family = none)]
1041 pub unsafe fn setTypingStyle(&self, typing_style: Option<&DOMCSSStyleDeclaration>);
1042
1043 #[deprecated = "No longer supported; please adopt WKWebView."]
1044 #[unsafe(method(smartInsertDeleteEnabled))]
1045 #[unsafe(method_family = none)]
1046 pub unsafe fn smartInsertDeleteEnabled(&self) -> bool;
1047
1048 #[deprecated = "No longer supported; please adopt WKWebView."]
1050 #[unsafe(method(setSmartInsertDeleteEnabled:))]
1051 #[unsafe(method_family = none)]
1052 pub unsafe fn setSmartInsertDeleteEnabled(&self, smart_insert_delete_enabled: bool);
1053
1054 #[deprecated = "No longer supported; please adopt WKWebView."]
1055 #[unsafe(method(isContinuousSpellCheckingEnabled))]
1056 #[unsafe(method_family = none)]
1057 pub unsafe fn isContinuousSpellCheckingEnabled(&self) -> bool;
1058
1059 #[deprecated = "No longer supported; please adopt WKWebView."]
1061 #[unsafe(method(setContinuousSpellCheckingEnabled:))]
1062 #[unsafe(method_family = none)]
1063 pub unsafe fn setContinuousSpellCheckingEnabled(
1064 &self,
1065 continuous_spell_checking_enabled: bool,
1066 );
1067
1068 #[deprecated = "No longer supported; please adopt WKWebView."]
1069 #[unsafe(method(spellCheckerDocumentTag))]
1070 #[unsafe(method_family = none)]
1071 pub unsafe fn spellCheckerDocumentTag(&self) -> NSInteger;
1072
1073 #[deprecated = "No longer supported; please adopt WKWebView."]
1074 #[unsafe(method(undoManager))]
1075 #[unsafe(method_family = none)]
1076 pub unsafe fn undoManager(&self) -> Option<Retained<NSUndoManager>>;
1077
1078 #[cfg(feature = "WebEditingDelegate")]
1079 #[deprecated = "No longer supported; please adopt WKWebView."]
1080 #[unsafe(method(editingDelegate))]
1081 #[unsafe(method_family = none)]
1082 pub unsafe fn editingDelegate(
1083 &self,
1084 ) -> Option<Retained<ProtocolObject<dyn WebEditingDelegate>>>;
1085
1086 #[cfg(feature = "WebEditingDelegate")]
1087 #[deprecated = "No longer supported; please adopt WKWebView."]
1089 #[unsafe(method(setEditingDelegate:))]
1090 #[unsafe(method_family = none)]
1091 pub unsafe fn setEditingDelegate(
1092 &self,
1093 editing_delegate: Option<&ProtocolObject<dyn WebEditingDelegate>>,
1094 );
1095
1096 #[cfg(all(
1097 feature = "DOMCSSStyleDeclaration",
1098 feature = "DOMObject",
1099 feature = "WebScriptObject"
1100 ))]
1101 #[deprecated = "No longer supported; please adopt WKWebView."]
1102 #[unsafe(method(styleDeclarationWithText:))]
1103 #[unsafe(method_family = none)]
1104 pub unsafe fn styleDeclarationWithText(
1105 &self,
1106 text: Option<&NSString>,
1107 ) -> Option<Retained<DOMCSSStyleDeclaration>>;
1108 );
1109}
1110
1111#[cfg(feature = "objc2-app-kit")]
1113#[cfg(target_os = "macos")]
1114impl WebView {
1115 extern_methods!(
1116 #[cfg(all(
1117 feature = "DOMNode",
1118 feature = "DOMObject",
1119 feature = "WebScriptObject"
1120 ))]
1121 #[deprecated = "No longer supported; please adopt WKWebView."]
1122 #[unsafe(method(replaceSelectionWithNode:))]
1123 #[unsafe(method_family = none)]
1124 pub unsafe fn replaceSelectionWithNode(&self, node: Option<&DOMNode>);
1125
1126 #[deprecated = "No longer supported; please adopt WKWebView."]
1127 #[unsafe(method(replaceSelectionWithText:))]
1128 #[unsafe(method_family = none)]
1129 pub unsafe fn replaceSelectionWithText(&self, text: Option<&NSString>);
1130
1131 #[deprecated = "No longer supported; please adopt WKWebView."]
1132 #[unsafe(method(replaceSelectionWithMarkupString:))]
1133 #[unsafe(method_family = none)]
1134 pub unsafe fn replaceSelectionWithMarkupString(&self, markup_string: Option<&NSString>);
1135
1136 #[cfg(feature = "WebArchive")]
1137 #[deprecated = "No longer supported; please adopt WKWebView."]
1138 #[unsafe(method(replaceSelectionWithArchive:))]
1139 #[unsafe(method_family = none)]
1140 pub unsafe fn replaceSelectionWithArchive(&self, archive: Option<&WebArchive>);
1141
1142 #[deprecated = "No longer supported; please adopt WKWebView."]
1143 #[unsafe(method(deleteSelection))]
1144 #[unsafe(method_family = none)]
1145 pub unsafe fn deleteSelection(&self);
1146
1147 #[cfg(all(
1148 feature = "DOMCSSStyleDeclaration",
1149 feature = "DOMObject",
1150 feature = "WebScriptObject"
1151 ))]
1152 #[deprecated = "No longer supported; please adopt WKWebView."]
1153 #[unsafe(method(applyStyle:))]
1154 #[unsafe(method_family = none)]
1155 pub unsafe fn applyStyle(&self, style: Option<&DOMCSSStyleDeclaration>);
1156 );
1157}
1158
1159#[cfg(feature = "objc2-app-kit")]
1161#[cfg(target_os = "macos")]
1162impl WebView {
1163 extern_methods!(
1164 #[deprecated = "No longer supported; please adopt WKWebView."]
1165 #[unsafe(method(copy:))]
1166 #[unsafe(method_family = none)]
1167 pub unsafe fn copy(&self, sender: Option<&AnyObject>);
1168
1169 #[deprecated = "No longer supported; please adopt WKWebView."]
1170 #[unsafe(method(cut:))]
1171 #[unsafe(method_family = none)]
1172 pub unsafe fn cut(&self, sender: Option<&AnyObject>);
1173
1174 #[deprecated = "No longer supported; please adopt WKWebView."]
1175 #[unsafe(method(paste:))]
1176 #[unsafe(method_family = none)]
1177 pub unsafe fn paste(&self, sender: Option<&AnyObject>);
1178
1179 #[deprecated = "No longer supported; please adopt WKWebView."]
1180 #[unsafe(method(copyFont:))]
1181 #[unsafe(method_family = none)]
1182 pub unsafe fn copyFont(&self, sender: Option<&AnyObject>);
1183
1184 #[deprecated = "No longer supported; please adopt WKWebView."]
1185 #[unsafe(method(pasteFont:))]
1186 #[unsafe(method_family = none)]
1187 pub unsafe fn pasteFont(&self, sender: Option<&AnyObject>);
1188
1189 #[deprecated = "No longer supported; please adopt WKWebView."]
1190 #[unsafe(method(delete:))]
1191 #[unsafe(method_family = none)]
1192 pub unsafe fn delete(&self, sender: Option<&AnyObject>);
1193
1194 #[deprecated = "No longer supported; please adopt WKWebView."]
1195 #[unsafe(method(pasteAsPlainText:))]
1196 #[unsafe(method_family = none)]
1197 pub unsafe fn pasteAsPlainText(&self, sender: Option<&AnyObject>);
1198
1199 #[deprecated = "No longer supported; please adopt WKWebView."]
1200 #[unsafe(method(pasteAsRichText:))]
1201 #[unsafe(method_family = none)]
1202 pub unsafe fn pasteAsRichText(&self, sender: Option<&AnyObject>);
1203
1204 #[deprecated = "No longer supported; please adopt WKWebView."]
1205 #[unsafe(method(changeFont:))]
1206 #[unsafe(method_family = none)]
1207 pub unsafe fn changeFont(&self, sender: Option<&AnyObject>);
1208
1209 #[deprecated = "No longer supported; please adopt WKWebView."]
1210 #[unsafe(method(changeAttributes:))]
1211 #[unsafe(method_family = none)]
1212 pub unsafe fn changeAttributes(&self, sender: Option<&AnyObject>);
1213
1214 #[deprecated = "No longer supported; please adopt WKWebView."]
1215 #[unsafe(method(changeDocumentBackgroundColor:))]
1216 #[unsafe(method_family = none)]
1217 pub unsafe fn changeDocumentBackgroundColor(&self, sender: Option<&AnyObject>);
1218
1219 #[deprecated = "No longer supported; please adopt WKWebView."]
1220 #[unsafe(method(changeColor:))]
1221 #[unsafe(method_family = none)]
1222 pub unsafe fn changeColor(&self, sender: Option<&AnyObject>);
1223
1224 #[deprecated = "No longer supported; please adopt WKWebView."]
1225 #[unsafe(method(alignCenter:))]
1226 #[unsafe(method_family = none)]
1227 pub unsafe fn alignCenter(&self, sender: Option<&AnyObject>);
1228
1229 #[deprecated = "No longer supported; please adopt WKWebView."]
1230 #[unsafe(method(alignJustified:))]
1231 #[unsafe(method_family = none)]
1232 pub unsafe fn alignJustified(&self, sender: Option<&AnyObject>);
1233
1234 #[deprecated = "No longer supported; please adopt WKWebView."]
1235 #[unsafe(method(alignLeft:))]
1236 #[unsafe(method_family = none)]
1237 pub unsafe fn alignLeft(&self, sender: Option<&AnyObject>);
1238
1239 #[deprecated = "No longer supported; please adopt WKWebView."]
1240 #[unsafe(method(alignRight:))]
1241 #[unsafe(method_family = none)]
1242 pub unsafe fn alignRight(&self, sender: Option<&AnyObject>);
1243
1244 #[deprecated = "No longer supported; please adopt WKWebView."]
1245 #[unsafe(method(checkSpelling:))]
1246 #[unsafe(method_family = none)]
1247 pub unsafe fn checkSpelling(&self, sender: Option<&AnyObject>);
1248
1249 #[deprecated = "No longer supported; please adopt WKWebView."]
1250 #[unsafe(method(showGuessPanel:))]
1251 #[unsafe(method_family = none)]
1252 pub unsafe fn showGuessPanel(&self, sender: Option<&AnyObject>);
1253
1254 #[deprecated = "No longer supported; please adopt WKWebView."]
1255 #[unsafe(method(performFindPanelAction:))]
1256 #[unsafe(method_family = none)]
1257 pub unsafe fn performFindPanelAction(&self, sender: Option<&AnyObject>);
1258
1259 #[deprecated = "No longer supported; please adopt WKWebView."]
1260 #[unsafe(method(startSpeaking:))]
1261 #[unsafe(method_family = none)]
1262 pub unsafe fn startSpeaking(&self, sender: Option<&AnyObject>);
1263
1264 #[deprecated = "No longer supported; please adopt WKWebView."]
1265 #[unsafe(method(stopSpeaking:))]
1266 #[unsafe(method_family = none)]
1267 pub unsafe fn stopSpeaking(&self, sender: Option<&AnyObject>);
1268
1269 #[deprecated = "No longer supported; please adopt WKWebView."]
1270 #[unsafe(method(moveToBeginningOfSentence:))]
1271 #[unsafe(method_family = none)]
1272 pub unsafe fn moveToBeginningOfSentence(&self, sender: Option<&AnyObject>);
1273
1274 #[deprecated = "No longer supported; please adopt WKWebView."]
1275 #[unsafe(method(moveToBeginningOfSentenceAndModifySelection:))]
1276 #[unsafe(method_family = none)]
1277 pub unsafe fn moveToBeginningOfSentenceAndModifySelection(
1278 &self,
1279 sender: Option<&AnyObject>,
1280 );
1281
1282 #[deprecated = "No longer supported; please adopt WKWebView."]
1283 #[unsafe(method(moveToEndOfSentence:))]
1284 #[unsafe(method_family = none)]
1285 pub unsafe fn moveToEndOfSentence(&self, sender: Option<&AnyObject>);
1286
1287 #[deprecated = "No longer supported; please adopt WKWebView."]
1288 #[unsafe(method(moveToEndOfSentenceAndModifySelection:))]
1289 #[unsafe(method_family = none)]
1290 pub unsafe fn moveToEndOfSentenceAndModifySelection(&self, sender: Option<&AnyObject>);
1291
1292 #[deprecated = "No longer supported; please adopt WKWebView."]
1293 #[unsafe(method(selectSentence:))]
1294 #[unsafe(method_family = none)]
1295 pub unsafe fn selectSentence(&self, sender: Option<&AnyObject>);
1296
1297 #[deprecated = "No longer supported; please adopt WKWebView."]
1298 #[unsafe(method(overWrite:))]
1299 #[unsafe(method_family = none)]
1300 pub unsafe fn overWrite(&self, sender: Option<&AnyObject>);
1301 );
1302}