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 /// Interface for single-line 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
694/// Trait containing all [`struct@Editable`] methods.
695///
696/// # Implementors
697///
698/// [`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]
699pub trait EditableExt: IsA<Editable> + 'static {
700 /// Retrieves the accessible platform state from the editable delegate.
701 ///
702 /// This is an helper function to retrieve the accessible state for
703 /// [`Editable`][crate::Editable] interface implementations using a delegate pattern.
704 ///
705 /// You should call this function in your editable widget implementation
706 /// of the `vfunc::Gtk::Accessible::get_platform_state` virtual function, for
707 /// instance:
708 ///
709 /// **⚠️ The following code is in c ⚠️**
710 ///
711 /// ```c
712 /// static void
713 /// accessible_interface_init (GtkAccessibleInterface *iface)
714 /// {
715 /// iface->get_platform_state = your_editable_get_accessible_platform_state;
716 /// }
717 ///
718 /// static gboolean
719 /// your_editable_get_accessible_platform_state (GtkAccessible *accessible,
720 /// GtkAccessiblePlatformState state)
721 /// {
722 /// return gtk_editable_delegate_get_accessible_platform_state (GTK_EDITABLE (accessible), state);
723 /// }
724 /// ```
725 ///
726 /// Note that the widget which is the delegate *must* be a direct child of
727 /// this widget, otherwise your implementation of `vfunc::Gtk::Accessible::get_platform_state`
728 /// might not even be called, as the platform change will originate from
729 /// the parent of the delegate, and, as a result, will not work properly.
730 ///
731 /// So, if you can't ensure the direct child condition, you should give the
732 /// delegate the [`AccessibleRole::TextBox`][crate::AccessibleRole::TextBox] role, or you can
733 /// change your tree to allow this function to work.
734 /// ## `state`
735 /// what kind of accessible state to retrieve
736 ///
737 /// # Returns
738 ///
739 /// the accessible platform state of the delegate
740 #[cfg(feature = "v4_10")]
741 #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
742 #[doc(alias = "gtk_editable_delegate_get_accessible_platform_state")]
743 fn delegate_get_accessible_platform_state(&self, state: AccessiblePlatformState) -> bool {
744 unsafe {
745 from_glib(ffi::gtk_editable_delegate_get_accessible_platform_state(
746 self.as_ref().to_glib_none().0,
747 state.into_glib(),
748 ))
749 }
750 }
751
752 /// Deletes the currently selected text of the editable.
753 ///
754 /// This call doesn’t do anything if there is no selected text.
755 #[doc(alias = "gtk_editable_delete_selection")]
756 fn delete_selection(&self) {
757 unsafe {
758 ffi::gtk_editable_delete_selection(self.as_ref().to_glib_none().0);
759 }
760 }
761
762 /// Deletes a sequence of characters.
763 ///
764 /// The characters that are deleted are those characters at positions
765 /// from @start_pos up to, but not including @end_pos. If @end_pos is
766 /// negative, then the characters deleted are those from @start_pos to
767 /// the end of the text.
768 ///
769 /// Note that the positions are specified in characters, not bytes.
770 /// ## `start_pos`
771 /// start position
772 /// ## `end_pos`
773 /// end position
774 #[doc(alias = "gtk_editable_delete_text")]
775 fn delete_text(&self, start_pos: i32, end_pos: i32) {
776 unsafe {
777 ffi::gtk_editable_delete_text(self.as_ref().to_glib_none().0, start_pos, end_pos);
778 }
779 }
780
781 /// Undoes the setup done by [`init_delegate()`][Self::init_delegate()].
782 ///
783 /// This is a helper function that should be called from dispose,
784 /// before removing the delegate object.
785 #[doc(alias = "gtk_editable_finish_delegate")]
786 fn finish_delegate(&self) {
787 unsafe {
788 ffi::gtk_editable_finish_delegate(self.as_ref().to_glib_none().0);
789 }
790 }
791
792 /// Gets the alignment of the editable.
793 ///
794 /// # Returns
795 ///
796 /// the alignment
797 #[doc(alias = "gtk_editable_get_alignment")]
798 #[doc(alias = "get_alignment")]
799 #[doc(alias = "xalign")]
800 fn alignment(&self) -> f32 {
801 unsafe { ffi::gtk_editable_get_alignment(self.as_ref().to_glib_none().0) }
802 }
803
804 /// Retrieves a sequence of characters.
805 ///
806 /// The characters that are retrieved are those characters at positions
807 /// from @start_pos up to, but not including @end_pos. If @end_pos is negative,
808 /// then the characters retrieved are those characters from @start_pos to
809 /// the end of the text.
810 ///
811 /// Note that positions are specified in characters, not bytes.
812 /// ## `start_pos`
813 /// start of text
814 /// ## `end_pos`
815 /// end of text
816 ///
817 /// # Returns
818 ///
819 /// a pointer to the contents of the widget as a
820 /// string. This string is allocated by the [`Editable`][crate::Editable] implementation
821 /// and should be freed by the caller.
822 #[doc(alias = "gtk_editable_get_chars")]
823 #[doc(alias = "get_chars")]
824 fn chars(&self, start_pos: i32, end_pos: i32) -> glib::GString {
825 unsafe {
826 from_glib_full(ffi::gtk_editable_get_chars(
827 self.as_ref().to_glib_none().0,
828 start_pos,
829 end_pos,
830 ))
831 }
832 }
833
834 /// Gets the [`Editable`][crate::Editable] that @self is delegating its
835 /// implementation to.
836 ///
837 /// Typically, the delegate is a [`Text`][crate::Text] widget.
838 ///
839 /// # Returns
840 ///
841 /// the delegate [`Editable`][crate::Editable]
842 #[doc(alias = "gtk_editable_get_delegate")]
843 #[doc(alias = "get_delegate")]
844 #[must_use]
845 fn delegate(&self) -> Option<Editable> {
846 unsafe {
847 from_glib_none(ffi::gtk_editable_get_delegate(
848 self.as_ref().to_glib_none().0,
849 ))
850 }
851 }
852
853 /// Retrieves whether @self is editable.
854 ///
855 /// # Returns
856 ///
857 /// [`true`] if @self is editable.
858 #[doc(alias = "gtk_editable_get_editable")]
859 #[doc(alias = "get_editable")]
860 #[doc(alias = "editable")]
861 fn is_editable(&self) -> bool {
862 unsafe {
863 from_glib(ffi::gtk_editable_get_editable(
864 self.as_ref().to_glib_none().0,
865 ))
866 }
867 }
868
869 /// Gets if undo/redo actions are enabled for @self
870 ///
871 /// # Returns
872 ///
873 /// [`true`] if undo is enabled
874 #[doc(alias = "gtk_editable_get_enable_undo")]
875 #[doc(alias = "get_enable_undo")]
876 #[doc(alias = "enable-undo")]
877 fn enables_undo(&self) -> bool {
878 unsafe {
879 from_glib(ffi::gtk_editable_get_enable_undo(
880 self.as_ref().to_glib_none().0,
881 ))
882 }
883 }
884
885 /// Retrieves the desired maximum width of @self, in characters.
886 ///
887 /// # Returns
888 ///
889 /// the maximum width of the entry, in characters
890 #[doc(alias = "gtk_editable_get_max_width_chars")]
891 #[doc(alias = "get_max_width_chars")]
892 #[doc(alias = "max-width-chars")]
893 fn max_width_chars(&self) -> i32 {
894 unsafe { ffi::gtk_editable_get_max_width_chars(self.as_ref().to_glib_none().0) }
895 }
896
897 /// Retrieves the current position of the cursor relative
898 /// to the start of the content of the editable.
899 ///
900 /// Note that this position is in characters, not in bytes.
901 ///
902 /// # Returns
903 ///
904 /// the cursor position
905 #[doc(alias = "gtk_editable_get_position")]
906 #[doc(alias = "get_position")]
907 #[doc(alias = "cursor-position")]
908 fn position(&self) -> i32 {
909 unsafe { ffi::gtk_editable_get_position(self.as_ref().to_glib_none().0) }
910 }
911
912 /// Retrieves the selection bound of the editable.
913 ///
914 /// @start_pos will be filled with the start of the selection and
915 /// @end_pos with end. If no text was selected both will be identical
916 /// and [`false`] will be returned.
917 ///
918 /// Note that positions are specified in characters, not bytes.
919 ///
920 /// # Returns
921 ///
922 /// [`true`] if there is a non-empty selection, [`false`] otherwise
923 ///
924 /// ## `start_pos`
925 /// location to store the starting position
926 ///
927 /// ## `end_pos`
928 /// location to store the end position
929 #[doc(alias = "gtk_editable_get_selection_bounds")]
930 #[doc(alias = "get_selection_bounds")]
931 fn selection_bounds(&self) -> Option<(i32, i32)> {
932 unsafe {
933 let mut start_pos = std::mem::MaybeUninit::uninit();
934 let mut end_pos = std::mem::MaybeUninit::uninit();
935 let ret = from_glib(ffi::gtk_editable_get_selection_bounds(
936 self.as_ref().to_glib_none().0,
937 start_pos.as_mut_ptr(),
938 end_pos.as_mut_ptr(),
939 ));
940 if ret {
941 Some((start_pos.assume_init(), end_pos.assume_init()))
942 } else {
943 None
944 }
945 }
946 }
947
948 /// Retrieves the contents of @self.
949 ///
950 /// The returned string is owned by GTK and must not be modified or freed.
951 ///
952 /// # Returns
953 ///
954 /// a pointer to the contents of the editable
955 #[doc(alias = "gtk_editable_get_text")]
956 #[doc(alias = "get_text")]
957 fn text(&self) -> glib::GString {
958 unsafe { from_glib_none(ffi::gtk_editable_get_text(self.as_ref().to_glib_none().0)) }
959 }
960
961 /// Gets the number of characters of space reserved
962 /// for the contents of the editable.
963 ///
964 /// # Returns
965 ///
966 /// number of chars to request space for, or negative if unset
967 #[doc(alias = "gtk_editable_get_width_chars")]
968 #[doc(alias = "get_width_chars")]
969 #[doc(alias = "width-chars")]
970 fn width_chars(&self) -> i32 {
971 unsafe { ffi::gtk_editable_get_width_chars(self.as_ref().to_glib_none().0) }
972 }
973
974 /// Sets up a delegate for [`Editable`][crate::Editable].
975 ///
976 /// This is assuming that the get_delegate vfunc in the [`Editable`][crate::Editable]
977 /// interface has been set up for the @self's type.
978 ///
979 /// This is a helper function that should be called in instance init,
980 /// after creating the delegate object.
981 #[doc(alias = "gtk_editable_init_delegate")]
982 fn init_delegate(&self) {
983 unsafe {
984 ffi::gtk_editable_init_delegate(self.as_ref().to_glib_none().0);
985 }
986 }
987
988 /// Inserts @length bytes of @text into the contents of the
989 /// widget, at position @position.
990 ///
991 /// Note that the position is in characters, not in bytes.
992 /// The function updates @position to point after the newly
993 /// inserted text.
994 /// ## `text`
995 /// the text to insert
996 /// ## `length`
997 /// the length of the text in bytes, or -1
998 /// ## `position`
999 /// location of the position text will be inserted at
1000 #[doc(alias = "gtk_editable_insert_text")]
1001 fn insert_text(&self, text: &str, position: &mut i32) {
1002 let length = text.len() as _;
1003 unsafe {
1004 ffi::gtk_editable_insert_text(
1005 self.as_ref().to_glib_none().0,
1006 text.to_glib_none().0,
1007 length,
1008 position,
1009 );
1010 }
1011 }
1012
1013 /// Selects a region of text.
1014 ///
1015 /// The characters that are selected are those characters at positions
1016 /// from @start_pos up to, but not including @end_pos. If @end_pos is
1017 /// negative, then the characters selected are those characters from
1018 /// @start_pos to the end of the text.
1019 ///
1020 /// Note that positions are specified in characters, not bytes.
1021 /// ## `start_pos`
1022 /// start of region
1023 /// ## `end_pos`
1024 /// end of region
1025 #[doc(alias = "gtk_editable_select_region")]
1026 fn select_region(&self, start_pos: i32, end_pos: i32) {
1027 unsafe {
1028 ffi::gtk_editable_select_region(self.as_ref().to_glib_none().0, start_pos, end_pos);
1029 }
1030 }
1031
1032 /// Sets the alignment for the contents of the editable.
1033 ///
1034 /// This controls the horizontal positioning of the contents when
1035 /// the displayed text is shorter than the width of the editable.
1036 /// ## `xalign`
1037 /// The horizontal alignment, from 0 (left) to 1 (right).
1038 /// Reversed for RTL layouts
1039 #[doc(alias = "gtk_editable_set_alignment")]
1040 #[doc(alias = "xalign")]
1041 fn set_alignment(&self, xalign: f32) {
1042 unsafe {
1043 ffi::gtk_editable_set_alignment(self.as_ref().to_glib_none().0, xalign);
1044 }
1045 }
1046
1047 /// Determines if the user can edit the text in the editable widget.
1048 /// ## `is_editable`
1049 /// [`true`] if the user is allowed to edit the text
1050 /// in the widget
1051 #[doc(alias = "gtk_editable_set_editable")]
1052 #[doc(alias = "editable")]
1053 fn set_editable(&self, is_editable: bool) {
1054 unsafe {
1055 ffi::gtk_editable_set_editable(self.as_ref().to_glib_none().0, is_editable.into_glib());
1056 }
1057 }
1058
1059 /// If enabled, changes to @self will be saved for undo/redo
1060 /// actions.
1061 ///
1062 /// This results in an additional copy of text changes and are not
1063 /// stored in secure memory. As such, undo is forcefully disabled
1064 /// when [`visibility`][struct@crate::Text#visibility] is set to [`false`].
1065 /// ## `enable_undo`
1066 /// if undo/redo should be enabled
1067 #[doc(alias = "gtk_editable_set_enable_undo")]
1068 #[doc(alias = "enable-undo")]
1069 fn set_enable_undo(&self, enable_undo: bool) {
1070 unsafe {
1071 ffi::gtk_editable_set_enable_undo(
1072 self.as_ref().to_glib_none().0,
1073 enable_undo.into_glib(),
1074 );
1075 }
1076 }
1077
1078 /// Sets the desired maximum width in characters of @self.
1079 /// ## `n_chars`
1080 /// the new desired maximum width, in characters
1081 #[doc(alias = "gtk_editable_set_max_width_chars")]
1082 #[doc(alias = "max-width-chars")]
1083 fn set_max_width_chars(&self, n_chars: i32) {
1084 unsafe {
1085 ffi::gtk_editable_set_max_width_chars(self.as_ref().to_glib_none().0, n_chars);
1086 }
1087 }
1088
1089 /// Sets the cursor position in the editable to the given value.
1090 ///
1091 /// The cursor is displayed before the character with the given (base 0)
1092 /// index in the contents of the editable. The value must be less than
1093 /// or equal to the number of characters in the editable. A value of -1
1094 /// indicates that the position should be set after the last character
1095 /// of the editable. Note that @position is in characters, not in bytes.
1096 /// ## `position`
1097 /// the position of the cursor
1098 #[doc(alias = "gtk_editable_set_position")]
1099 #[doc(alias = "cursor-position")]
1100 fn set_position(&self, position: i32) {
1101 unsafe {
1102 ffi::gtk_editable_set_position(self.as_ref().to_glib_none().0, position);
1103 }
1104 }
1105
1106 /// Sets the text in the editable to the given value.
1107 ///
1108 /// This is replacing the current contents.
1109 /// ## `text`
1110 /// the text to set
1111 #[doc(alias = "gtk_editable_set_text")]
1112 #[doc(alias = "text")]
1113 fn set_text(&self, text: &str) {
1114 unsafe {
1115 ffi::gtk_editable_set_text(self.as_ref().to_glib_none().0, text.to_glib_none().0);
1116 }
1117 }
1118
1119 /// Changes the size request of the editable to be about the
1120 /// right size for @n_chars characters.
1121 ///
1122 /// Note that it changes the size request, the size can still
1123 /// be affected by how you pack the widget into containers.
1124 /// If @n_chars is -1, the size reverts to the default size.
1125 /// ## `n_chars`
1126 /// width in chars
1127 #[doc(alias = "gtk_editable_set_width_chars")]
1128 #[doc(alias = "width-chars")]
1129 fn set_width_chars(&self, n_chars: i32) {
1130 unsafe {
1131 ffi::gtk_editable_set_width_chars(self.as_ref().to_glib_none().0, n_chars);
1132 }
1133 }
1134
1135 /// The position of the opposite end of the selection from the cursor in chars.
1136 #[doc(alias = "selection-bound")]
1137 fn selection_bound(&self) -> i32 {
1138 ObjectExt::property(self.as_ref(), "selection-bound")
1139 }
1140
1141 /// Emitted at the end of a single user-visible operation on the
1142 /// contents.
1143 ///
1144 /// E.g., a paste operation that replaces the contents of the
1145 /// selection will cause only one signal emission (even though it
1146 /// is implemented by first deleting the selection, then inserting
1147 /// the new content, and may cause multiple ::notify::text signals
1148 /// to be emitted).
1149 #[doc(alias = "changed")]
1150 fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1151 unsafe extern "C" fn changed_trampoline<P: IsA<Editable>, F: Fn(&P) + 'static>(
1152 this: *mut ffi::GtkEditable,
1153 f: glib::ffi::gpointer,
1154 ) {
1155 let f: &F = &*(f as *const F);
1156 f(Editable::from_glib_borrow(this).unsafe_cast_ref())
1157 }
1158 unsafe {
1159 let f: Box_<F> = Box_::new(f);
1160 connect_raw(
1161 self.as_ptr() as *mut _,
1162 c"changed".as_ptr() as *const _,
1163 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1164 changed_trampoline::<Self, F> as *const (),
1165 )),
1166 Box_::into_raw(f),
1167 )
1168 }
1169 }
1170
1171 /// Emitted when text is deleted from the widget by the user.
1172 ///
1173 /// The default handler for this signal will normally be responsible for
1174 /// deleting the text, so by connecting to this signal and then stopping
1175 /// the signal with g_signal_stop_emission(), it is possible to modify the
1176 /// range of deleted text, or prevent it from being deleted entirely.
1177 ///
1178 /// The @start_pos and @end_pos parameters are interpreted as for
1179 /// [`delete_text()`][Self::delete_text()].
1180 /// ## `start_pos`
1181 /// the starting position
1182 /// ## `end_pos`
1183 /// the end position
1184 #[doc(alias = "delete-text")]
1185 fn connect_delete_text<F: Fn(&Self, i32, i32) + 'static>(&self, f: F) -> SignalHandlerId {
1186 unsafe extern "C" fn delete_text_trampoline<
1187 P: IsA<Editable>,
1188 F: Fn(&P, i32, i32) + 'static,
1189 >(
1190 this: *mut ffi::GtkEditable,
1191 start_pos: std::ffi::c_int,
1192 end_pos: std::ffi::c_int,
1193 f: glib::ffi::gpointer,
1194 ) {
1195 let f: &F = &*(f as *const F);
1196 f(
1197 Editable::from_glib_borrow(this).unsafe_cast_ref(),
1198 start_pos,
1199 end_pos,
1200 )
1201 }
1202 unsafe {
1203 let f: Box_<F> = Box_::new(f);
1204 connect_raw(
1205 self.as_ptr() as *mut _,
1206 c"delete-text".as_ptr() as *const _,
1207 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1208 delete_text_trampoline::<Self, F> as *const (),
1209 )),
1210 Box_::into_raw(f),
1211 )
1212 }
1213 }
1214
1215 #[doc(alias = "cursor-position")]
1216 fn connect_cursor_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1217 unsafe extern "C" fn notify_cursor_position_trampoline<
1218 P: IsA<Editable>,
1219 F: Fn(&P) + 'static,
1220 >(
1221 this: *mut ffi::GtkEditable,
1222 _param_spec: glib::ffi::gpointer,
1223 f: glib::ffi::gpointer,
1224 ) {
1225 let f: &F = &*(f as *const F);
1226 f(Editable::from_glib_borrow(this).unsafe_cast_ref())
1227 }
1228 unsafe {
1229 let f: Box_<F> = Box_::new(f);
1230 connect_raw(
1231 self.as_ptr() as *mut _,
1232 c"notify::cursor-position".as_ptr() as *const _,
1233 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1234 notify_cursor_position_trampoline::<Self, F> as *const (),
1235 )),
1236 Box_::into_raw(f),
1237 )
1238 }
1239 }
1240
1241 #[doc(alias = "editable")]
1242 fn connect_editable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1243 unsafe extern "C" fn notify_editable_trampoline<P: IsA<Editable>, F: Fn(&P) + 'static>(
1244 this: *mut ffi::GtkEditable,
1245 _param_spec: glib::ffi::gpointer,
1246 f: glib::ffi::gpointer,
1247 ) {
1248 let f: &F = &*(f as *const F);
1249 f(Editable::from_glib_borrow(this).unsafe_cast_ref())
1250 }
1251 unsafe {
1252 let f: Box_<F> = Box_::new(f);
1253 connect_raw(
1254 self.as_ptr() as *mut _,
1255 c"notify::editable".as_ptr() as *const _,
1256 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1257 notify_editable_trampoline::<Self, F> as *const (),
1258 )),
1259 Box_::into_raw(f),
1260 )
1261 }
1262 }
1263
1264 #[doc(alias = "enable-undo")]
1265 fn connect_enable_undo_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1266 unsafe extern "C" fn notify_enable_undo_trampoline<
1267 P: IsA<Editable>,
1268 F: Fn(&P) + 'static,
1269 >(
1270 this: *mut ffi::GtkEditable,
1271 _param_spec: glib::ffi::gpointer,
1272 f: glib::ffi::gpointer,
1273 ) {
1274 let f: &F = &*(f as *const F);
1275 f(Editable::from_glib_borrow(this).unsafe_cast_ref())
1276 }
1277 unsafe {
1278 let f: Box_<F> = Box_::new(f);
1279 connect_raw(
1280 self.as_ptr() as *mut _,
1281 c"notify::enable-undo".as_ptr() as *const _,
1282 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1283 notify_enable_undo_trampoline::<Self, F> as *const (),
1284 )),
1285 Box_::into_raw(f),
1286 )
1287 }
1288 }
1289
1290 #[doc(alias = "max-width-chars")]
1291 fn connect_max_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1292 unsafe extern "C" fn notify_max_width_chars_trampoline<
1293 P: IsA<Editable>,
1294 F: Fn(&P) + 'static,
1295 >(
1296 this: *mut ffi::GtkEditable,
1297 _param_spec: glib::ffi::gpointer,
1298 f: glib::ffi::gpointer,
1299 ) {
1300 let f: &F = &*(f as *const F);
1301 f(Editable::from_glib_borrow(this).unsafe_cast_ref())
1302 }
1303 unsafe {
1304 let f: Box_<F> = Box_::new(f);
1305 connect_raw(
1306 self.as_ptr() as *mut _,
1307 c"notify::max-width-chars".as_ptr() as *const _,
1308 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1309 notify_max_width_chars_trampoline::<Self, F> as *const (),
1310 )),
1311 Box_::into_raw(f),
1312 )
1313 }
1314 }
1315
1316 #[doc(alias = "selection-bound")]
1317 fn connect_selection_bound_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1318 unsafe extern "C" fn notify_selection_bound_trampoline<
1319 P: IsA<Editable>,
1320 F: Fn(&P) + 'static,
1321 >(
1322 this: *mut ffi::GtkEditable,
1323 _param_spec: glib::ffi::gpointer,
1324 f: glib::ffi::gpointer,
1325 ) {
1326 let f: &F = &*(f as *const F);
1327 f(Editable::from_glib_borrow(this).unsafe_cast_ref())
1328 }
1329 unsafe {
1330 let f: Box_<F> = Box_::new(f);
1331 connect_raw(
1332 self.as_ptr() as *mut _,
1333 c"notify::selection-bound".as_ptr() as *const _,
1334 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1335 notify_selection_bound_trampoline::<Self, F> as *const (),
1336 )),
1337 Box_::into_raw(f),
1338 )
1339 }
1340 }
1341
1342 #[doc(alias = "text")]
1343 fn connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1344 unsafe extern "C" fn notify_text_trampoline<P: IsA<Editable>, F: Fn(&P) + 'static>(
1345 this: *mut ffi::GtkEditable,
1346 _param_spec: glib::ffi::gpointer,
1347 f: glib::ffi::gpointer,
1348 ) {
1349 let f: &F = &*(f as *const F);
1350 f(Editable::from_glib_borrow(this).unsafe_cast_ref())
1351 }
1352 unsafe {
1353 let f: Box_<F> = Box_::new(f);
1354 connect_raw(
1355 self.as_ptr() as *mut _,
1356 c"notify::text".as_ptr() as *const _,
1357 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1358 notify_text_trampoline::<Self, F> as *const (),
1359 )),
1360 Box_::into_raw(f),
1361 )
1362 }
1363 }
1364
1365 #[doc(alias = "width-chars")]
1366 fn connect_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1367 unsafe extern "C" fn notify_width_chars_trampoline<
1368 P: IsA<Editable>,
1369 F: Fn(&P) + 'static,
1370 >(
1371 this: *mut ffi::GtkEditable,
1372 _param_spec: glib::ffi::gpointer,
1373 f: glib::ffi::gpointer,
1374 ) {
1375 let f: &F = &*(f as *const F);
1376 f(Editable::from_glib_borrow(this).unsafe_cast_ref())
1377 }
1378 unsafe {
1379 let f: Box_<F> = Box_::new(f);
1380 connect_raw(
1381 self.as_ptr() as *mut _,
1382 c"notify::width-chars".as_ptr() as *const _,
1383 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1384 notify_width_chars_trampoline::<Self, F> as *const (),
1385 )),
1386 Box_::into_raw(f),
1387 )
1388 }
1389 }
1390
1391 #[doc(alias = "xalign")]
1392 fn connect_xalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1393 unsafe extern "C" fn notify_xalign_trampoline<P: IsA<Editable>, F: Fn(&P) + 'static>(
1394 this: *mut ffi::GtkEditable,
1395 _param_spec: glib::ffi::gpointer,
1396 f: glib::ffi::gpointer,
1397 ) {
1398 let f: &F = &*(f as *const F);
1399 f(Editable::from_glib_borrow(this).unsafe_cast_ref())
1400 }
1401 unsafe {
1402 let f: Box_<F> = Box_::new(f);
1403 connect_raw(
1404 self.as_ptr() as *mut _,
1405 c"notify::xalign".as_ptr() as *const _,
1406 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1407 notify_xalign_trampoline::<Self, F> as *const (),
1408 )),
1409 Box_::into_raw(f),
1410 )
1411 }
1412 }
1413}
1414
1415impl<O: IsA<Editable>> EditableExt for O {}