1use 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#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct UITextBorderStyle(pub NSInteger);
20impl UITextBorderStyle {
21 #[doc(alias = "UITextBorderStyleNone")]
22 pub const None: Self = Self(0);
23 #[doc(alias = "UITextBorderStyleLine")]
24 pub const Line: Self = Self(1);
25 #[doc(alias = "UITextBorderStyleBezel")]
26 pub const Bezel: Self = Self(2);
27 #[doc(alias = "UITextBorderStyleRoundedRect")]
28 pub const RoundedRect: Self = Self(3);
29}
30
31unsafe impl Encode for UITextBorderStyle {
32 const ENCODING: Encoding = NSInteger::ENCODING;
33}
34
35unsafe impl RefEncode for UITextBorderStyle {
36 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
37}
38
39#[repr(transparent)]
42#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
43pub struct UITextFieldViewMode(pub NSInteger);
44impl UITextFieldViewMode {
45 #[doc(alias = "UITextFieldViewModeNever")]
46 pub const Never: Self = Self(0);
47 #[doc(alias = "UITextFieldViewModeWhileEditing")]
48 pub const WhileEditing: Self = Self(1);
49 #[doc(alias = "UITextFieldViewModeUnlessEditing")]
50 pub const UnlessEditing: Self = Self(2);
51 #[doc(alias = "UITextFieldViewModeAlways")]
52 pub const Always: Self = Self(3);
53}
54
55unsafe impl Encode for UITextFieldViewMode {
56 const ENCODING: Encoding = NSInteger::ENCODING;
57}
58
59unsafe impl RefEncode for UITextFieldViewMode {
60 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
61}
62
63#[repr(transparent)]
66#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
67pub struct UITextFieldDidEndEditingReason(pub NSInteger);
68impl UITextFieldDidEndEditingReason {
69 #[doc(alias = "UITextFieldDidEndEditingReasonCommitted")]
70 pub const Committed: Self = Self(0);
71 #[doc(alias = "UITextFieldDidEndEditingReasonCancelled")]
72 pub const Cancelled: Self = Self(1);
73}
74
75unsafe impl Encode for UITextFieldDidEndEditingReason {
76 const ENCODING: Encoding = NSInteger::ENCODING;
77}
78
79unsafe impl RefEncode for UITextFieldDidEndEditingReason {
80 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
81}
82
83extern_class!(
84 #[unsafe(super(UIControl, UIView, UIResponder, NSObject))]
86 #[thread_kind = MainThreadOnly]
87 #[derive(Debug, PartialEq, Eq, Hash)]
88 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
89 pub struct UITextField;
90);
91
92#[cfg(all(
93 feature = "UIControl",
94 feature = "UIResponder",
95 feature = "UIView",
96 feature = "objc2-quartz-core"
97))]
98#[cfg(not(target_os = "watchos"))]
99extern_conformance!(
100 unsafe impl CALayerDelegate for UITextField {}
101);
102
103#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
104extern_conformance!(
105 unsafe impl NSCoding for UITextField {}
106);
107
108#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
109extern_conformance!(
110 unsafe impl NSObjectProtocol for UITextField {}
111);
112
113#[cfg(all(
114 feature = "UIAppearance",
115 feature = "UIControl",
116 feature = "UIResponder",
117 feature = "UIView"
118))]
119extern_conformance!(
120 unsafe impl UIAppearance for UITextField {}
121);
122
123#[cfg(all(
124 feature = "UIAppearance",
125 feature = "UIControl",
126 feature = "UIResponder",
127 feature = "UIView"
128))]
129extern_conformance!(
130 unsafe impl UIAppearanceContainer for UITextField {}
131);
132
133#[cfg(all(
134 feature = "UIContentSizeCategoryAdjusting",
135 feature = "UIControl",
136 feature = "UIResponder",
137 feature = "UIView"
138))]
139extern_conformance!(
140 unsafe impl UIContentSizeCategoryAdjusting for UITextField {}
141);
142
143#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
144extern_conformance!(
145 unsafe impl UICoordinateSpace for UITextField {}
146);
147
148#[cfg(all(
149 feature = "UIControl",
150 feature = "UIDynamicBehavior",
151 feature = "UIResponder",
152 feature = "UIView"
153))]
154extern_conformance!(
155 unsafe impl UIDynamicItem for UITextField {}
156);
157
158#[cfg(all(
159 feature = "UIControl",
160 feature = "UIFocus",
161 feature = "UIResponder",
162 feature = "UIView"
163))]
164extern_conformance!(
165 unsafe impl UIFocusEnvironment for UITextField {}
166);
167
168#[cfg(all(
169 feature = "UIControl",
170 feature = "UIFocus",
171 feature = "UIResponder",
172 feature = "UIView"
173))]
174extern_conformance!(
175 unsafe impl UIFocusItem for UITextField {}
176);
177
178#[cfg(all(
179 feature = "UIControl",
180 feature = "UIFocus",
181 feature = "UIResponder",
182 feature = "UIView"
183))]
184extern_conformance!(
185 unsafe impl UIFocusItemContainer for UITextField {}
186);
187
188#[cfg(all(
189 feature = "UIControl",
190 feature = "UIResponder",
191 feature = "UITextInput",
192 feature = "UITextInputTraits",
193 feature = "UIView"
194))]
195extern_conformance!(
196 unsafe impl UIKeyInput for UITextField {}
197);
198
199#[cfg(all(
200 feature = "UIControl",
201 feature = "UILetterformAwareAdjusting",
202 feature = "UIResponder",
203 feature = "UIView"
204))]
205extern_conformance!(
206 unsafe impl UILetterformAwareAdjusting for UITextField {}
207);
208
209#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
210extern_conformance!(
211 unsafe impl UIResponderStandardEditActions for UITextField {}
212);
213
214#[cfg(all(
215 feature = "UIControl",
216 feature = "UIResponder",
217 feature = "UITextInput",
218 feature = "UITextInputTraits",
219 feature = "UIView"
220))]
221extern_conformance!(
222 unsafe impl UITextInput for UITextField {}
223);
224
225#[cfg(all(
226 feature = "UIControl",
227 feature = "UIResponder",
228 feature = "UITextInputTraits",
229 feature = "UIView"
230))]
231extern_conformance!(
232 unsafe impl UITextInputTraits for UITextField {}
233);
234
235#[cfg(all(
236 feature = "UIControl",
237 feature = "UIResponder",
238 feature = "UITraitCollection",
239 feature = "UIView"
240))]
241extern_conformance!(
242 unsafe impl UITraitEnvironment for UITextField {}
243);
244
245#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
246impl UITextField {
247 extern_methods!(
248 #[unsafe(method(text))]
249 #[unsafe(method_family = none)]
250 pub fn text(&self) -> Option<Retained<NSString>>;
251
252 #[unsafe(method(setText:))]
256 #[unsafe(method_family = none)]
257 pub fn setText(&self, text: Option<&NSString>);
258
259 #[unsafe(method(attributedText))]
260 #[unsafe(method_family = none)]
261 pub fn attributedText(&self) -> Option<Retained<NSAttributedString>>;
262
263 #[unsafe(method(setAttributedText:))]
267 #[unsafe(method_family = none)]
268 pub fn setAttributedText(&self, attributed_text: Option<&NSAttributedString>);
269
270 #[cfg(feature = "UIColor")]
271 #[unsafe(method(textColor))]
272 #[unsafe(method_family = none)]
273 pub fn textColor(&self) -> Option<Retained<UIColor>>;
274
275 #[cfg(feature = "UIColor")]
276 #[unsafe(method(setTextColor:))]
278 #[unsafe(method_family = none)]
279 pub fn setTextColor(&self, text_color: Option<&UIColor>);
280
281 #[cfg(feature = "UIFont")]
282 #[unsafe(method(font))]
283 #[unsafe(method_family = none)]
284 pub fn font(&self) -> Option<Retained<UIFont>>;
285
286 #[cfg(feature = "UIFont")]
287 #[unsafe(method(setFont:))]
289 #[unsafe(method_family = none)]
290 pub fn setFont(&self, font: Option<&UIFont>);
291
292 #[cfg(feature = "NSText")]
293 #[unsafe(method(textAlignment))]
294 #[unsafe(method_family = none)]
295 pub fn textAlignment(&self) -> NSTextAlignment;
296
297 #[cfg(feature = "NSText")]
298 #[unsafe(method(setTextAlignment:))]
300 #[unsafe(method_family = none)]
301 pub fn setTextAlignment(&self, text_alignment: NSTextAlignment);
302
303 #[unsafe(method(borderStyle))]
304 #[unsafe(method_family = none)]
305 pub fn borderStyle(&self) -> UITextBorderStyle;
306
307 #[unsafe(method(setBorderStyle:))]
309 #[unsafe(method_family = none)]
310 pub fn setBorderStyle(&self, border_style: UITextBorderStyle);
311
312 #[unsafe(method(defaultTextAttributes))]
313 #[unsafe(method_family = none)]
314 pub fn defaultTextAttributes(
315 &self,
316 ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
317
318 #[unsafe(method(setDefaultTextAttributes:))]
326 #[unsafe(method_family = none)]
327 pub unsafe fn setDefaultTextAttributes(
328 &self,
329 default_text_attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
330 );
331
332 #[unsafe(method(placeholder))]
333 #[unsafe(method_family = none)]
334 pub fn placeholder(&self) -> Option<Retained<NSString>>;
335
336 #[unsafe(method(setPlaceholder:))]
340 #[unsafe(method_family = none)]
341 pub fn setPlaceholder(&self, placeholder: Option<&NSString>);
342
343 #[unsafe(method(attributedPlaceholder))]
344 #[unsafe(method_family = none)]
345 pub fn attributedPlaceholder(&self) -> Option<Retained<NSAttributedString>>;
346
347 #[unsafe(method(setAttributedPlaceholder:))]
351 #[unsafe(method_family = none)]
352 pub fn setAttributedPlaceholder(&self, attributed_placeholder: Option<&NSAttributedString>);
353
354 #[unsafe(method(clearsOnBeginEditing))]
355 #[unsafe(method_family = none)]
356 pub fn clearsOnBeginEditing(&self) -> bool;
357
358 #[unsafe(method(setClearsOnBeginEditing:))]
360 #[unsafe(method_family = none)]
361 pub fn setClearsOnBeginEditing(&self, clears_on_begin_editing: bool);
362
363 #[unsafe(method(adjustsFontSizeToFitWidth))]
364 #[unsafe(method_family = none)]
365 pub fn adjustsFontSizeToFitWidth(&self) -> bool;
366
367 #[unsafe(method(setAdjustsFontSizeToFitWidth:))]
369 #[unsafe(method_family = none)]
370 pub fn setAdjustsFontSizeToFitWidth(&self, adjusts_font_size_to_fit_width: bool);
371
372 #[cfg(feature = "objc2-core-foundation")]
373 #[unsafe(method(minimumFontSize))]
374 #[unsafe(method_family = none)]
375 pub fn minimumFontSize(&self) -> CGFloat;
376
377 #[cfg(feature = "objc2-core-foundation")]
378 #[unsafe(method(setMinimumFontSize:))]
380 #[unsafe(method_family = none)]
381 pub fn setMinimumFontSize(&self, minimum_font_size: CGFloat);
382
383 #[unsafe(method(delegate))]
384 #[unsafe(method_family = none)]
385 pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UITextFieldDelegate>>>;
386
387 #[unsafe(method(setDelegate:))]
391 #[unsafe(method_family = none)]
392 pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UITextFieldDelegate>>);
393
394 #[cfg(feature = "UIImage")]
395 #[unsafe(method(background))]
396 #[unsafe(method_family = none)]
397 pub fn background(&self) -> Option<Retained<UIImage>>;
398
399 #[cfg(feature = "UIImage")]
400 #[unsafe(method(setBackground:))]
402 #[unsafe(method_family = none)]
403 pub fn setBackground(&self, background: Option<&UIImage>);
404
405 #[cfg(feature = "UIImage")]
406 #[unsafe(method(disabledBackground))]
407 #[unsafe(method_family = none)]
408 pub fn disabledBackground(&self) -> Option<Retained<UIImage>>;
409
410 #[cfg(feature = "UIImage")]
411 #[unsafe(method(setDisabledBackground:))]
413 #[unsafe(method_family = none)]
414 pub fn setDisabledBackground(&self, disabled_background: Option<&UIImage>);
415
416 #[unsafe(method(isEditing))]
417 #[unsafe(method_family = none)]
418 pub fn isEditing(&self) -> bool;
419
420 #[unsafe(method(allowsEditingTextAttributes))]
421 #[unsafe(method_family = none)]
422 pub fn allowsEditingTextAttributes(&self) -> bool;
423
424 #[unsafe(method(setAllowsEditingTextAttributes:))]
426 #[unsafe(method_family = none)]
427 pub fn setAllowsEditingTextAttributes(&self, allows_editing_text_attributes: bool);
428
429 #[unsafe(method(typingAttributes))]
430 #[unsafe(method_family = none)]
431 pub fn typingAttributes(
432 &self,
433 ) -> Option<Retained<NSDictionary<NSAttributedStringKey, AnyObject>>>;
434
435 #[unsafe(method(setTypingAttributes:))]
443 #[unsafe(method_family = none)]
444 pub unsafe fn setTypingAttributes(
445 &self,
446 typing_attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
447 );
448
449 #[unsafe(method(clearButtonMode))]
450 #[unsafe(method_family = none)]
451 pub fn clearButtonMode(&self) -> UITextFieldViewMode;
452
453 #[unsafe(method(setClearButtonMode:))]
455 #[unsafe(method_family = none)]
456 pub fn setClearButtonMode(&self, clear_button_mode: UITextFieldViewMode);
457
458 #[unsafe(method(leftView))]
459 #[unsafe(method_family = none)]
460 pub fn leftView(&self) -> Option<Retained<UIView>>;
461
462 #[unsafe(method(setLeftView:))]
464 #[unsafe(method_family = none)]
465 pub fn setLeftView(&self, left_view: Option<&UIView>);
466
467 #[unsafe(method(leftViewMode))]
468 #[unsafe(method_family = none)]
469 pub fn leftViewMode(&self) -> UITextFieldViewMode;
470
471 #[unsafe(method(setLeftViewMode:))]
473 #[unsafe(method_family = none)]
474 pub fn setLeftViewMode(&self, left_view_mode: UITextFieldViewMode);
475
476 #[unsafe(method(rightView))]
477 #[unsafe(method_family = none)]
478 pub fn rightView(&self) -> Option<Retained<UIView>>;
479
480 #[unsafe(method(setRightView:))]
482 #[unsafe(method_family = none)]
483 pub fn setRightView(&self, right_view: Option<&UIView>);
484
485 #[unsafe(method(rightViewMode))]
486 #[unsafe(method_family = none)]
487 pub fn rightViewMode(&self) -> UITextFieldViewMode;
488
489 #[unsafe(method(setRightViewMode:))]
491 #[unsafe(method_family = none)]
492 pub fn setRightViewMode(&self, right_view_mode: UITextFieldViewMode);
493
494 #[cfg(feature = "objc2-core-foundation")]
495 #[unsafe(method(borderRectForBounds:))]
496 #[unsafe(method_family = none)]
497 pub fn borderRectForBounds(&self, bounds: CGRect) -> CGRect;
498
499 #[cfg(feature = "objc2-core-foundation")]
500 #[unsafe(method(textRectForBounds:))]
501 #[unsafe(method_family = none)]
502 pub fn textRectForBounds(&self, bounds: CGRect) -> CGRect;
503
504 #[cfg(feature = "objc2-core-foundation")]
505 #[unsafe(method(placeholderRectForBounds:))]
506 #[unsafe(method_family = none)]
507 pub fn placeholderRectForBounds(&self, bounds: CGRect) -> CGRect;
508
509 #[cfg(feature = "objc2-core-foundation")]
510 #[unsafe(method(editingRectForBounds:))]
511 #[unsafe(method_family = none)]
512 pub fn editingRectForBounds(&self, bounds: CGRect) -> CGRect;
513
514 #[cfg(feature = "objc2-core-foundation")]
515 #[unsafe(method(clearButtonRectForBounds:))]
516 #[unsafe(method_family = none)]
517 pub fn clearButtonRectForBounds(&self, bounds: CGRect) -> CGRect;
518
519 #[cfg(feature = "objc2-core-foundation")]
520 #[unsafe(method(leftViewRectForBounds:))]
521 #[unsafe(method_family = none)]
522 pub fn leftViewRectForBounds(&self, bounds: CGRect) -> CGRect;
523
524 #[cfg(feature = "objc2-core-foundation")]
525 #[unsafe(method(rightViewRectForBounds:))]
526 #[unsafe(method_family = none)]
527 pub fn rightViewRectForBounds(&self, bounds: CGRect) -> CGRect;
528
529 #[cfg(feature = "objc2-core-foundation")]
530 #[deprecated = "This method is no longer called."]
531 #[unsafe(method(drawTextInRect:))]
532 #[unsafe(method_family = none)]
533 pub fn drawTextInRect(&self, rect: CGRect);
534
535 #[cfg(feature = "objc2-core-foundation")]
536 #[unsafe(method(drawPlaceholderInRect:))]
537 #[unsafe(method_family = none)]
538 pub fn drawPlaceholderInRect(&self, rect: CGRect);
539
540 #[unsafe(method(inputView))]
541 #[unsafe(method_family = none)]
542 pub fn inputView(&self) -> Option<Retained<UIView>>;
543
544 #[unsafe(method(setInputView:))]
546 #[unsafe(method_family = none)]
547 pub fn setInputView(&self, input_view: Option<&UIView>);
548
549 #[unsafe(method(inputAccessoryView))]
550 #[unsafe(method_family = none)]
551 pub fn inputAccessoryView(&self) -> Option<Retained<UIView>>;
552
553 #[unsafe(method(setInputAccessoryView:))]
555 #[unsafe(method_family = none)]
556 pub fn setInputAccessoryView(&self, input_accessory_view: Option<&UIView>);
557
558 #[unsafe(method(clearsOnInsertion))]
559 #[unsafe(method_family = none)]
560 pub fn clearsOnInsertion(&self) -> bool;
561
562 #[unsafe(method(setClearsOnInsertion:))]
564 #[unsafe(method_family = none)]
565 pub fn setClearsOnInsertion(&self, clears_on_insertion: bool);
566 );
567}
568
569#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
571impl UITextField {
572 extern_methods!(
573 #[cfg(feature = "objc2-core-foundation")]
574 #[unsafe(method(initWithFrame:))]
575 #[unsafe(method_family = init)]
576 pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
577
578 #[unsafe(method(initWithCoder:))]
582 #[unsafe(method_family = init)]
583 pub unsafe fn initWithCoder(
584 this: Allocated<Self>,
585 coder: &NSCoder,
586 ) -> Option<Retained<Self>>;
587
588 #[cfg(all(
589 feature = "UIAction",
590 feature = "UIMenuElement",
591 feature = "objc2-core-foundation"
592 ))]
593 #[unsafe(method(initWithFrame:primaryAction:))]
595 #[unsafe(method_family = init)]
596 pub fn initWithFrame_primaryAction(
597 this: Allocated<Self>,
598 frame: CGRect,
599 primary_action: Option<&UIAction>,
600 ) -> Retained<Self>;
601 );
602}
603
604#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
606impl UITextField {
607 extern_methods!(
608 #[unsafe(method(init))]
609 #[unsafe(method_family = init)]
610 pub fn init(this: Allocated<Self>) -> Retained<Self>;
611 );
612}
613
614#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
616impl UITextField {
617 extern_methods!(
618 #[unsafe(method(new))]
619 #[unsafe(method_family = new)]
620 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
621 );
622}
623
624#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
625impl UITextField {
626 extern_methods!();
627}
628
629#[cfg(all(
630 feature = "UIControl",
631 feature = "UIResponder",
632 feature = "UITextDragging",
633 feature = "UITextInput",
634 feature = "UITextInputTraits",
635 feature = "UIView"
636))]
637extern_conformance!(
638 unsafe impl UITextDraggable for UITextField {}
639);
640
641#[cfg(all(
642 feature = "UIControl",
643 feature = "UIPasteConfigurationSupporting",
644 feature = "UIResponder",
645 feature = "UITextDropping",
646 feature = "UITextInput",
647 feature = "UITextInputTraits",
648 feature = "UITextPasteConfigurationSupporting",
649 feature = "UIView"
650))]
651extern_conformance!(
652 unsafe impl UITextDroppable for UITextField {}
653);
654
655#[cfg(all(
656 feature = "UIControl",
657 feature = "UIPasteConfigurationSupporting",
658 feature = "UIResponder",
659 feature = "UITextPasteConfigurationSupporting",
660 feature = "UIView"
661))]
662extern_conformance!(
663 unsafe impl UITextPasteConfigurationSupporting for UITextField {}
664);
665
666#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
668impl UITextField {
669 extern_methods!(
670 #[unsafe(method(interactionState))]
671 #[unsafe(method_family = none)]
672 pub fn interactionState(&self) -> Retained<AnyObject>;
673
674 #[unsafe(method(setInteractionState:))]
682 #[unsafe(method_family = none)]
683 pub unsafe fn setInteractionState(&self, interaction_state: &AnyObject);
684 );
685}
686
687#[cfg(all(feature = "UIResponder", feature = "UIView"))]
689impl UIView {
690 extern_methods!(
691 #[unsafe(method(endEditing:))]
692 #[unsafe(method_family = none)]
693 pub fn endEditing(&self, force: bool) -> bool;
694 );
695}
696
697extern_protocol!(
698 pub unsafe trait UITextFieldDelegate: NSObjectProtocol + MainThreadOnly {
700 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
701 #[optional]
702 #[unsafe(method(textFieldShouldBeginEditing:))]
703 #[unsafe(method_family = none)]
704 fn textFieldShouldBeginEditing(&self, text_field: &UITextField) -> bool;
705
706 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
707 #[optional]
708 #[unsafe(method(textFieldDidBeginEditing:))]
709 #[unsafe(method_family = none)]
710 fn textFieldDidBeginEditing(&self, text_field: &UITextField);
711
712 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
713 #[optional]
714 #[unsafe(method(textFieldShouldEndEditing:))]
715 #[unsafe(method_family = none)]
716 fn textFieldShouldEndEditing(&self, text_field: &UITextField) -> bool;
717
718 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
719 #[optional]
720 #[unsafe(method(textFieldDidEndEditing:))]
721 #[unsafe(method_family = none)]
722 fn textFieldDidEndEditing(&self, text_field: &UITextField);
723
724 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
725 #[optional]
726 #[unsafe(method(textFieldDidEndEditing:reason:))]
727 #[unsafe(method_family = none)]
728 fn textFieldDidEndEditing_reason(
729 &self,
730 text_field: &UITextField,
731 reason: UITextFieldDidEndEditingReason,
732 );
733
734 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
735 #[deprecated]
736 #[optional]
737 #[unsafe(method(textField:shouldChangeCharactersInRange:replacementString:))]
738 #[unsafe(method_family = none)]
739 fn textField_shouldChangeCharactersInRange_replacementString(
740 &self,
741 text_field: &UITextField,
742 range: NSRange,
743 string: &NSString,
744 ) -> bool;
745
746 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
747 #[optional]
762 #[unsafe(method(textField:shouldChangeCharactersInRanges:replacementString:))]
763 #[unsafe(method_family = none)]
764 fn textField_shouldChangeCharactersInRanges_replacementString(
765 &self,
766 text_field: &UITextField,
767 ranges: &NSArray<NSValue>,
768 string: &NSString,
769 ) -> bool;
770
771 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
772 #[optional]
773 #[unsafe(method(textFieldDidChangeSelection:))]
774 #[unsafe(method_family = none)]
775 fn textFieldDidChangeSelection(&self, text_field: &UITextField);
776
777 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
778 #[optional]
779 #[unsafe(method(textFieldShouldClear:))]
780 #[unsafe(method_family = none)]
781 fn textFieldShouldClear(&self, text_field: &UITextField) -> bool;
782
783 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
784 #[optional]
785 #[unsafe(method(textFieldShouldReturn:))]
786 #[unsafe(method_family = none)]
787 fn textFieldShouldReturn(&self, text_field: &UITextField) -> bool;
788
789 #[cfg(all(
790 feature = "UIControl",
791 feature = "UIMenu",
792 feature = "UIMenuElement",
793 feature = "UIResponder",
794 feature = "UIView"
795 ))]
796 #[deprecated]
809 #[optional]
810 #[unsafe(method(textField:editMenuForCharactersInRange:suggestedActions:))]
811 #[unsafe(method_family = none)]
812 fn textField_editMenuForCharactersInRange_suggestedActions(
813 &self,
814 text_field: &UITextField,
815 range: NSRange,
816 suggested_actions: &NSArray<UIMenuElement>,
817 ) -> Option<Retained<UIMenu>>;
818
819 #[cfg(all(
820 feature = "UIControl",
821 feature = "UIMenu",
822 feature = "UIMenuElement",
823 feature = "UIResponder",
824 feature = "UIView"
825 ))]
826 #[optional]
839 #[unsafe(method(textField:editMenuForCharactersInRanges:suggestedActions:))]
840 #[unsafe(method_family = none)]
841 fn textField_editMenuForCharactersInRanges_suggestedActions(
842 &self,
843 text_field: &UITextField,
844 ranges: &NSArray<NSValue>,
845 suggested_actions: &NSArray<UIMenuElement>,
846 ) -> Option<Retained<UIMenu>>;
847
848 #[cfg(all(
849 feature = "UIControl",
850 feature = "UIEditMenuInteraction",
851 feature = "UIResponder",
852 feature = "UIView"
853 ))]
854 #[optional]
861 #[unsafe(method(textField:willPresentEditMenuWithAnimator:))]
862 #[unsafe(method_family = none)]
863 fn textField_willPresentEditMenuWithAnimator(
864 &self,
865 text_field: &UITextField,
866 animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>,
867 );
868
869 #[cfg(all(
870 feature = "UIControl",
871 feature = "UIEditMenuInteraction",
872 feature = "UIResponder",
873 feature = "UIView"
874 ))]
875 #[optional]
882 #[unsafe(method(textField:willDismissEditMenuWithAnimator:))]
883 #[unsafe(method_family = none)]
884 fn textField_willDismissEditMenuWithAnimator(
885 &self,
886 text_field: &UITextField,
887 animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>,
888 );
889
890 #[cfg(all(
891 feature = "UIControl",
892 feature = "UIInputSuggestion",
893 feature = "UIResponder",
894 feature = "UIView"
895 ))]
896 #[optional]
902 #[unsafe(method(textField:insertInputSuggestion:))]
903 #[unsafe(method_family = none)]
904 fn textField_insertInputSuggestion(
905 &self,
906 text_field: &UITextField,
907 input_suggestion: &UIInputSuggestion,
908 );
909 }
910);
911
912extern "C" {
913 pub static UITextFieldTextDidBeginEditingNotification: &'static NSNotificationName;
915}
916
917extern "C" {
918 pub static UITextFieldTextDidEndEditingNotification: &'static NSNotificationName;
920}
921
922extern "C" {
923 pub static UITextFieldTextDidChangeNotification: &'static NSNotificationName;
925}
926
927extern "C" {
928 pub static UITextFieldDidEndEditingReasonKey: &'static NSString;
930}