Skip to main content

gtk4/auto/
editable.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5#[cfg(feature = "v4_10")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
7use crate::{Accessible, AccessiblePlatformState};
8use crate::{Buildable, ConstraintTarget, Widget, ffi};
9use glib::{
10    object::ObjectType as _,
11    prelude::*,
12    signal::{SignalHandlerId, connect_raw},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17#[cfg(feature = "v4_10")]
18#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
19glib::wrapper! {
20    /// text_widget, gtk_widget_unparent);
21    ///   ...
22    /// }
23    /// ```text
24    ///
25    /// Finally, use [func@Gtk.Editable.delegate_set_property] in your `set_property`
26    /// function (and similar for `get_property`), to set the editable properties:
27    ///
28    /// ```c
29    ///   ...
30    ///   if (gtk_editable_delegate_set_property (object, prop_id, value, pspec))
31    ///     return;
32    ///
33    ///   switch (prop_id)
34    ///   ...
35    /// ```text
36    ///
37    /// It is important to note that if you create a [`Editable`][crate::Editable] that uses
38    /// a delegate, the low level [`insert-text`][struct@crate::Editable#insert-text] and
39    /// [`delete-text`][struct@crate::Editable#delete-text] signals will be propagated from the
40    /// "wrapper" editable to the delegate, but they will not be propagated from
41    /// the delegate to the "wrapper" editable, as they would cause an infinite
42    /// recursion. If you wish to connect to the [`insert-text`][struct@crate::Editable#insert-text]
43    /// and [`delete-text`][struct@crate::Editable#delete-text] signals, you will need to connect
44    /// to them on the delegate obtained via [`EditableExt::delegate()`][crate::prelude::EditableExt::delegate()].
45    ///
46    /// ## Properties
47    ///
48    ///
49    /// #### `complete-text`
50    ///  The contents of the entry, including uncommited content such as the
51    /// preedit.
52    ///
53    /// Readable
54    ///
55    ///
56    /// #### `cursor-position`
57    ///  The current position of the insertion cursor in chars.
58    ///
59    /// Readable
60    ///
61    ///
62    /// #### `editable`
63    ///  Whether the entry contents can be edited.
64    ///
65    /// Readable | Writable
66    ///
67    ///
68    /// #### `enable-undo`
69    ///  If undo/redo should be enabled for the editable.
70    ///
71    /// Readable | Writable
72    ///
73    ///
74    /// #### `input-interceptor`
75    ///  The widget used to intercept input for this editable
76    ///
77    /// Readable | Writable
78    ///
79    ///
80    /// #### `max-width-chars`
81    ///  The desired maximum width of the entry, in characters.
82    ///
83    /// Readable | Writable
84    ///
85    ///
86    /// #### `selection-bound`
87    ///  The position of the opposite end of the selection from the cursor in chars.
88    ///
89    /// Readable
90    ///
91    ///
92    /// #### `text`
93    ///  The contents of the entry.
94    ///
95    /// Readable | Writable
96    ///
97    ///
98    /// #### `width-chars`
99    ///  Number of characters to leave space for in the entry.
100    ///
101    /// Readable | Writable
102    ///
103    ///
104    /// #### `xalign`
105    ///  The horizontal alignment, from 0 (left) to 1 (right).
106    ///
107    /// Reversed for RTL layouts.
108    ///
109    /// Readable | Writable
110    /// <details><summary><h4>Widget</h4></summary>
111    ///
112    ///
113    /// #### `can-focus`
114    ///  Whether the widget or any of its descendents can accept
115    /// the input focus.
116    ///
117    /// This property is meant to be set by widget implementations,
118    /// typically in their instance init function.
119    ///
120    /// Readable | Writable
121    ///
122    ///
123    /// #### `can-target`
124    ///  Whether the widget can receive pointer events.
125    ///
126    /// Readable | Writable
127    ///
128    ///
129    /// #### `css-classes`
130    ///  A list of css classes applied to this widget.
131    ///
132    /// Readable | Writable
133    ///
134    ///
135    /// #### `css-name`
136    ///  The name of this widget in the CSS tree.
137    ///
138    /// This property is meant to be set by widget implementations,
139    /// typically in their instance init function.
140    ///
141    /// Readable | Writable | Construct Only
142    ///
143    ///
144    /// #### `cursor`
145    ///  The cursor used by @widget.
146    ///
147    /// Readable | Writable
148    ///
149    ///
150    /// #### `focus-on-click`
151    ///  Whether the widget should grab focus when it is clicked with the mouse.
152    ///
153    /// This property is only relevant for widgets that can take focus.
154    ///
155    /// Readable | Writable
156    ///
157    ///
158    /// #### `focusable`
159    ///  Whether this widget itself will accept the input focus.
160    ///
161    /// Readable | Writable
162    ///
163    ///
164    /// #### `halign`
165    ///  How to distribute horizontal space if widget gets extra space.
166    ///
167    /// Readable | Writable
168    ///
169    ///
170    /// #### `has-default`
171    ///  Whether the widget is the default widget.
172    ///
173    /// Readable
174    ///
175    ///
176    /// #### `has-focus`
177    ///  Whether the widget has the input focus.
178    ///
179    /// Readable
180    ///
181    ///
182    /// #### `has-tooltip`
183    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
184    /// signal on @widget.
185    ///
186    /// A true value indicates that @widget can have a tooltip, in this case
187    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
188    /// determine whether it will provide a tooltip or not.
189    ///
190    /// Readable | Writable
191    ///
192    ///
193    /// #### `height-request`
194    ///  Overrides for height request of the widget.
195    ///
196    /// If this is -1, the natural request will be used.
197    ///
198    /// Readable | Writable
199    ///
200    ///
201    /// #### `hexpand`
202    ///  Whether to expand horizontally.
203    ///
204    /// Readable | Writable
205    ///
206    ///
207    /// #### `hexpand-set`
208    ///  Whether to use the `hexpand` property.
209    ///
210    /// Readable | Writable
211    ///
212    ///
213    /// #### `layout-manager`
214    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
215    /// the preferred size of the widget, and allocate its children.
216    ///
217    /// This property is meant to be set by widget implementations,
218    /// typically in their instance init function.
219    ///
220    /// Readable | Writable
221    ///
222    ///
223    /// #### `limit-events`
224    ///  Makes this widget act like a modal dialog, with respect to
225    /// event delivery.
226    ///
227    /// Global event controllers will not handle events with targets
228    /// inside the widget, unless they are set up to ignore propagation
229    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
230    ///
231    /// Readable | Writable
232    ///
233    ///
234    /// #### `margin-bottom`
235    ///  Margin on bottom side of widget.
236    ///
237    /// This property adds margin outside of the widget's normal size
238    /// request, the margin will be added in addition to the size from
239    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
240    ///
241    /// Readable | Writable
242    ///
243    ///
244    /// #### `margin-end`
245    ///  Margin on end of widget, horizontally.
246    ///
247    /// This property supports left-to-right and right-to-left text
248    /// directions.
249    ///
250    /// This property adds margin outside of the widget's normal size
251    /// request, the margin will be added in addition to the size from
252    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
253    ///
254    /// Readable | Writable
255    ///
256    ///
257    /// #### `margin-start`
258    ///  Margin on start of widget, horizontally.
259    ///
260    /// This property supports left-to-right and right-to-left text
261    /// directions.
262    ///
263    /// This property adds margin outside of the widget's normal size
264    /// request, the margin will be added in addition to the size from
265    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
266    ///
267    /// Readable | Writable
268    ///
269    ///
270    /// #### `margin-top`
271    ///  Margin on top side of widget.
272    ///
273    /// This property adds margin outside of the widget's normal size
274    /// request, the margin will be added in addition to the size from
275    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
276    ///
277    /// Readable | Writable
278    ///
279    ///
280    /// #### `name`
281    ///  The name of the widget.
282    ///
283    /// Readable | Writable
284    ///
285    ///
286    /// #### `opacity`
287    ///  The requested opacity of the widget.
288    ///
289    /// Readable | Writable
290    ///
291    ///
292    /// #### `overflow`
293    ///  How content outside the widget's content area is treated.
294    ///
295    /// This property is meant to be set by widget implementations,
296    /// typically in their instance init function.
297    ///
298    /// Readable | Writable
299    ///
300    ///
301    /// #### `parent`
302    ///  The parent widget of this widget.
303    ///
304    /// Readable
305    ///
306    ///
307    /// #### `receives-default`
308    ///  Whether the widget will receive the default action when it is focused.
309    ///
310    /// Readable | Writable
311    ///
312    ///
313    /// #### `root`
314    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
315    ///
316    /// This will be `NULL` if the widget is not contained in a root widget.
317    ///
318    /// Readable
319    ///
320    ///
321    /// #### `scale-factor`
322    ///  The scale factor of the widget.
323    ///
324    /// Readable
325    ///
326    ///
327    /// #### `sensitive`
328    ///  Whether the widget responds to input.
329    ///
330    /// Readable | Writable
331    ///
332    ///
333    /// #### `tooltip-markup`
334    ///  Sets the text of tooltip to be the given string, which is marked up
335    /// with Pango markup.
336    ///
337    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
338    ///
339    /// This is a convenience property which will take care of getting the
340    /// tooltip shown if the given string is not `NULL`:
341    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
342    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
343    /// the default signal handler.
344    ///
345    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
346    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
347    ///
348    /// Readable | Writable
349    ///
350    ///
351    /// #### `tooltip-text`
352    ///  Sets the text of tooltip to be the given string.
353    ///
354    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
355    ///
356    /// This is a convenience property which will take care of getting the
357    /// tooltip shown if the given string is not `NULL`:
358    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
359    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
360    /// the default signal handler.
361    ///
362    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
363    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
364    ///
365    /// Readable | Writable
366    ///
367    ///
368    /// #### `valign`
369    ///  How to distribute vertical space if widget gets extra space.
370    ///
371    /// Readable | Writable
372    ///
373    ///
374    /// #### `vexpand`
375    ///  Whether to expand vertically.
376    ///
377    /// Readable | Writable
378    ///
379    ///
380    /// #### `vexpand-set`
381    ///  Whether to use the `vexpand` property.
382    ///
383    /// Readable | Writable
384    ///
385    ///
386    /// #### `visible`
387    ///  Whether the widget is visible.
388    ///
389    /// Readable | Writable
390    ///
391    ///
392    /// #### `width-request`
393    ///  Overrides for width request of the widget.
394    ///
395    /// If this is -1, the natural request will be used.
396    ///
397    /// Readable | Writable
398    /// </details>
399    /// <details><summary><h4>Accessible</h4></summary>
400    ///
401    ///
402    /// #### `accessible-role`
403    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
404    ///
405    /// The accessible role cannot be changed once set.
406    ///
407    /// Readable | Writable
408    /// </details>
409    ///
410    /// ## Signals
411    ///
412    ///
413    /// #### `changed`
414    ///  Emitted at the end of a single user-visible operation on the
415    /// contents.
416    ///
417    /// E.g., a paste operation that replaces the contents of the
418    /// selection will cause only one signal emission (even though it
419    /// is implemented by first deleting the selection, then inserting
420    /// the new content, and may cause multiple ::notify::text signals
421    /// to be emitted).
422    ///
423    ///
424    ///
425    ///
426    /// #### `delete-text`
427    ///  Emitted when text is deleted from the widget by the user.
428    ///
429    /// The default handler for this signal will normally be responsible for
430    /// deleting the text, so by connecting to this signal and then stopping
431    /// the signal with g_signal_stop_emission(), it is possible to modify the
432    /// range of deleted text, or prevent it from being deleted entirely.
433    ///
434    /// The @start_pos and @end_pos parameters are interpreted as for
435    /// [`EditableExt::delete_text()`][crate::prelude::EditableExt::delete_text()].
436    ///
437    ///
438    ///
439    ///
440    /// #### `input-intercepted`
441    ///  Emitted whenever keyboard input has been handled through the
442    /// input interceptor widget set through [`EditableExt::set_input_interceptor()`][crate::prelude::EditableExt::set_input_interceptor()]
443    ///
444    /// A typical reaction to this event would be to show and focus @editable, so
445    /// that input is handled directly. In that case keyboard input will no longer
446    /// be handled through the input interceptor and this signal will stop being
447    /// emitted.
448    ///
449    ///
450    ///
451    ///
452    /// #### `insert-text`
453    ///  Emitted when text is inserted into the widget by the user.
454    ///
455    /// The default handler for this signal will normally be responsible
456    /// for inserting the text, so by connecting to this signal and then
457    /// stopping the signal with g_signal_stop_emission(), it is possible
458    /// to modify the inserted text, or prevent it from being inserted entirely.
459    ///
460    ///
461    /// <details><summary><h4>Widget</h4></summary>
462    ///
463    ///
464    /// #### `destroy`
465    ///  Signals that all holders of a reference to the widget should release
466    /// the reference that they hold.
467    ///
468    /// May result in finalization of the widget if all references are released.
469    ///
470    /// This signal is not suitable for saving widget state.
471    ///
472    ///
473    ///
474    ///
475    /// #### `direction-changed`
476    ///  Emitted when the text direction of a widget changes.
477    ///
478    ///
479    ///
480    ///
481    /// #### `hide`
482    ///  Emitted when @widget is hidden.
483    ///
484    ///
485    ///
486    ///
487    /// #### `keynav-failed`
488    ///  Emitted if keyboard navigation fails.
489    ///
490    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
491    ///
492    ///
493    ///
494    ///
495    /// #### `map`
496    ///  Emitted when @widget is going to be mapped.
497    ///
498    /// A widget is mapped when the widget is visible (which is controlled with
499    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
500    /// are also visible.
501    ///
502    /// The `::map` signal can be used to determine whether a widget will be drawn,
503    /// for instance it can resume an animation that was stopped during the
504    /// emission of [`unmap`][struct@crate::Widget#unmap].
505    ///
506    ///
507    ///
508    ///
509    /// #### `mnemonic-activate`
510    ///  Emitted when a widget is activated via a mnemonic.
511    ///
512    /// The default handler for this signal activates @widget if @group_cycling
513    /// is false, or just makes @widget grab focus if @group_cycling is true.
514    ///
515    ///
516    ///
517    ///
518    /// #### `move-focus`
519    ///   to move backward.
520    ///
521    /// Action
522    ///
523    ///
524    /// #### `query-tooltip`
525    ///  Emitted when the widget’s tooltip is about to be shown.
526    ///
527    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
528    /// is true and the hover timeout has expired with the cursor hovering
529    /// above @widget; or emitted when @widget got focus in keyboard mode.
530    ///
531    /// Using the given coordinates, the signal handler should determine
532    /// whether a tooltip should be shown for @widget. If this is the case
533    /// true should be returned, false otherwise. Note that if @keyboard_mode
534    /// is true, the values of @x and @y are undefined and should not be used.
535    ///
536    /// The signal handler is free to manipulate @tooltip with the therefore
537    /// destined function calls.
538    ///
539    ///
540    ///
541    ///
542    /// #### `realize`
543    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
544    ///
545    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
546    /// or the widget has been mapped (that is, it is going to be drawn).
547    ///
548    ///
549    ///
550    ///
551    /// #### `show`
552    ///  Emitted when @widget is shown.
553    ///
554    ///
555    ///
556    ///
557    /// #### `state-flags-changed`
558    ///  Emitted when the widget state changes.
559    ///
560    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
561    ///
562    ///
563    ///
564    ///
565    /// #### `unmap`
566    ///  Emitted when @widget is going to be unmapped.
567    ///
568    /// A widget is unmapped when either it or any of its parents up to the
569    /// toplevel widget have been set as hidden.
570    ///
571    /// As `::unmap` indicates that a widget will not be shown any longer,
572    /// it can be used to, for example, stop an animation on the widget.
573    ///
574    ///
575    ///
576    ///
577    /// #### `unrealize`
578    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
579    ///
580    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
581    /// or the widget has been unmapped (that is, it is going to be hidden).
582    ///
583    ///
584    /// </details>
585    ///
586    /// # Implements
587    ///
588    /// [`EditableExt`][trait@crate::prelude::EditableExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`EditableExtManual`][trait@crate::prelude::EditableExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
589    #[doc(alias = "GtkEditable")]
590    pub struct Editable(Interface<ffi::GtkEditable, ffi::GtkEditableInterface>) @requires Widget, Accessible, Buildable, ConstraintTarget;
591
592    match fn {
593        type_ => || ffi::gtk_editable_get_type(),
594    }
595}
596
597#[cfg(not(feature = "v4_10"))]
598glib::wrapper! {
599    #[doc(alias = "GtkEditable")]
600    pub struct Editable(Interface<ffi::GtkEditable, ffi::GtkEditableInterface>) @requires Widget, Buildable, ConstraintTarget;
601
602    match fn {
603        type_ => || ffi::gtk_editable_get_type(),
604    }
605}
606
607impl Editable {
608    pub const NONE: Option<&'static Editable> = None;
609}
610
611/// Trait containing all [`struct@Editable`] methods.
612///
613/// # Implementors
614///
615/// [`EditableLabel`][struct@crate::EditableLabel], [`Editable`][struct@crate::Editable], [`Entry`][struct@crate::Entry], [`PasswordEntry`][struct@crate::PasswordEntry], [`SearchEntry`][struct@crate::SearchEntry], [`SpinButton`][struct@crate::SpinButton], [`Text`][struct@crate::Text]
616pub trait EditableExt: IsA<Editable> + 'static {
617    /// get_platform_state = your_editable_get_accessible_platform_state;
618    /// }
619    ///
620    /// static gboolean
621    /// your_editable_get_accessible_platform_state (GtkAccessible *accessible,
622    ///                                              GtkAccessiblePlatformState state)
623    /// {
624    ///   return gtk_editable_delegate_get_accessible_platform_state (GTK_EDITABLE (accessible), state);
625    /// }
626    /// ```text
627    ///
628    /// Note that the widget which is the delegate *must* be a direct child of
629    /// this widget, otherwise your implementation of `vfunc::Gtk::Accessible::get_platform_state`
630    /// might not even be called, as the platform change will originate from
631    /// the parent of the delegate, and, as a result, will not work properly.
632    ///
633    /// So, if you can't ensure the direct child condition, you should give the
634    /// delegate the [`AccessibleRole::TextBox`][crate::AccessibleRole::TextBox] role, or you can
635    /// change your tree to allow this function to work.
636    /// ## `state`
637    /// what kind of accessible state to retrieve
638    ///
639    /// # Returns
640    ///
641    /// the accessible platform state of the delegate
642    #[cfg(feature = "v4_10")]
643    #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
644    #[doc(alias = "gtk_editable_delegate_get_accessible_platform_state")]
645    fn delegate_get_accessible_platform_state(&self, state: AccessiblePlatformState) -> bool {
646        unsafe {
647            from_glib(ffi::gtk_editable_delegate_get_accessible_platform_state(
648                self.as_ref().to_glib_none().0,
649                state.into_glib(),
650            ))
651        }
652    }
653
654    /// Deletes the currently selected text of the editable.
655    ///
656    /// This call doesn’t do anything if there is no selected text.
657    #[doc(alias = "gtk_editable_delete_selection")]
658    fn delete_selection(&self) {
659        unsafe {
660            ffi::gtk_editable_delete_selection(self.as_ref().to_glib_none().0);
661        }
662    }
663
664    /// Deletes a sequence of characters.
665    ///
666    /// The characters that are deleted are those characters at positions
667    /// from @start_pos up to, but not including @end_pos. If @end_pos is
668    /// negative, then the characters deleted are those from @start_pos to
669    /// the end of the text.
670    ///
671    /// Note that the positions are specified in characters, not bytes.
672    /// ## `start_pos`
673    /// start position
674    /// ## `end_pos`
675    /// end position
676    #[doc(alias = "gtk_editable_delete_text")]
677    fn delete_text(&self, start_pos: i32, end_pos: i32) {
678        unsafe {
679            ffi::gtk_editable_delete_text(self.as_ref().to_glib_none().0, start_pos, end_pos);
680        }
681    }
682
683    /// Undoes the setup done by [`init_delegate()`][Self::init_delegate()].
684    ///
685    /// This is a helper function that should be called from dispose,
686    /// before removing the delegate object.
687    #[doc(alias = "gtk_editable_finish_delegate")]
688    fn finish_delegate(&self) {
689        unsafe {
690            ffi::gtk_editable_finish_delegate(self.as_ref().to_glib_none().0);
691        }
692    }
693
694    /// Gets the alignment of the editable.
695    ///
696    /// # Returns
697    ///
698    /// the alignment
699    #[doc(alias = "gtk_editable_get_alignment")]
700    #[doc(alias = "get_alignment")]
701    #[doc(alias = "xalign")]
702    fn alignment(&self) -> f32 {
703        unsafe { ffi::gtk_editable_get_alignment(self.as_ref().to_glib_none().0) }
704    }
705
706    /// Retrieves a sequence of characters.
707    ///
708    /// The characters that are retrieved are those characters at positions
709    /// from @start_pos up to, but not including @end_pos. If @end_pos is negative,
710    /// then the characters retrieved are those characters from @start_pos to
711    /// the end of the text.
712    ///
713    /// Note that positions are specified in characters, not bytes.
714    /// ## `start_pos`
715    /// start of text
716    /// ## `end_pos`
717    /// end of text
718    ///
719    /// # Returns
720    ///
721    /// a pointer to the contents of the widget as a
722    ///   string. This string is allocated by the [`Editable`][crate::Editable] implementation
723    ///   and should be freed by the caller.
724    #[doc(alias = "gtk_editable_get_chars")]
725    #[doc(alias = "get_chars")]
726    fn chars(&self, start_pos: i32, end_pos: i32) -> glib::GString {
727        unsafe {
728            from_glib_full(ffi::gtk_editable_get_chars(
729                self.as_ref().to_glib_none().0,
730                start_pos,
731                end_pos,
732            ))
733        }
734    }
735
736    /// Retrieves the contents of @self, including *pseudo-content*
737    /// such as the preedit buffer.
738    ///
739    /// # Returns
740    ///
741    /// the complete contents of the editable
742    #[cfg(feature = "v4_24")]
743    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
744    #[doc(alias = "gtk_editable_get_complete_text")]
745    #[doc(alias = "get_complete_text")]
746    #[doc(alias = "complete-text")]
747    fn complete_text(&self) -> glib::GString {
748        unsafe {
749            from_glib_full(ffi::gtk_editable_get_complete_text(
750                self.as_ref().to_glib_none().0,
751            ))
752        }
753    }
754
755    /// Gets the [`Editable`][crate::Editable] that @self is delegating its
756    /// implementation to.
757    ///
758    /// Typically, the delegate is a [`Text`][crate::Text] widget.
759    ///
760    /// # Returns
761    ///
762    /// the delegate [`Editable`][crate::Editable]
763    #[doc(alias = "gtk_editable_get_delegate")]
764    #[doc(alias = "get_delegate")]
765    #[must_use]
766    fn delegate(&self) -> Option<Editable> {
767        unsafe {
768            from_glib_none(ffi::gtk_editable_get_delegate(
769                self.as_ref().to_glib_none().0,
770            ))
771        }
772    }
773
774    /// Retrieves whether @self is editable.
775    ///
776    /// # Returns
777    ///
778    /// [`true`] if @self is editable.
779    #[doc(alias = "gtk_editable_get_editable")]
780    #[doc(alias = "get_editable")]
781    #[doc(alias = "editable")]
782    fn is_editable(&self) -> bool {
783        unsafe {
784            from_glib(ffi::gtk_editable_get_editable(
785                self.as_ref().to_glib_none().0,
786            ))
787        }
788    }
789
790    /// Gets if undo/redo actions are enabled for @self
791    ///
792    /// # Returns
793    ///
794    /// [`true`] if undo is enabled
795    #[doc(alias = "gtk_editable_get_enable_undo")]
796    #[doc(alias = "get_enable_undo")]
797    #[doc(alias = "enable-undo")]
798    fn enables_undo(&self) -> bool {
799        unsafe {
800            from_glib(ffi::gtk_editable_get_enable_undo(
801                self.as_ref().to_glib_none().0,
802            ))
803        }
804    }
805
806    /// Retrieves the widget that was previously set up as input interceptor
807    /// for @self. See [`set_input_interceptor()`][Self::set_input_interceptor()].
808    ///
809    /// # Returns
810    ///
811    /// The editable widget
812    #[cfg(feature = "v4_24")]
813    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
814    #[doc(alias = "gtk_editable_get_input_interceptor")]
815    #[doc(alias = "get_input_interceptor")]
816    #[doc(alias = "input-interceptor")]
817    fn input_interceptor(&self) -> Option<Widget> {
818        unsafe {
819            from_glib_full(ffi::gtk_editable_get_input_interceptor(
820                self.as_ref().to_glib_none().0,
821            ))
822        }
823    }
824
825    /// Retrieves the desired maximum width of @self, in characters.
826    ///
827    /// # Returns
828    ///
829    /// the maximum width of the entry, in characters
830    #[doc(alias = "gtk_editable_get_max_width_chars")]
831    #[doc(alias = "get_max_width_chars")]
832    #[doc(alias = "max-width-chars")]
833    fn max_width_chars(&self) -> i32 {
834        unsafe { ffi::gtk_editable_get_max_width_chars(self.as_ref().to_glib_none().0) }
835    }
836
837    /// Retrieves the current position of the cursor relative
838    /// to the start of the content of the editable.
839    ///
840    /// Note that this position is in characters, not in bytes.
841    ///
842    /// # Returns
843    ///
844    /// the cursor position
845    #[doc(alias = "gtk_editable_get_position")]
846    #[doc(alias = "get_position")]
847    #[doc(alias = "cursor-position")]
848    fn position(&self) -> i32 {
849        unsafe { ffi::gtk_editable_get_position(self.as_ref().to_glib_none().0) }
850    }
851
852    /// Retrieves the selection bound of the editable.
853    ///
854    /// @start_pos will be filled with the start of the selection and
855    /// @end_pos with end. If no text was selected both will be identical
856    /// and [`false`] will be returned.
857    ///
858    /// Note that positions are specified in characters, not bytes.
859    ///
860    /// # Returns
861    ///
862    /// [`true`] if there is a non-empty selection, [`false`] otherwise
863    ///
864    /// ## `start_pos`
865    /// location to store the starting position
866    ///
867    /// ## `end_pos`
868    /// location to store the end position
869    #[doc(alias = "gtk_editable_get_selection_bounds")]
870    #[doc(alias = "get_selection_bounds")]
871    fn selection_bounds(&self) -> Option<(i32, i32)> {
872        unsafe {
873            let mut start_pos = std::mem::MaybeUninit::uninit();
874            let mut end_pos = std::mem::MaybeUninit::uninit();
875            let ret = from_glib(ffi::gtk_editable_get_selection_bounds(
876                self.as_ref().to_glib_none().0,
877                start_pos.as_mut_ptr(),
878                end_pos.as_mut_ptr(),
879            ));
880            if ret {
881                Some((start_pos.assume_init(), end_pos.assume_init()))
882            } else {
883                None
884            }
885        }
886    }
887
888    /// Retrieves the contents of @self.
889    ///
890    /// The returned string is owned by GTK and must not be modified or freed.
891    ///
892    /// # Returns
893    ///
894    /// a pointer to the contents of the editable
895    #[doc(alias = "gtk_editable_get_text")]
896    #[doc(alias = "get_text")]
897    fn text(&self) -> glib::GString {
898        unsafe { from_glib_none(ffi::gtk_editable_get_text(self.as_ref().to_glib_none().0)) }
899    }
900
901    /// Gets the number of characters of space reserved
902    /// for the contents of the editable.
903    ///
904    /// # Returns
905    ///
906    /// number of chars to request space for, or negative if unset
907    #[doc(alias = "gtk_editable_get_width_chars")]
908    #[doc(alias = "get_width_chars")]
909    #[doc(alias = "width-chars")]
910    fn width_chars(&self) -> i32 {
911        unsafe { ffi::gtk_editable_get_width_chars(self.as_ref().to_glib_none().0) }
912    }
913
914    /// Sets up a delegate for [`Editable`][crate::Editable].
915    ///
916    /// This is assuming that the get_delegate vfunc in the [`Editable`][crate::Editable]
917    /// interface has been set up for the @self's type.
918    ///
919    /// This is a helper function that should be called in instance init,
920    /// after creating the delegate object.
921    #[doc(alias = "gtk_editable_init_delegate")]
922    fn init_delegate(&self) {
923        unsafe {
924            ffi::gtk_editable_init_delegate(self.as_ref().to_glib_none().0);
925        }
926    }
927
928    /// Inserts @length bytes of @text into the contents of the
929    /// widget, at position @position.
930    ///
931    /// Note that the position is in characters, not in bytes.
932    /// The function updates @position to point after the newly
933    /// inserted text.
934    /// ## `text`
935    /// the text to insert
936    /// ## `length`
937    /// the length of the text in bytes, or -1
938    ///
939    /// # Returns
940    ///
941    ///
942    /// ## `position`
943    /// location of the position text will be inserted at
944    #[doc(alias = "gtk_editable_insert_text")]
945    fn insert_text(&self, text: &str, position: &mut i32) {
946        let length = text.len() as _;
947        unsafe {
948            ffi::gtk_editable_insert_text(
949                self.as_ref().to_glib_none().0,
950                text.to_glib_none().0,
951                length,
952                position,
953            );
954        }
955    }
956
957    /// Selects a region of text.
958    ///
959    /// The characters that are selected are those characters at positions
960    /// from @start_pos up to, but not including @end_pos. If @end_pos is
961    /// negative, then the characters selected are those characters from
962    /// @start_pos to  the end of the text.
963    ///
964    /// Note that positions are specified in characters, not bytes.
965    /// ## `start_pos`
966    /// start of region
967    /// ## `end_pos`
968    /// end of region
969    #[doc(alias = "gtk_editable_select_region")]
970    fn select_region(&self, start_pos: i32, end_pos: i32) {
971        unsafe {
972            ffi::gtk_editable_select_region(self.as_ref().to_glib_none().0, start_pos, end_pos);
973        }
974    }
975
976    /// Sets the alignment for the contents of the editable.
977    ///
978    /// This controls the horizontal positioning of the contents when
979    /// the displayed text is shorter than the width of the editable.
980    /// ## `xalign`
981    /// The horizontal alignment, from 0 (left) to 1 (right).
982    ///   Reversed for RTL layouts
983    #[doc(alias = "gtk_editable_set_alignment")]
984    #[doc(alias = "xalign")]
985    fn set_alignment(&self, xalign: f32) {
986        unsafe {
987            ffi::gtk_editable_set_alignment(self.as_ref().to_glib_none().0, xalign);
988        }
989    }
990
991    /// Determines if the user can edit the text in the editable widget.
992    /// ## `is_editable`
993    /// [`true`] if the user is allowed to edit the text
994    ///   in the widget
995    #[doc(alias = "gtk_editable_set_editable")]
996    #[doc(alias = "editable")]
997    fn set_editable(&self, is_editable: bool) {
998        unsafe {
999            ffi::gtk_editable_set_editable(self.as_ref().to_glib_none().0, is_editable.into_glib());
1000        }
1001    }
1002
1003    /// If enabled, changes to @self will be saved for undo/redo
1004    /// actions.
1005    ///
1006    /// This results in an additional copy of text changes and are not
1007    /// stored in secure memory. As such, undo is forcefully disabled
1008    /// when [`visibility`][struct@crate::Text#visibility] is set to [`false`].
1009    /// ## `enable_undo`
1010    /// if undo/redo should be enabled
1011    #[doc(alias = "gtk_editable_set_enable_undo")]
1012    #[doc(alias = "enable-undo")]
1013    fn set_enable_undo(&self, enable_undo: bool) {
1014        unsafe {
1015            ffi::gtk_editable_set_enable_undo(
1016                self.as_ref().to_glib_none().0,
1017                enable_undo.into_glib(),
1018            );
1019        }
1020    }
1021
1022    /// Sets @interceptor as the widget that @self will intercept key events from.
1023    ///
1024    /// A typical usecase for this is implementing auto-showing search entries, so
1025    /// that textual input may be intercepted from another widget and handled first
1026    /// hand by the given editable. The events will be handled in the bubble phase
1027    /// of @interceptor, which means that editable child widgets of @interceptor will
1028    /// receive the text input before it can be captured.
1029    ///
1030    /// Only those events that would be handled by an input method will be handled,
1031    /// this excludes combinations of Ctrl/Alt/Mod, and other shortcuts.
1032    /// ## `interceptor`
1033    /// the input interceptor widget
1034    #[cfg(feature = "v4_24")]
1035    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
1036    #[doc(alias = "gtk_editable_set_input_interceptor")]
1037    #[doc(alias = "input-interceptor")]
1038    fn set_input_interceptor(&self, interceptor: Option<&impl IsA<Widget>>) {
1039        unsafe {
1040            ffi::gtk_editable_set_input_interceptor(
1041                self.as_ref().to_glib_none().0,
1042                interceptor.map(|p| p.as_ref()).to_glib_none().0,
1043            );
1044        }
1045    }
1046
1047    /// Sets the desired maximum width in characters of @self.
1048    /// ## `n_chars`
1049    /// the new desired maximum width, in characters
1050    #[doc(alias = "gtk_editable_set_max_width_chars")]
1051    #[doc(alias = "max-width-chars")]
1052    fn set_max_width_chars(&self, n_chars: i32) {
1053        unsafe {
1054            ffi::gtk_editable_set_max_width_chars(self.as_ref().to_glib_none().0, n_chars);
1055        }
1056    }
1057
1058    /// Sets the cursor position in the editable to the given value.
1059    ///
1060    /// The cursor is displayed before the character with the given (base 0)
1061    /// index in the contents of the editable. The value must be less than
1062    /// or equal to the number of characters in the editable. A value of -1
1063    /// indicates that the position should be set after the last character
1064    /// of the editable. Note that @position is in characters, not in bytes.
1065    /// ## `position`
1066    /// the position of the cursor
1067    #[doc(alias = "gtk_editable_set_position")]
1068    #[doc(alias = "cursor-position")]
1069    fn set_position(&self, position: i32) {
1070        unsafe {
1071            ffi::gtk_editable_set_position(self.as_ref().to_glib_none().0, position);
1072        }
1073    }
1074
1075    /// Sets the text in the editable to the given value.
1076    ///
1077    /// This is replacing the current contents.
1078    /// ## `text`
1079    /// the text to set
1080    #[doc(alias = "gtk_editable_set_text")]
1081    #[doc(alias = "text")]
1082    fn set_text(&self, text: &str) {
1083        unsafe {
1084            ffi::gtk_editable_set_text(self.as_ref().to_glib_none().0, text.to_glib_none().0);
1085        }
1086    }
1087
1088    /// Changes the size request of the editable to be about the
1089    /// right size for @n_chars characters.
1090    ///
1091    /// Note that it changes the size request, the size can still
1092    /// be affected by how you pack the widget into containers.
1093    /// If @n_chars is -1, the size reverts to the default size.
1094    /// ## `n_chars`
1095    /// width in chars
1096    #[doc(alias = "gtk_editable_set_width_chars")]
1097    #[doc(alias = "width-chars")]
1098    fn set_width_chars(&self, n_chars: i32) {
1099        unsafe {
1100            ffi::gtk_editable_set_width_chars(self.as_ref().to_glib_none().0, n_chars);
1101        }
1102    }
1103
1104    /// The position of the opposite end of the selection from the cursor in chars.
1105    #[doc(alias = "selection-bound")]
1106    fn selection_bound(&self) -> i32 {
1107        ObjectExt::property(self.as_ref(), "selection-bound")
1108    }
1109
1110    /// Emitted at the end of a single user-visible operation on the
1111    /// contents.
1112    ///
1113    /// E.g., a paste operation that replaces the contents of the
1114    /// selection will cause only one signal emission (even though it
1115    /// is implemented by first deleting the selection, then inserting
1116    /// the new content, and may cause multiple ::notify::text signals
1117    /// to be emitted).
1118    #[doc(alias = "changed")]
1119    fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1120        unsafe extern "C" fn changed_trampoline<P: IsA<Editable>, F: Fn(&P) + 'static>(
1121            this: *mut ffi::GtkEditable,
1122            f: glib::ffi::gpointer,
1123        ) {
1124            unsafe {
1125                let f: &F = &*(f as *const F);
1126                f(Editable::from_glib_borrow(this).unsafe_cast_ref())
1127            }
1128        }
1129        unsafe {
1130            let f: Box_<F> = Box_::new(f);
1131            connect_raw(
1132                self.as_ptr() as *mut _,
1133                c"changed".as_ptr(),
1134                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1135                    changed_trampoline::<Self, F> as *const (),
1136                )),
1137                Box_::into_raw(f),
1138            )
1139        }
1140    }
1141
1142    /// Emitted when text is deleted from the widget by the user.
1143    ///
1144    /// The default handler for this signal will normally be responsible for
1145    /// deleting the text, so by connecting to this signal and then stopping
1146    /// the signal with g_signal_stop_emission(), it is possible to modify the
1147    /// range of deleted text, or prevent it from being deleted entirely.
1148    ///
1149    /// The @start_pos and @end_pos parameters are interpreted as for
1150    /// [`delete_text()`][Self::delete_text()].
1151    /// ## `start_pos`
1152    /// the starting position
1153    /// ## `end_pos`
1154    /// the end position
1155    #[doc(alias = "delete-text")]
1156    fn connect_delete_text<F: Fn(&Self, i32, i32) + 'static>(&self, f: F) -> SignalHandlerId {
1157        unsafe extern "C" fn delete_text_trampoline<
1158            P: IsA<Editable>,
1159            F: Fn(&P, i32, i32) + 'static,
1160        >(
1161            this: *mut ffi::GtkEditable,
1162            start_pos: std::ffi::c_int,
1163            end_pos: std::ffi::c_int,
1164            f: glib::ffi::gpointer,
1165        ) {
1166            unsafe {
1167                let f: &F = &*(f as *const F);
1168                f(
1169                    Editable::from_glib_borrow(this).unsafe_cast_ref(),
1170                    start_pos,
1171                    end_pos,
1172                )
1173            }
1174        }
1175        unsafe {
1176            let f: Box_<F> = Box_::new(f);
1177            connect_raw(
1178                self.as_ptr() as *mut _,
1179                c"delete-text".as_ptr(),
1180                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1181                    delete_text_trampoline::<Self, F> as *const (),
1182                )),
1183                Box_::into_raw(f),
1184            )
1185        }
1186    }
1187
1188    /// Emitted whenever keyboard input has been handled through the
1189    /// input interceptor widget set through [`set_input_interceptor()`][Self::set_input_interceptor()]
1190    ///
1191    /// A typical reaction to this event would be to show and focus @editable, so
1192    /// that input is handled directly. In that case keyboard input will no longer
1193    /// be handled through the input interceptor and this signal will stop being
1194    /// emitted.
1195    #[cfg(feature = "v4_24")]
1196    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
1197    #[doc(alias = "input-intercepted")]
1198    fn connect_input_intercepted<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1199        unsafe extern "C" fn input_intercepted_trampoline<P: IsA<Editable>, F: Fn(&P) + 'static>(
1200            this: *mut ffi::GtkEditable,
1201            f: glib::ffi::gpointer,
1202        ) {
1203            unsafe {
1204                let f: &F = &*(f as *const F);
1205                f(Editable::from_glib_borrow(this).unsafe_cast_ref())
1206            }
1207        }
1208        unsafe {
1209            let f: Box_<F> = Box_::new(f);
1210            connect_raw(
1211                self.as_ptr() as *mut _,
1212                c"input-intercepted".as_ptr(),
1213                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1214                    input_intercepted_trampoline::<Self, F> as *const (),
1215                )),
1216                Box_::into_raw(f),
1217            )
1218        }
1219    }
1220
1221    #[cfg(feature = "v4_24")]
1222    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
1223    #[doc(alias = "complete-text")]
1224    fn connect_complete_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1225        unsafe extern "C" fn notify_complete_text_trampoline<
1226            P: IsA<Editable>,
1227            F: Fn(&P) + 'static,
1228        >(
1229            this: *mut ffi::GtkEditable,
1230            _param_spec: glib::ffi::gpointer,
1231            f: glib::ffi::gpointer,
1232        ) {
1233            unsafe {
1234                let f: &F = &*(f as *const F);
1235                f(Editable::from_glib_borrow(this).unsafe_cast_ref())
1236            }
1237        }
1238        unsafe {
1239            let f: Box_<F> = Box_::new(f);
1240            connect_raw(
1241                self.as_ptr() as *mut _,
1242                c"notify::complete-text".as_ptr(),
1243                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1244                    notify_complete_text_trampoline::<Self, F> as *const (),
1245                )),
1246                Box_::into_raw(f),
1247            )
1248        }
1249    }
1250
1251    #[doc(alias = "cursor-position")]
1252    fn connect_cursor_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1253        unsafe extern "C" fn notify_cursor_position_trampoline<
1254            P: IsA<Editable>,
1255            F: Fn(&P) + 'static,
1256        >(
1257            this: *mut ffi::GtkEditable,
1258            _param_spec: glib::ffi::gpointer,
1259            f: glib::ffi::gpointer,
1260        ) {
1261            unsafe {
1262                let f: &F = &*(f as *const F);
1263                f(Editable::from_glib_borrow(this).unsafe_cast_ref())
1264            }
1265        }
1266        unsafe {
1267            let f: Box_<F> = Box_::new(f);
1268            connect_raw(
1269                self.as_ptr() as *mut _,
1270                c"notify::cursor-position".as_ptr(),
1271                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1272                    notify_cursor_position_trampoline::<Self, F> as *const (),
1273                )),
1274                Box_::into_raw(f),
1275            )
1276        }
1277    }
1278
1279    #[doc(alias = "editable")]
1280    fn connect_editable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1281        unsafe extern "C" fn notify_editable_trampoline<P: IsA<Editable>, F: Fn(&P) + 'static>(
1282            this: *mut ffi::GtkEditable,
1283            _param_spec: glib::ffi::gpointer,
1284            f: glib::ffi::gpointer,
1285        ) {
1286            unsafe {
1287                let f: &F = &*(f as *const F);
1288                f(Editable::from_glib_borrow(this).unsafe_cast_ref())
1289            }
1290        }
1291        unsafe {
1292            let f: Box_<F> = Box_::new(f);
1293            connect_raw(
1294                self.as_ptr() as *mut _,
1295                c"notify::editable".as_ptr(),
1296                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1297                    notify_editable_trampoline::<Self, F> as *const (),
1298                )),
1299                Box_::into_raw(f),
1300            )
1301        }
1302    }
1303
1304    #[doc(alias = "enable-undo")]
1305    fn connect_enable_undo_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1306        unsafe extern "C" fn notify_enable_undo_trampoline<
1307            P: IsA<Editable>,
1308            F: Fn(&P) + 'static,
1309        >(
1310            this: *mut ffi::GtkEditable,
1311            _param_spec: glib::ffi::gpointer,
1312            f: glib::ffi::gpointer,
1313        ) {
1314            unsafe {
1315                let f: &F = &*(f as *const F);
1316                f(Editable::from_glib_borrow(this).unsafe_cast_ref())
1317            }
1318        }
1319        unsafe {
1320            let f: Box_<F> = Box_::new(f);
1321            connect_raw(
1322                self.as_ptr() as *mut _,
1323                c"notify::enable-undo".as_ptr(),
1324                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1325                    notify_enable_undo_trampoline::<Self, F> as *const (),
1326                )),
1327                Box_::into_raw(f),
1328            )
1329        }
1330    }
1331
1332    #[cfg(feature = "v4_24")]
1333    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
1334    #[doc(alias = "input-interceptor")]
1335    fn connect_input_interceptor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1336        unsafe extern "C" fn notify_input_interceptor_trampoline<
1337            P: IsA<Editable>,
1338            F: Fn(&P) + 'static,
1339        >(
1340            this: *mut ffi::GtkEditable,
1341            _param_spec: glib::ffi::gpointer,
1342            f: glib::ffi::gpointer,
1343        ) {
1344            unsafe {
1345                let f: &F = &*(f as *const F);
1346                f(Editable::from_glib_borrow(this).unsafe_cast_ref())
1347            }
1348        }
1349        unsafe {
1350            let f: Box_<F> = Box_::new(f);
1351            connect_raw(
1352                self.as_ptr() as *mut _,
1353                c"notify::input-interceptor".as_ptr(),
1354                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1355                    notify_input_interceptor_trampoline::<Self, F> as *const (),
1356                )),
1357                Box_::into_raw(f),
1358            )
1359        }
1360    }
1361
1362    #[doc(alias = "max-width-chars")]
1363    fn connect_max_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1364        unsafe extern "C" fn notify_max_width_chars_trampoline<
1365            P: IsA<Editable>,
1366            F: Fn(&P) + 'static,
1367        >(
1368            this: *mut ffi::GtkEditable,
1369            _param_spec: glib::ffi::gpointer,
1370            f: glib::ffi::gpointer,
1371        ) {
1372            unsafe {
1373                let f: &F = &*(f as *const F);
1374                f(Editable::from_glib_borrow(this).unsafe_cast_ref())
1375            }
1376        }
1377        unsafe {
1378            let f: Box_<F> = Box_::new(f);
1379            connect_raw(
1380                self.as_ptr() as *mut _,
1381                c"notify::max-width-chars".as_ptr(),
1382                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1383                    notify_max_width_chars_trampoline::<Self, F> as *const (),
1384                )),
1385                Box_::into_raw(f),
1386            )
1387        }
1388    }
1389
1390    #[doc(alias = "selection-bound")]
1391    fn connect_selection_bound_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1392        unsafe extern "C" fn notify_selection_bound_trampoline<
1393            P: IsA<Editable>,
1394            F: Fn(&P) + 'static,
1395        >(
1396            this: *mut ffi::GtkEditable,
1397            _param_spec: glib::ffi::gpointer,
1398            f: glib::ffi::gpointer,
1399        ) {
1400            unsafe {
1401                let f: &F = &*(f as *const F);
1402                f(Editable::from_glib_borrow(this).unsafe_cast_ref())
1403            }
1404        }
1405        unsafe {
1406            let f: Box_<F> = Box_::new(f);
1407            connect_raw(
1408                self.as_ptr() as *mut _,
1409                c"notify::selection-bound".as_ptr(),
1410                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1411                    notify_selection_bound_trampoline::<Self, F> as *const (),
1412                )),
1413                Box_::into_raw(f),
1414            )
1415        }
1416    }
1417
1418    #[doc(alias = "text")]
1419    fn connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1420        unsafe extern "C" fn notify_text_trampoline<P: IsA<Editable>, F: Fn(&P) + 'static>(
1421            this: *mut ffi::GtkEditable,
1422            _param_spec: glib::ffi::gpointer,
1423            f: glib::ffi::gpointer,
1424        ) {
1425            unsafe {
1426                let f: &F = &*(f as *const F);
1427                f(Editable::from_glib_borrow(this).unsafe_cast_ref())
1428            }
1429        }
1430        unsafe {
1431            let f: Box_<F> = Box_::new(f);
1432            connect_raw(
1433                self.as_ptr() as *mut _,
1434                c"notify::text".as_ptr(),
1435                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1436                    notify_text_trampoline::<Self, F> as *const (),
1437                )),
1438                Box_::into_raw(f),
1439            )
1440        }
1441    }
1442
1443    #[doc(alias = "width-chars")]
1444    fn connect_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1445        unsafe extern "C" fn notify_width_chars_trampoline<
1446            P: IsA<Editable>,
1447            F: Fn(&P) + 'static,
1448        >(
1449            this: *mut ffi::GtkEditable,
1450            _param_spec: glib::ffi::gpointer,
1451            f: glib::ffi::gpointer,
1452        ) {
1453            unsafe {
1454                let f: &F = &*(f as *const F);
1455                f(Editable::from_glib_borrow(this).unsafe_cast_ref())
1456            }
1457        }
1458        unsafe {
1459            let f: Box_<F> = Box_::new(f);
1460            connect_raw(
1461                self.as_ptr() as *mut _,
1462                c"notify::width-chars".as_ptr(),
1463                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1464                    notify_width_chars_trampoline::<Self, F> as *const (),
1465                )),
1466                Box_::into_raw(f),
1467            )
1468        }
1469    }
1470
1471    #[doc(alias = "xalign")]
1472    fn connect_xalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1473        unsafe extern "C" fn notify_xalign_trampoline<P: IsA<Editable>, F: Fn(&P) + 'static>(
1474            this: *mut ffi::GtkEditable,
1475            _param_spec: glib::ffi::gpointer,
1476            f: glib::ffi::gpointer,
1477        ) {
1478            unsafe {
1479                let f: &F = &*(f as *const F);
1480                f(Editable::from_glib_borrow(this).unsafe_cast_ref())
1481            }
1482        }
1483        unsafe {
1484            let f: Box_<F> = Box_::new(f);
1485            connect_raw(
1486                self.as_ptr() as *mut _,
1487                c"notify::xalign".as_ptr(),
1488                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1489                    notify_xalign_trampoline::<Self, F> as *const (),
1490                )),
1491                Box_::into_raw(f),
1492            )
1493        }
1494    }
1495}
1496
1497impl<O: IsA<Editable>> EditableExt for O {}