Skip to main content

ohos_arkui_binding/component/built_in_component/
text_input.rs

1//! Module component::built_in_component::text_input wrappers and related types.
2
3use crate::ArkUICommonFontAttribute;
4
5impl Clone for super::TextInput {
6    fn clone(&self) -> Self {
7        Self(self.0.clone())
8    }
9}
10
11impl ArkUICommonFontAttribute for super::TextInput {}
12
13// BEGIN_GENERATED_COMPONENT_METHODS_TextInput
14impl super::TextInput {
15    pub fn set_text_input_placeholder<T: Into<crate::ArkUINodeAttributeItem>>(
16        &self,
17        value: T,
18    ) -> crate::ArkUIResult<()> {
19        <Self as crate::ArkUICommonAttribute>::set_attribute(
20            self,
21            crate::ArkUINodeAttributeType::TextInputPlaceholder,
22            value.into(),
23        )
24    }
25
26    pub fn get_text_input_placeholder(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
27        <Self as crate::ArkUICommonAttribute>::get_attribute(
28            self,
29            crate::ArkUINodeAttributeType::TextInputPlaceholder,
30        )
31    }
32
33    pub fn set_text_input_text<T: Into<crate::ArkUINodeAttributeItem>>(
34        &self,
35        value: T,
36    ) -> crate::ArkUIResult<()> {
37        <Self as crate::ArkUICommonAttribute>::set_attribute(
38            self,
39            crate::ArkUINodeAttributeType::TextInputText,
40            value.into(),
41        )
42    }
43
44    pub fn get_text_input_text(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
45        <Self as crate::ArkUICommonAttribute>::get_attribute(
46            self,
47            crate::ArkUINodeAttributeType::TextInputText,
48        )
49    }
50
51    pub fn set_text_input_caret_color<T: Into<crate::ArkUINodeAttributeItem>>(
52        &self,
53        value: T,
54    ) -> crate::ArkUIResult<()> {
55        <Self as crate::ArkUICommonAttribute>::set_attribute(
56            self,
57            crate::ArkUINodeAttributeType::TextInputCaretColor,
58            value.into(),
59        )
60    }
61
62    pub fn get_text_input_caret_color(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
63        <Self as crate::ArkUICommonAttribute>::get_attribute(
64            self,
65            crate::ArkUINodeAttributeType::TextInputCaretColor,
66        )
67    }
68
69    pub fn set_text_input_caret_style<T: Into<crate::ArkUINodeAttributeItem>>(
70        &self,
71        value: T,
72    ) -> crate::ArkUIResult<()> {
73        <Self as crate::ArkUICommonAttribute>::set_attribute(
74            self,
75            crate::ArkUINodeAttributeType::TextInputCaretStyle,
76            value.into(),
77        )
78    }
79
80    pub fn get_text_input_caret_style(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
81        <Self as crate::ArkUICommonAttribute>::get_attribute(
82            self,
83            crate::ArkUINodeAttributeType::TextInputCaretStyle,
84        )
85    }
86
87    pub fn set_text_input_show_underline<T: Into<crate::ArkUINodeAttributeItem>>(
88        &self,
89        value: T,
90    ) -> crate::ArkUIResult<()> {
91        <Self as crate::ArkUICommonAttribute>::set_attribute(
92            self,
93            crate::ArkUINodeAttributeType::TextInputShowUnderline,
94            value.into(),
95        )
96    }
97
98    pub fn get_text_input_show_underline(
99        &self,
100    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
101        <Self as crate::ArkUICommonAttribute>::get_attribute(
102            self,
103            crate::ArkUINodeAttributeType::TextInputShowUnderline,
104        )
105    }
106
107    pub fn set_text_input_max_length<T: Into<crate::ArkUINodeAttributeItem>>(
108        &self,
109        value: T,
110    ) -> crate::ArkUIResult<()> {
111        <Self as crate::ArkUICommonAttribute>::set_attribute(
112            self,
113            crate::ArkUINodeAttributeType::TextInputMaxLength,
114            value.into(),
115        )
116    }
117
118    pub fn get_text_input_max_length(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
119        <Self as crate::ArkUICommonAttribute>::get_attribute(
120            self,
121            crate::ArkUINodeAttributeType::TextInputMaxLength,
122        )
123    }
124
125    pub fn set_text_input_enter_key_type<T: Into<crate::ArkUINodeAttributeItem>>(
126        &self,
127        value: T,
128    ) -> crate::ArkUIResult<()> {
129        <Self as crate::ArkUICommonAttribute>::set_attribute(
130            self,
131            crate::ArkUINodeAttributeType::TextInputEnterKeyType,
132            value.into(),
133        )
134    }
135
136    pub fn get_text_input_enter_key_type(
137        &self,
138    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
139        <Self as crate::ArkUICommonAttribute>::get_attribute(
140            self,
141            crate::ArkUINodeAttributeType::TextInputEnterKeyType,
142        )
143    }
144
145    pub fn set_text_input_placeholder_color<T: Into<crate::ArkUINodeAttributeItem>>(
146        &self,
147        value: T,
148    ) -> crate::ArkUIResult<()> {
149        <Self as crate::ArkUICommonAttribute>::set_attribute(
150            self,
151            crate::ArkUINodeAttributeType::TextInputPlaceholderColor,
152            value.into(),
153        )
154    }
155
156    pub fn get_text_input_placeholder_color(
157        &self,
158    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
159        <Self as crate::ArkUICommonAttribute>::get_attribute(
160            self,
161            crate::ArkUINodeAttributeType::TextInputPlaceholderColor,
162        )
163    }
164
165    pub fn set_text_input_placeholder_font<T: Into<crate::ArkUINodeAttributeItem>>(
166        &self,
167        value: T,
168    ) -> crate::ArkUIResult<()> {
169        <Self as crate::ArkUICommonAttribute>::set_attribute(
170            self,
171            crate::ArkUINodeAttributeType::TextInputPlaceholderFont,
172            value.into(),
173        )
174    }
175
176    pub fn get_text_input_placeholder_font(
177        &self,
178    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
179        <Self as crate::ArkUICommonAttribute>::get_attribute(
180            self,
181            crate::ArkUINodeAttributeType::TextInputPlaceholderFont,
182        )
183    }
184
185    pub fn set_text_input_enable_keyboard_on_focus<T: Into<crate::ArkUINodeAttributeItem>>(
186        &self,
187        value: T,
188    ) -> crate::ArkUIResult<()> {
189        <Self as crate::ArkUICommonAttribute>::set_attribute(
190            self,
191            crate::ArkUINodeAttributeType::TextInputEnableKeyboardOnFocus,
192            value.into(),
193        )
194    }
195
196    pub fn get_text_input_enable_keyboard_on_focus(
197        &self,
198    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
199        <Self as crate::ArkUICommonAttribute>::get_attribute(
200            self,
201            crate::ArkUINodeAttributeType::TextInputEnableKeyboardOnFocus,
202        )
203    }
204
205    pub fn set_text_input_type<T: Into<crate::ArkUINodeAttributeItem>>(
206        &self,
207        value: T,
208    ) -> crate::ArkUIResult<()> {
209        <Self as crate::ArkUICommonAttribute>::set_attribute(
210            self,
211            crate::ArkUINodeAttributeType::TextInputType,
212            value.into(),
213        )
214    }
215
216    pub fn get_text_input_type(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
217        <Self as crate::ArkUICommonAttribute>::get_attribute(
218            self,
219            crate::ArkUINodeAttributeType::TextInputType,
220        )
221    }
222
223    pub fn set_text_input_selected_background_color<T: Into<crate::ArkUINodeAttributeItem>>(
224        &self,
225        value: T,
226    ) -> crate::ArkUIResult<()> {
227        <Self as crate::ArkUICommonAttribute>::set_attribute(
228            self,
229            crate::ArkUINodeAttributeType::TextInputSelectedBackgroundColor,
230            value.into(),
231        )
232    }
233
234    pub fn get_text_input_selected_background_color(
235        &self,
236    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
237        <Self as crate::ArkUICommonAttribute>::get_attribute(
238            self,
239            crate::ArkUINodeAttributeType::TextInputSelectedBackgroundColor,
240        )
241    }
242
243    pub fn set_text_input_show_password_icon<T: Into<crate::ArkUINodeAttributeItem>>(
244        &self,
245        value: T,
246    ) -> crate::ArkUIResult<()> {
247        <Self as crate::ArkUICommonAttribute>::set_attribute(
248            self,
249            crate::ArkUINodeAttributeType::TextInputShowPasswordIcon,
250            value.into(),
251        )
252    }
253
254    pub fn get_text_input_show_password_icon(
255        &self,
256    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
257        <Self as crate::ArkUICommonAttribute>::get_attribute(
258            self,
259            crate::ArkUINodeAttributeType::TextInputShowPasswordIcon,
260        )
261    }
262
263    pub fn set_text_input_editing<T: Into<crate::ArkUINodeAttributeItem>>(
264        &self,
265        value: T,
266    ) -> crate::ArkUIResult<()> {
267        <Self as crate::ArkUICommonAttribute>::set_attribute(
268            self,
269            crate::ArkUINodeAttributeType::TextInputEditing,
270            value.into(),
271        )
272    }
273
274    pub fn get_text_input_editing(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
275        <Self as crate::ArkUICommonAttribute>::get_attribute(
276            self,
277            crate::ArkUINodeAttributeType::TextInputEditing,
278        )
279    }
280
281    pub fn set_text_input_cancel_button<T: Into<crate::ArkUINodeAttributeItem>>(
282        &self,
283        value: T,
284    ) -> crate::ArkUIResult<()> {
285        <Self as crate::ArkUICommonAttribute>::set_attribute(
286            self,
287            crate::ArkUINodeAttributeType::TextInputCancelButton,
288            value.into(),
289        )
290    }
291
292    pub fn get_text_input_cancel_button(
293        &self,
294    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
295        <Self as crate::ArkUICommonAttribute>::get_attribute(
296            self,
297            crate::ArkUINodeAttributeType::TextInputCancelButton,
298        )
299    }
300
301    pub fn set_text_input_text_selection<T: Into<crate::ArkUINodeAttributeItem>>(
302        &self,
303        value: T,
304    ) -> crate::ArkUIResult<()> {
305        <Self as crate::ArkUICommonAttribute>::set_attribute(
306            self,
307            crate::ArkUINodeAttributeType::TextInputTextSelection,
308            value.into(),
309        )
310    }
311
312    pub fn get_text_input_text_selection(
313        &self,
314    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
315        <Self as crate::ArkUICommonAttribute>::get_attribute(
316            self,
317            crate::ArkUINodeAttributeType::TextInputTextSelection,
318        )
319    }
320
321    pub fn set_text_input_underline_color<T: Into<crate::ArkUINodeAttributeItem>>(
322        &self,
323        value: T,
324    ) -> crate::ArkUIResult<()> {
325        <Self as crate::ArkUICommonAttribute>::set_attribute(
326            self,
327            crate::ArkUINodeAttributeType::TextInputUnderlineColor,
328            value.into(),
329        )
330    }
331
332    pub fn get_text_input_underline_color(
333        &self,
334    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
335        <Self as crate::ArkUICommonAttribute>::get_attribute(
336            self,
337            crate::ArkUINodeAttributeType::TextInputUnderlineColor,
338        )
339    }
340
341    pub fn set_text_input_enable_auto_fill<T: Into<crate::ArkUINodeAttributeItem>>(
342        &self,
343        value: T,
344    ) -> crate::ArkUIResult<()> {
345        <Self as crate::ArkUICommonAttribute>::set_attribute(
346            self,
347            crate::ArkUINodeAttributeType::TextInputEnableAutoFill,
348            value.into(),
349        )
350    }
351
352    pub fn get_text_input_enable_auto_fill(
353        &self,
354    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
355        <Self as crate::ArkUICommonAttribute>::get_attribute(
356            self,
357            crate::ArkUINodeAttributeType::TextInputEnableAutoFill,
358        )
359    }
360
361    pub fn set_text_input_content_type<T: Into<crate::ArkUINodeAttributeItem>>(
362        &self,
363        value: T,
364    ) -> crate::ArkUIResult<()> {
365        <Self as crate::ArkUICommonAttribute>::set_attribute(
366            self,
367            crate::ArkUINodeAttributeType::TextInputContentType,
368            value.into(),
369        )
370    }
371
372    pub fn get_text_input_content_type(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
373        <Self as crate::ArkUICommonAttribute>::get_attribute(
374            self,
375            crate::ArkUINodeAttributeType::TextInputContentType,
376        )
377    }
378
379    pub fn set_text_input_password_rules<T: Into<crate::ArkUINodeAttributeItem>>(
380        &self,
381        value: T,
382    ) -> crate::ArkUIResult<()> {
383        <Self as crate::ArkUICommonAttribute>::set_attribute(
384            self,
385            crate::ArkUINodeAttributeType::TextInputPasswordRules,
386            value.into(),
387        )
388    }
389
390    pub fn get_text_input_password_rules(
391        &self,
392    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
393        <Self as crate::ArkUICommonAttribute>::get_attribute(
394            self,
395            crate::ArkUINodeAttributeType::TextInputPasswordRules,
396        )
397    }
398
399    pub fn set_text_input_select_all<T: Into<crate::ArkUINodeAttributeItem>>(
400        &self,
401        value: T,
402    ) -> crate::ArkUIResult<()> {
403        <Self as crate::ArkUICommonAttribute>::set_attribute(
404            self,
405            crate::ArkUINodeAttributeType::TextInputSelectAll,
406            value.into(),
407        )
408    }
409
410    pub fn get_text_input_select_all(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
411        <Self as crate::ArkUICommonAttribute>::get_attribute(
412            self,
413            crate::ArkUINodeAttributeType::TextInputSelectAll,
414        )
415    }
416
417    pub fn set_text_input_input_filter<T: Into<crate::ArkUINodeAttributeItem>>(
418        &self,
419        value: T,
420    ) -> crate::ArkUIResult<()> {
421        <Self as crate::ArkUICommonAttribute>::set_attribute(
422            self,
423            crate::ArkUINodeAttributeType::TextInputInputFilter,
424            value.into(),
425        )
426    }
427
428    pub fn get_text_input_input_filter(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
429        <Self as crate::ArkUICommonAttribute>::get_attribute(
430            self,
431            crate::ArkUINodeAttributeType::TextInputInputFilter,
432        )
433    }
434
435    pub fn set_text_input_style<T: Into<crate::ArkUINodeAttributeItem>>(
436        &self,
437        value: T,
438    ) -> crate::ArkUIResult<()> {
439        <Self as crate::ArkUICommonAttribute>::set_attribute(
440            self,
441            crate::ArkUINodeAttributeType::TextInputStyle,
442            value.into(),
443        )
444    }
445
446    pub fn get_text_input_style(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
447        <Self as crate::ArkUICommonAttribute>::get_attribute(
448            self,
449            crate::ArkUINodeAttributeType::TextInputStyle,
450        )
451    }
452
453    pub fn set_text_input_caret_offset<T: Into<crate::ArkUINodeAttributeItem>>(
454        &self,
455        value: T,
456    ) -> crate::ArkUIResult<()> {
457        <Self as crate::ArkUICommonAttribute>::set_attribute(
458            self,
459            crate::ArkUINodeAttributeType::TextInputCaretOffset,
460            value.into(),
461        )
462    }
463
464    pub fn get_text_input_caret_offset(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
465        <Self as crate::ArkUICommonAttribute>::get_attribute(
466            self,
467            crate::ArkUINodeAttributeType::TextInputCaretOffset,
468        )
469    }
470
471    pub fn set_text_input_content_rect<T: Into<crate::ArkUINodeAttributeItem>>(
472        &self,
473        value: T,
474    ) -> crate::ArkUIResult<()> {
475        <Self as crate::ArkUICommonAttribute>::set_attribute(
476            self,
477            crate::ArkUINodeAttributeType::TextInputContentRect,
478            value.into(),
479        )
480    }
481
482    pub fn get_text_input_content_rect(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
483        <Self as crate::ArkUICommonAttribute>::get_attribute(
484            self,
485            crate::ArkUINodeAttributeType::TextInputContentRect,
486        )
487    }
488
489    pub fn set_text_input_content_line_count<T: Into<crate::ArkUINodeAttributeItem>>(
490        &self,
491        value: T,
492    ) -> crate::ArkUIResult<()> {
493        <Self as crate::ArkUICommonAttribute>::set_attribute(
494            self,
495            crate::ArkUINodeAttributeType::TextInputContentLineCount,
496            value.into(),
497        )
498    }
499
500    pub fn get_text_input_content_line_count(
501        &self,
502    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
503        <Self as crate::ArkUICommonAttribute>::get_attribute(
504            self,
505            crate::ArkUINodeAttributeType::TextInputContentLineCount,
506        )
507    }
508
509    pub fn set_text_input_selection_menu_hidden<T: Into<crate::ArkUINodeAttributeItem>>(
510        &self,
511        value: T,
512    ) -> crate::ArkUIResult<()> {
513        <Self as crate::ArkUICommonAttribute>::set_attribute(
514            self,
515            crate::ArkUINodeAttributeType::TextInputSelectionMenuHidden,
516            value.into(),
517        )
518    }
519
520    pub fn get_text_input_selection_menu_hidden(
521        &self,
522    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
523        <Self as crate::ArkUICommonAttribute>::get_attribute(
524            self,
525            crate::ArkUINodeAttributeType::TextInputSelectionMenuHidden,
526        )
527    }
528
529    pub fn set_text_input_blur_on_submit<T: Into<crate::ArkUINodeAttributeItem>>(
530        &self,
531        value: T,
532    ) -> crate::ArkUIResult<()> {
533        <Self as crate::ArkUICommonAttribute>::set_attribute(
534            self,
535            crate::ArkUINodeAttributeType::TextInputBlurOnSubmit,
536            value.into(),
537        )
538    }
539
540    pub fn get_text_input_blur_on_submit(
541        &self,
542    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
543        <Self as crate::ArkUICommonAttribute>::get_attribute(
544            self,
545            crate::ArkUINodeAttributeType::TextInputBlurOnSubmit,
546        )
547    }
548
549    pub fn set_text_input_custom_keyboard<T: Into<crate::ArkUINodeAttributeItem>>(
550        &self,
551        value: T,
552    ) -> crate::ArkUIResult<()> {
553        <Self as crate::ArkUICommonAttribute>::set_attribute(
554            self,
555            crate::ArkUINodeAttributeType::TextInputCustomKeyboard,
556            value.into(),
557        )
558    }
559
560    pub fn get_text_input_custom_keyboard(
561        &self,
562    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
563        <Self as crate::ArkUICommonAttribute>::get_attribute(
564            self,
565            crate::ArkUINodeAttributeType::TextInputCustomKeyboard,
566        )
567    }
568
569    pub fn set_text_input_word_break<T: Into<crate::ArkUINodeAttributeItem>>(
570        &self,
571        value: T,
572    ) -> crate::ArkUIResult<()> {
573        <Self as crate::ArkUICommonAttribute>::set_attribute(
574            self,
575            crate::ArkUINodeAttributeType::TextInputWordBreak,
576            value.into(),
577        )
578    }
579
580    pub fn get_text_input_word_break(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
581        <Self as crate::ArkUICommonAttribute>::get_attribute(
582            self,
583            crate::ArkUINodeAttributeType::TextInputWordBreak,
584        )
585    }
586
587    pub fn set_text_input_show_keyboard_on_focus<T: Into<crate::ArkUINodeAttributeItem>>(
588        &self,
589        value: T,
590    ) -> crate::ArkUIResult<()> {
591        <Self as crate::ArkUICommonAttribute>::set_attribute(
592            self,
593            crate::ArkUINodeAttributeType::TextInputShowKeyboardOnFocus,
594            value.into(),
595        )
596    }
597
598    pub fn get_text_input_show_keyboard_on_focus(
599        &self,
600    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
601        <Self as crate::ArkUICommonAttribute>::get_attribute(
602            self,
603            crate::ArkUINodeAttributeType::TextInputShowKeyboardOnFocus,
604        )
605    }
606
607    pub fn set_text_input_number_of_lines<T: Into<crate::ArkUINodeAttributeItem>>(
608        &self,
609        value: T,
610    ) -> crate::ArkUIResult<()> {
611        <Self as crate::ArkUICommonAttribute>::set_attribute(
612            self,
613            crate::ArkUINodeAttributeType::TextInputNumberOfLines,
614            value.into(),
615        )
616    }
617
618    pub fn get_text_input_number_of_lines(
619        &self,
620    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
621        <Self as crate::ArkUICommonAttribute>::get_attribute(
622            self,
623            crate::ArkUINodeAttributeType::TextInputNumberOfLines,
624        )
625    }
626
627    #[cfg(feature = "api-20")]
628    pub fn set_text_input_enable_fill_animation<T: Into<crate::ArkUINodeAttributeItem>>(
629        &self,
630        value: T,
631    ) -> crate::ArkUIResult<()> {
632        <Self as crate::ArkUICommonAttribute>::set_attribute(
633            self,
634            crate::ArkUINodeAttributeType::TextInputEnableFillAnimation,
635            value.into(),
636        )
637    }
638
639    #[cfg(feature = "api-20")]
640    pub fn get_text_input_enable_fill_animation(
641        &self,
642    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
643        <Self as crate::ArkUICommonAttribute>::get_attribute(
644            self,
645            crate::ArkUINodeAttributeType::TextInputEnableFillAnimation,
646        )
647    }
648
649    #[cfg(feature = "api-15")]
650    pub fn set_text_input_enable_preview_text<T: Into<crate::ArkUINodeAttributeItem>>(
651        &self,
652        value: T,
653    ) -> crate::ArkUIResult<()> {
654        <Self as crate::ArkUICommonAttribute>::set_attribute(
655            self,
656            crate::ArkUINodeAttributeType::TextInputEnablePreviewText,
657            value.into(),
658        )
659    }
660
661    #[cfg(feature = "api-15")]
662    pub fn get_text_input_enable_preview_text(
663        &self,
664    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
665        <Self as crate::ArkUICommonAttribute>::get_attribute(
666            self,
667            crate::ArkUINodeAttributeType::TextInputEnablePreviewText,
668        )
669    }
670
671    #[cfg(feature = "api-22")]
672    pub fn set_text_input_enable_selected_data_detector<T: Into<crate::ArkUINodeAttributeItem>>(
673        &self,
674        value: T,
675    ) -> crate::ArkUIResult<()> {
676        <Self as crate::ArkUICommonAttribute>::set_attribute(
677            self,
678            crate::ArkUINodeAttributeType::TextInputEnableSelectedDataDetector,
679            value.into(),
680        )
681    }
682
683    #[cfg(feature = "api-22")]
684    pub fn get_text_input_enable_selected_data_detector(
685        &self,
686    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
687        <Self as crate::ArkUICommonAttribute>::get_attribute(
688            self,
689            crate::ArkUINodeAttributeType::TextInputEnableSelectedDataDetector,
690        )
691    }
692
693    #[cfg(feature = "api-18")]
694    pub fn set_text_input_half_leading<T: Into<crate::ArkUINodeAttributeItem>>(
695        &self,
696        value: T,
697    ) -> crate::ArkUIResult<()> {
698        <Self as crate::ArkUICommonAttribute>::set_attribute(
699            self,
700            crate::ArkUINodeAttributeType::TextInputHalfLeading,
701            value.into(),
702        )
703    }
704
705    #[cfg(feature = "api-18")]
706    pub fn get_text_input_half_leading(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
707        <Self as crate::ArkUICommonAttribute>::get_attribute(
708            self,
709            crate::ArkUINodeAttributeType::TextInputHalfLeading,
710        )
711    }
712
713    #[cfg(feature = "api-15")]
714    pub fn set_text_input_keyboard_appearance<T: Into<crate::ArkUINodeAttributeItem>>(
715        &self,
716        value: T,
717    ) -> crate::ArkUIResult<()> {
718        <Self as crate::ArkUICommonAttribute>::set_attribute(
719            self,
720            crate::ArkUINodeAttributeType::TextInputKeyboardAppearance,
721            value.into(),
722        )
723    }
724
725    #[cfg(feature = "api-15")]
726    pub fn get_text_input_keyboard_appearance(
727        &self,
728    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
729        <Self as crate::ArkUICommonAttribute>::get_attribute(
730            self,
731            crate::ArkUINodeAttributeType::TextInputKeyboardAppearance,
732        )
733    }
734
735    #[cfg(feature = "api-15")]
736    pub fn set_text_input_letter_spacing<T: Into<crate::ArkUINodeAttributeItem>>(
737        &self,
738        value: T,
739    ) -> crate::ArkUIResult<()> {
740        <Self as crate::ArkUICommonAttribute>::set_attribute(
741            self,
742            crate::ArkUINodeAttributeType::TextInputLetterSpacing,
743            value.into(),
744        )
745    }
746
747    #[cfg(feature = "api-15")]
748    pub fn get_text_input_letter_spacing(
749        &self,
750    ) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
751        <Self as crate::ArkUICommonAttribute>::get_attribute(
752            self,
753            crate::ArkUINodeAttributeType::TextInputLetterSpacing,
754        )
755    }
756
757    #[cfg(feature = "api-20")]
758    pub fn set_text_input_line_height<T: Into<crate::ArkUINodeAttributeItem>>(
759        &self,
760        value: T,
761    ) -> crate::ArkUIResult<()> {
762        <Self as crate::ArkUICommonAttribute>::set_attribute(
763            self,
764            crate::ArkUINodeAttributeType::TextInputLineHeight,
765            value.into(),
766        )
767    }
768
769    #[cfg(feature = "api-20")]
770    pub fn get_text_input_line_height(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
771        <Self as crate::ArkUICommonAttribute>::get_attribute(
772            self,
773            crate::ArkUINodeAttributeType::TextInputLineHeight,
774        )
775    }
776
777    #[cfg(feature = "api-22")]
778    pub fn set_text_input_show_counter<T: Into<crate::ArkUINodeAttributeItem>>(
779        &self,
780        value: T,
781    ) -> crate::ArkUIResult<()> {
782        <Self as crate::ArkUICommonAttribute>::set_attribute(
783            self,
784            crate::ArkUINodeAttributeType::TextInputShowCounter,
785            value.into(),
786        )
787    }
788
789    #[cfg(feature = "api-22")]
790    pub fn get_text_input_show_counter(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
791        <Self as crate::ArkUICommonAttribute>::get_attribute(
792            self,
793            crate::ArkUINodeAttributeType::TextInputShowCounter,
794        )
795    }
796}
797// END_GENERATED_COMPONENT_METHODS_TextInput
798
799impl super::TextInput {
800    pub fn on_text_input_change<T: Fn(String) + 'static>(&mut self, cb: T) {
801        crate::ArkUIEvent::on_event(
802            self,
803            crate::NodeEventType::TextInputOnChange,
804            move |event| {
805                cb(event.async_string().unwrap_or_default());
806            },
807        );
808    }
809
810    pub fn on_text_input_submit<T: Fn(i32) + 'static>(&mut self, cb: T) {
811        crate::ArkUIEvent::on_event(
812            self,
813            crate::NodeEventType::TextInputOnSubmit,
814            move |event| {
815                cb(event.i32_value(0).unwrap_or_default());
816            },
817        );
818    }
819
820    pub fn on_text_input_cut<T: Fn(String) + 'static>(&mut self, cb: T) {
821        crate::ArkUIEvent::on_event(self, crate::NodeEventType::TextInputOnCut, move |event| {
822            cb(event.async_string().unwrap_or_default());
823        });
824    }
825
826    pub fn on_text_input_paste<T: Fn(String) + 'static>(&mut self, cb: T) {
827        crate::ArkUIEvent::on_event(self, crate::NodeEventType::TextInputOnPaste, move |event| {
828            cb(event.async_string().unwrap_or_default());
829        });
830    }
831
832    pub fn on_text_input_selection_change<T: Fn(i32, i32) + 'static>(&mut self, cb: T) {
833        crate::ArkUIEvent::on_event(
834            self,
835            crate::NodeEventType::TextInputOnTextSelectionChange,
836            move |event| {
837                cb(
838                    event.i32_value(0).unwrap_or_default(),
839                    event.i32_value(1).unwrap_or_default(),
840                );
841            },
842        );
843    }
844
845    pub fn on_text_input_edit_change<T: Fn(bool) + 'static>(&mut self, cb: T) {
846        crate::ArkUIEvent::on_event(
847            self,
848            crate::NodeEventType::TextInputOnEditChange,
849            move |event| {
850                cb(event.i32_value(0).unwrap_or_default() != 0);
851            },
852        );
853    }
854
855    pub fn on_text_input_content_size_change<T: Fn(f32, f32) + 'static>(&mut self, cb: T) {
856        crate::ArkUIEvent::on_event(
857            self,
858            crate::NodeEventType::TextInputOnContentSizeChange,
859            move |event| {
860                cb(
861                    event.f32_value(0).unwrap_or_default(),
862                    event.f32_value(1).unwrap_or_default(),
863                );
864            },
865        );
866    }
867
868    pub fn on_text_input_input_filter_error<T: Fn(String) + 'static>(&mut self, cb: T) {
869        crate::ArkUIEvent::on_event(
870            self,
871            crate::NodeEventType::TextInputOnInputFilterError,
872            move |event| {
873                cb(event.async_string().unwrap_or_default());
874            },
875        );
876    }
877
878    pub fn on_text_input_content_scroll<T: Fn(i32, i32) + 'static>(&mut self, cb: T) {
879        crate::ArkUIEvent::on_event(
880            self,
881            crate::NodeEventType::TextInputOnContentScroll,
882            move |event| {
883                cb(
884                    event.i32_value(0).unwrap_or_default(),
885                    event.i32_value(1).unwrap_or_default(),
886                );
887            },
888        );
889    }
890
891    pub fn on_text_input_will_insert<T: Fn(f32, String) -> bool + 'static>(&mut self, cb: T) {
892        crate::ArkUIEvent::on_event(
893            self,
894            crate::NodeEventType::TextInputOnWillInsert,
895            move |event| {
896                let should_insert = cb(
897                    event.f32_value(0).unwrap_or_default(),
898                    event.string_value(0).unwrap_or_default(),
899                );
900                let _ = event.set_return_bool(should_insert);
901            },
902        );
903    }
904
905    pub fn on_text_input_did_insert<T: Fn(f32, String) + 'static>(&mut self, cb: T) {
906        crate::ArkUIEvent::on_event(
907            self,
908            crate::NodeEventType::TextInputOnDidInsert,
909            move |event| {
910                cb(
911                    event.f32_value(0).unwrap_or_default(),
912                    event.string_value(0).unwrap_or_default(),
913                );
914            },
915        );
916    }
917
918    pub fn on_text_input_will_delete<T: Fn(f32, i32, String) -> bool + 'static>(&mut self, cb: T) {
919        crate::ArkUIEvent::on_event(
920            self,
921            crate::NodeEventType::TextInputOnWillDelete,
922            move |event| {
923                let should_delete = cb(
924                    event.f32_value(0).unwrap_or_default(),
925                    event.i32_value(1).unwrap_or_default(),
926                    event.string_value(0).unwrap_or_default(),
927                );
928                let _ = event.set_return_bool(should_delete);
929            },
930        );
931    }
932
933    pub fn on_text_input_did_delete<T: Fn(f32, i32, String) + 'static>(&mut self, cb: T) {
934        crate::ArkUIEvent::on_event(
935            self,
936            crate::NodeEventType::TextInputOnDidDelete,
937            move |event| {
938                cb(
939                    event.f32_value(0).unwrap_or_default(),
940                    event.i32_value(1).unwrap_or_default(),
941                    event.string_value(0).unwrap_or_default(),
942                );
943            },
944        );
945    }
946
947    #[cfg(feature = "api-15")]
948    pub fn on_text_input_change_with_preview_text<T: Fn(crate::TextChangeEventData) + 'static>(
949        &mut self,
950        cb: T,
951    ) {
952        crate::ArkUIEvent::on_event(
953            self,
954            crate::NodeEventType::TextInputOnChangeWithPreviewText,
955            move |event| {
956                if let Some(data) = event.text_change() {
957                    cb(data);
958                }
959            },
960        );
961    }
962
963    #[cfg(feature = "api-20")]
964    pub fn on_text_input_will_change<T: Fn(crate::TextChangeEventData) + 'static>(
965        &mut self,
966        cb: T,
967    ) {
968        crate::ArkUIEvent::on_event(
969            self,
970            crate::NodeEventType::TextInputOnWillChange,
971            move |event| {
972                if let Some(data) = event.text_change() {
973                    cb(data);
974                }
975            },
976        );
977    }
978}