1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
use objc2_foundation::*;

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct WKNavigationType(pub NSInteger);
impl WKNavigationType {
    #[doc(alias = "WKNavigationTypeLinkActivated")]
    pub const LinkActivated: Self = Self(0);
    #[doc(alias = "WKNavigationTypeFormSubmitted")]
    pub const FormSubmitted: Self = Self(1);
    #[doc(alias = "WKNavigationTypeBackForward")]
    pub const BackForward: Self = Self(2);
    #[doc(alias = "WKNavigationTypeReload")]
    pub const Reload: Self = Self(3);
    #[doc(alias = "WKNavigationTypeFormResubmitted")]
    pub const FormResubmitted: Self = Self(4);
    #[doc(alias = "WKNavigationTypeOther")]
    pub const Other: Self = Self(-1);
}

unsafe impl Encode for WKNavigationType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for WKNavigationType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct WKNavigationAction;

    unsafe impl ClassType for WKNavigationAction {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSObjectProtocol for WKNavigationAction {}

extern_methods!(
    unsafe impl WKNavigationAction {
        #[cfg(feature = "WKFrameInfo")]
        #[method_id(@__retain_semantics Other targetFrame)]
        pub unsafe fn targetFrame(&self) -> Option<Retained<WKFrameInfo>>;

        #[method(navigationType)]
        pub unsafe fn navigationType(&self) -> WKNavigationType;

        #[method_id(@__retain_semantics Other request)]
        pub unsafe fn request(&self) -> Retained<NSURLRequest>;

        #[method(shouldPerformDownload)]
        pub unsafe fn shouldPerformDownload(&self) -> bool;

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        #[method(modifierFlags)]
        pub unsafe fn modifierFlags(&self) -> NSEventModifierFlags;

        #[method(buttonNumber)]
        pub unsafe fn buttonNumber(&self) -> NSInteger;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl WKNavigationAction {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);