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 NSTokenStyle(pub NSUInteger);
impl NSTokenStyle {
#[doc(alias = "NSTokenStyleDefault")]
pub const Default: Self = Self(0);
#[doc(alias = "NSTokenStyleNone")]
pub const None: Self = Self(1);
#[doc(alias = "NSTokenStyleRounded")]
pub const Rounded: Self = Self(2);
#[doc(alias = "NSTokenStyleSquared")]
pub const Squared: Self = Self(3);
#[doc(alias = "NSTokenStylePlainSquared")]
pub const PlainSquared: Self = Self(4);
}
unsafe impl Encode for NSTokenStyle {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSTokenStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSTextFieldCell, NSActionCell, NSCell, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
pub struct NSTokenFieldCell;
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
extern_conformance!(
unsafe impl NSAccessibility for NSTokenFieldCell {}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
extern_conformance!(
unsafe impl NSAccessibilityElementProtocol for NSTokenFieldCell {}
);
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
extern_conformance!(
unsafe impl NSCoding for NSTokenFieldCell {}
);
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
extern_conformance!(
unsafe impl NSCopying for NSTokenFieldCell {}
);
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
unsafe impl CopyingHelper for NSTokenFieldCell {
type Result = Self;
}
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
extern_conformance!(
unsafe impl NSObjectProtocol for NSTokenFieldCell {}
);
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell",
feature = "NSUserInterfaceItemIdentification"
))]
extern_conformance!(
unsafe impl NSUserInterfaceItemIdentification for NSTokenFieldCell {}
);
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
impl NSTokenFieldCell {
extern_methods!(
#[unsafe(method(tokenStyle))]
#[unsafe(method_family = none)]
pub fn tokenStyle(&self) -> NSTokenStyle;
#[unsafe(method(setTokenStyle:))]
#[unsafe(method_family = none)]
pub fn setTokenStyle(&self, token_style: NSTokenStyle);
#[unsafe(method(completionDelay))]
#[unsafe(method_family = none)]
pub fn completionDelay(&self) -> NSTimeInterval;
#[unsafe(method(setCompletionDelay:))]
#[unsafe(method_family = none)]
pub fn setCompletionDelay(&self, completion_delay: NSTimeInterval);
#[unsafe(method(defaultCompletionDelay))]
#[unsafe(method_family = none)]
pub fn defaultCompletionDelay(mtm: MainThreadMarker) -> NSTimeInterval;
#[unsafe(method(tokenizingCharacterSet))]
#[unsafe(method_family = none)]
pub fn tokenizingCharacterSet(&self) -> Retained<NSCharacterSet>;
#[unsafe(method(setTokenizingCharacterSet:))]
#[unsafe(method_family = none)]
pub fn setTokenizingCharacterSet(&self, tokenizing_character_set: Option<&NSCharacterSet>);
#[unsafe(method(defaultTokenizingCharacterSet))]
#[unsafe(method_family = none)]
pub fn defaultTokenizingCharacterSet(mtm: MainThreadMarker) -> Retained<NSCharacterSet>;
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSTokenFieldCellDelegate>>>;
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSTokenFieldCellDelegate>>);
);
}
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
impl NSTokenFieldCell {
extern_methods!(
#[unsafe(method(initTextCell:))]
#[unsafe(method_family = init)]
pub fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
#[cfg(feature = "NSImage")]
#[unsafe(method(initImageCell:))]
#[unsafe(method_family = init)]
pub unsafe fn initImageCell(
this: Allocated<Self>,
image: Option<&NSImage>,
) -> Retained<Self>;
);
}
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
impl NSTokenFieldCell {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
impl NSTokenFieldCell {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern_protocol!(
pub unsafe trait NSTokenFieldCellDelegate: NSObjectProtocol + MainThreadOnly {
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
#[optional]
#[unsafe(method(tokenFieldCell:completionsForSubstring:indexOfToken:indexOfSelectedItem:))]
#[unsafe(method_family = none)]
unsafe fn tokenFieldCell_completionsForSubstring_indexOfToken_indexOfSelectedItem(
&self,
token_field_cell: &NSTokenFieldCell,
substring: &NSString,
token_index: NSInteger,
selected_index: NonNull<NSInteger>,
) -> Retained<NSArray>;
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
#[optional]
#[unsafe(method(tokenFieldCell:shouldAddObjects:atIndex:))]
#[unsafe(method_family = none)]
unsafe fn tokenFieldCell_shouldAddObjects_atIndex(
&self,
token_field_cell: &NSTokenFieldCell,
tokens: &NSArray,
index: NSUInteger,
) -> Retained<NSArray>;
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
#[optional]
#[unsafe(method(tokenFieldCell:displayStringForRepresentedObject:))]
#[unsafe(method_family = none)]
unsafe fn tokenFieldCell_displayStringForRepresentedObject(
&self,
token_field_cell: &NSTokenFieldCell,
represented_object: &AnyObject,
) -> Option<Retained<NSString>>;
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
#[optional]
#[unsafe(method(tokenFieldCell:editingStringForRepresentedObject:))]
#[unsafe(method_family = none)]
unsafe fn tokenFieldCell_editingStringForRepresentedObject(
&self,
token_field_cell: &NSTokenFieldCell,
represented_object: &AnyObject,
) -> Option<Retained<NSString>>;
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
#[optional]
#[unsafe(method(tokenFieldCell:representedObjectForEditingString:))]
#[unsafe(method_family = none)]
fn tokenFieldCell_representedObjectForEditingString(
&self,
token_field_cell: &NSTokenFieldCell,
editing_string: &NSString,
) -> Option<Retained<AnyObject>>;
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSPasteboard",
feature = "NSTextFieldCell"
))]
#[optional]
#[unsafe(method(tokenFieldCell:writeRepresentedObjects:toPasteboard:))]
#[unsafe(method_family = none)]
unsafe fn tokenFieldCell_writeRepresentedObjects_toPasteboard(
&self,
token_field_cell: &NSTokenFieldCell,
objects: &NSArray,
pboard: &NSPasteboard,
) -> bool;
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSPasteboard",
feature = "NSTextFieldCell"
))]
#[optional]
#[unsafe(method(tokenFieldCell:readFromPasteboard:))]
#[unsafe(method_family = none)]
fn tokenFieldCell_readFromPasteboard(
&self,
token_field_cell: &NSTokenFieldCell,
pboard: &NSPasteboard,
) -> Option<Retained<NSArray>>;
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSMenu",
feature = "NSTextFieldCell"
))]
#[optional]
#[unsafe(method(tokenFieldCell:menuForRepresentedObject:))]
#[unsafe(method_family = none)]
unsafe fn tokenFieldCell_menuForRepresentedObject(
&self,
token_field_cell: &NSTokenFieldCell,
represented_object: &AnyObject,
) -> Option<Retained<NSMenu>>;
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
#[optional]
#[unsafe(method(tokenFieldCell:hasMenuForRepresentedObject:))]
#[unsafe(method_family = none)]
unsafe fn tokenFieldCell_hasMenuForRepresentedObject(
&self,
token_field_cell: &NSTokenFieldCell,
represented_object: &AnyObject,
) -> bool;
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
#[optional]
#[unsafe(method(tokenFieldCell:styleForRepresentedObject:))]
#[unsafe(method_family = none)]
unsafe fn tokenFieldCell_styleForRepresentedObject(
&self,
token_field_cell: &NSTokenFieldCell,
represented_object: &AnyObject,
) -> NSTokenStyle;
}
);
#[deprecated]
pub static NSDefaultTokenStyle: NSTokenStyle = NSTokenStyle(NSTokenStyle::Default.0);
#[deprecated]
pub static NSPlainTextTokenStyle: NSTokenStyle = NSTokenStyle(NSTokenStyle::None.0);
#[deprecated]
pub static NSRoundedTokenStyle: NSTokenStyle = NSTokenStyle(NSTokenStyle::Rounded.0);