use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[unsafe(super(NSControl, NSView, NSResponder, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
pub struct NSTextField;
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAccessibility for NSTextField {}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAccessibilityElementProtocol for NSTextField {}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAccessibilityNavigableStaticText for NSTextField {}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAccessibilityStaticText for NSTextField {}
);
#[cfg(all(
feature = "NSAnimation",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAnimatablePropertyContainer for NSTextField {}
);
#[cfg(all(
feature = "NSAppearance",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAppearanceCustomization for NSTextField {}
);
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
unsafe impl NSCoding for NSTextField {}
);
#[cfg(all(
feature = "NSControl",
feature = "NSDragging",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSDraggingDestination for NSTextField {}
);
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
unsafe impl NSObjectProtocol for NSTextField {}
);
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextContent",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSTextContent for NSTextField {}
);
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSUserInterfaceItemIdentification",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSUserInterfaceItemIdentification for NSTextField {}
);
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSUserInterfaceValidation",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSUserInterfaceValidations for NSTextField {}
);
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSTextField {
extern_methods!(
#[unsafe(method(placeholderString))]
#[unsafe(method_family = none)]
pub fn placeholderString(&self) -> Option<Retained<NSString>>;
#[unsafe(method(setPlaceholderString:))]
#[unsafe(method_family = none)]
pub fn setPlaceholderString(&self, placeholder_string: Option<&NSString>);
#[unsafe(method(placeholderAttributedString))]
#[unsafe(method_family = none)]
pub fn placeholderAttributedString(&self) -> Option<Retained<NSAttributedString>>;
#[unsafe(method(setPlaceholderAttributedString:))]
#[unsafe(method_family = none)]
pub fn setPlaceholderAttributedString(
&self,
placeholder_attributed_string: Option<&NSAttributedString>,
);
#[cfg(feature = "NSColor")]
#[unsafe(method(backgroundColor))]
#[unsafe(method_family = none)]
pub fn backgroundColor(&self) -> Option<Retained<NSColor>>;
#[cfg(feature = "NSColor")]
#[unsafe(method(setBackgroundColor:))]
#[unsafe(method_family = none)]
pub fn setBackgroundColor(&self, background_color: Option<&NSColor>);
#[unsafe(method(drawsBackground))]
#[unsafe(method_family = none)]
pub fn drawsBackground(&self) -> bool;
#[unsafe(method(setDrawsBackground:))]
#[unsafe(method_family = none)]
pub fn setDrawsBackground(&self, draws_background: bool);
#[cfg(feature = "NSColor")]
#[unsafe(method(textColor))]
#[unsafe(method_family = none)]
pub fn textColor(&self) -> Option<Retained<NSColor>>;
#[cfg(feature = "NSColor")]
#[unsafe(method(setTextColor:))]
#[unsafe(method_family = none)]
pub fn setTextColor(&self, text_color: Option<&NSColor>);
#[unsafe(method(isBordered))]
#[unsafe(method_family = none)]
pub fn isBordered(&self) -> bool;
#[unsafe(method(setBordered:))]
#[unsafe(method_family = none)]
pub fn setBordered(&self, bordered: bool);
#[unsafe(method(isBezeled))]
#[unsafe(method_family = none)]
pub fn isBezeled(&self) -> bool;
#[unsafe(method(setBezeled:))]
#[unsafe(method_family = none)]
pub fn setBezeled(&self, bezeled: bool);
#[unsafe(method(isEditable))]
#[unsafe(method_family = none)]
pub fn isEditable(&self) -> bool;
#[unsafe(method(setEditable:))]
#[unsafe(method_family = none)]
pub fn setEditable(&self, editable: bool);
#[unsafe(method(isSelectable))]
#[unsafe(method_family = none)]
pub fn isSelectable(&self) -> bool;
#[unsafe(method(setSelectable:))]
#[unsafe(method_family = none)]
pub fn setSelectable(&self, selectable: bool);
#[unsafe(method(selectText:))]
#[unsafe(method_family = none)]
pub unsafe fn selectText(&self, sender: Option<&AnyObject>);
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSTextFieldDelegate>>>;
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn NSTextFieldDelegate>>,
);
#[cfg(feature = "NSText")]
#[unsafe(method(textShouldBeginEditing:))]
#[unsafe(method_family = none)]
pub fn textShouldBeginEditing(&self, text_object: &NSText) -> bool;
#[cfg(feature = "NSText")]
#[unsafe(method(textShouldEndEditing:))]
#[unsafe(method_family = none)]
pub fn textShouldEndEditing(&self, text_object: &NSText) -> bool;
#[unsafe(method(textDidBeginEditing:))]
#[unsafe(method_family = none)]
pub fn textDidBeginEditing(&self, notification: &NSNotification);
#[unsafe(method(textDidEndEditing:))]
#[unsafe(method_family = none)]
pub fn textDidEndEditing(&self, notification: &NSNotification);
#[unsafe(method(textDidChange:))]
#[unsafe(method_family = none)]
pub fn textDidChange(&self, notification: &NSNotification);
#[unsafe(method(acceptsFirstResponder))]
#[unsafe(method_family = none)]
pub fn acceptsFirstResponder(&self) -> bool;
#[cfg(feature = "NSTextFieldCell")]
#[unsafe(method(bezelStyle))]
#[unsafe(method_family = none)]
pub fn bezelStyle(&self) -> NSTextFieldBezelStyle;
#[cfg(feature = "NSTextFieldCell")]
#[unsafe(method(setBezelStyle:))]
#[unsafe(method_family = none)]
pub fn setBezelStyle(&self, bezel_style: NSTextFieldBezelStyle);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(preferredMaxLayoutWidth))]
#[unsafe(method_family = none)]
pub fn preferredMaxLayoutWidth(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setPreferredMaxLayoutWidth:))]
#[unsafe(method_family = none)]
pub fn setPreferredMaxLayoutWidth(&self, preferred_max_layout_width: CGFloat);
#[unsafe(method(maximumNumberOfLines))]
#[unsafe(method_family = none)]
pub fn maximumNumberOfLines(&self) -> NSInteger;
#[unsafe(method(setMaximumNumberOfLines:))]
#[unsafe(method_family = none)]
pub fn setMaximumNumberOfLines(&self, maximum_number_of_lines: NSInteger);
#[unsafe(method(allowsDefaultTighteningForTruncation))]
#[unsafe(method_family = none)]
pub fn allowsDefaultTighteningForTruncation(&self) -> bool;
#[unsafe(method(setAllowsDefaultTighteningForTruncation:))]
#[unsafe(method_family = none)]
pub fn setAllowsDefaultTighteningForTruncation(
&self,
allows_default_tightening_for_truncation: bool,
);
#[cfg(feature = "NSParagraphStyle")]
#[unsafe(method(lineBreakStrategy))]
#[unsafe(method_family = none)]
pub fn lineBreakStrategy(&self) -> NSLineBreakStrategy;
#[cfg(feature = "NSParagraphStyle")]
#[unsafe(method(setLineBreakStrategy:))]
#[unsafe(method_family = none)]
pub fn setLineBreakStrategy(&self, line_break_strategy: NSLineBreakStrategy);
#[unsafe(method(allowsWritingTools))]
#[unsafe(method_family = none)]
pub fn allowsWritingTools(&self) -> bool;
#[unsafe(method(setAllowsWritingTools:))]
#[unsafe(method_family = none)]
pub fn setAllowsWritingTools(&self, allows_writing_tools: bool);
#[unsafe(method(allowsWritingToolsAffordance))]
#[unsafe(method_family = none)]
pub fn allowsWritingToolsAffordance(&self) -> bool;
#[unsafe(method(setAllowsWritingToolsAffordance:))]
#[unsafe(method_family = none)]
pub fn setAllowsWritingToolsAffordance(&self, allows_writing_tools_affordance: bool);
#[unsafe(method(placeholderStrings))]
#[unsafe(method_family = none)]
pub fn placeholderStrings(&self) -> Retained<NSArray<NSString>>;
#[unsafe(method(setPlaceholderStrings:))]
#[unsafe(method_family = none)]
pub fn setPlaceholderStrings(&self, placeholder_strings: &NSArray<NSString>);
#[unsafe(method(placeholderAttributedStrings))]
#[unsafe(method_family = none)]
pub fn placeholderAttributedStrings(&self) -> Retained<NSArray<NSAttributedString>>;
#[unsafe(method(setPlaceholderAttributedStrings:))]
#[unsafe(method_family = none)]
pub fn setPlaceholderAttributedStrings(
&self,
placeholder_attributed_strings: &NSArray<NSAttributedString>,
);
#[unsafe(method(resolvesNaturalAlignmentWithBaseWritingDirection))]
#[unsafe(method_family = none)]
pub fn resolvesNaturalAlignmentWithBaseWritingDirection(&self) -> bool;
#[unsafe(method(setResolvesNaturalAlignmentWithBaseWritingDirection:))]
#[unsafe(method_family = none)]
pub fn setResolvesNaturalAlignmentWithBaseWritingDirection(
&self,
resolves_natural_alignment_with_base_writing_direction: bool,
);
);
}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSTextField {
extern_methods!(
#[unsafe(method(initWithFrame:))]
#[unsafe(method_family = init)]
pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
);
}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSTextField {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSTextField {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSTextField {
extern_methods!(
#[unsafe(method(isAutomaticTextCompletionEnabled))]
#[unsafe(method_family = none)]
pub fn isAutomaticTextCompletionEnabled(&self) -> bool;
#[unsafe(method(setAutomaticTextCompletionEnabled:))]
#[unsafe(method_family = none)]
pub fn setAutomaticTextCompletionEnabled(&self, automatic_text_completion_enabled: bool);
#[unsafe(method(allowsCharacterPickerTouchBarItem))]
#[unsafe(method_family = none)]
pub fn allowsCharacterPickerTouchBarItem(&self) -> bool;
#[unsafe(method(setAllowsCharacterPickerTouchBarItem:))]
#[unsafe(method_family = none)]
pub fn setAllowsCharacterPickerTouchBarItem(
&self,
allows_character_picker_touch_bar_item: bool,
);
);
}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSTextField {
extern_methods!(
#[unsafe(method(labelWithString:))]
#[unsafe(method_family = none)]
pub fn labelWithString(string_value: &NSString, mtm: MainThreadMarker) -> Retained<Self>;
#[unsafe(method(wrappingLabelWithString:))]
#[unsafe(method_family = none)]
pub fn wrappingLabelWithString(
string_value: &NSString,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[unsafe(method(labelWithAttributedString:))]
#[unsafe(method_family = none)]
pub fn labelWithAttributedString(
attributed_string_value: &NSAttributedString,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[unsafe(method(textFieldWithString:))]
#[unsafe(method_family = none)]
pub fn textFieldWithString(
string_value: &NSString,
mtm: MainThreadMarker,
) -> Retained<Self>;
);
}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSTextField {
extern_methods!(
#[unsafe(method(allowsEditingTextAttributes))]
#[unsafe(method_family = none)]
pub fn allowsEditingTextAttributes(&self) -> bool;
#[unsafe(method(setAllowsEditingTextAttributes:))]
#[unsafe(method_family = none)]
pub fn setAllowsEditingTextAttributes(&self, allows_editing_text_attributes: bool);
#[unsafe(method(importsGraphics))]
#[unsafe(method_family = none)]
pub fn importsGraphics(&self) -> bool;
#[unsafe(method(setImportsGraphics:))]
#[unsafe(method_family = none)]
pub fn setImportsGraphics(&self, imports_graphics: bool);
);
}
extern_protocol!(
#[cfg(feature = "NSControl")]
pub unsafe trait NSTextFieldDelegate:
NSControlTextEditingDelegate + MainThreadOnly
{
#[cfg(all(
feature = "NSResponder",
feature = "NSText",
feature = "NSTextView",
feature = "NSView"
))]
#[optional]
#[unsafe(method(textField:textView:candidatesForSelectedRange:))]
#[unsafe(method_family = none)]
fn textField_textView_candidatesForSelectedRange(
&self,
text_field: &NSTextField,
text_view: &NSTextView,
selected_range: NSRange,
) -> Option<Retained<NSArray>>;
#[cfg(all(
feature = "NSResponder",
feature = "NSText",
feature = "NSTextView",
feature = "NSView"
))]
#[optional]
#[unsafe(method(textField:textView:candidates:forSelectedRange:))]
#[unsafe(method_family = none)]
fn textField_textView_candidates_forSelectedRange(
&self,
text_field: &NSTextField,
text_view: &NSTextView,
candidates: &NSArray<NSTextCheckingResult>,
selected_range: NSRange,
) -> Retained<NSArray<NSTextCheckingResult>>;
#[cfg(all(
feature = "NSResponder",
feature = "NSText",
feature = "NSTextView",
feature = "NSView"
))]
#[optional]
#[unsafe(method(textField:textView:shouldSelectCandidateAtIndex:))]
#[unsafe(method_family = none)]
fn textField_textView_shouldSelectCandidateAtIndex(
&self,
text_field: &NSTextField,
text_view: &NSTextView,
index: NSUInteger,
) -> bool;
}
);
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSTextField {
extern_methods!(
#[deprecated = "Use `-setTitle:` instead"]
#[unsafe(method(setTitleWithMnemonic:))]
#[unsafe(method_family = none)]
pub unsafe fn setTitleWithMnemonic(&self, string_with_ampersand: Option<&NSString>);
);
}