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