objc2_web_kit/generated/
WebHistoryItem.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use 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    /// [Apple's documentation](https://developer.apple.com/documentation/webkit/webhistoryitemchangednotification?language=objc)
15    #[deprecated]
16    pub static WebHistoryItemChangedNotification: Option<&'static NSString>;
17}
18
19extern_class!(
20    /// WebHistoryItems are created by WebKit to represent pages visited.
21    /// The WebBackForwardList and WebHistory classes both use WebHistoryItems to represent
22    /// pages visited.  With the exception of the displayTitle, the properties of
23    /// WebHistoryItems are set by WebKit.  WebHistoryItems are normally never created directly.
24    ///
25    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/webhistoryitem?language=objc)
26    #[unsafe(super(NSObject))]
27    #[derive(Debug, PartialEq, Eq, Hash)]
28    #[deprecated]
29    pub struct WebHistoryItem;
30);
31
32extern_conformance!(
33    unsafe impl NSCopying for WebHistoryItem {}
34);
35
36unsafe impl CopyingHelper for WebHistoryItem {
37    type Result = Self;
38}
39
40extern_conformance!(
41    unsafe impl NSObjectProtocol for WebHistoryItem {}
42);
43
44impl WebHistoryItem {
45    extern_methods!(
46        /// Parameter `URLString`: The URL string for the item.
47        ///
48        /// Parameter `title`: The title to use for the item.  This is normally the
49        /// <title
50        /// > of a page.
51        ///
52        /// Parameter `time`: The time used to indicate when the item was used.
53        ///
54        /// Initialize a new WebHistoryItem
55        ///
56        /// WebHistoryItems are normally created for you by the WebKit.
57        /// You may use this method to prepopulate a WebBackForwardList, or create
58        /// 'artificial' items to add to a WebBackForwardList.  When first initialized
59        /// the URLString and originalURLString will be the same.
60        ///
61        /// # Safety
62        ///
63        /// - `url_string` might not allow `None`.
64        /// - `title` might not allow `None`.
65        #[deprecated]
66        #[unsafe(method(initWithURLString:title:lastVisitedTimeInterval:))]
67        #[unsafe(method_family = init)]
68        pub unsafe fn initWithURLString_title_lastVisitedTimeInterval(
69            this: Allocated<Self>,
70            url_string: Option<&NSString>,
71            title: Option<&NSString>,
72            time: NSTimeInterval,
73        ) -> Option<Retained<Self>>;
74
75        /// The string representation of the initial URL of this item.
76        /// This value is normally set by the WebKit.
77        #[deprecated]
78        #[unsafe(method(originalURLString))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn originalURLString(&self) -> Retained<NSString>;
81
82        /// The string representation of the URL represented by this item.
83        ///
84        /// The URLString may be different than the originalURLString if the page
85        /// redirected to a new location.  This value is normally set by the WebKit.
86        #[deprecated]
87        #[unsafe(method(URLString))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn URLString(&self) -> Retained<NSString>;
90
91        /// The title of the page represented by this item.
92        ///
93        /// This title cannot be changed by the client.  This value
94        /// is normally set by the WebKit when a page title for the item is received.
95        #[deprecated]
96        #[unsafe(method(title))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn title(&self) -> Retained<NSString>;
99
100        /// The last time the page represented by this item was visited. The interval
101        /// is since the reference date as determined by NSDate.  This value is normally set by
102        /// the WebKit.
103        #[deprecated]
104        #[unsafe(method(lastVisitedTimeInterval))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn lastVisitedTimeInterval(&self) -> NSTimeInterval;
107
108        #[deprecated]
109        #[unsafe(method(alternateTitle))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn alternateTitle(&self) -> Retained<NSString>;
112
113        /// Setter for [`alternateTitle`][Self::alternateTitle].
114        ///
115        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
116        #[deprecated]
117        #[unsafe(method(setAlternateTitle:))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn setAlternateTitle(&self, alternate_title: Option<&NSString>);
120
121        #[cfg(feature = "objc2-app-kit")]
122        #[cfg(target_os = "macos")]
123        /// The favorite icon of the page represented by this item.
124        ///
125        /// This icon returned will be determined by the WebKit.
126        #[deprecated]
127        #[unsafe(method(icon))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn icon(&self) -> Option<Retained<NSImage>>;
130    );
131}
132
133/// Methods declared on superclass `NSObject`.
134impl WebHistoryItem {
135    extern_methods!(
136        #[unsafe(method(init))]
137        #[unsafe(method_family = init)]
138        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
139
140        #[unsafe(method(new))]
141        #[unsafe(method_family = new)]
142        pub unsafe fn new() -> Retained<Self>;
143    );
144}