objc2_web_kit/generated/WebBackForwardList.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 /// WebBackForwardList holds an ordered list of WebHistoryItems that comprises the back and
12 /// forward lists.
13 ///
14 /// Note that the methods which modify instances of this class do not cause
15 /// navigation to happen in other layers of the stack; they are only for maintaining this data
16 /// structure.
17 ///
18 /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/webbackforwardlist?language=objc)
19 #[unsafe(super(NSObject))]
20 #[derive(Debug, PartialEq, Eq, Hash)]
21 #[deprecated]
22 pub struct WebBackForwardList;
23);
24
25extern_conformance!(
26 unsafe impl NSObjectProtocol for WebBackForwardList {}
27);
28
29impl WebBackForwardList {
30 extern_methods!(
31 #[cfg(feature = "WebHistoryItem")]
32 /// Adds an entry to the list.
33 ///
34 /// Parameter `item`: The entry to add.
35 ///
36 /// The added entry is inserted immediately after the current entry.
37 /// If the current position in the list is not at the end of the list, elements in the
38 /// forward list will be dropped at this point. In addition, entries may be dropped to keep
39 /// the size of the list within the maximum size.
40 ///
41 /// # Safety
42 ///
43 /// `item` might not allow `None`.
44 #[deprecated]
45 #[unsafe(method(addItem:))]
46 #[unsafe(method_family = none)]
47 pub unsafe fn addItem(&self, item: Option<&WebHistoryItem>);
48
49 /// Move the current pointer back to the entry before the current entry.
50 #[deprecated]
51 #[unsafe(method(goBack))]
52 #[unsafe(method_family = none)]
53 pub unsafe fn goBack(&self);
54
55 /// Move the current pointer ahead to the entry after the current entry.
56 #[deprecated]
57 #[unsafe(method(goForward))]
58 #[unsafe(method_family = none)]
59 pub unsafe fn goForward(&self);
60
61 #[cfg(feature = "WebHistoryItem")]
62 /// Move the current pointer to the given entry.
63 ///
64 /// Parameter `item`: The history item to move the pointer to
65 ///
66 /// # Safety
67 ///
68 /// `item` might not allow `None`.
69 #[deprecated]
70 #[unsafe(method(goToItem:))]
71 #[unsafe(method_family = none)]
72 pub unsafe fn goToItem(&self, item: Option<&WebHistoryItem>);
73
74 #[cfg(feature = "WebHistoryItem")]
75 /// The entry right before the current entry, or nil if there isn't one.
76 #[deprecated]
77 #[unsafe(method(backItem))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn backItem(&self) -> Option<Retained<WebHistoryItem>>;
80
81 #[cfg(feature = "WebHistoryItem")]
82 /// Returns the current entry.
83 #[deprecated]
84 #[unsafe(method(currentItem))]
85 #[unsafe(method_family = none)]
86 pub unsafe fn currentItem(&self) -> Option<Retained<WebHistoryItem>>;
87
88 #[cfg(feature = "WebHistoryItem")]
89 /// The entry right after the current entry, or nil if there isn't one.
90 #[deprecated]
91 #[unsafe(method(forwardItem))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn forwardItem(&self) -> Option<Retained<WebHistoryItem>>;
94
95 /// Returns a portion of the list before the current entry.
96 ///
97 /// Parameter `limit`: A cap on the size of the array returned.
98 ///
99 /// Returns: An array of items before the current entry, or nil if there are none. The entries are in the order that they were originally visited.
100 #[deprecated]
101 #[unsafe(method(backListWithLimit:))]
102 #[unsafe(method_family = none)]
103 pub unsafe fn backListWithLimit(&self, limit: c_int) -> Option<Retained<NSArray>>;
104
105 /// Returns a portion of the list after the current entry.
106 ///
107 /// Parameter `limit`: A cap on the size of the array returned.
108 ///
109 /// Returns: An array of items after the current entry, or nil if there are none. The entries are in the order that they were originally visited.
110 #[deprecated]
111 #[unsafe(method(forwardListWithLimit:))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn forwardListWithLimit(&self, limit: c_int) -> Option<Retained<NSArray>>;
114
115 /// The list's maximum size.
116 #[deprecated]
117 #[unsafe(method(capacity))]
118 #[unsafe(method_family = none)]
119 pub unsafe fn capacity(&self) -> c_int;
120
121 /// Setter for [`capacity`][Self::capacity].
122 #[deprecated]
123 #[unsafe(method(setCapacity:))]
124 #[unsafe(method_family = none)]
125 pub unsafe fn setCapacity(&self, capacity: c_int);
126
127 /// The number of items in the list.
128 #[deprecated]
129 #[unsafe(method(backListCount))]
130 #[unsafe(method_family = none)]
131 pub unsafe fn backListCount(&self) -> c_int;
132
133 /// Returns: The number of items in the list.
134 #[deprecated]
135 #[unsafe(method(forwardListCount))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn forwardListCount(&self) -> c_int;
138
139 #[cfg(feature = "WebHistoryItem")]
140 /// Parameter `item`: The item that will be checked for presence in the WebBackForwardList.
141 ///
142 /// Returns: Returns YES if the item is in the list.
143 ///
144 /// # Safety
145 ///
146 /// `item` might not allow `None`.
147 #[deprecated]
148 #[unsafe(method(containsItem:))]
149 #[unsafe(method_family = none)]
150 pub unsafe fn containsItem(&self, item: Option<&WebHistoryItem>) -> bool;
151
152 #[cfg(feature = "WebHistoryItem")]
153 /// Returns an entry the given distance from the current entry.
154 ///
155 /// Parameter `index`: Index of the desired list item relative to the current item; 0 is current item, -1 is back item, 1 is forward item, etc.
156 ///
157 /// Returns: The entry the given distance from the current entry. If index exceeds the limits of the list, nil is returned.
158 #[deprecated]
159 #[unsafe(method(itemAtIndex:))]
160 #[unsafe(method_family = none)]
161 pub unsafe fn itemAtIndex(&self, index: c_int) -> Option<Retained<WebHistoryItem>>;
162 );
163}
164
165/// Methods declared on superclass `NSObject`.
166impl WebBackForwardList {
167 extern_methods!(
168 #[unsafe(method(init))]
169 #[unsafe(method_family = init)]
170 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
171
172 #[unsafe(method(new))]
173 #[unsafe(method_family = new)]
174 pub unsafe fn new() -> Retained<Self>;
175 );
176}
177
178/// WebBackForwardListDeprecated.
179#[deprecated]
180impl WebBackForwardList {
181 extern_methods!(
182 /// The size passed to this method determines whether the WebView
183 /// associated with this WebBackForwardList will use the shared page cache.
184 ///
185 /// Parameter `size`: If size is 0, the WebView associated with this WebBackForwardList
186 /// will not use the shared page cache. Otherwise, it will.
187 #[deprecated]
188 #[unsafe(method(setPageCacheSize:))]
189 #[unsafe(method_family = none)]
190 pub unsafe fn setPageCacheSize(&self, size: NSUInteger);
191
192 /// Returns the size of the shared page cache, or 0.
193 ///
194 /// Returns: The size of the shared page cache (in pages), or 0 if the WebView
195 /// associated with this WebBackForwardList will not use the shared page cache.
196 #[deprecated]
197 #[unsafe(method(pageCacheSize))]
198 #[unsafe(method_family = none)]
199 pub unsafe fn pageCacheSize(&self) -> NSUInteger;
200 );
201}