objc2_web_kit/generated/
DOMElement.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
10/// [Apple's documentation](https://developer.apple.com/documentation/webkit/dom_allow_keyboard_input?language=objc)
11#[deprecated]
12pub const DOM_ALLOW_KEYBOARD_INPUT: c_uint = 1;
13
14extern_class!(
15    /// [Apple's documentation](https://developer.apple.com/documentation/webkit/domelement?language=objc)
16    #[unsafe(super(DOMNode, DOMObject, WebScriptObject, NSObject))]
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    #[cfg(all(
19        feature = "DOMNode",
20        feature = "DOMObject",
21        feature = "WebScriptObject"
22    ))]
23    #[deprecated]
24    pub struct DOMElement;
25);
26
27#[cfg(all(
28    feature = "DOMEventTarget",
29    feature = "DOMNode",
30    feature = "DOMObject",
31    feature = "WebScriptObject"
32))]
33extern_conformance!(
34    unsafe impl DOMEventTarget for DOMElement {}
35);
36
37#[cfg(all(
38    feature = "DOMNode",
39    feature = "DOMObject",
40    feature = "WebScriptObject"
41))]
42extern_conformance!(
43    unsafe impl NSCopying for DOMElement {}
44);
45
46#[cfg(all(
47    feature = "DOMNode",
48    feature = "DOMObject",
49    feature = "WebScriptObject"
50))]
51unsafe impl CopyingHelper for DOMElement {
52    type Result = Self;
53}
54
55#[cfg(all(
56    feature = "DOMNode",
57    feature = "DOMObject",
58    feature = "WebScriptObject"
59))]
60extern_conformance!(
61    unsafe impl NSObjectProtocol for DOMElement {}
62);
63
64#[cfg(all(
65    feature = "DOMNode",
66    feature = "DOMObject",
67    feature = "WebScriptObject"
68))]
69impl DOMElement {
70    extern_methods!(
71        #[deprecated]
72        #[unsafe(method(tagName))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn tagName(&self) -> Retained<NSString>;
75
76        #[cfg(feature = "DOMCSSStyleDeclaration")]
77        #[deprecated]
78        #[unsafe(method(style))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn style(&self) -> Option<Retained<DOMCSSStyleDeclaration>>;
81
82        #[deprecated]
83        #[unsafe(method(offsetLeft))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn offsetLeft(&self) -> c_int;
86
87        #[deprecated]
88        #[unsafe(method(offsetTop))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn offsetTop(&self) -> c_int;
91
92        #[deprecated]
93        #[unsafe(method(offsetWidth))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn offsetWidth(&self) -> c_int;
96
97        #[deprecated]
98        #[unsafe(method(offsetHeight))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn offsetHeight(&self) -> c_int;
101
102        #[unsafe(method(clientLeft))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn clientLeft(&self) -> c_int;
105
106        #[unsafe(method(clientTop))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn clientTop(&self) -> c_int;
109
110        #[deprecated]
111        #[unsafe(method(clientWidth))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn clientWidth(&self) -> c_int;
114
115        #[deprecated]
116        #[unsafe(method(clientHeight))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn clientHeight(&self) -> c_int;
119
120        #[deprecated]
121        #[unsafe(method(scrollLeft))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn scrollLeft(&self) -> c_int;
124
125        /// Setter for [`scrollLeft`][Self::scrollLeft].
126        #[deprecated]
127        #[unsafe(method(setScrollLeft:))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn setScrollLeft(&self, scroll_left: c_int);
130
131        #[deprecated]
132        #[unsafe(method(scrollTop))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn scrollTop(&self) -> c_int;
135
136        /// Setter for [`scrollTop`][Self::scrollTop].
137        #[deprecated]
138        #[unsafe(method(setScrollTop:))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn setScrollTop(&self, scroll_top: c_int);
141
142        #[deprecated]
143        #[unsafe(method(scrollWidth))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn scrollWidth(&self) -> c_int;
146
147        #[deprecated]
148        #[unsafe(method(scrollHeight))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn scrollHeight(&self) -> c_int;
151
152        #[deprecated]
153        #[unsafe(method(offsetParent))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn offsetParent(&self) -> Option<Retained<DOMElement>>;
156
157        #[deprecated]
158        #[unsafe(method(innerHTML))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn innerHTML(&self) -> Retained<NSString>;
161
162        /// Setter for [`innerHTML`][Self::innerHTML].
163        ///
164        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
165        #[deprecated]
166        #[unsafe(method(setInnerHTML:))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn setInnerHTML(&self, inner_html: Option<&NSString>);
169
170        #[deprecated]
171        #[unsafe(method(outerHTML))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn outerHTML(&self) -> Retained<NSString>;
174
175        /// Setter for [`outerHTML`][Self::outerHTML].
176        ///
177        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
178        #[deprecated]
179        #[unsafe(method(setOuterHTML:))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn setOuterHTML(&self, outer_html: Option<&NSString>);
182
183        #[deprecated]
184        #[unsafe(method(className))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn className(&self) -> Retained<NSString>;
187
188        /// Setter for [`className`][Self::className].
189        ///
190        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
191        #[deprecated]
192        #[unsafe(method(setClassName:))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn setClassName(&self, class_name: Option<&NSString>);
195
196        #[unsafe(method(innerText))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn innerText(&self) -> Retained<NSString>;
199
200        #[unsafe(method(previousElementSibling))]
201        #[unsafe(method_family = none)]
202        pub unsafe fn previousElementSibling(&self) -> Option<Retained<DOMElement>>;
203
204        #[unsafe(method(nextElementSibling))]
205        #[unsafe(method_family = none)]
206        pub unsafe fn nextElementSibling(&self) -> Option<Retained<DOMElement>>;
207
208        #[unsafe(method(firstElementChild))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn firstElementChild(&self) -> Option<Retained<DOMElement>>;
211
212        #[unsafe(method(lastElementChild))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn lastElementChild(&self) -> Option<Retained<DOMElement>>;
215
216        #[unsafe(method(childElementCount))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn childElementCount(&self) -> c_uint;
219
220        /// # Safety
221        ///
222        /// `name` might not allow `None`.
223        #[deprecated]
224        #[unsafe(method(getAttribute:))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn getAttribute(&self, name: Option<&NSString>) -> Option<Retained<NSString>>;
227
228        /// # Safety
229        ///
230        /// - `name` might not allow `None`.
231        /// - `value` might not allow `None`.
232        #[unsafe(method(setAttribute:value:))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn setAttribute_value(&self, name: Option<&NSString>, value: Option<&NSString>);
235
236        /// # Safety
237        ///
238        /// `name` might not allow `None`.
239        #[deprecated]
240        #[unsafe(method(removeAttribute:))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn removeAttribute(&self, name: Option<&NSString>);
243
244        #[cfg(feature = "DOMAttr")]
245        /// # Safety
246        ///
247        /// `name` might not allow `None`.
248        #[deprecated]
249        #[unsafe(method(getAttributeNode:))]
250        #[unsafe(method_family = none)]
251        pub unsafe fn getAttributeNode(&self, name: Option<&NSString>)
252            -> Option<Retained<DOMAttr>>;
253
254        #[cfg(feature = "DOMAttr")]
255        /// # Safety
256        ///
257        /// `new_attr` might not allow `None`.
258        #[deprecated]
259        #[unsafe(method(setAttributeNode:))]
260        #[unsafe(method_family = none)]
261        pub unsafe fn setAttributeNode(
262            &self,
263            new_attr: Option<&DOMAttr>,
264        ) -> Option<Retained<DOMAttr>>;
265
266        #[cfg(feature = "DOMAttr")]
267        /// # Safety
268        ///
269        /// `old_attr` might not allow `None`.
270        #[deprecated]
271        #[unsafe(method(removeAttributeNode:))]
272        #[unsafe(method_family = none)]
273        pub unsafe fn removeAttributeNode(
274            &self,
275            old_attr: Option<&DOMAttr>,
276        ) -> Option<Retained<DOMAttr>>;
277
278        #[cfg(feature = "DOMNodeList")]
279        /// # Safety
280        ///
281        /// `name` might not allow `None`.
282        #[deprecated]
283        #[unsafe(method(getElementsByTagName:))]
284        #[unsafe(method_family = none)]
285        pub unsafe fn getElementsByTagName(
286            &self,
287            name: Option<&NSString>,
288        ) -> Option<Retained<DOMNodeList>>;
289
290        /// # Safety
291        ///
292        /// - `namespace_uri` might not allow `None`.
293        /// - `local_name` might not allow `None`.
294        #[unsafe(method(getAttributeNS:localName:))]
295        #[unsafe(method_family = none)]
296        pub unsafe fn getAttributeNS_localName(
297            &self,
298            namespace_uri: Option<&NSString>,
299            local_name: Option<&NSString>,
300        ) -> Option<Retained<NSString>>;
301
302        /// # Safety
303        ///
304        /// - `namespace_uri` might not allow `None`.
305        /// - `qualified_name` might not allow `None`.
306        /// - `value` might not allow `None`.
307        #[unsafe(method(setAttributeNS:qualifiedName:value:))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn setAttributeNS_qualifiedName_value(
310            &self,
311            namespace_uri: Option<&NSString>,
312            qualified_name: Option<&NSString>,
313            value: Option<&NSString>,
314        );
315
316        /// # Safety
317        ///
318        /// - `namespace_uri` might not allow `None`.
319        /// - `local_name` might not allow `None`.
320        #[unsafe(method(removeAttributeNS:localName:))]
321        #[unsafe(method_family = none)]
322        pub unsafe fn removeAttributeNS_localName(
323            &self,
324            namespace_uri: Option<&NSString>,
325            local_name: Option<&NSString>,
326        );
327
328        #[cfg(feature = "DOMNodeList")]
329        /// # Safety
330        ///
331        /// - `namespace_uri` might not allow `None`.
332        /// - `local_name` might not allow `None`.
333        #[unsafe(method(getElementsByTagNameNS:localName:))]
334        #[unsafe(method_family = none)]
335        pub unsafe fn getElementsByTagNameNS_localName(
336            &self,
337            namespace_uri: Option<&NSString>,
338            local_name: Option<&NSString>,
339        ) -> Option<Retained<DOMNodeList>>;
340
341        #[cfg(feature = "DOMAttr")]
342        /// # Safety
343        ///
344        /// - `namespace_uri` might not allow `None`.
345        /// - `local_name` might not allow `None`.
346        #[unsafe(method(getAttributeNodeNS:localName:))]
347        #[unsafe(method_family = none)]
348        pub unsafe fn getAttributeNodeNS_localName(
349            &self,
350            namespace_uri: Option<&NSString>,
351            local_name: Option<&NSString>,
352        ) -> Option<Retained<DOMAttr>>;
353
354        #[cfg(feature = "DOMAttr")]
355        /// # Safety
356        ///
357        /// `new_attr` might not allow `None`.
358        #[deprecated]
359        #[unsafe(method(setAttributeNodeNS:))]
360        #[unsafe(method_family = none)]
361        pub unsafe fn setAttributeNodeNS(
362            &self,
363            new_attr: Option<&DOMAttr>,
364        ) -> Option<Retained<DOMAttr>>;
365
366        /// # Safety
367        ///
368        /// `name` might not allow `None`.
369        #[deprecated]
370        #[unsafe(method(hasAttribute:))]
371        #[unsafe(method_family = none)]
372        pub unsafe fn hasAttribute(&self, name: Option<&NSString>) -> bool;
373
374        /// # Safety
375        ///
376        /// - `namespace_uri` might not allow `None`.
377        /// - `local_name` might not allow `None`.
378        #[unsafe(method(hasAttributeNS:localName:))]
379        #[unsafe(method_family = none)]
380        pub unsafe fn hasAttributeNS_localName(
381            &self,
382            namespace_uri: Option<&NSString>,
383            local_name: Option<&NSString>,
384        ) -> bool;
385
386        #[unsafe(method(focus))]
387        #[unsafe(method_family = none)]
388        pub unsafe fn focus(&self);
389
390        #[unsafe(method(blur))]
391        #[unsafe(method_family = none)]
392        pub unsafe fn blur(&self);
393
394        #[unsafe(method(scrollIntoView:))]
395        #[unsafe(method_family = none)]
396        pub unsafe fn scrollIntoView(&self, align_with_top: bool);
397
398        #[unsafe(method(scrollIntoViewIfNeeded:))]
399        #[unsafe(method_family = none)]
400        pub unsafe fn scrollIntoViewIfNeeded(&self, center_if_needed: bool);
401
402        #[cfg(feature = "DOMNodeList")]
403        /// # Safety
404        ///
405        /// `name` might not allow `None`.
406        #[unsafe(method(getElementsByClassName:))]
407        #[unsafe(method_family = none)]
408        pub unsafe fn getElementsByClassName(
409            &self,
410            name: Option<&NSString>,
411        ) -> Option<Retained<DOMNodeList>>;
412
413        #[unsafe(method(webkitRequestFullScreen:))]
414        #[unsafe(method_family = none)]
415        pub unsafe fn webkitRequestFullScreen(&self, flags: c_ushort);
416
417        /// # Safety
418        ///
419        /// `selectors` might not allow `None`.
420        #[unsafe(method(querySelector:))]
421        #[unsafe(method_family = none)]
422        pub unsafe fn querySelector(
423            &self,
424            selectors: Option<&NSString>,
425        ) -> Option<Retained<DOMElement>>;
426
427        #[cfg(feature = "DOMNodeList")]
428        /// # Safety
429        ///
430        /// `selectors` might not allow `None`.
431        #[unsafe(method(querySelectorAll:))]
432        #[unsafe(method_family = none)]
433        pub unsafe fn querySelectorAll(
434            &self,
435            selectors: Option<&NSString>,
436        ) -> Option<Retained<DOMNodeList>>;
437    );
438}
439
440/// Methods declared on superclass `DOMObject`.
441#[cfg(all(
442    feature = "DOMNode",
443    feature = "DOMObject",
444    feature = "WebScriptObject"
445))]
446impl DOMElement {
447    extern_methods!(
448        #[deprecated]
449        #[unsafe(method(init))]
450        #[unsafe(method_family = init)]
451        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
452    );
453}
454
455/// Methods declared on superclass `NSObject`.
456#[cfg(all(
457    feature = "DOMNode",
458    feature = "DOMObject",
459    feature = "WebScriptObject"
460))]
461impl DOMElement {
462    extern_methods!(
463        #[unsafe(method(new))]
464        #[unsafe(method_family = new)]
465        pub unsafe fn new() -> Retained<Self>;
466    );
467}
468
469/// DOMElementDeprecated.
470#[deprecated]
471#[cfg(all(
472    feature = "DOMNode",
473    feature = "DOMObject",
474    feature = "WebScriptObject"
475))]
476impl DOMElement {
477    extern_methods!(
478        /// # Safety
479        ///
480        /// - `name` might not allow `None`.
481        /// - `value` might not allow `None`.
482        #[deprecated]
483        #[unsafe(method(setAttribute::))]
484        #[unsafe(method_family = none)]
485        pub unsafe fn setAttribute(&self, name: Option<&NSString>, value: Option<&NSString>);
486
487        /// # Safety
488        ///
489        /// - `namespace_uri` might not allow `None`.
490        /// - `local_name` might not allow `None`.
491        #[deprecated]
492        #[unsafe(method(getAttributeNS::))]
493        #[unsafe(method_family = none)]
494        pub unsafe fn getAttributeNS(
495            &self,
496            namespace_uri: Option<&NSString>,
497            local_name: Option<&NSString>,
498        ) -> Option<Retained<NSString>>;
499
500        /// # Safety
501        ///
502        /// - `namespace_uri` might not allow `None`.
503        /// - `qualified_name` might not allow `None`.
504        /// - `value` might not allow `None`.
505        #[deprecated]
506        #[unsafe(method(setAttributeNS:::))]
507        #[unsafe(method_family = none)]
508        pub unsafe fn setAttributeNS(
509            &self,
510            namespace_uri: Option<&NSString>,
511            qualified_name: Option<&NSString>,
512            value: Option<&NSString>,
513        );
514
515        /// # Safety
516        ///
517        /// - `namespace_uri` might not allow `None`.
518        /// - `local_name` might not allow `None`.
519        #[deprecated]
520        #[unsafe(method(removeAttributeNS::))]
521        #[unsafe(method_family = none)]
522        pub unsafe fn removeAttributeNS(
523            &self,
524            namespace_uri: Option<&NSString>,
525            local_name: Option<&NSString>,
526        );
527
528        #[cfg(feature = "DOMNodeList")]
529        /// # Safety
530        ///
531        /// - `namespace_uri` might not allow `None`.
532        /// - `local_name` might not allow `None`.
533        #[deprecated]
534        #[unsafe(method(getElementsByTagNameNS::))]
535        #[unsafe(method_family = none)]
536        pub unsafe fn getElementsByTagNameNS(
537            &self,
538            namespace_uri: Option<&NSString>,
539            local_name: Option<&NSString>,
540        ) -> Option<Retained<DOMNodeList>>;
541
542        #[cfg(feature = "DOMAttr")]
543        /// # Safety
544        ///
545        /// - `namespace_uri` might not allow `None`.
546        /// - `local_name` might not allow `None`.
547        #[deprecated]
548        #[unsafe(method(getAttributeNodeNS::))]
549        #[unsafe(method_family = none)]
550        pub unsafe fn getAttributeNodeNS(
551            &self,
552            namespace_uri: Option<&NSString>,
553            local_name: Option<&NSString>,
554        ) -> Option<Retained<DOMAttr>>;
555
556        /// # Safety
557        ///
558        /// - `namespace_uri` might not allow `None`.
559        /// - `local_name` might not allow `None`.
560        #[deprecated]
561        #[unsafe(method(hasAttributeNS::))]
562        #[unsafe(method_family = none)]
563        pub unsafe fn hasAttributeNS(
564            &self,
565            namespace_uri: Option<&NSString>,
566            local_name: Option<&NSString>,
567        ) -> bool;
568
569        #[deprecated]
570        #[unsafe(method(scrollByLines:))]
571        #[unsafe(method_family = none)]
572        pub unsafe fn scrollByLines(&self, lines: c_int);
573
574        #[deprecated]
575        #[unsafe(method(scrollByPages:))]
576        #[unsafe(method_family = none)]
577        pub unsafe fn scrollByPages(&self, pages: c_int);
578    );
579}