1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
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!(
/// `NSSearchToolbarItem` provides the standard UI behavior for integrating a search field into the toolbar.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nssearchtoolbaritem?language=objc)
#[unsafe(super(NSToolbarItem, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSToolbarItem")]
pub struct NSSearchToolbarItem;
);
#[cfg(feature = "NSToolbarItem")]
extern_conformance!(
unsafe impl NSCopying for NSSearchToolbarItem {}
);
#[cfg(feature = "NSToolbarItem")]
unsafe impl CopyingHelper for NSSearchToolbarItem {
type Result = Self;
}
#[cfg(feature = "NSToolbarItem")]
extern_conformance!(
unsafe impl NSObjectProtocol for NSSearchToolbarItem {}
);
#[cfg(feature = "NSToolbarItem")]
impl NSSearchToolbarItem {
extern_methods!(
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSSearchField",
feature = "NSTextField",
feature = "NSView"
))]
/// An `NSSearchField` displayed in the toolbar item.
/// While inside the toolbar item, the field properties and layout constraints are managed by the item.
/// The field should be configured before assigned.
/// The width constraint for the field could be updated after assigned.
/// When set to nil, will reset to a search field with the default configuration.
#[unsafe(method(searchField))]
#[unsafe(method_family = none)]
pub fn searchField(&self) -> Retained<NSSearchField>;
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSSearchField",
feature = "NSTextField",
feature = "NSView"
))]
/// Setter for [`searchField`][Self::searchField].
#[unsafe(method(setSearchField:))]
#[unsafe(method_family = none)]
pub fn setSearchField(&self, search_field: &NSSearchField);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
/// The base view property is owned by the toolbar item and not available for customization.
#[unsafe(method(view))]
#[unsafe(method_family = none)]
pub unsafe fn view(&self) -> Option<Retained<NSView>>;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
/// Setter for [`view`][Self::view].
#[unsafe(method(setView:))]
#[unsafe(method_family = none)]
pub unsafe fn setView(&self, view: Option<&NSView>);
/// When YES, the cancel button in the field resigns the first responder status of the search field as clearing the contents.
/// The default is YES.
#[unsafe(method(resignsFirstResponderWithCancel))]
#[unsafe(method_family = none)]
pub fn resignsFirstResponderWithCancel(&self) -> bool;
/// Setter for [`resignsFirstResponderWithCancel`][Self::resignsFirstResponderWithCancel].
#[unsafe(method(setResignsFirstResponderWithCancel:))]
#[unsafe(method_family = none)]
pub fn setResignsFirstResponderWithCancel(&self, resigns_first_responder_with_cancel: bool);
#[cfg(feature = "objc2-core-foundation")]
/// The preferred width for the search field.
/// This value is used to configure the search field width whenever it gets the keyboard focus.
/// If specifying custom width constraints to the search field, they should not conflict with this value.
#[unsafe(method(preferredWidthForSearchField))]
#[unsafe(method_family = none)]
pub fn preferredWidthForSearchField(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
/// Setter for [`preferredWidthForSearchField`][Self::preferredWidthForSearchField].
#[unsafe(method(setPreferredWidthForSearchField:))]
#[unsafe(method_family = none)]
pub fn setPreferredWidthForSearchField(&self, preferred_width_for_search_field: CGFloat);
/// Starts a search interaction.
/// If necessary, expands to the preferred width and moves the keyboard focus to the search field.
#[unsafe(method(beginSearchInteraction))]
#[unsafe(method_family = none)]
pub fn beginSearchInteraction(&self);
/// Ends a search interaction.
/// Gives up the first responder by calling `-endEditing:` to the search field.
/// Adjusts to the natural available width for the toolbar item if necessary.
#[unsafe(method(endSearchInteraction))]
#[unsafe(method_family = none)]
pub fn endSearchInteraction(&self);
);
}
/// Methods declared on superclass `NSToolbarItem`.
#[cfg(feature = "NSToolbarItem")]
impl NSSearchToolbarItem {
extern_methods!(
#[cfg(feature = "NSToolbar")]
/// Initialize the toolbar item with an identifier which is a development language string used by the toolbar and its delegate for identification purposes.
#[unsafe(method(initWithItemIdentifier:))]
#[unsafe(method_family = init)]
pub fn initWithItemIdentifier(
this: Allocated<Self>,
item_identifier: &NSToolbarItemIdentifier,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
#[cfg(feature = "NSToolbarItem")]
impl NSSearchToolbarItem {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}