use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
use objc2_foundation::*;
use crate::*;
#[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!(
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct WKNavigationAction;
);
unsafe impl NSObjectProtocol for WKNavigationAction {}
impl WKNavigationAction {
extern_methods!(
#[cfg(feature = "WKFrameInfo")]
#[unsafe(method(targetFrame))]
#[unsafe(method_family = none)]
pub unsafe fn targetFrame(&self) -> Option<Retained<WKFrameInfo>>;
#[unsafe(method(navigationType))]
#[unsafe(method_family = none)]
pub unsafe fn navigationType(&self) -> WKNavigationType;
#[unsafe(method(request))]
#[unsafe(method_family = none)]
pub unsafe fn request(&self) -> Retained<NSURLRequest>;
#[unsafe(method(shouldPerformDownload))]
#[unsafe(method_family = none)]
pub unsafe fn shouldPerformDownload(&self) -> bool;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
#[unsafe(method(modifierFlags))]
#[unsafe(method_family = none)]
pub unsafe fn modifierFlags(&self) -> NSEventModifierFlags;
#[unsafe(method(buttonNumber))]
#[unsafe(method_family = none)]
pub unsafe fn buttonNumber(&self) -> NSInteger;
);
}
impl WKNavigationAction {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}