use crate::common::*;
use crate::AppKit::*;
use crate::CoreData::*;
use crate::Foundation::*;
extern_protocol!(
pub struct NSTokenFieldDelegate;
unsafe impl ProtocolType for NSTokenFieldDelegate {
#[optional]
#[method_id(@__retain_semantics Other tokenField:completionsForSubstring:indexOfToken:indexOfSelectedItem:)]
pub unsafe fn tokenField_completionsForSubstring_indexOfToken_indexOfSelectedItem(
&self,
tokenField: &NSTokenField,
substring: &NSString,
tokenIndex: NSInteger,
selectedIndex: *mut NSInteger,
) -> Option<Id<NSArray, Shared>>;
#[optional]
#[method_id(@__retain_semantics Other tokenField:shouldAddObjects:atIndex:)]
pub unsafe fn tokenField_shouldAddObjects_atIndex(
&self,
tokenField: &NSTokenField,
tokens: &NSArray,
index: NSUInteger,
) -> Id<NSArray, Shared>;
#[optional]
#[method_id(@__retain_semantics Other tokenField:displayStringForRepresentedObject:)]
pub unsafe fn tokenField_displayStringForRepresentedObject(
&self,
tokenField: &NSTokenField,
representedObject: &Object,
) -> Option<Id<NSString, Shared>>;
#[optional]
#[method_id(@__retain_semantics Other tokenField:editingStringForRepresentedObject:)]
pub unsafe fn tokenField_editingStringForRepresentedObject(
&self,
tokenField: &NSTokenField,
representedObject: &Object,
) -> Option<Id<NSString, Shared>>;
#[optional]
#[method_id(@__retain_semantics Other tokenField:representedObjectForEditingString:)]
pub unsafe fn tokenField_representedObjectForEditingString(
&self,
tokenField: &NSTokenField,
editingString: &NSString,
) -> Option<Id<Object, Shared>>;
#[optional]
#[method(tokenField:writeRepresentedObjects:toPasteboard:)]
pub unsafe fn tokenField_writeRepresentedObjects_toPasteboard(
&self,
tokenField: &NSTokenField,
objects: &NSArray,
pboard: &NSPasteboard,
) -> bool;
#[optional]
#[method_id(@__retain_semantics Other tokenField:readFromPasteboard:)]
pub unsafe fn tokenField_readFromPasteboard(
&self,
tokenField: &NSTokenField,
pboard: &NSPasteboard,
) -> Option<Id<NSArray, Shared>>;
#[optional]
#[method_id(@__retain_semantics Other tokenField:menuForRepresentedObject:)]
pub unsafe fn tokenField_menuForRepresentedObject(
&self,
tokenField: &NSTokenField,
representedObject: &Object,
) -> Option<Id<NSMenu, Shared>>;
#[optional]
#[method(tokenField:hasMenuForRepresentedObject:)]
pub unsafe fn tokenField_hasMenuForRepresentedObject(
&self,
tokenField: &NSTokenField,
representedObject: &Object,
) -> bool;
#[optional]
#[method(tokenField:styleForRepresentedObject:)]
pub unsafe fn tokenField_styleForRepresentedObject(
&self,
tokenField: &NSTokenField,
representedObject: &Object,
) -> NSTokenStyle;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSTokenField;
unsafe impl ClassType for NSTokenField {
#[inherits(NSControl, NSView, NSResponder, NSObject)]
type Super = NSTextField;
}
);
extern_methods!(
unsafe impl NSTokenField {
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(&self) -> Option<Id<NSTokenFieldDelegate, Shared>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(&self, delegate: Option<&NSTokenFieldDelegate>);
#[method(tokenStyle)]
pub unsafe fn tokenStyle(&self) -> NSTokenStyle;
#[method(setTokenStyle:)]
pub unsafe fn setTokenStyle(&self, tokenStyle: NSTokenStyle);
#[method(completionDelay)]
pub unsafe fn completionDelay(&self) -> NSTimeInterval;
#[method(setCompletionDelay:)]
pub unsafe fn setCompletionDelay(&self, completionDelay: NSTimeInterval);
#[method(defaultCompletionDelay)]
pub unsafe fn defaultCompletionDelay() -> NSTimeInterval;
#[method_id(@__retain_semantics Other tokenizingCharacterSet)]
pub unsafe fn tokenizingCharacterSet(&self) -> Id<NSCharacterSet, Shared>;
#[method(setTokenizingCharacterSet:)]
pub unsafe fn setTokenizingCharacterSet(
&self,
tokenizingCharacterSet: Option<&NSCharacterSet>,
);
#[method_id(@__retain_semantics Other defaultTokenizingCharacterSet)]
pub unsafe fn defaultTokenizingCharacterSet() -> Id<NSCharacterSet, Shared>;
}
);
extern_methods!(
unsafe impl NSTokenField {
#[method_id(@__retain_semantics Other labelWithString:)]
pub unsafe fn labelWithString(stringValue: &NSString) -> Id<Self, Shared>;
#[method_id(@__retain_semantics Other wrappingLabelWithString:)]
pub unsafe fn wrappingLabelWithString(stringValue: &NSString) -> Id<Self, Shared>;
#[method_id(@__retain_semantics Other labelWithAttributedString:)]
pub unsafe fn labelWithAttributedString(
attributedStringValue: &NSAttributedString,
) -> Id<Self, Shared>;
#[method_id(@__retain_semantics Other textFieldWithString:)]
pub unsafe fn textFieldWithString(stringValue: &NSString) -> Id<Self, Shared>;
}
);
extern_methods!(
unsafe impl NSTokenField {
#[method_id(@__retain_semantics Init initWithFrame:)]
pub unsafe fn initWithFrame(
this: Option<Allocated<Self>>,
frameRect: NSRect,
) -> Id<Self, Shared>;
}
);