use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
pub type NSSearchFieldRecentsAutosaveName = NSString;
extern_protocol!(
#[cfg(all(feature = "NSControl", feature = "NSTextField"))]
pub unsafe trait NSSearchFieldDelegate: NSTextFieldDelegate + MainThreadOnly {
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[optional]
#[unsafe(method(searchFieldDidStartSearching:))]
#[unsafe(method_family = none)]
fn searchFieldDidStartSearching(&self, sender: &NSSearchField);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[optional]
#[unsafe(method(searchFieldDidEndSearching:))]
#[unsafe(method_family = none)]
fn searchFieldDidEndSearching(&self, sender: &NSSearchField);
}
);
extern_class!(
#[unsafe(super(NSTextField, NSControl, NSView, NSResponder, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
pub struct NSSearchField;
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAccessibility for NSSearchField {}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAccessibilityElementProtocol for NSSearchField {}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAccessibilityNavigableStaticText for NSSearchField {}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAccessibilityStaticText for NSSearchField {}
);
#[cfg(all(
feature = "NSAnimation",
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAnimatablePropertyContainer for NSSearchField {}
);
#[cfg(all(
feature = "NSAppearance",
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAppearanceCustomization for NSSearchField {}
);
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSCoding for NSSearchField {}
);
#[cfg(all(
feature = "NSControl",
feature = "NSDragging",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSDraggingDestination for NSSearchField {}
);
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSObjectProtocol for NSSearchField {}
);
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextContent",
feature = "NSTextField",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSTextContent for NSSearchField {}
);
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSUserInterfaceItemIdentification",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSUserInterfaceItemIdentification for NSSearchField {}
);
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSUserInterfaceValidation",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSUserInterfaceValidations for NSSearchField {}
);
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
impl NSSearchField {
extern_methods!(
#[unsafe(method(searchTextBounds))]
#[unsafe(method_family = none)]
pub fn searchTextBounds(&self) -> NSRect;
#[unsafe(method(searchButtonBounds))]
#[unsafe(method_family = none)]
pub fn searchButtonBounds(&self) -> NSRect;
#[unsafe(method(cancelButtonBounds))]
#[unsafe(method_family = none)]
pub fn cancelButtonBounds(&self) -> NSRect;
#[unsafe(method(recentSearches))]
#[unsafe(method_family = none)]
pub fn recentSearches(&self) -> Retained<NSArray<NSString>>;
#[unsafe(method(setRecentSearches:))]
#[unsafe(method_family = none)]
pub fn setRecentSearches(&self, recent_searches: &NSArray<NSString>);
#[unsafe(method(recentsAutosaveName))]
#[unsafe(method_family = none)]
pub fn recentsAutosaveName(&self) -> Option<Retained<NSSearchFieldRecentsAutosaveName>>;
#[unsafe(method(setRecentsAutosaveName:))]
#[unsafe(method_family = none)]
pub fn setRecentsAutosaveName(
&self,
recents_autosave_name: Option<&NSSearchFieldRecentsAutosaveName>,
);
#[cfg(feature = "NSMenu")]
#[unsafe(method(searchMenuTemplate))]
#[unsafe(method_family = none)]
pub fn searchMenuTemplate(&self) -> Option<Retained<NSMenu>>;
#[cfg(feature = "NSMenu")]
#[unsafe(method(setSearchMenuTemplate:))]
#[unsafe(method_family = none)]
pub fn setSearchMenuTemplate(&self, search_menu_template: Option<&NSMenu>);
#[unsafe(method(sendsWholeSearchString))]
#[unsafe(method_family = none)]
pub fn sendsWholeSearchString(&self) -> bool;
#[unsafe(method(setSendsWholeSearchString:))]
#[unsafe(method_family = none)]
pub fn setSendsWholeSearchString(&self, sends_whole_search_string: bool);
#[unsafe(method(maximumRecents))]
#[unsafe(method_family = none)]
pub fn maximumRecents(&self) -> NSInteger;
#[unsafe(method(setMaximumRecents:))]
#[unsafe(method_family = none)]
pub fn setMaximumRecents(&self, maximum_recents: NSInteger);
#[unsafe(method(sendsSearchStringImmediately))]
#[unsafe(method_family = none)]
pub fn sendsSearchStringImmediately(&self) -> bool;
#[unsafe(method(setSendsSearchStringImmediately:))]
#[unsafe(method_family = none)]
pub fn setSendsSearchStringImmediately(&self, sends_search_string_immediately: bool);
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSSearchFieldDelegate>>>;
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn NSSearchFieldDelegate>>,
);
);
}
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
impl NSSearchField {
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 = "NSTextField",
feature = "NSView"
))]
impl NSSearchField {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
impl NSSearchField {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
impl NSSearchField {
extern_methods!(
#[deprecated]
#[unsafe(method(rectForSearchTextWhenCentered:))]
#[unsafe(method_family = none)]
pub fn rectForSearchTextWhenCentered(&self, is_centered: bool) -> NSRect;
#[deprecated]
#[unsafe(method(rectForSearchButtonWhenCentered:))]
#[unsafe(method_family = none)]
pub fn rectForSearchButtonWhenCentered(&self, is_centered: bool) -> NSRect;
#[deprecated]
#[unsafe(method(rectForCancelButtonWhenCentered:))]
#[unsafe(method_family = none)]
pub fn rectForCancelButtonWhenCentered(&self, is_centered: bool) -> NSRect;
#[deprecated = "The placeholder centering UI design is no longer available. Setting this property is no-op."]
#[unsafe(method(centersPlaceholder))]
#[unsafe(method_family = none)]
pub fn centersPlaceholder(&self) -> bool;
#[deprecated = "The placeholder centering UI design is no longer available. Setting this property is no-op."]
#[unsafe(method(setCentersPlaceholder:))]
#[unsafe(method_family = none)]
pub fn setCentersPlaceholder(&self, centers_placeholder: bool);
);
}