use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UITextDragOptions(pub NSInteger);
bitflags::bitflags! {
impl UITextDragOptions: NSInteger {
#[doc(alias = "UITextDragOptionsNone")]
const None = 0;
const UITextDragOptionStripTextColorFromPreviews = 1<<0;
}
}
unsafe impl Encode for UITextDragOptions {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UITextDragOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
#[cfg(all(feature = "UITextInput", feature = "UITextInputTraits"))]
pub unsafe trait UITextDraggable: UITextInput + IsMainThreadOnly {
#[method_id(@__retain_semantics Other textDragDelegate)]
unsafe fn textDragDelegate(
&self,
) -> Option<Retained<ProtocolObject<dyn UITextDragDelegate>>>;
#[method(setTextDragDelegate:)]
unsafe fn setTextDragDelegate(
&self,
text_drag_delegate: Option<&ProtocolObject<dyn UITextDragDelegate>>,
);
#[cfg(feature = "UIDragInteraction")]
#[method_id(@__retain_semantics Other textDragInteraction)]
unsafe fn textDragInteraction(&self) -> Option<Retained<UIDragInteraction>>;
#[method(isTextDragActive)]
unsafe fn isTextDragActive(&self) -> bool;
#[method(textDragOptions)]
unsafe fn textDragOptions(&self) -> UITextDragOptions;
#[method(setTextDragOptions:)]
unsafe fn setTextDragOptions(&self, text_drag_options: UITextDragOptions);
}
#[cfg(all(feature = "UITextInput", feature = "UITextInputTraits"))]
unsafe impl ProtocolType for dyn UITextDraggable {}
);
extern_protocol!(
pub unsafe trait UITextDragDelegate: NSObjectProtocol + IsMainThreadOnly {
#[cfg(all(
feature = "UIDragItem",
feature = "UIResponder",
feature = "UITextInput",
feature = "UITextInputTraits",
feature = "UIView"
))]
#[optional]
#[method_id(@__retain_semantics Other textDraggableView:itemsForDrag:)]
unsafe fn textDraggableView_itemsForDrag(
&self,
text_draggable_view: &UIView,
drag_request: &ProtocolObject<dyn UITextDragRequest>,
) -> Retained<NSArray<UIDragItem>>;
#[cfg(all(
feature = "UIDragItem",
feature = "UIDragSession",
feature = "UIResponder",
feature = "UITargetedDragPreview",
feature = "UITargetedPreview",
feature = "UITextInput",
feature = "UITextInputTraits",
feature = "UIView"
))]
#[optional]
#[method_id(@__retain_semantics Other textDraggableView:dragPreviewForLiftingItem:session:)]
unsafe fn textDraggableView_dragPreviewForLiftingItem_session(
&self,
text_draggable_view: &UIView,
item: &UIDragItem,
session: &ProtocolObject<dyn UIDragSession>,
) -> Option<Retained<UITargetedDragPreview>>;
#[cfg(all(
feature = "UIDragInteraction",
feature = "UIDragSession",
feature = "UIResponder",
feature = "UITextInput",
feature = "UITextInputTraits",
feature = "UIView"
))]
#[optional]
#[method(textDraggableView:willAnimateLiftWithAnimator:session:)]
unsafe fn textDraggableView_willAnimateLiftWithAnimator_session(
&self,
text_draggable_view: &UIView,
animator: &ProtocolObject<dyn UIDragAnimating>,
session: &ProtocolObject<dyn UIDragSession>,
);
#[cfg(all(
feature = "UIDragSession",
feature = "UIResponder",
feature = "UITextInput",
feature = "UITextInputTraits",
feature = "UIView"
))]
#[optional]
#[method(textDraggableView:dragSessionWillBegin:)]
unsafe fn textDraggableView_dragSessionWillBegin(
&self,
text_draggable_view: &UIView,
session: &ProtocolObject<dyn UIDragSession>,
);
#[cfg(all(
feature = "UIDragSession",
feature = "UIDropInteraction",
feature = "UIResponder",
feature = "UITextInput",
feature = "UITextInputTraits",
feature = "UIView"
))]
#[optional]
#[method(textDraggableView:dragSessionDidEnd:withOperation:)]
unsafe fn textDraggableView_dragSessionDidEnd_withOperation(
&self,
text_draggable_view: &UIView,
session: &ProtocolObject<dyn UIDragSession>,
operation: UIDropOperation,
);
}
unsafe impl ProtocolType for dyn UITextDragDelegate {}
);
extern_protocol!(
pub unsafe trait UITextDragRequest: NSObjectProtocol + IsMainThreadOnly {
#[cfg(feature = "UITextInput")]
#[method_id(@__retain_semantics Other dragRange)]
unsafe fn dragRange(&self) -> Retained<UITextRange>;
#[cfg(feature = "UIDragItem")]
#[method_id(@__retain_semantics Other suggestedItems)]
unsafe fn suggestedItems(&self) -> Retained<NSArray<UIDragItem>>;
#[cfg(feature = "UIDragItem")]
#[method_id(@__retain_semantics Other existingItems)]
unsafe fn existingItems(&self) -> Retained<NSArray<UIDragItem>>;
#[method(isSelected)]
unsafe fn isSelected(&self) -> bool;
#[cfg(feature = "UIDragSession")]
#[method_id(@__retain_semantics Other dragSession)]
unsafe fn dragSession(&self) -> Retained<ProtocolObject<dyn UIDragSession>>;
}
unsafe impl ProtocolType for dyn UITextDragRequest {}
);