use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UISwipeGestureRecognizerDirection(pub NSUInteger);
bitflags::bitflags! {
impl UISwipeGestureRecognizerDirection: NSUInteger {
#[doc(alias = "UISwipeGestureRecognizerDirectionRight")]
const Right = 1<<0;
#[doc(alias = "UISwipeGestureRecognizerDirectionLeft")]
const Left = 1<<1;
#[doc(alias = "UISwipeGestureRecognizerDirectionUp")]
const Up = 1<<2;
#[doc(alias = "UISwipeGestureRecognizerDirectionDown")]
const Down = 1<<3;
}
}
unsafe impl Encode for UISwipeGestureRecognizerDirection {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for UISwipeGestureRecognizerDirection {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(UIGestureRecognizer, NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "UIGestureRecognizer")]
pub struct UISwipeGestureRecognizer;
);
#[cfg(feature = "UIGestureRecognizer")]
extern_conformance!(
unsafe impl NSObjectProtocol for UISwipeGestureRecognizer {}
);
#[cfg(feature = "UIGestureRecognizer")]
impl UISwipeGestureRecognizer {
extern_methods!(
#[unsafe(method(numberOfTouchesRequired))]
#[unsafe(method_family = none)]
pub fn numberOfTouchesRequired(&self) -> NSUInteger;
#[unsafe(method(setNumberOfTouchesRequired:))]
#[unsafe(method_family = none)]
pub fn setNumberOfTouchesRequired(&self, number_of_touches_required: NSUInteger);
#[unsafe(method(direction))]
#[unsafe(method_family = none)]
pub fn direction(&self) -> UISwipeGestureRecognizerDirection;
#[unsafe(method(setDirection:))]
#[unsafe(method_family = none)]
pub fn setDirection(&self, direction: UISwipeGestureRecognizerDirection);
);
}
#[cfg(feature = "UIGestureRecognizer")]
impl UISwipeGestureRecognizer {
extern_methods!(
#[unsafe(method(initWithTarget:action:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithTarget_action(
this: Allocated<Self>,
target: Option<&AnyObject>,
action: Option<Sel>,
) -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
);
}
#[cfg(feature = "UIGestureRecognizer")]
impl UISwipeGestureRecognizer {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}