objc2_ui_kit/generated/
UISearchBar.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12
13use crate::*;
14
15/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisearchbaricon?language=objc)
16// NS_ENUM
17#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct UISearchBarIcon(pub NSInteger);
20impl UISearchBarIcon {
21    #[doc(alias = "UISearchBarIconSearch")]
22    pub const Search: Self = Self(0);
23    #[doc(alias = "UISearchBarIconClear")]
24    pub const Clear: Self = Self(1);
25    #[doc(alias = "UISearchBarIconBookmark")]
26    pub const Bookmark: Self = Self(2);
27    #[doc(alias = "UISearchBarIconResultsList")]
28    pub const ResultsList: Self = Self(3);
29}
30
31unsafe impl Encode for UISearchBarIcon {
32    const ENCODING: Encoding = NSInteger::ENCODING;
33}
34
35unsafe impl RefEncode for UISearchBarIcon {
36    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
37}
38
39/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisearchbarstyle?language=objc)
40// NS_ENUM
41#[repr(transparent)]
42#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
43pub struct UISearchBarStyle(pub NSUInteger);
44impl UISearchBarStyle {
45    #[doc(alias = "UISearchBarStyleDefault")]
46    pub const Default: Self = Self(0);
47    #[doc(alias = "UISearchBarStyleProminent")]
48    pub const Prominent: Self = Self(1);
49    #[doc(alias = "UISearchBarStyleMinimal")]
50    pub const Minimal: Self = Self(2);
51}
52
53unsafe impl Encode for UISearchBarStyle {
54    const ENCODING: Encoding = NSUInteger::ENCODING;
55}
56
57unsafe impl RefEncode for UISearchBarStyle {
58    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
59}
60
61extern_protocol!(
62    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uilooktodictatecapable?language=objc)
63    pub unsafe trait UILookToDictateCapable: NSObjectProtocol {
64        /// Enable or disable 'Look To Dictate' on the receiver.
65        #[unsafe(method(isLookToDictateEnabled))]
66        #[unsafe(method_family = none)]
67        unsafe fn isLookToDictateEnabled(&self) -> bool;
68
69        /// Setter for [`isLookToDictateEnabled`][Self::isLookToDictateEnabled].
70        #[unsafe(method(setLookToDictateEnabled:))]
71        #[unsafe(method_family = none)]
72        unsafe fn setLookToDictateEnabled(&self, look_to_dictate_enabled: bool);
73    }
74);
75
76extern_class!(
77    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisearchbar?language=objc)
78    #[unsafe(super(UIView, UIResponder, NSObject))]
79    #[thread_kind = MainThreadOnly]
80    #[derive(Debug, PartialEq, Eq, Hash)]
81    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
82    pub struct UISearchBar;
83);
84
85#[cfg(all(
86    feature = "UIResponder",
87    feature = "UIView",
88    feature = "objc2-quartz-core"
89))]
90#[cfg(not(target_os = "watchos"))]
91extern_conformance!(
92    unsafe impl CALayerDelegate for UISearchBar {}
93);
94
95#[cfg(all(feature = "UIResponder", feature = "UIView"))]
96extern_conformance!(
97    unsafe impl NSCoding for UISearchBar {}
98);
99
100#[cfg(all(feature = "UIResponder", feature = "UIView"))]
101extern_conformance!(
102    unsafe impl NSObjectProtocol for UISearchBar {}
103);
104
105#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
106extern_conformance!(
107    unsafe impl UIAppearance for UISearchBar {}
108);
109
110#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
111extern_conformance!(
112    unsafe impl UIAppearanceContainer for UISearchBar {}
113);
114
115#[cfg(all(feature = "UIBarCommon", feature = "UIResponder", feature = "UIView"))]
116extern_conformance!(
117    unsafe impl UIBarPositioning for UISearchBar {}
118);
119
120#[cfg(all(feature = "UIResponder", feature = "UIView"))]
121extern_conformance!(
122    unsafe impl UICoordinateSpace for UISearchBar {}
123);
124
125#[cfg(all(
126    feature = "UIDynamicBehavior",
127    feature = "UIResponder",
128    feature = "UIView"
129))]
130extern_conformance!(
131    unsafe impl UIDynamicItem for UISearchBar {}
132);
133
134#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
135extern_conformance!(
136    unsafe impl UIFocusEnvironment for UISearchBar {}
137);
138
139#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
140extern_conformance!(
141    unsafe impl UIFocusItem for UISearchBar {}
142);
143
144#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
145extern_conformance!(
146    unsafe impl UIFocusItemContainer for UISearchBar {}
147);
148
149#[cfg(all(feature = "UIResponder", feature = "UIView"))]
150extern_conformance!(
151    unsafe impl UILookToDictateCapable for UISearchBar {}
152);
153
154#[cfg(all(feature = "UIResponder", feature = "UIView"))]
155extern_conformance!(
156    unsafe impl UIResponderStandardEditActions for UISearchBar {}
157);
158
159#[cfg(all(
160    feature = "UIResponder",
161    feature = "UITextInputTraits",
162    feature = "UIView"
163))]
164extern_conformance!(
165    unsafe impl UITextInputTraits for UISearchBar {}
166);
167
168#[cfg(all(
169    feature = "UIResponder",
170    feature = "UITraitCollection",
171    feature = "UIView"
172))]
173extern_conformance!(
174    unsafe impl UITraitEnvironment for UISearchBar {}
175);
176
177#[cfg(all(feature = "UIResponder", feature = "UIView"))]
178impl UISearchBar {
179    extern_methods!(
180        #[unsafe(method(init))]
181        #[unsafe(method_family = init)]
182        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
183
184        #[cfg(feature = "objc2-core-foundation")]
185        #[unsafe(method(initWithFrame:))]
186        #[unsafe(method_family = init)]
187        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
188
189        #[unsafe(method(initWithCoder:))]
190        #[unsafe(method_family = init)]
191        pub unsafe fn initWithCoder(
192            this: Allocated<Self>,
193            coder: &NSCoder,
194        ) -> Option<Retained<Self>>;
195
196        #[cfg(feature = "UIInterface")]
197        #[unsafe(method(barStyle))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn barStyle(&self) -> UIBarStyle;
200
201        #[cfg(feature = "UIInterface")]
202        /// Setter for [`barStyle`][Self::barStyle].
203        #[unsafe(method(setBarStyle:))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn setBarStyle(&self, bar_style: UIBarStyle);
206
207        #[cfg(feature = "UIBarCommon")]
208        #[unsafe(method(delegate))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UISearchBarDelegate>>>;
211
212        #[cfg(feature = "UIBarCommon")]
213        /// This is a [weak property][objc2::topics::weak_property].
214        /// Setter for [`delegate`][Self::delegate].
215        #[unsafe(method(setDelegate:))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn setDelegate(
218            &self,
219            delegate: Option<&ProtocolObject<dyn UISearchBarDelegate>>,
220        );
221
222        #[unsafe(method(text))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn text(&self) -> Option<Retained<NSString>>;
225
226        /// Setter for [`text`][Self::text].
227        #[unsafe(method(setText:))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn setText(&self, text: Option<&NSString>);
230
231        #[unsafe(method(prompt))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn prompt(&self) -> Option<Retained<NSString>>;
234
235        /// Setter for [`prompt`][Self::prompt].
236        #[unsafe(method(setPrompt:))]
237        #[unsafe(method_family = none)]
238        pub unsafe fn setPrompt(&self, prompt: Option<&NSString>);
239
240        #[unsafe(method(placeholder))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn placeholder(&self) -> Option<Retained<NSString>>;
243
244        /// Setter for [`placeholder`][Self::placeholder].
245        #[unsafe(method(setPlaceholder:))]
246        #[unsafe(method_family = none)]
247        pub unsafe fn setPlaceholder(&self, placeholder: Option<&NSString>);
248
249        #[unsafe(method(showsBookmarkButton))]
250        #[unsafe(method_family = none)]
251        pub unsafe fn showsBookmarkButton(&self) -> bool;
252
253        /// Setter for [`showsBookmarkButton`][Self::showsBookmarkButton].
254        #[unsafe(method(setShowsBookmarkButton:))]
255        #[unsafe(method_family = none)]
256        pub unsafe fn setShowsBookmarkButton(&self, shows_bookmark_button: bool);
257
258        #[cfg(all(
259            feature = "UIControl",
260            feature = "UISearchTextField",
261            feature = "UITextField"
262        ))]
263        #[unsafe(method(searchTextField))]
264        #[unsafe(method_family = none)]
265        pub unsafe fn searchTextField(&self) -> Retained<UISearchTextField>;
266
267        #[unsafe(method(showsCancelButton))]
268        #[unsafe(method_family = none)]
269        pub unsafe fn showsCancelButton(&self) -> bool;
270
271        /// Setter for [`showsCancelButton`][Self::showsCancelButton].
272        #[unsafe(method(setShowsCancelButton:))]
273        #[unsafe(method_family = none)]
274        pub unsafe fn setShowsCancelButton(&self, shows_cancel_button: bool);
275
276        #[unsafe(method(showsSearchResultsButton))]
277        #[unsafe(method_family = none)]
278        pub unsafe fn showsSearchResultsButton(&self) -> bool;
279
280        /// Setter for [`showsSearchResultsButton`][Self::showsSearchResultsButton].
281        #[unsafe(method(setShowsSearchResultsButton:))]
282        #[unsafe(method_family = none)]
283        pub unsafe fn setShowsSearchResultsButton(&self, shows_search_results_button: bool);
284
285        #[unsafe(method(isSearchResultsButtonSelected))]
286        #[unsafe(method_family = none)]
287        pub unsafe fn isSearchResultsButtonSelected(&self) -> bool;
288
289        /// Setter for [`isSearchResultsButtonSelected`][Self::isSearchResultsButtonSelected].
290        #[unsafe(method(setSearchResultsButtonSelected:))]
291        #[unsafe(method_family = none)]
292        pub unsafe fn setSearchResultsButtonSelected(&self, search_results_button_selected: bool);
293
294        #[unsafe(method(setShowsCancelButton:animated:))]
295        #[unsafe(method_family = none)]
296        pub unsafe fn setShowsCancelButton_animated(
297            &self,
298            shows_cancel_button: bool,
299            animated: bool,
300        );
301
302        #[cfg(feature = "UITextInput")]
303        /// Use this method to modify the contents of the Unified Content Bar, shown on top of the keyboard when search is engaged.
304        /// You may modify the returned inputAssistantItem to add to or replace the existing items on the bar.
305        /// Modifications made to the returned UITextInputAssistantItem are reflected automatically.
306        #[unsafe(method(inputAssistantItem))]
307        #[unsafe(method_family = none)]
308        pub unsafe fn inputAssistantItem(&self) -> Retained<UITextInputAssistantItem>;
309
310        #[cfg(feature = "UIColor")]
311        #[unsafe(method(tintColor))]
312        #[unsafe(method_family = none)]
313        pub unsafe fn tintColor(&self) -> Option<Retained<UIColor>>;
314
315        #[cfg(feature = "UIColor")]
316        /// Setter for [`tintColor`][Self::tintColor].
317        #[unsafe(method(setTintColor:))]
318        #[unsafe(method_family = none)]
319        pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);
320
321        #[cfg(feature = "UIColor")]
322        #[unsafe(method(barTintColor))]
323        #[unsafe(method_family = none)]
324        pub unsafe fn barTintColor(&self) -> Option<Retained<UIColor>>;
325
326        #[cfg(feature = "UIColor")]
327        /// Setter for [`barTintColor`][Self::barTintColor].
328        #[unsafe(method(setBarTintColor:))]
329        #[unsafe(method_family = none)]
330        pub unsafe fn setBarTintColor(&self, bar_tint_color: Option<&UIColor>);
331
332        #[unsafe(method(searchBarStyle))]
333        #[unsafe(method_family = none)]
334        pub unsafe fn searchBarStyle(&self) -> UISearchBarStyle;
335
336        /// Setter for [`searchBarStyle`][Self::searchBarStyle].
337        #[unsafe(method(setSearchBarStyle:))]
338        #[unsafe(method_family = none)]
339        pub unsafe fn setSearchBarStyle(&self, search_bar_style: UISearchBarStyle);
340
341        #[unsafe(method(isTranslucent))]
342        #[unsafe(method_family = none)]
343        pub unsafe fn isTranslucent(&self) -> bool;
344
345        /// Setter for [`isTranslucent`][Self::isTranslucent].
346        #[unsafe(method(setTranslucent:))]
347        #[unsafe(method_family = none)]
348        pub unsafe fn setTranslucent(&self, translucent: bool);
349
350        #[unsafe(method(scopeButtonTitles))]
351        #[unsafe(method_family = none)]
352        pub unsafe fn scopeButtonTitles(&self) -> Option<Retained<NSArray<NSString>>>;
353
354        /// Setter for [`scopeButtonTitles`][Self::scopeButtonTitles].
355        #[unsafe(method(setScopeButtonTitles:))]
356        #[unsafe(method_family = none)]
357        pub unsafe fn setScopeButtonTitles(&self, scope_button_titles: Option<&NSArray<NSString>>);
358
359        #[unsafe(method(selectedScopeButtonIndex))]
360        #[unsafe(method_family = none)]
361        pub unsafe fn selectedScopeButtonIndex(&self) -> NSInteger;
362
363        /// Setter for [`selectedScopeButtonIndex`][Self::selectedScopeButtonIndex].
364        #[unsafe(method(setSelectedScopeButtonIndex:))]
365        #[unsafe(method_family = none)]
366        pub unsafe fn setSelectedScopeButtonIndex(&self, selected_scope_button_index: NSInteger);
367
368        #[unsafe(method(showsScopeBar))]
369        #[unsafe(method_family = none)]
370        pub unsafe fn showsScopeBar(&self) -> bool;
371
372        /// Setter for [`showsScopeBar`][Self::showsScopeBar].
373        #[unsafe(method(setShowsScopeBar:))]
374        #[unsafe(method_family = none)]
375        pub unsafe fn setShowsScopeBar(&self, shows_scope_bar: bool);
376
377        #[unsafe(method(setShowsScopeBar:animated:))]
378        #[unsafe(method_family = none)]
379        pub unsafe fn setShowsScopeBar_animated(&self, show: bool, animate: bool);
380
381        #[unsafe(method(inputAccessoryView))]
382        #[unsafe(method_family = none)]
383        pub unsafe fn inputAccessoryView(&self) -> Option<Retained<UIView>>;
384
385        /// Setter for [`inputAccessoryView`][Self::inputAccessoryView].
386        #[unsafe(method(setInputAccessoryView:))]
387        #[unsafe(method_family = none)]
388        pub unsafe fn setInputAccessoryView(&self, input_accessory_view: Option<&UIView>);
389
390        /// When set to false, user interaction will be prevented and the search bar will take on a disabled appearance
391        /// If the search bar is associated with a UINavigationItem with `UINavigationItemSearchBarPlacementInline`,
392        /// then the minimized (icon-only) UISearchBar will not grow to the text field while `enabled` is false.
393        #[unsafe(method(isEnabled))]
394        #[unsafe(method_family = none)]
395        pub unsafe fn isEnabled(&self) -> bool;
396
397        /// Setter for [`isEnabled`][Self::isEnabled].
398        #[unsafe(method(setEnabled:))]
399        #[unsafe(method_family = none)]
400        pub unsafe fn setEnabled(&self, enabled: bool);
401
402        #[cfg(feature = "UIImage")]
403        #[unsafe(method(backgroundImage))]
404        #[unsafe(method_family = none)]
405        pub unsafe fn backgroundImage(&self) -> Option<Retained<UIImage>>;
406
407        #[cfg(feature = "UIImage")]
408        /// Setter for [`backgroundImage`][Self::backgroundImage].
409        #[unsafe(method(setBackgroundImage:))]
410        #[unsafe(method_family = none)]
411        pub unsafe fn setBackgroundImage(&self, background_image: Option<&UIImage>);
412
413        #[cfg(feature = "UIImage")]
414        #[unsafe(method(scopeBarBackgroundImage))]
415        #[unsafe(method_family = none)]
416        pub unsafe fn scopeBarBackgroundImage(&self) -> Option<Retained<UIImage>>;
417
418        #[cfg(feature = "UIImage")]
419        /// Setter for [`scopeBarBackgroundImage`][Self::scopeBarBackgroundImage].
420        #[unsafe(method(setScopeBarBackgroundImage:))]
421        #[unsafe(method_family = none)]
422        pub unsafe fn setScopeBarBackgroundImage(
423            &self,
424            scope_bar_background_image: Option<&UIImage>,
425        );
426
427        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
428        #[unsafe(method(setBackgroundImage:forBarPosition:barMetrics:))]
429        #[unsafe(method_family = none)]
430        pub unsafe fn setBackgroundImage_forBarPosition_barMetrics(
431            &self,
432            background_image: Option<&UIImage>,
433            bar_position: UIBarPosition,
434            bar_metrics: UIBarMetrics,
435        );
436
437        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
438        #[unsafe(method(backgroundImageForBarPosition:barMetrics:))]
439        #[unsafe(method_family = none)]
440        pub unsafe fn backgroundImageForBarPosition_barMetrics(
441            &self,
442            bar_position: UIBarPosition,
443            bar_metrics: UIBarMetrics,
444        ) -> Option<Retained<UIImage>>;
445
446        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
447        #[unsafe(method(setSearchFieldBackgroundImage:forState:))]
448        #[unsafe(method_family = none)]
449        pub unsafe fn setSearchFieldBackgroundImage_forState(
450            &self,
451            background_image: Option<&UIImage>,
452            state: UIControlState,
453        );
454
455        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
456        #[unsafe(method(searchFieldBackgroundImageForState:))]
457        #[unsafe(method_family = none)]
458        pub unsafe fn searchFieldBackgroundImageForState(
459            &self,
460            state: UIControlState,
461        ) -> Option<Retained<UIImage>>;
462
463        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
464        #[unsafe(method(setImage:forSearchBarIcon:state:))]
465        #[unsafe(method_family = none)]
466        pub unsafe fn setImage_forSearchBarIcon_state(
467            &self,
468            icon_image: Option<&UIImage>,
469            icon: UISearchBarIcon,
470            state: UIControlState,
471        );
472
473        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
474        #[unsafe(method(imageForSearchBarIcon:state:))]
475        #[unsafe(method_family = none)]
476        pub unsafe fn imageForSearchBarIcon_state(
477            &self,
478            icon: UISearchBarIcon,
479            state: UIControlState,
480        ) -> Option<Retained<UIImage>>;
481
482        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
483        #[unsafe(method(setScopeBarButtonBackgroundImage:forState:))]
484        #[unsafe(method_family = none)]
485        pub unsafe fn setScopeBarButtonBackgroundImage_forState(
486            &self,
487            background_image: Option<&UIImage>,
488            state: UIControlState,
489        );
490
491        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
492        #[unsafe(method(scopeBarButtonBackgroundImageForState:))]
493        #[unsafe(method_family = none)]
494        pub unsafe fn scopeBarButtonBackgroundImageForState(
495            &self,
496            state: UIControlState,
497        ) -> Option<Retained<UIImage>>;
498
499        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
500        #[unsafe(method(setScopeBarButtonDividerImage:forLeftSegmentState:rightSegmentState:))]
501        #[unsafe(method_family = none)]
502        pub unsafe fn setScopeBarButtonDividerImage_forLeftSegmentState_rightSegmentState(
503            &self,
504            divider_image: Option<&UIImage>,
505            left_state: UIControlState,
506            right_state: UIControlState,
507        );
508
509        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
510        #[unsafe(method(scopeBarButtonDividerImageForLeftSegmentState:rightSegmentState:))]
511        #[unsafe(method_family = none)]
512        pub unsafe fn scopeBarButtonDividerImageForLeftSegmentState_rightSegmentState(
513            &self,
514            left_state: UIControlState,
515            right_state: UIControlState,
516        ) -> Option<Retained<UIImage>>;
517
518        #[cfg(feature = "UIControl")]
519        #[unsafe(method(setScopeBarButtonTitleTextAttributes:forState:))]
520        #[unsafe(method_family = none)]
521        pub unsafe fn setScopeBarButtonTitleTextAttributes_forState(
522            &self,
523            attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
524            state: UIControlState,
525        );
526
527        #[cfg(feature = "UIControl")]
528        #[unsafe(method(scopeBarButtonTitleTextAttributesForState:))]
529        #[unsafe(method_family = none)]
530        pub unsafe fn scopeBarButtonTitleTextAttributesForState(
531            &self,
532            state: UIControlState,
533        ) -> Option<Retained<NSDictionary<NSAttributedStringKey, AnyObject>>>;
534
535        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
536        #[unsafe(method(searchFieldBackgroundPositionAdjustment))]
537        #[unsafe(method_family = none)]
538        pub unsafe fn searchFieldBackgroundPositionAdjustment(&self) -> UIOffset;
539
540        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
541        /// Setter for [`searchFieldBackgroundPositionAdjustment`][Self::searchFieldBackgroundPositionAdjustment].
542        #[unsafe(method(setSearchFieldBackgroundPositionAdjustment:))]
543        #[unsafe(method_family = none)]
544        pub unsafe fn setSearchFieldBackgroundPositionAdjustment(
545            &self,
546            search_field_background_position_adjustment: UIOffset,
547        );
548
549        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
550        #[unsafe(method(searchTextPositionAdjustment))]
551        #[unsafe(method_family = none)]
552        pub unsafe fn searchTextPositionAdjustment(&self) -> UIOffset;
553
554        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
555        /// Setter for [`searchTextPositionAdjustment`][Self::searchTextPositionAdjustment].
556        #[unsafe(method(setSearchTextPositionAdjustment:))]
557        #[unsafe(method_family = none)]
558        pub unsafe fn setSearchTextPositionAdjustment(
559            &self,
560            search_text_position_adjustment: UIOffset,
561        );
562
563        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
564        #[unsafe(method(setPositionAdjustment:forSearchBarIcon:))]
565        #[unsafe(method_family = none)]
566        pub unsafe fn setPositionAdjustment_forSearchBarIcon(
567            &self,
568            adjustment: UIOffset,
569            icon: UISearchBarIcon,
570        );
571
572        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
573        #[unsafe(method(positionAdjustmentForSearchBarIcon:))]
574        #[unsafe(method_family = none)]
575        pub unsafe fn positionAdjustmentForSearchBarIcon(&self, icon: UISearchBarIcon) -> UIOffset;
576
577        #[unsafe(method(isLookToDictateEnabled))]
578        #[unsafe(method_family = none)]
579        pub unsafe fn isLookToDictateEnabled(&self) -> bool;
580
581        /// Setter for [`isLookToDictateEnabled`][Self::isLookToDictateEnabled].
582        #[unsafe(method(setLookToDictateEnabled:))]
583        #[unsafe(method_family = none)]
584        pub unsafe fn setLookToDictateEnabled(&self, look_to_dictate_enabled: bool);
585    );
586}
587
588/// Methods declared on superclass `NSObject`.
589#[cfg(all(feature = "UIResponder", feature = "UIView"))]
590impl UISearchBar {
591    extern_methods!(
592        #[unsafe(method(new))]
593        #[unsafe(method_family = new)]
594        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
595    );
596}
597
598extern_protocol!(
599    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisearchbardelegate?language=objc)
600    #[cfg(feature = "UIBarCommon")]
601    pub unsafe trait UISearchBarDelegate: UIBarPositioningDelegate + MainThreadOnly {
602        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
603        #[optional]
604        #[unsafe(method(searchBarShouldBeginEditing:))]
605        #[unsafe(method_family = none)]
606        unsafe fn searchBarShouldBeginEditing(&self, search_bar: &UISearchBar) -> bool;
607
608        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
609        #[optional]
610        #[unsafe(method(searchBarTextDidBeginEditing:))]
611        #[unsafe(method_family = none)]
612        unsafe fn searchBarTextDidBeginEditing(&self, search_bar: &UISearchBar);
613
614        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
615        #[optional]
616        #[unsafe(method(searchBarShouldEndEditing:))]
617        #[unsafe(method_family = none)]
618        unsafe fn searchBarShouldEndEditing(&self, search_bar: &UISearchBar) -> bool;
619
620        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
621        #[optional]
622        #[unsafe(method(searchBarTextDidEndEditing:))]
623        #[unsafe(method_family = none)]
624        unsafe fn searchBarTextDidEndEditing(&self, search_bar: &UISearchBar);
625
626        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
627        #[optional]
628        #[unsafe(method(searchBar:textDidChange:))]
629        #[unsafe(method_family = none)]
630        unsafe fn searchBar_textDidChange(&self, search_bar: &UISearchBar, search_text: &NSString);
631
632        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
633        #[optional]
634        #[unsafe(method(searchBar:shouldChangeTextInRange:replacementText:))]
635        #[unsafe(method_family = none)]
636        unsafe fn searchBar_shouldChangeTextInRange_replacementText(
637            &self,
638            search_bar: &UISearchBar,
639            range: NSRange,
640            text: &NSString,
641        ) -> bool;
642
643        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
644        #[optional]
645        #[unsafe(method(searchBarSearchButtonClicked:))]
646        #[unsafe(method_family = none)]
647        unsafe fn searchBarSearchButtonClicked(&self, search_bar: &UISearchBar);
648
649        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
650        #[optional]
651        #[unsafe(method(searchBarBookmarkButtonClicked:))]
652        #[unsafe(method_family = none)]
653        unsafe fn searchBarBookmarkButtonClicked(&self, search_bar: &UISearchBar);
654
655        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
656        #[optional]
657        #[unsafe(method(searchBarCancelButtonClicked:))]
658        #[unsafe(method_family = none)]
659        unsafe fn searchBarCancelButtonClicked(&self, search_bar: &UISearchBar);
660
661        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
662        #[optional]
663        #[unsafe(method(searchBarResultsListButtonClicked:))]
664        #[unsafe(method_family = none)]
665        unsafe fn searchBarResultsListButtonClicked(&self, search_bar: &UISearchBar);
666
667        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
668        #[optional]
669        #[unsafe(method(searchBar:selectedScopeButtonIndexDidChange:))]
670        #[unsafe(method_family = none)]
671        unsafe fn searchBar_selectedScopeButtonIndexDidChange(
672            &self,
673            search_bar: &UISearchBar,
674            selected_scope: NSInteger,
675        );
676    }
677);