Skip to main content

gtk4/auto/
text_view.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5#[cfg(feature = "v4_10")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
7use crate::Accessible;
8#[cfg(feature = "v4_14")]
9#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
10use crate::AccessibleText;
11use crate::{
12    AccessibleRole, Adjustment, Align, Buildable, ConstraintTarget, DeleteType, InputHints,
13    InputPurpose, Justification, LayoutManager, MovementStep, Overflow, ScrollStep, Scrollable,
14    ScrollablePolicy, TextBuffer, TextChildAnchor, TextExtendSelection, TextIter, TextMark,
15    TextWindowType, Widget, WrapMode, ffi,
16};
17use glib::{
18    object::ObjectType as _,
19    prelude::*,
20    signal::{SignalHandlerId, connect_raw},
21    translate::*,
22};
23use std::boxed::Box as Box_;
24
25#[cfg(all(feature = "v4_10", feature = "v4_14"))]
26#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
27glib::wrapper! {
28    ///  clears the content.
29    ///
30    /// Additionally, the following signals have default keybindings:
31    ///
32    /// - [`backspace`][struct@crate::TextView#backspace]
33    /// - [`copy-clipboard`][struct@crate::TextView#copy-clipboard]
34    /// - [`cut-clipboard`][struct@crate::TextView#cut-clipboard]
35    /// - [`delete-from-cursor`][struct@crate::TextView#delete-from-cursor]
36    /// - [`insert-emoji`][struct@crate::TextView#insert-emoji]
37    /// - [`move-cursor`][struct@crate::TextView#move-cursor]
38    /// - [`paste-clipboard`][struct@crate::TextView#paste-clipboard]
39    /// - [`select-all`][struct@crate::TextView#select-all]
40    /// - [`toggle-cursor-visible`][struct@crate::TextView#toggle-cursor-visible]
41    /// - [`toggle-overwrite`][struct@crate::TextView#toggle-overwrite]
42    ///
43    /// ## Actions
44    ///
45    /// [`TextView`][crate::TextView] defines a set of built-in actions:
46    ///
47    /// - `clipboard.copy` copies the contents to the clipboard.
48    /// - `clipboard.cut` copies the contents to the clipboard and deletes it from
49    ///   the widget.
50    /// - `clipboard.paste` inserts the contents of the clipboard into the widget.
51    /// - `menu.popup` opens the context menu.
52    /// - `misc.insert-emoji` opens the Emoji chooser.
53    /// - `selection.delete` deletes the current selection.
54    /// - `selection.select-all` selects all of the widgets content.
55    /// - `text.redo` redoes the last change to the contents.
56    /// - `text.undo` undoes the last change to the contents.
57    /// - `text.clear` clears the content.
58    ///
59    /// ## CSS nodes
60    ///
61    /// ```text
62    /// textview.view
63    /// ├── border.top
64    /// ├── border.left
65    /// ├── text
66    /// │   ├── [preedit[.whole][.selection][.prediction][.prefix/.suffix][.spelling-error][.compose-error]]
67    /// │   ╰── [selection]
68    /// ├── border.right
69    /// ├── border.bottom
70    /// ╰── [window.popup]
71    /// ```
72    ///
73    /// [`TextView`][crate::TextView] has a main css node with name textview and style class .view,
74    /// and subnodes for each of the border windows, and the main text area,
75    /// with names border and text, respectively. The border nodes each get
76    /// one of the style classes .left, .right, .top or .bottom.
77    ///
78    /// A node representing the selection will appear below the text node.
79    ///
80    /// If a context menu is opened, the window node will appear as a subnode
81    /// of the main node.
82    ///
83    /// If using an input method with a pre-edit buffer, this string will be styled
84    /// with a `preedit` subnode of the `text` node. the different style classes
85    /// express the possible roles of a piece of text in the pre-edit buffer:
86    ///
87    /// - `.whole` denotes the parts of the pre-edit buffer without a special role
88    /// - `.selection`, `.prefix` and `.suffix` style classes will be used to
89    ///   highlight the specific portions of the pre-edit buffer being edited and its
90    ///   surroundings
91    /// - `.prediction` will be used for parts of the pre-edit buffer not typed by the
92    ///   user (e.g. autocompletion)
93    /// - `.spelling-error` and `.compose-error` will be respectively used to indicate
94    ///   errors in spelling or character composition (e.g. non-existent transliterations).
95    ///
96    /// ## Accessibility
97    ///
98    /// [`TextView`][crate::TextView] uses the [enum@Gtk.AccessibleRole.text_box] role.
99    ///
100    /// ## Properties
101    ///
102    ///
103    /// #### `accepts-tab`
104    ///  Whether Tab will result in a tab character being entered.
105    ///
106    /// Readable | Writable
107    ///
108    ///
109    /// #### `bottom-margin`
110    ///  The bottom margin for text in the text view.
111    ///
112    /// Note that this property is confusingly named. In CSS terms,
113    /// the value set here is padding, and it is applied in addition
114    /// to the padding from the theme.
115    ///
116    /// Don't confuse this property with [`margin-bottom`][struct@crate::Widget#margin-bottom].
117    ///
118    /// Readable | Writable
119    ///
120    ///
121    /// #### `buffer`
122    ///  The buffer which is displayed.
123    ///
124    /// Readable | Writable
125    ///
126    ///
127    /// #### `cursor-visible`
128    ///  If the insertion cursor is shown.
129    ///
130    /// Readable | Writable
131    ///
132    ///
133    /// #### `editable`
134    ///  Whether the text can be modified by the user.
135    ///
136    /// Readable | Writable
137    ///
138    ///
139    /// #### `extra-menu`
140    ///  A menu model whose contents will be appended to the context menu.
141    ///
142    /// Readable | Writable
143    ///
144    ///
145    /// #### `im-module`
146    ///  Which IM (input method) module should be used for this text_view.
147    ///
148    /// See [`IMMulticontext`][crate::IMMulticontext].
149    ///
150    /// Setting this to a non-[`None`] value overrides the system-wide IM module
151    /// setting. See the GtkSettings [`gtk-im-module`][struct@crate::Settings#gtk-im-module] property.
152    ///
153    /// Readable | Writable
154    ///
155    ///
156    /// #### `indent`
157    ///  Amount to indent the paragraph, in pixels.
158    ///
159    /// A negative value of indent will produce a hanging indentation.
160    /// That is, the first line will have the full width, and subsequent
161    /// lines will be indented by the absolute value of indent.
162    ///
163    /// Readable | Writable
164    ///
165    ///
166    /// #### `input-hints`
167    ///  Additional hints (beyond [`input-purpose`][struct@crate::TextView#input-purpose])
168    /// that allow input methods to fine-tune their behaviour.
169    ///
170    /// Readable | Writable
171    ///
172    ///
173    /// #### `input-purpose`
174    ///  The purpose of this text field.
175    ///
176    /// This property can be used by on-screen keyboards and other input
177    /// methods to adjust their behaviour.
178    ///
179    /// Readable | Writable
180    ///
181    ///
182    /// #### `justification`
183    ///  Left, right, or center justification.
184    ///
185    /// Readable | Writable
186    ///
187    ///
188    /// #### `left-margin`
189    ///  The default left margin for text in the text view.
190    ///
191    /// Tags in the buffer may override the default.
192    ///
193    /// Note that this property is confusingly named. In CSS terms,
194    /// the value set here is padding, and it is applied in addition
195    /// to the padding from the theme.
196    ///
197    /// Readable | Writable
198    ///
199    ///
200    /// #### `monospace`
201    ///  Whether text should be displayed in a monospace font.
202    ///
203    /// If [`true`], set the .monospace style class on the
204    /// text view to indicate that a monospace font is desired.
205    ///
206    /// Readable | Writable
207    ///
208    ///
209    /// #### `overwrite`
210    ///  Whether entered text overwrites existing contents.
211    ///
212    /// Readable | Writable
213    ///
214    ///
215    /// #### `pixels-above-lines`
216    ///  Pixels of blank space above paragraphs.
217    ///
218    /// Readable | Writable
219    ///
220    ///
221    /// #### `pixels-below-lines`
222    ///  Pixels of blank space below paragraphs.
223    ///
224    /// Readable | Writable
225    ///
226    ///
227    /// #### `pixels-inside-wrap`
228    ///  Pixels of blank space between wrapped lines in a paragraph.
229    ///
230    /// Readable | Writable
231    ///
232    ///
233    /// #### `right-margin`
234    ///  The default right margin for text in the text view.
235    ///
236    /// Tags in the buffer may override the default.
237    ///
238    /// Note that this property is confusingly named. In CSS terms,
239    /// the value set here is padding, and it is applied in addition
240    /// to the padding from the theme.
241    ///
242    /// Readable | Writable
243    ///
244    ///
245    /// #### `tabs`
246    ///  Custom tabs for this text.
247    ///
248    /// Readable | Writable
249    ///
250    ///
251    /// #### `top-margin`
252    ///  The top margin for text in the text view.
253    ///
254    /// Note that this property is confusingly named. In CSS terms,
255    /// the value set here is padding, and it is applied in addition
256    /// to the padding from the theme.
257    ///
258    /// Don't confuse this property with [`margin-top`][struct@crate::Widget#margin-top].
259    ///
260    /// Readable | Writable
261    ///
262    ///
263    /// #### `wrap-mode`
264    ///  Whether to wrap lines never, at word boundaries, or at character boundaries.
265    ///
266    /// Readable | Writable
267    /// <details><summary><h4>Widget</h4></summary>
268    ///
269    ///
270    /// #### `can-focus`
271    ///  Whether the widget or any of its descendents can accept
272    /// the input focus.
273    ///
274    /// This property is meant to be set by widget implementations,
275    /// typically in their instance init function.
276    ///
277    /// Readable | Writable
278    ///
279    ///
280    /// #### `can-target`
281    ///  Whether the widget can receive pointer events.
282    ///
283    /// Readable | Writable
284    ///
285    ///
286    /// #### `css-classes`
287    ///  A list of css classes applied to this widget.
288    ///
289    /// Readable | Writable
290    ///
291    ///
292    /// #### `css-name`
293    ///  The name of this widget in the CSS tree.
294    ///
295    /// This property is meant to be set by widget implementations,
296    /// typically in their instance init function.
297    ///
298    /// Readable | Writable | Construct Only
299    ///
300    ///
301    /// #### `cursor`
302    ///  The cursor used by @widget.
303    ///
304    /// Readable | Writable
305    ///
306    ///
307    /// #### `focus-on-click`
308    ///  Whether the widget should grab focus when it is clicked with the mouse.
309    ///
310    /// This property is only relevant for widgets that can take focus.
311    ///
312    /// Readable | Writable
313    ///
314    ///
315    /// #### `focusable`
316    ///  Whether this widget itself will accept the input focus.
317    ///
318    /// Readable | Writable
319    ///
320    ///
321    /// #### `halign`
322    ///  How to distribute horizontal space if widget gets extra space.
323    ///
324    /// Readable | Writable
325    ///
326    ///
327    /// #### `has-default`
328    ///  Whether the widget is the default widget.
329    ///
330    /// Readable
331    ///
332    ///
333    /// #### `has-focus`
334    ///  Whether the widget has the input focus.
335    ///
336    /// Readable
337    ///
338    ///
339    /// #### `has-tooltip`
340    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
341    /// signal on @widget.
342    ///
343    /// A true value indicates that @widget can have a tooltip, in this case
344    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
345    /// determine whether it will provide a tooltip or not.
346    ///
347    /// Readable | Writable
348    ///
349    ///
350    /// #### `height-request`
351    ///  Overrides for height request of the widget.
352    ///
353    /// If this is -1, the natural request will be used.
354    ///
355    /// Readable | Writable
356    ///
357    ///
358    /// #### `hexpand`
359    ///  Whether to expand horizontally.
360    ///
361    /// Readable | Writable
362    ///
363    ///
364    /// #### `hexpand-set`
365    ///  Whether to use the `hexpand` property.
366    ///
367    /// Readable | Writable
368    ///
369    ///
370    /// #### `layout-manager`
371    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
372    /// the preferred size of the widget, and allocate its children.
373    ///
374    /// This property is meant to be set by widget implementations,
375    /// typically in their instance init function.
376    ///
377    /// Readable | Writable
378    ///
379    ///
380    /// #### `limit-events`
381    ///  Makes this widget act like a modal dialog, with respect to
382    /// event delivery.
383    ///
384    /// Global event controllers will not handle events with targets
385    /// inside the widget, unless they are set up to ignore propagation
386    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
387    ///
388    /// Readable | Writable
389    ///
390    ///
391    /// #### `margin-bottom`
392    ///  Margin on bottom side of widget.
393    ///
394    /// This property adds margin outside of the widget's normal size
395    /// request, the margin will be added in addition to the size from
396    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
397    ///
398    /// Readable | Writable
399    ///
400    ///
401    /// #### `margin-end`
402    ///  Margin on end of widget, horizontally.
403    ///
404    /// This property supports left-to-right and right-to-left text
405    /// directions.
406    ///
407    /// This property adds margin outside of the widget's normal size
408    /// request, the margin will be added in addition to the size from
409    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
410    ///
411    /// Readable | Writable
412    ///
413    ///
414    /// #### `margin-start`
415    ///  Margin on start of widget, horizontally.
416    ///
417    /// This property supports left-to-right and right-to-left text
418    /// directions.
419    ///
420    /// This property adds margin outside of the widget's normal size
421    /// request, the margin will be added in addition to the size from
422    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
423    ///
424    /// Readable | Writable
425    ///
426    ///
427    /// #### `margin-top`
428    ///  Margin on top side of widget.
429    ///
430    /// This property adds margin outside of the widget's normal size
431    /// request, the margin will be added in addition to the size from
432    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
433    ///
434    /// Readable | Writable
435    ///
436    ///
437    /// #### `name`
438    ///  The name of the widget.
439    ///
440    /// Readable | Writable
441    ///
442    ///
443    /// #### `opacity`
444    ///  The requested opacity of the widget.
445    ///
446    /// Readable | Writable
447    ///
448    ///
449    /// #### `overflow`
450    ///  How content outside the widget's content area is treated.
451    ///
452    /// This property is meant to be set by widget implementations,
453    /// typically in their instance init function.
454    ///
455    /// Readable | Writable
456    ///
457    ///
458    /// #### `parent`
459    ///  The parent widget of this widget.
460    ///
461    /// Readable
462    ///
463    ///
464    /// #### `receives-default`
465    ///  Whether the widget will receive the default action when it is focused.
466    ///
467    /// Readable | Writable
468    ///
469    ///
470    /// #### `root`
471    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
472    ///
473    /// This will be `NULL` if the widget is not contained in a root widget.
474    ///
475    /// Readable
476    ///
477    ///
478    /// #### `scale-factor`
479    ///  The scale factor of the widget.
480    ///
481    /// Readable
482    ///
483    ///
484    /// #### `sensitive`
485    ///  Whether the widget responds to input.
486    ///
487    /// Readable | Writable
488    ///
489    ///
490    /// #### `tooltip-markup`
491    ///  Sets the text of tooltip to be the given string, which is marked up
492    /// with Pango markup.
493    ///
494    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
495    ///
496    /// This is a convenience property which will take care of getting the
497    /// tooltip shown if the given string is not `NULL`:
498    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
499    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
500    /// the default signal handler.
501    ///
502    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
503    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
504    ///
505    /// Readable | Writable
506    ///
507    ///
508    /// #### `tooltip-text`
509    ///  Sets the text of tooltip to be the given string.
510    ///
511    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
512    ///
513    /// This is a convenience property which will take care of getting the
514    /// tooltip shown if the given string is not `NULL`:
515    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
516    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
517    /// the default signal handler.
518    ///
519    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
520    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
521    ///
522    /// Readable | Writable
523    ///
524    ///
525    /// #### `valign`
526    ///  How to distribute vertical space if widget gets extra space.
527    ///
528    /// Readable | Writable
529    ///
530    ///
531    /// #### `vexpand`
532    ///  Whether to expand vertically.
533    ///
534    /// Readable | Writable
535    ///
536    ///
537    /// #### `vexpand-set`
538    ///  Whether to use the `vexpand` property.
539    ///
540    /// Readable | Writable
541    ///
542    ///
543    /// #### `visible`
544    ///  Whether the widget is visible.
545    ///
546    /// Readable | Writable
547    ///
548    ///
549    /// #### `width-request`
550    ///  Overrides for width request of the widget.
551    ///
552    /// If this is -1, the natural request will be used.
553    ///
554    /// Readable | Writable
555    /// </details>
556    /// <details><summary><h4>Accessible</h4></summary>
557    ///
558    ///
559    /// #### `accessible-role`
560    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
561    ///
562    /// The accessible role cannot be changed once set.
563    ///
564    /// Readable | Writable
565    /// </details>
566    /// <details><summary><h4>Scrollable</h4></summary>
567    ///
568    ///
569    /// #### `hadjustment`
570    ///  Horizontal [`Adjustment`][crate::Adjustment] of the scrollable widget.
571    ///
572    /// This adjustment is shared between the scrollable widget and its parent.
573    ///
574    /// Readable | Writable | Construct
575    ///
576    ///
577    /// #### `hscroll-policy`
578    ///  Determines when horizontal scrolling should start.
579    ///
580    /// Readable | Writable
581    ///
582    ///
583    /// #### `vadjustment`
584    ///  Vertical [`Adjustment`][crate::Adjustment] of the scrollable widget.
585    ///
586    /// This adjustment is shared between the scrollable widget and its parent.
587    ///
588    /// Readable | Writable | Construct
589    ///
590    ///
591    /// #### `vscroll-policy`
592    ///  Determines when vertical scrolling should start.
593    ///
594    /// Readable | Writable
595    /// </details>
596    ///
597    /// ## Signals
598    ///
599    ///
600    /// #### `backspace`
601    ///  .
602    ///
603    /// Action
604    ///
605    ///
606    /// #### `copy-clipboard`
607    ///  .
608    ///
609    /// Action
610    ///
611    ///
612    /// #### `cut-clipboard`
613    ///  .
614    ///
615    /// Action
616    ///
617    ///
618    /// #### `delete-from-cursor`
619    ///   for
620    /// deleting a word backwards.
621    ///
622    /// Action
623    ///
624    ///
625    /// #### `extend-selection`
626    ///  Emitted when the selection needs to be extended at @location.
627    ///
628    ///
629    ///
630    ///
631    /// #### `insert-at-cursor`
632    ///  Gets emitted when the user initiates the insertion of a
633    /// fixed string at the cursor.
634    ///
635    /// The ::insert-at-cursor signal is a [keybinding signal](class.SignalAction.html).
636    ///
637    /// This signal has no default bindings.
638    ///
639    /// Action
640    ///
641    ///
642    /// #### `insert-emoji`
643    ///  /kbd
644    ///
645    /// Action
646    ///
647    ///
648    /// #### `move-cursor`
649    ///
650    ///   move horizontally by pages
651    ///
652    /// Action
653    ///
654    ///
655    /// #### `move-viewport`
656    ///  Gets emitted to move the viewport.
657    ///
658    /// The ::move-viewport signal is a [keybinding signal](class.SignalAction.html),
659    /// which can be bound to key combinations to allow the user to move the viewport,
660    /// i.e. change what part of the text view is visible in a containing scrolled
661    /// window.
662    ///
663    /// There are no default bindings for this signal.
664    ///
665    /// Action
666    ///
667    ///
668    /// #### `paste-clipboard`
669    ///  .
670    ///
671    /// Action
672    ///
673    ///
674    /// #### `preedit-changed`
675    ///  Emitted when preedit text of the active IM changes.
676    ///
677    /// If an input method is used, the typed text will not immediately
678    /// be committed to the buffer. So if you are interested in the text,
679    /// connect to this signal.
680    ///
681    /// This signal is only emitted if the text at the given position
682    /// is actually editable.
683    ///
684    /// Action
685    ///
686    ///
687    /// #### `select-all`
688    ///   for unselecting.
689    ///
690    /// Action
691    ///
692    ///
693    /// #### `set-anchor`
694    ///  Gets emitted when the user initiates settings the "anchor" mark.
695    ///
696    /// The ::set-anchor signal is a [keybinding signal](class.SignalAction.html)
697    /// which gets emitted when the user initiates setting the "anchor"
698    /// mark. The "anchor" mark gets placed at the same position as the
699    /// "insert" mark.
700    ///
701    /// This signal has no default bindings.
702    ///
703    /// Action
704    ///
705    ///
706    /// #### `toggle-cursor-visible`
707    ///  .
708    ///
709    /// Action
710    ///
711    ///
712    /// #### `toggle-overwrite`
713    ///  .
714    ///
715    /// Action
716    /// <details><summary><h4>Widget</h4></summary>
717    ///
718    ///
719    /// #### `destroy`
720    ///  Signals that all holders of a reference to the widget should release
721    /// the reference that they hold.
722    ///
723    /// May result in finalization of the widget if all references are released.
724    ///
725    /// This signal is not suitable for saving widget state.
726    ///
727    ///
728    ///
729    ///
730    /// #### `direction-changed`
731    ///  Emitted when the text direction of a widget changes.
732    ///
733    ///
734    ///
735    ///
736    /// #### `hide`
737    ///  Emitted when @widget is hidden.
738    ///
739    ///
740    ///
741    ///
742    /// #### `keynav-failed`
743    ///  Emitted if keyboard navigation fails.
744    ///
745    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
746    ///
747    ///
748    ///
749    ///
750    /// #### `map`
751    ///  Emitted when @widget is going to be mapped.
752    ///
753    /// A widget is mapped when the widget is visible (which is controlled with
754    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
755    /// are also visible.
756    ///
757    /// The `::map` signal can be used to determine whether a widget will be drawn,
758    /// for instance it can resume an animation that was stopped during the
759    /// emission of [`unmap`][struct@crate::Widget#unmap].
760    ///
761    ///
762    ///
763    ///
764    /// #### `mnemonic-activate`
765    ///  Emitted when a widget is activated via a mnemonic.
766    ///
767    /// The default handler for this signal activates @widget if @group_cycling
768    /// is false, or just makes @widget grab focus if @group_cycling is true.
769    ///
770    ///
771    ///
772    ///
773    /// #### `move-focus`
774    ///   to move backward.
775    ///
776    /// Action
777    ///
778    ///
779    /// #### `query-tooltip`
780    ///  Emitted when the widget’s tooltip is about to be shown.
781    ///
782    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
783    /// is true and the hover timeout has expired with the cursor hovering
784    /// above @widget; or emitted when @widget got focus in keyboard mode.
785    ///
786    /// Using the given coordinates, the signal handler should determine
787    /// whether a tooltip should be shown for @widget. If this is the case
788    /// true should be returned, false otherwise. Note that if @keyboard_mode
789    /// is true, the values of @x and @y are undefined and should not be used.
790    ///
791    /// The signal handler is free to manipulate @tooltip with the therefore
792    /// destined function calls.
793    ///
794    ///
795    ///
796    ///
797    /// #### `realize`
798    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
799    ///
800    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
801    /// or the widget has been mapped (that is, it is going to be drawn).
802    ///
803    ///
804    ///
805    ///
806    /// #### `show`
807    ///  Emitted when @widget is shown.
808    ///
809    ///
810    ///
811    ///
812    /// #### `state-flags-changed`
813    ///  Emitted when the widget state changes.
814    ///
815    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
816    ///
817    ///
818    ///
819    ///
820    /// #### `unmap`
821    ///  Emitted when @widget is going to be unmapped.
822    ///
823    /// A widget is unmapped when either it or any of its parents up to the
824    /// toplevel widget have been set as hidden.
825    ///
826    /// As `::unmap` indicates that a widget will not be shown any longer,
827    /// it can be used to, for example, stop an animation on the widget.
828    ///
829    ///
830    ///
831    ///
832    /// #### `unrealize`
833    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
834    ///
835    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
836    /// or the widget has been unmapped (that is, it is going to be hidden).
837    ///
838    ///
839    /// </details>
840    ///
841    /// # Implements
842    ///
843    /// [`TextViewExt`][trait@crate::prelude::TextViewExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`AccessibleTextExt`][trait@crate::prelude::AccessibleTextExt], [`ScrollableExt`][trait@crate::prelude::ScrollableExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
844    #[doc(alias = "GtkTextView")]
845    pub struct TextView(Object<ffi::GtkTextView, ffi::GtkTextViewClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, AccessibleText, Scrollable;
846
847    match fn {
848        type_ => || ffi::gtk_text_view_get_type(),
849    }
850}
851
852#[cfg(all(feature = "v4_10", not(feature = "v4_14")))]
853glib::wrapper! {
854    #[doc(alias = "GtkTextView")]
855    pub struct TextView(Object<ffi::GtkTextView, ffi::GtkTextViewClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, Scrollable;
856
857    match fn {
858        type_ => || ffi::gtk_text_view_get_type(),
859    }
860}
861
862#[cfg(not(any(feature = "v4_10", feature = "v4_14")))]
863glib::wrapper! {
864    #[doc(alias = "GtkTextView")]
865    pub struct TextView(Object<ffi::GtkTextView, ffi::GtkTextViewClass>) @extends Widget, @implements Buildable, ConstraintTarget, Scrollable;
866
867    match fn {
868        type_ => || ffi::gtk_text_view_get_type(),
869    }
870}
871
872impl TextView {
873    pub const NONE: Option<&'static TextView> = None;
874
875    /// Creates a new [`TextView`][crate::TextView].
876    ///
877    /// If you don’t call [`TextViewExt::set_buffer()`][crate::prelude::TextViewExt::set_buffer()] before using the
878    /// text view, an empty default buffer will be created for you. Get the
879    /// buffer with [`TextViewExt::buffer()`][crate::prelude::TextViewExt::buffer()]. If you want to specify
880    /// your own buffer, consider [`with_buffer()`][Self::with_buffer()].
881    ///
882    /// # Returns
883    ///
884    /// a new [`TextView`][crate::TextView]
885    #[doc(alias = "gtk_text_view_new")]
886    pub fn new() -> TextView {
887        assert_initialized_main_thread!();
888        unsafe { Widget::from_glib_none(ffi::gtk_text_view_new()).unsafe_cast() }
889    }
890
891    /// Creates a new [`TextView`][crate::TextView] widget displaying the buffer @buffer.
892    ///
893    /// One buffer can be shared among many widgets. @buffer may be [`None`]
894    /// to create a default buffer, in which case this function is equivalent
895    /// to [`new()`][Self::new()]. The text view adds its own reference count
896    /// to the buffer; it does not take over an existing reference.
897    /// ## `buffer`
898    /// a [`TextBuffer`][crate::TextBuffer]
899    ///
900    /// # Returns
901    ///
902    /// a new [`TextView`][crate::TextView].
903    #[doc(alias = "gtk_text_view_new_with_buffer")]
904    #[doc(alias = "new_with_buffer")]
905    pub fn with_buffer(buffer: &impl IsA<TextBuffer>) -> TextView {
906        skip_assert_initialized!();
907        unsafe {
908            Widget::from_glib_none(ffi::gtk_text_view_new_with_buffer(
909                buffer.as_ref().to_glib_none().0,
910            ))
911            .unsafe_cast()
912        }
913    }
914
915    // rustdoc-stripper-ignore-next
916    /// Creates a new builder-pattern struct instance to construct [`TextView`] objects.
917    ///
918    /// This method returns an instance of [`TextViewBuilder`](crate::builders::TextViewBuilder) which can be used to create [`TextView`] objects.
919    pub fn builder() -> TextViewBuilder {
920        TextViewBuilder::new()
921    }
922}
923
924impl Default for TextView {
925    fn default() -> Self {
926        Self::new()
927    }
928}
929
930// rustdoc-stripper-ignore-next
931/// A [builder-pattern] type to construct [`TextView`] objects.
932///
933/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
934#[must_use = "The builder must be built to be used"]
935pub struct TextViewBuilder {
936    builder: glib::object::ObjectBuilder<'static, TextView>,
937}
938
939impl TextViewBuilder {
940    fn new() -> Self {
941        Self {
942            builder: glib::object::Object::builder(),
943        }
944    }
945
946    /// Whether Tab will result in a tab character being entered.
947    pub fn accepts_tab(self, accepts_tab: bool) -> Self {
948        Self {
949            builder: self.builder.property("accepts-tab", accepts_tab),
950        }
951    }
952
953    /// The bottom margin for text in the text view.
954    ///
955    /// Note that this property is confusingly named. In CSS terms,
956    /// the value set here is padding, and it is applied in addition
957    /// to the padding from the theme.
958    ///
959    /// Don't confuse this property with [`margin-bottom`][struct@crate::Widget#margin-bottom].
960    pub fn bottom_margin(self, bottom_margin: i32) -> Self {
961        Self {
962            builder: self.builder.property("bottom-margin", bottom_margin),
963        }
964    }
965
966    /// The buffer which is displayed.
967    pub fn buffer(self, buffer: &impl IsA<TextBuffer>) -> Self {
968        Self {
969            builder: self.builder.property("buffer", buffer.clone().upcast()),
970        }
971    }
972
973    /// If the insertion cursor is shown.
974    pub fn cursor_visible(self, cursor_visible: bool) -> Self {
975        Self {
976            builder: self.builder.property("cursor-visible", cursor_visible),
977        }
978    }
979
980    /// Whether the text can be modified by the user.
981    pub fn editable(self, editable: bool) -> Self {
982        Self {
983            builder: self.builder.property("editable", editable),
984        }
985    }
986
987    /// A menu model whose contents will be appended to the context menu.
988    pub fn extra_menu(self, extra_menu: &impl IsA<gio::MenuModel>) -> Self {
989        Self {
990            builder: self
991                .builder
992                .property("extra-menu", extra_menu.clone().upcast()),
993        }
994    }
995
996    /// Which IM (input method) module should be used for this text_view.
997    ///
998    /// See [`IMMulticontext`][crate::IMMulticontext].
999    ///
1000    /// Setting this to a non-[`None`] value overrides the system-wide IM module
1001    /// setting. See the GtkSettings [`gtk-im-module`][struct@crate::Settings#gtk-im-module] property.
1002    pub fn im_module(self, im_module: impl Into<glib::GString>) -> Self {
1003        Self {
1004            builder: self.builder.property("im-module", im_module.into()),
1005        }
1006    }
1007
1008    /// Amount to indent the paragraph, in pixels.
1009    ///
1010    /// A negative value of indent will produce a hanging indentation.
1011    /// That is, the first line will have the full width, and subsequent
1012    /// lines will be indented by the absolute value of indent.
1013    pub fn indent(self, indent: i32) -> Self {
1014        Self {
1015            builder: self.builder.property("indent", indent),
1016        }
1017    }
1018
1019    /// Additional hints (beyond [`input-purpose`][struct@crate::TextView#input-purpose])
1020    /// that allow input methods to fine-tune their behaviour.
1021    pub fn input_hints(self, input_hints: InputHints) -> Self {
1022        Self {
1023            builder: self.builder.property("input-hints", input_hints),
1024        }
1025    }
1026
1027    /// The purpose of this text field.
1028    ///
1029    /// This property can be used by on-screen keyboards and other input
1030    /// methods to adjust their behaviour.
1031    pub fn input_purpose(self, input_purpose: InputPurpose) -> Self {
1032        Self {
1033            builder: self.builder.property("input-purpose", input_purpose),
1034        }
1035    }
1036
1037    /// Left, right, or center justification.
1038    pub fn justification(self, justification: Justification) -> Self {
1039        Self {
1040            builder: self.builder.property("justification", justification),
1041        }
1042    }
1043
1044    /// The default left margin for text in the text view.
1045    ///
1046    /// Tags in the buffer may override the default.
1047    ///
1048    /// Note that this property is confusingly named. In CSS terms,
1049    /// the value set here is padding, and it is applied in addition
1050    /// to the padding from the theme.
1051    pub fn left_margin(self, left_margin: i32) -> Self {
1052        Self {
1053            builder: self.builder.property("left-margin", left_margin),
1054        }
1055    }
1056
1057    /// Whether text should be displayed in a monospace font.
1058    ///
1059    /// If [`true`], set the .monospace style class on the
1060    /// text view to indicate that a monospace font is desired.
1061    pub fn monospace(self, monospace: bool) -> Self {
1062        Self {
1063            builder: self.builder.property("monospace", monospace),
1064        }
1065    }
1066
1067    /// Whether entered text overwrites existing contents.
1068    pub fn overwrite(self, overwrite: bool) -> Self {
1069        Self {
1070            builder: self.builder.property("overwrite", overwrite),
1071        }
1072    }
1073
1074    /// Pixels of blank space above paragraphs.
1075    pub fn pixels_above_lines(self, pixels_above_lines: i32) -> Self {
1076        Self {
1077            builder: self
1078                .builder
1079                .property("pixels-above-lines", pixels_above_lines),
1080        }
1081    }
1082
1083    /// Pixels of blank space below paragraphs.
1084    pub fn pixels_below_lines(self, pixels_below_lines: i32) -> Self {
1085        Self {
1086            builder: self
1087                .builder
1088                .property("pixels-below-lines", pixels_below_lines),
1089        }
1090    }
1091
1092    /// Pixels of blank space between wrapped lines in a paragraph.
1093    pub fn pixels_inside_wrap(self, pixels_inside_wrap: i32) -> Self {
1094        Self {
1095            builder: self
1096                .builder
1097                .property("pixels-inside-wrap", pixels_inside_wrap),
1098        }
1099    }
1100
1101    /// The default right margin for text in the text view.
1102    ///
1103    /// Tags in the buffer may override the default.
1104    ///
1105    /// Note that this property is confusingly named. In CSS terms,
1106    /// the value set here is padding, and it is applied in addition
1107    /// to the padding from the theme.
1108    pub fn right_margin(self, right_margin: i32) -> Self {
1109        Self {
1110            builder: self.builder.property("right-margin", right_margin),
1111        }
1112    }
1113
1114    /// Custom tabs for this text.
1115    pub fn tabs(self, tabs: &pango::TabArray) -> Self {
1116        Self {
1117            builder: self.builder.property("tabs", tabs),
1118        }
1119    }
1120
1121    /// The top margin for text in the text view.
1122    ///
1123    /// Note that this property is confusingly named. In CSS terms,
1124    /// the value set here is padding, and it is applied in addition
1125    /// to the padding from the theme.
1126    ///
1127    /// Don't confuse this property with [`margin-top`][struct@crate::Widget#margin-top].
1128    pub fn top_margin(self, top_margin: i32) -> Self {
1129        Self {
1130            builder: self.builder.property("top-margin", top_margin),
1131        }
1132    }
1133
1134    /// Whether to wrap lines never, at word boundaries, or at character boundaries.
1135    pub fn wrap_mode(self, wrap_mode: WrapMode) -> Self {
1136        Self {
1137            builder: self.builder.property("wrap-mode", wrap_mode),
1138        }
1139    }
1140
1141    /// Whether the widget or any of its descendents can accept
1142    /// the input focus.
1143    ///
1144    /// This property is meant to be set by widget implementations,
1145    /// typically in their instance init function.
1146    pub fn can_focus(self, can_focus: bool) -> Self {
1147        Self {
1148            builder: self.builder.property("can-focus", can_focus),
1149        }
1150    }
1151
1152    /// Whether the widget can receive pointer events.
1153    pub fn can_target(self, can_target: bool) -> Self {
1154        Self {
1155            builder: self.builder.property("can-target", can_target),
1156        }
1157    }
1158
1159    /// A list of css classes applied to this widget.
1160    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1161        Self {
1162            builder: self.builder.property("css-classes", css_classes.into()),
1163        }
1164    }
1165
1166    /// The name of this widget in the CSS tree.
1167    ///
1168    /// This property is meant to be set by widget implementations,
1169    /// typically in their instance init function.
1170    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1171        Self {
1172            builder: self.builder.property("css-name", css_name.into()),
1173        }
1174    }
1175
1176    /// The cursor used by @widget.
1177    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1178        Self {
1179            builder: self.builder.property("cursor", cursor.clone()),
1180        }
1181    }
1182
1183    /// Whether the widget should grab focus when it is clicked with the mouse.
1184    ///
1185    /// This property is only relevant for widgets that can take focus.
1186    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1187        Self {
1188            builder: self.builder.property("focus-on-click", focus_on_click),
1189        }
1190    }
1191
1192    /// Whether this widget itself will accept the input focus.
1193    pub fn focusable(self, focusable: bool) -> Self {
1194        Self {
1195            builder: self.builder.property("focusable", focusable),
1196        }
1197    }
1198
1199    /// How to distribute horizontal space if widget gets extra space.
1200    pub fn halign(self, halign: Align) -> Self {
1201        Self {
1202            builder: self.builder.property("halign", halign),
1203        }
1204    }
1205
1206    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1207    /// signal on @widget.
1208    ///
1209    /// A true value indicates that @widget can have a tooltip, in this case
1210    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1211    /// determine whether it will provide a tooltip or not.
1212    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1213        Self {
1214            builder: self.builder.property("has-tooltip", has_tooltip),
1215        }
1216    }
1217
1218    /// Overrides for height request of the widget.
1219    ///
1220    /// If this is -1, the natural request will be used.
1221    pub fn height_request(self, height_request: i32) -> Self {
1222        Self {
1223            builder: self.builder.property("height-request", height_request),
1224        }
1225    }
1226
1227    /// Whether to expand horizontally.
1228    pub fn hexpand(self, hexpand: bool) -> Self {
1229        Self {
1230            builder: self.builder.property("hexpand", hexpand),
1231        }
1232    }
1233
1234    /// Whether to use the `hexpand` property.
1235    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1236        Self {
1237            builder: self.builder.property("hexpand-set", hexpand_set),
1238        }
1239    }
1240
1241    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1242    /// the preferred size of the widget, and allocate its children.
1243    ///
1244    /// This property is meant to be set by widget implementations,
1245    /// typically in their instance init function.
1246    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1247        Self {
1248            builder: self
1249                .builder
1250                .property("layout-manager", layout_manager.clone().upcast()),
1251        }
1252    }
1253
1254    /// Makes this widget act like a modal dialog, with respect to
1255    /// event delivery.
1256    ///
1257    /// Global event controllers will not handle events with targets
1258    /// inside the widget, unless they are set up to ignore propagation
1259    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1260    #[cfg(feature = "v4_18")]
1261    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1262    pub fn limit_events(self, limit_events: bool) -> Self {
1263        Self {
1264            builder: self.builder.property("limit-events", limit_events),
1265        }
1266    }
1267
1268    /// Margin on bottom side of widget.
1269    ///
1270    /// This property adds margin outside of the widget's normal size
1271    /// request, the margin will be added in addition to the size from
1272    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1273    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1274        Self {
1275            builder: self.builder.property("margin-bottom", margin_bottom),
1276        }
1277    }
1278
1279    /// Margin on end of widget, horizontally.
1280    ///
1281    /// This property supports left-to-right and right-to-left text
1282    /// directions.
1283    ///
1284    /// This property adds margin outside of the widget's normal size
1285    /// request, the margin will be added in addition to the size from
1286    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1287    pub fn margin_end(self, margin_end: i32) -> Self {
1288        Self {
1289            builder: self.builder.property("margin-end", margin_end),
1290        }
1291    }
1292
1293    /// Margin on start of widget, horizontally.
1294    ///
1295    /// This property supports left-to-right and right-to-left text
1296    /// directions.
1297    ///
1298    /// This property adds margin outside of the widget's normal size
1299    /// request, the margin will be added in addition to the size from
1300    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1301    pub fn margin_start(self, margin_start: i32) -> Self {
1302        Self {
1303            builder: self.builder.property("margin-start", margin_start),
1304        }
1305    }
1306
1307    /// Margin on top side of widget.
1308    ///
1309    /// This property adds margin outside of the widget's normal size
1310    /// request, the margin will be added in addition to the size from
1311    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1312    pub fn margin_top(self, margin_top: i32) -> Self {
1313        Self {
1314            builder: self.builder.property("margin-top", margin_top),
1315        }
1316    }
1317
1318    /// The name of the widget.
1319    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1320        Self {
1321            builder: self.builder.property("name", name.into()),
1322        }
1323    }
1324
1325    /// The requested opacity of the widget.
1326    pub fn opacity(self, opacity: f64) -> Self {
1327        Self {
1328            builder: self.builder.property("opacity", opacity),
1329        }
1330    }
1331
1332    /// How content outside the widget's content area is treated.
1333    ///
1334    /// This property is meant to be set by widget implementations,
1335    /// typically in their instance init function.
1336    pub fn overflow(self, overflow: Overflow) -> Self {
1337        Self {
1338            builder: self.builder.property("overflow", overflow),
1339        }
1340    }
1341
1342    /// Whether the widget will receive the default action when it is focused.
1343    pub fn receives_default(self, receives_default: bool) -> Self {
1344        Self {
1345            builder: self.builder.property("receives-default", receives_default),
1346        }
1347    }
1348
1349    /// Whether the widget responds to input.
1350    pub fn sensitive(self, sensitive: bool) -> Self {
1351        Self {
1352            builder: self.builder.property("sensitive", sensitive),
1353        }
1354    }
1355
1356    /// Sets the text of tooltip to be the given string, which is marked up
1357    /// with Pango markup.
1358    ///
1359    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1360    ///
1361    /// This is a convenience property which will take care of getting the
1362    /// tooltip shown if the given string is not `NULL`:
1363    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1364    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1365    /// the default signal handler.
1366    ///
1367    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1368    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1369    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1370        Self {
1371            builder: self
1372                .builder
1373                .property("tooltip-markup", tooltip_markup.into()),
1374        }
1375    }
1376
1377    /// Sets the text of tooltip to be the given string.
1378    ///
1379    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1380    ///
1381    /// This is a convenience property which will take care of getting the
1382    /// tooltip shown if the given string is not `NULL`:
1383    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1384    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1385    /// the default signal handler.
1386    ///
1387    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1388    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1389    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1390        Self {
1391            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1392        }
1393    }
1394
1395    /// How to distribute vertical space if widget gets extra space.
1396    pub fn valign(self, valign: Align) -> Self {
1397        Self {
1398            builder: self.builder.property("valign", valign),
1399        }
1400    }
1401
1402    /// Whether to expand vertically.
1403    pub fn vexpand(self, vexpand: bool) -> Self {
1404        Self {
1405            builder: self.builder.property("vexpand", vexpand),
1406        }
1407    }
1408
1409    /// Whether to use the `vexpand` property.
1410    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1411        Self {
1412            builder: self.builder.property("vexpand-set", vexpand_set),
1413        }
1414    }
1415
1416    /// Whether the widget is visible.
1417    pub fn visible(self, visible: bool) -> Self {
1418        Self {
1419            builder: self.builder.property("visible", visible),
1420        }
1421    }
1422
1423    /// Overrides for width request of the widget.
1424    ///
1425    /// If this is -1, the natural request will be used.
1426    pub fn width_request(self, width_request: i32) -> Self {
1427        Self {
1428            builder: self.builder.property("width-request", width_request),
1429        }
1430    }
1431
1432    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1433    ///
1434    /// The accessible role cannot be changed once set.
1435    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1436        Self {
1437            builder: self.builder.property("accessible-role", accessible_role),
1438        }
1439    }
1440
1441    /// Horizontal [`Adjustment`][crate::Adjustment] of the scrollable widget.
1442    ///
1443    /// This adjustment is shared between the scrollable widget and its parent.
1444    pub fn hadjustment(self, hadjustment: &impl IsA<Adjustment>) -> Self {
1445        Self {
1446            builder: self
1447                .builder
1448                .property("hadjustment", hadjustment.clone().upcast()),
1449        }
1450    }
1451
1452    /// Determines when horizontal scrolling should start.
1453    pub fn hscroll_policy(self, hscroll_policy: ScrollablePolicy) -> Self {
1454        Self {
1455            builder: self.builder.property("hscroll-policy", hscroll_policy),
1456        }
1457    }
1458
1459    /// Vertical [`Adjustment`][crate::Adjustment] of the scrollable widget.
1460    ///
1461    /// This adjustment is shared between the scrollable widget and its parent.
1462    pub fn vadjustment(self, vadjustment: &impl IsA<Adjustment>) -> Self {
1463        Self {
1464            builder: self
1465                .builder
1466                .property("vadjustment", vadjustment.clone().upcast()),
1467        }
1468    }
1469
1470    /// Determines when vertical scrolling should start.
1471    pub fn vscroll_policy(self, vscroll_policy: ScrollablePolicy) -> Self {
1472        Self {
1473            builder: self.builder.property("vscroll-policy", vscroll_policy),
1474        }
1475    }
1476
1477    // rustdoc-stripper-ignore-next
1478    /// Build the [`TextView`].
1479    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1480    pub fn build(self) -> TextView {
1481        assert_initialized_main_thread!();
1482        self.builder.build()
1483    }
1484}
1485
1486/// Trait containing all [`struct@TextView`] methods.
1487///
1488/// # Implementors
1489///
1490/// [`TextView`][struct@crate::TextView]
1491pub trait TextViewExt: IsA<TextView> + 'static {
1492    /// Adds a child widget in the text buffer, at the given @anchor.
1493    /// ## `child`
1494    /// a [`Widget`][crate::Widget]
1495    /// ## `anchor`
1496    /// a [`TextChildAnchor`][crate::TextChildAnchor] in the [`TextBuffer`][crate::TextBuffer] for @self
1497    #[doc(alias = "gtk_text_view_add_child_at_anchor")]
1498    fn add_child_at_anchor(&self, child: &impl IsA<Widget>, anchor: &impl IsA<TextChildAnchor>) {
1499        unsafe {
1500            ffi::gtk_text_view_add_child_at_anchor(
1501                self.as_ref().to_glib_none().0,
1502                child.as_ref().to_glib_none().0,
1503                anchor.as_ref().to_glib_none().0,
1504            );
1505        }
1506    }
1507
1508    /// Adds @child at a fixed coordinate in the [`TextView`][crate::TextView]'s text window.
1509    ///
1510    /// The @xpos and @ypos must be in buffer coordinates (see
1511    /// [`iter_location()`][Self::iter_location()] to convert to
1512    /// buffer coordinates).
1513    ///
1514    /// @child will scroll with the text view.
1515    ///
1516    /// If instead you want a widget that will not move with the
1517    /// [`TextView`][crate::TextView] contents see [`Overlay`][crate::Overlay].
1518    /// ## `child`
1519    /// a [`Widget`][crate::Widget]
1520    /// ## `xpos`
1521    /// X position of child in window coordinates
1522    /// ## `ypos`
1523    /// Y position of child in window coordinates
1524    #[doc(alias = "gtk_text_view_add_overlay")]
1525    fn add_overlay(&self, child: &impl IsA<Widget>, xpos: i32, ypos: i32) {
1526        unsafe {
1527            ffi::gtk_text_view_add_overlay(
1528                self.as_ref().to_glib_none().0,
1529                child.as_ref().to_glib_none().0,
1530                xpos,
1531                ypos,
1532            );
1533        }
1534    }
1535
1536    /// Moves the given @iter backward by one display (wrapped) line.
1537    ///
1538    /// A display line is different from a paragraph. Paragraphs are
1539    /// separated by newlines or other paragraph separator characters.
1540    /// Display lines are created by line-wrapping a paragraph. If
1541    /// wrapping is turned off, display lines and paragraphs will be the
1542    /// same. Display lines are divided differently for each view, since
1543    /// they depend on the view’s width; paragraphs are the same in all
1544    /// views, since they depend on the contents of the [`TextBuffer`][crate::TextBuffer].
1545    /// ## `iter`
1546    /// a [`TextIter`][crate::TextIter]
1547    ///
1548    /// # Returns
1549    ///
1550    /// [`true`] if @iter was moved and is not on the end iterator
1551    #[doc(alias = "gtk_text_view_backward_display_line")]
1552    fn backward_display_line(&self, iter: &mut TextIter) -> bool {
1553        unsafe {
1554            from_glib(ffi::gtk_text_view_backward_display_line(
1555                self.as_ref().to_glib_none().0,
1556                iter.to_glib_none_mut().0,
1557            ))
1558        }
1559    }
1560
1561    /// Moves the given @iter backward to the next display line start.
1562    ///
1563    /// A display line is different from a paragraph. Paragraphs are
1564    /// separated by newlines or other paragraph separator characters.
1565    /// Display lines are created by line-wrapping a paragraph. If
1566    /// wrapping is turned off, display lines and paragraphs will be the
1567    /// same. Display lines are divided differently for each view, since
1568    /// they depend on the view’s width; paragraphs are the same in all
1569    /// views, since they depend on the contents of the [`TextBuffer`][crate::TextBuffer].
1570    /// ## `iter`
1571    /// a [`TextIter`][crate::TextIter]
1572    ///
1573    /// # Returns
1574    ///
1575    /// [`true`] if @iter was moved and is not on the end iterator
1576    #[doc(alias = "gtk_text_view_backward_display_line_start")]
1577    fn backward_display_line_start(&self, iter: &mut TextIter) -> bool {
1578        unsafe {
1579            from_glib(ffi::gtk_text_view_backward_display_line_start(
1580                self.as_ref().to_glib_none().0,
1581                iter.to_glib_none_mut().0,
1582            ))
1583        }
1584    }
1585
1586    /// Converts buffer coordinates to window coordinates.
1587    /// ## `win`
1588    /// a [`TextWindowType`][crate::TextWindowType]
1589    /// ## `buffer_x`
1590    /// buffer x coordinate
1591    /// ## `buffer_y`
1592    /// buffer y coordinate
1593    ///
1594    /// # Returns
1595    ///
1596    ///
1597    /// ## `window_x`
1598    /// window x coordinate return location
1599    ///
1600    /// ## `window_y`
1601    /// window y coordinate return location
1602    #[doc(alias = "gtk_text_view_buffer_to_window_coords")]
1603    fn buffer_to_window_coords(
1604        &self,
1605        win: TextWindowType,
1606        buffer_x: i32,
1607        buffer_y: i32,
1608    ) -> (i32, i32) {
1609        unsafe {
1610            let mut window_x = std::mem::MaybeUninit::uninit();
1611            let mut window_y = std::mem::MaybeUninit::uninit();
1612            ffi::gtk_text_view_buffer_to_window_coords(
1613                self.as_ref().to_glib_none().0,
1614                win.into_glib(),
1615                buffer_x,
1616                buffer_y,
1617                window_x.as_mut_ptr(),
1618                window_y.as_mut_ptr(),
1619            );
1620            (window_x.assume_init(), window_y.assume_init())
1621        }
1622    }
1623
1624    /// Moves the given @iter forward by one display (wrapped) line.
1625    ///
1626    /// A display line is different from a paragraph. Paragraphs are
1627    /// separated by newlines or other paragraph separator characters.
1628    /// Display lines are created by line-wrapping a paragraph. If
1629    /// wrapping is turned off, display lines and paragraphs will be the
1630    /// same. Display lines are divided differently for each view, since
1631    /// they depend on the view’s width; paragraphs are the same in all
1632    /// views, since they depend on the contents of the [`TextBuffer`][crate::TextBuffer].
1633    /// ## `iter`
1634    /// a [`TextIter`][crate::TextIter]
1635    ///
1636    /// # Returns
1637    ///
1638    /// [`true`] if @iter was moved and is not on the end iterator
1639    #[doc(alias = "gtk_text_view_forward_display_line")]
1640    fn forward_display_line(&self, iter: &mut TextIter) -> bool {
1641        unsafe {
1642            from_glib(ffi::gtk_text_view_forward_display_line(
1643                self.as_ref().to_glib_none().0,
1644                iter.to_glib_none_mut().0,
1645            ))
1646        }
1647    }
1648
1649    /// Moves the given @iter forward to the next display line end.
1650    ///
1651    /// A display line is different from a paragraph. Paragraphs are
1652    /// separated by newlines or other paragraph separator characters.
1653    /// Display lines are created by line-wrapping a paragraph. If
1654    /// wrapping is turned off, display lines and paragraphs will be the
1655    /// same. Display lines are divided differently for each view, since
1656    /// they depend on the view’s width; paragraphs are the same in all
1657    /// views, since they depend on the contents of the [`TextBuffer`][crate::TextBuffer].
1658    /// ## `iter`
1659    /// a [`TextIter`][crate::TextIter]
1660    ///
1661    /// # Returns
1662    ///
1663    /// [`true`] if @iter was moved and is not on the end iterator
1664    #[doc(alias = "gtk_text_view_forward_display_line_end")]
1665    fn forward_display_line_end(&self, iter: &mut TextIter) -> bool {
1666        unsafe {
1667            from_glib(ffi::gtk_text_view_forward_display_line_end(
1668                self.as_ref().to_glib_none().0,
1669                iter.to_glib_none_mut().0,
1670            ))
1671        }
1672    }
1673
1674    ///  key inserts a tab characters.
1675    ///
1676    /// See [`set_accepts_tab()`][Self::set_accepts_tab()].
1677    ///
1678    /// # Returns
1679    ///
1680    /// [`true`] if pressing the Tab key inserts a tab character,
1681    ///   [`false`] if pressing the Tab key moves the keyboard focus.
1682    #[doc(alias = "gtk_text_view_get_accepts_tab")]
1683    #[doc(alias = "get_accepts_tab")]
1684    #[doc(alias = "accepts-tab")]
1685    fn accepts_tab(&self) -> bool {
1686        unsafe {
1687            from_glib(ffi::gtk_text_view_get_accepts_tab(
1688                self.as_ref().to_glib_none().0,
1689            ))
1690        }
1691    }
1692
1693    /// Gets the bottom margin for text in the @self.
1694    ///
1695    /// # Returns
1696    ///
1697    /// bottom margin in pixels
1698    #[doc(alias = "gtk_text_view_get_bottom_margin")]
1699    #[doc(alias = "get_bottom_margin")]
1700    #[doc(alias = "bottom-margin")]
1701    fn bottom_margin(&self) -> i32 {
1702        unsafe { ffi::gtk_text_view_get_bottom_margin(self.as_ref().to_glib_none().0) }
1703    }
1704
1705    /// Returns the [`TextBuffer`][crate::TextBuffer] being displayed by this text view.
1706    ///
1707    /// The reference count on the buffer is not incremented; the caller
1708    /// of this function won’t own a new reference.
1709    ///
1710    /// # Returns
1711    ///
1712    /// a [`TextBuffer`][crate::TextBuffer]
1713    #[doc(alias = "gtk_text_view_get_buffer")]
1714    #[doc(alias = "get_buffer")]
1715    fn buffer(&self) -> TextBuffer {
1716        unsafe {
1717            from_glib_none(ffi::gtk_text_view_get_buffer(
1718                self.as_ref().to_glib_none().0,
1719            ))
1720        }
1721    }
1722
1723    /// Determine the positions of the strong and weak cursors if the
1724    /// insertion point is at @iter.
1725    ///
1726    /// The position of each cursor is stored as a zero-width rectangle.
1727    /// The strong cursor location is the location where characters of
1728    /// the directionality equal to the base direction of the paragraph
1729    /// are inserted. The weak cursor location is the location where
1730    /// characters of the directionality opposite to the base direction
1731    /// of the paragraph are inserted.
1732    ///
1733    /// If @iter is [`None`], the actual cursor position is used.
1734    ///
1735    /// Note that if @iter happens to be the actual cursor position, and
1736    /// there is currently an IM preedit sequence being entered, the
1737    /// returned locations will be adjusted to account for the preedit
1738    /// cursor’s offset within the preedit sequence.
1739    ///
1740    /// The rectangle position is in buffer coordinates; use
1741    /// [`buffer_to_window_coords()`][Self::buffer_to_window_coords()] to convert these
1742    /// coordinates to coordinates for one of the windows in the text view.
1743    /// ## `iter`
1744    /// a [`TextIter`][crate::TextIter]
1745    ///
1746    /// # Returns
1747    ///
1748    ///
1749    /// ## `strong`
1750    /// location to store the strong cursor position
1751    ///
1752    /// ## `weak`
1753    /// location to store the weak cursor position
1754    #[doc(alias = "gtk_text_view_get_cursor_locations")]
1755    #[doc(alias = "get_cursor_locations")]
1756    fn cursor_locations(&self, iter: Option<&TextIter>) -> (gdk::Rectangle, gdk::Rectangle) {
1757        unsafe {
1758            let mut strong = gdk::Rectangle::uninitialized();
1759            let mut weak = gdk::Rectangle::uninitialized();
1760            ffi::gtk_text_view_get_cursor_locations(
1761                self.as_ref().to_glib_none().0,
1762                iter.to_glib_none().0,
1763                strong.to_glib_none_mut().0,
1764                weak.to_glib_none_mut().0,
1765            );
1766            (strong, weak)
1767        }
1768    }
1769
1770    /// Find out whether the cursor should be displayed.
1771    ///
1772    /// # Returns
1773    ///
1774    /// whether the insertion mark is visible
1775    #[doc(alias = "gtk_text_view_get_cursor_visible")]
1776    #[doc(alias = "get_cursor_visible")]
1777    #[doc(alias = "cursor-visible")]
1778    fn is_cursor_visible(&self) -> bool {
1779        unsafe {
1780            from_glib(ffi::gtk_text_view_get_cursor_visible(
1781                self.as_ref().to_glib_none().0,
1782            ))
1783        }
1784    }
1785
1786    /// Returns the default editability of the [`TextView`][crate::TextView].
1787    ///
1788    /// Tags in the buffer may override this setting for some ranges of text.
1789    ///
1790    /// # Returns
1791    ///
1792    /// whether text is editable by default
1793    #[doc(alias = "gtk_text_view_get_editable")]
1794    #[doc(alias = "get_editable")]
1795    #[doc(alias = "editable")]
1796    fn is_editable(&self) -> bool {
1797        unsafe {
1798            from_glib(ffi::gtk_text_view_get_editable(
1799                self.as_ref().to_glib_none().0,
1800            ))
1801        }
1802    }
1803
1804    /// Gets the menu model that gets added to the context menu
1805    /// or [`None`] if none has been set.
1806    ///
1807    /// # Returns
1808    ///
1809    /// the menu model
1810    #[doc(alias = "gtk_text_view_get_extra_menu")]
1811    #[doc(alias = "get_extra_menu")]
1812    #[doc(alias = "extra-menu")]
1813    fn extra_menu(&self) -> Option<gio::MenuModel> {
1814        unsafe {
1815            from_glib_none(ffi::gtk_text_view_get_extra_menu(
1816                self.as_ref().to_glib_none().0,
1817            ))
1818        }
1819    }
1820
1821    /// Gets a [`Widget`][crate::Widget] that has previously been set as gutter.
1822    ///
1823    /// See [`set_gutter()`][Self::set_gutter()].
1824    ///
1825    /// @win must be one of [`TextWindowType::Left`][crate::TextWindowType::Left], [`TextWindowType::Right`][crate::TextWindowType::Right],
1826    /// [`TextWindowType::Top`][crate::TextWindowType::Top], or [`TextWindowType::Bottom`][crate::TextWindowType::Bottom].
1827    /// ## `win`
1828    /// a [`TextWindowType`][crate::TextWindowType]
1829    ///
1830    /// # Returns
1831    ///
1832    /// a [`Widget`][crate::Widget]
1833    #[doc(alias = "gtk_text_view_get_gutter")]
1834    #[doc(alias = "get_gutter")]
1835    fn gutter(&self, win: TextWindowType) -> Option<Widget> {
1836        unsafe {
1837            from_glib_none(ffi::gtk_text_view_get_gutter(
1838                self.as_ref().to_glib_none().0,
1839                win.into_glib(),
1840            ))
1841        }
1842    }
1843
1844    /// Gets the default indentation of paragraphs in @self.
1845    ///
1846    /// Tags in the view’s buffer may override the default.
1847    /// The indentation may be negative.
1848    ///
1849    /// # Returns
1850    ///
1851    /// number of pixels of indentation
1852    #[doc(alias = "gtk_text_view_get_indent")]
1853    #[doc(alias = "get_indent")]
1854    fn indent(&self) -> i32 {
1855        unsafe { ffi::gtk_text_view_get_indent(self.as_ref().to_glib_none().0) }
1856    }
1857
1858    /// Gets the `input-hints` of the [`TextView`][crate::TextView].
1859    ///
1860    /// # Returns
1861    ///
1862    /// the input hints
1863    #[doc(alias = "gtk_text_view_get_input_hints")]
1864    #[doc(alias = "get_input_hints")]
1865    #[doc(alias = "input-hints")]
1866    fn input_hints(&self) -> InputHints {
1867        unsafe {
1868            from_glib(ffi::gtk_text_view_get_input_hints(
1869                self.as_ref().to_glib_none().0,
1870            ))
1871        }
1872    }
1873
1874    /// Gets the `input-purpose` of the [`TextView`][crate::TextView].
1875    ///
1876    /// # Returns
1877    ///
1878    /// the input purpose
1879    #[doc(alias = "gtk_text_view_get_input_purpose")]
1880    #[doc(alias = "get_input_purpose")]
1881    #[doc(alias = "input-purpose")]
1882    fn input_purpose(&self) -> InputPurpose {
1883        unsafe {
1884            from_glib(ffi::gtk_text_view_get_input_purpose(
1885                self.as_ref().to_glib_none().0,
1886            ))
1887        }
1888    }
1889
1890    /// Retrieves the iterator at buffer coordinates @x and @y.
1891    ///
1892    /// Buffer coordinates are coordinates for the entire buffer, not just
1893    /// the currently-displayed portion. If you have coordinates from an
1894    /// event, you have to convert those to buffer coordinates with
1895    /// [`window_to_buffer_coords()`][Self::window_to_buffer_coords()].
1896    /// ## `x`
1897    /// x position, in buffer coordinates
1898    /// ## `y`
1899    /// y position, in buffer coordinates
1900    ///
1901    /// # Returns
1902    ///
1903    /// [`true`] if the position is over text
1904    ///
1905    /// ## `iter`
1906    /// a [`TextIter`][crate::TextIter]
1907    #[doc(alias = "gtk_text_view_get_iter_at_location")]
1908    #[doc(alias = "get_iter_at_location")]
1909    fn iter_at_location(&self, x: i32, y: i32) -> Option<TextIter> {
1910        unsafe {
1911            let mut iter = TextIter::uninitialized();
1912            let ret = from_glib(ffi::gtk_text_view_get_iter_at_location(
1913                self.as_ref().to_glib_none().0,
1914                iter.to_glib_none_mut().0,
1915                x,
1916                y,
1917            ));
1918            if ret { Some(iter) } else { None }
1919        }
1920    }
1921
1922    /// Retrieves the iterator pointing to the character at buffer
1923    /// coordinates @x and @y.
1924    ///
1925    /// Buffer coordinates are coordinates for the entire buffer, not just
1926    /// the currently-displayed portion. If you have coordinates from an event,
1927    /// you have to convert those to buffer coordinates with
1928    /// [`window_to_buffer_coords()`][Self::window_to_buffer_coords()].
1929    ///
1930    /// Note that this is different from [`iter_at_location()`][Self::iter_at_location()],
1931    /// which returns cursor locations, i.e. positions between characters.
1932    /// ## `x`
1933    /// x position, in buffer coordinates
1934    /// ## `y`
1935    /// y position, in buffer coordinates
1936    ///
1937    /// # Returns
1938    ///
1939    /// [`true`] if the position is over text
1940    ///
1941    /// ## `iter`
1942    /// a [`TextIter`][crate::TextIter]
1943    ///
1944    /// ## `trailing`
1945    /// if non-[`None`], location to store
1946    ///    an integer indicating where in the grapheme the user clicked.
1947    ///    It will either be zero, or the number of characters in the grapheme.
1948    ///    0 represents the trailing edge of the grapheme.
1949    #[doc(alias = "gtk_text_view_get_iter_at_position")]
1950    #[doc(alias = "get_iter_at_position")]
1951    fn iter_at_position(&self, x: i32, y: i32) -> Option<(TextIter, i32)> {
1952        unsafe {
1953            let mut iter = TextIter::uninitialized();
1954            let mut trailing = std::mem::MaybeUninit::uninit();
1955            let ret = from_glib(ffi::gtk_text_view_get_iter_at_position(
1956                self.as_ref().to_glib_none().0,
1957                iter.to_glib_none_mut().0,
1958                trailing.as_mut_ptr(),
1959                x,
1960                y,
1961            ));
1962            if ret {
1963                Some((iter, trailing.assume_init()))
1964            } else {
1965                None
1966            }
1967        }
1968    }
1969
1970    /// Gets a rectangle which roughly contains the character at @iter.
1971    ///
1972    /// The rectangle position is in buffer coordinates; use
1973    /// [`buffer_to_window_coords()`][Self::buffer_to_window_coords()] to convert these
1974    /// coordinates to coordinates for one of the windows in the text view.
1975    /// ## `iter`
1976    /// a [`TextIter`][crate::TextIter]
1977    ///
1978    /// # Returns
1979    ///
1980    ///
1981    /// ## `location`
1982    /// bounds of the character at @iter
1983    #[doc(alias = "gtk_text_view_get_iter_location")]
1984    #[doc(alias = "get_iter_location")]
1985    fn iter_location(&self, iter: &TextIter) -> gdk::Rectangle {
1986        unsafe {
1987            let mut location = gdk::Rectangle::uninitialized();
1988            ffi::gtk_text_view_get_iter_location(
1989                self.as_ref().to_glib_none().0,
1990                iter.to_glib_none().0,
1991                location.to_glib_none_mut().0,
1992            );
1993            location
1994        }
1995    }
1996
1997    /// Gets the default justification of paragraphs in @self.
1998    ///
1999    /// Tags in the buffer may override the default.
2000    ///
2001    /// # Returns
2002    ///
2003    /// default justification
2004    #[doc(alias = "gtk_text_view_get_justification")]
2005    #[doc(alias = "get_justification")]
2006    fn justification(&self) -> Justification {
2007        unsafe {
2008            from_glib(ffi::gtk_text_view_get_justification(
2009                self.as_ref().to_glib_none().0,
2010            ))
2011        }
2012    }
2013
2014    /// Gets the default left margin size of paragraphs in the @self.
2015    ///
2016    /// Tags in the buffer may override the default.
2017    ///
2018    /// # Returns
2019    ///
2020    /// left margin in pixels
2021    #[doc(alias = "gtk_text_view_get_left_margin")]
2022    #[doc(alias = "get_left_margin")]
2023    #[doc(alias = "left-margin")]
2024    fn left_margin(&self) -> i32 {
2025        unsafe { ffi::gtk_text_view_get_left_margin(self.as_ref().to_glib_none().0) }
2026    }
2027
2028    /// Gets the [`TextIter`][crate::TextIter] at the start of the line containing
2029    /// the coordinate @y.
2030    ///
2031    /// @y is in buffer coordinates, convert from window coordinates with
2032    /// [`window_to_buffer_coords()`][Self::window_to_buffer_coords()]. If non-[`None`],
2033    /// @line_top will be filled with the coordinate of the top edge
2034    /// of the line.
2035    /// ## `y`
2036    /// a y coordinate
2037    ///
2038    /// # Returns
2039    ///
2040    ///
2041    /// ## `target_iter`
2042    /// a [`TextIter`][crate::TextIter]
2043    ///
2044    /// ## `line_top`
2045    /// return location for top coordinate of the line
2046    #[doc(alias = "gtk_text_view_get_line_at_y")]
2047    #[doc(alias = "get_line_at_y")]
2048    fn line_at_y(&self, y: i32) -> (TextIter, i32) {
2049        unsafe {
2050            let mut target_iter = TextIter::uninitialized();
2051            let mut line_top = std::mem::MaybeUninit::uninit();
2052            ffi::gtk_text_view_get_line_at_y(
2053                self.as_ref().to_glib_none().0,
2054                target_iter.to_glib_none_mut().0,
2055                y,
2056                line_top.as_mut_ptr(),
2057            );
2058            (target_iter, line_top.assume_init())
2059        }
2060    }
2061
2062    /// Gets the y coordinate of the top of the line containing @iter,
2063    /// and the height of the line.
2064    ///
2065    /// The coordinate is a buffer coordinate; convert to window
2066    /// coordinates with [`buffer_to_window_coords()`][Self::buffer_to_window_coords()].
2067    /// ## `iter`
2068    /// a [`TextIter`][crate::TextIter]
2069    ///
2070    /// # Returns
2071    ///
2072    ///
2073    /// ## `y`
2074    /// return location for a y coordinate
2075    ///
2076    /// ## `height`
2077    /// return location for a height
2078    #[doc(alias = "gtk_text_view_get_line_yrange")]
2079    #[doc(alias = "get_line_yrange")]
2080    fn line_yrange(&self, iter: &TextIter) -> (i32, i32) {
2081        unsafe {
2082            let mut y = std::mem::MaybeUninit::uninit();
2083            let mut height = std::mem::MaybeUninit::uninit();
2084            ffi::gtk_text_view_get_line_yrange(
2085                self.as_ref().to_glib_none().0,
2086                iter.to_glib_none().0,
2087                y.as_mut_ptr(),
2088                height.as_mut_ptr(),
2089            );
2090            (y.assume_init(), height.assume_init())
2091        }
2092    }
2093
2094    /// Gets the [`pango::Context`][crate::pango::Context] that is used for rendering LTR directed
2095    /// text layouts.
2096    ///
2097    /// The context may be replaced when CSS changes occur.
2098    ///
2099    /// # Returns
2100    ///
2101    /// a [`pango::Context`][crate::pango::Context]
2102    #[cfg(feature = "v4_4")]
2103    #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
2104    #[doc(alias = "gtk_text_view_get_ltr_context")]
2105    #[doc(alias = "get_ltr_context")]
2106    fn ltr_context(&self) -> pango::Context {
2107        unsafe {
2108            from_glib_none(ffi::gtk_text_view_get_ltr_context(
2109                self.as_ref().to_glib_none().0,
2110            ))
2111        }
2112    }
2113
2114    /// Gets whether the [`TextView`][crate::TextView] uses monospace styling.
2115    ///
2116    /// # Returns
2117    ///
2118    /// [`true`] if monospace fonts are desired
2119    #[doc(alias = "gtk_text_view_get_monospace")]
2120    #[doc(alias = "get_monospace")]
2121    #[doc(alias = "monospace")]
2122    fn is_monospace(&self) -> bool {
2123        unsafe {
2124            from_glib(ffi::gtk_text_view_get_monospace(
2125                self.as_ref().to_glib_none().0,
2126            ))
2127        }
2128    }
2129
2130    /// Returns whether the [`TextView`][crate::TextView] is in overwrite mode or not.
2131    ///
2132    /// # Returns
2133    ///
2134    /// whether @self is in overwrite mode or not.
2135    #[doc(alias = "gtk_text_view_get_overwrite")]
2136    #[doc(alias = "get_overwrite")]
2137    #[doc(alias = "overwrite")]
2138    fn overwrites(&self) -> bool {
2139        unsafe {
2140            from_glib(ffi::gtk_text_view_get_overwrite(
2141                self.as_ref().to_glib_none().0,
2142            ))
2143        }
2144    }
2145
2146    /// Gets the default number of pixels to put above paragraphs.
2147    ///
2148    /// Adding this function with [`pixels_below_lines()`][Self::pixels_below_lines()]
2149    /// is equal to the line space between each paragraph.
2150    ///
2151    /// # Returns
2152    ///
2153    /// default number of pixels above paragraphs
2154    #[doc(alias = "gtk_text_view_get_pixels_above_lines")]
2155    #[doc(alias = "get_pixels_above_lines")]
2156    #[doc(alias = "pixels-above-lines")]
2157    fn pixels_above_lines(&self) -> i32 {
2158        unsafe { ffi::gtk_text_view_get_pixels_above_lines(self.as_ref().to_glib_none().0) }
2159    }
2160
2161    /// Gets the default number of pixels to put below paragraphs.
2162    ///
2163    /// The line space is the sum of the value returned by this function and
2164    /// the value returned by [`pixels_above_lines()`][Self::pixels_above_lines()].
2165    ///
2166    /// # Returns
2167    ///
2168    /// default number of blank pixels below paragraphs
2169    #[doc(alias = "gtk_text_view_get_pixels_below_lines")]
2170    #[doc(alias = "get_pixels_below_lines")]
2171    #[doc(alias = "pixels-below-lines")]
2172    fn pixels_below_lines(&self) -> i32 {
2173        unsafe { ffi::gtk_text_view_get_pixels_below_lines(self.as_ref().to_glib_none().0) }
2174    }
2175
2176    /// Gets the default number of pixels to put between wrapped lines
2177    /// inside a paragraph.
2178    ///
2179    /// # Returns
2180    ///
2181    /// default number of pixels of blank space between wrapped lines
2182    #[doc(alias = "gtk_text_view_get_pixels_inside_wrap")]
2183    #[doc(alias = "get_pixels_inside_wrap")]
2184    #[doc(alias = "pixels-inside-wrap")]
2185    fn pixels_inside_wrap(&self) -> i32 {
2186        unsafe { ffi::gtk_text_view_get_pixels_inside_wrap(self.as_ref().to_glib_none().0) }
2187    }
2188
2189    /// Gets the default right margin for text in @self.
2190    ///
2191    /// Tags in the buffer may override the default.
2192    ///
2193    /// # Returns
2194    ///
2195    /// right margin in pixels
2196    #[doc(alias = "gtk_text_view_get_right_margin")]
2197    #[doc(alias = "get_right_margin")]
2198    #[doc(alias = "right-margin")]
2199    fn right_margin(&self) -> i32 {
2200        unsafe { ffi::gtk_text_view_get_right_margin(self.as_ref().to_glib_none().0) }
2201    }
2202
2203    /// Gets the [`pango::Context`][crate::pango::Context] that is used for rendering RTL directed
2204    /// text layouts.
2205    ///
2206    /// The context may be replaced when CSS changes occur.
2207    ///
2208    /// # Returns
2209    ///
2210    /// a [`pango::Context`][crate::pango::Context]
2211    #[cfg(feature = "v4_4")]
2212    #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
2213    #[doc(alias = "gtk_text_view_get_rtl_context")]
2214    #[doc(alias = "get_rtl_context")]
2215    fn rtl_context(&self) -> pango::Context {
2216        unsafe {
2217            from_glib_none(ffi::gtk_text_view_get_rtl_context(
2218                self.as_ref().to_glib_none().0,
2219            ))
2220        }
2221    }
2222
2223    /// Gets the default tabs for @self.
2224    ///
2225    /// Tags in the buffer may override the defaults. The returned array
2226    /// will be [`None`] if “standard” (8-space) tabs are used. Free the
2227    /// return value with `Pango::TabArray::free()`.
2228    ///
2229    /// # Returns
2230    ///
2231    /// copy of default tab array,
2232    ///   or [`None`] if standard tabs are used; must be freed with
2233    ///   `Pango::TabArray::free()`.
2234    #[doc(alias = "gtk_text_view_get_tabs")]
2235    #[doc(alias = "get_tabs")]
2236    fn tabs(&self) -> Option<pango::TabArray> {
2237        unsafe { from_glib_full(ffi::gtk_text_view_get_tabs(self.as_ref().to_glib_none().0)) }
2238    }
2239
2240    /// Gets the top margin for text in the @self.
2241    ///
2242    /// # Returns
2243    ///
2244    /// top margin in pixels
2245    #[doc(alias = "gtk_text_view_get_top_margin")]
2246    #[doc(alias = "get_top_margin")]
2247    #[doc(alias = "top-margin")]
2248    fn top_margin(&self) -> i32 {
2249        unsafe { ffi::gtk_text_view_get_top_margin(self.as_ref().to_glib_none().0) }
2250    }
2251
2252    /// Gets the X,Y offset in buffer coordinates of the top-left corner of
2253    /// the textview's text contents.
2254    ///
2255    /// This allows for more-precise positioning than what is provided by
2256    /// [`visible_rect()`][Self::visible_rect()] as you can discover what
2257    /// device pixel is being quantized for text positioning.
2258    ///
2259    /// You might want this when making ulterior widgets align with quantized
2260    /// device pixels of the textview contents such as line numbers.
2261    ///
2262    /// # Returns
2263    ///
2264    ///
2265    /// ## `x_offset`
2266    /// a location for the X offset
2267    ///
2268    /// ## `y_offset`
2269    /// a location for the Y offset
2270    #[cfg(feature = "v4_18")]
2271    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
2272    #[doc(alias = "gtk_text_view_get_visible_offset")]
2273    #[doc(alias = "get_visible_offset")]
2274    fn visible_offset(&self) -> (f64, f64) {
2275        unsafe {
2276            let mut x_offset = std::mem::MaybeUninit::uninit();
2277            let mut y_offset = std::mem::MaybeUninit::uninit();
2278            ffi::gtk_text_view_get_visible_offset(
2279                self.as_ref().to_glib_none().0,
2280                x_offset.as_mut_ptr(),
2281                y_offset.as_mut_ptr(),
2282            );
2283            (x_offset.assume_init(), y_offset.assume_init())
2284        }
2285    }
2286
2287    /// Fills @visible_rect with the currently-visible
2288    /// region of the buffer, in buffer coordinates.
2289    ///
2290    /// Convert to window coordinates with
2291    /// [`buffer_to_window_coords()`][Self::buffer_to_window_coords()].
2292    ///
2293    /// # Returns
2294    ///
2295    ///
2296    /// ## `visible_rect`
2297    /// rectangle to fill
2298    #[doc(alias = "gtk_text_view_get_visible_rect")]
2299    #[doc(alias = "get_visible_rect")]
2300    fn visible_rect(&self) -> gdk::Rectangle {
2301        unsafe {
2302            let mut visible_rect = gdk::Rectangle::uninitialized();
2303            ffi::gtk_text_view_get_visible_rect(
2304                self.as_ref().to_glib_none().0,
2305                visible_rect.to_glib_none_mut().0,
2306            );
2307            visible_rect
2308        }
2309    }
2310
2311    /// Gets the line wrapping for the view.
2312    ///
2313    /// # Returns
2314    ///
2315    /// the line wrap setting
2316    #[doc(alias = "gtk_text_view_get_wrap_mode")]
2317    #[doc(alias = "get_wrap_mode")]
2318    #[doc(alias = "wrap-mode")]
2319    fn wrap_mode(&self) -> WrapMode {
2320        unsafe {
2321            from_glib(ffi::gtk_text_view_get_wrap_mode(
2322                self.as_ref().to_glib_none().0,
2323            ))
2324        }
2325    }
2326
2327    /// key_press_event (widget, event);
2328    /// }
2329    /// ```text
2330    ///
2331    /// ## `event`
2332    /// the key event
2333    ///
2334    /// # Returns
2335    ///
2336    /// [`true`] if the input method handled the key event.
2337    #[doc(alias = "gtk_text_view_im_context_filter_keypress")]
2338    fn im_context_filter_keypress(&self, event: impl AsRef<gdk::Event>) -> bool {
2339        unsafe {
2340            from_glib(ffi::gtk_text_view_im_context_filter_keypress(
2341                self.as_ref().to_glib_none().0,
2342                event.as_ref().to_glib_none().0,
2343            ))
2344        }
2345    }
2346
2347    /// Moves a mark within the buffer so that it's
2348    /// located within the currently-visible text area.
2349    /// ## `mark`
2350    /// a [`TextMark`][crate::TextMark]
2351    ///
2352    /// # Returns
2353    ///
2354    /// [`true`] if the mark moved (wasn’t already onscreen)
2355    #[doc(alias = "gtk_text_view_move_mark_onscreen")]
2356    fn move_mark_onscreen(&self, mark: &impl IsA<TextMark>) -> bool {
2357        unsafe {
2358            from_glib(ffi::gtk_text_view_move_mark_onscreen(
2359                self.as_ref().to_glib_none().0,
2360                mark.as_ref().to_glib_none().0,
2361            ))
2362        }
2363    }
2364
2365    /// Updates the position of a child.
2366    ///
2367    /// See [`add_overlay()`][Self::add_overlay()].
2368    /// ## `child`
2369    /// a widget already added with [`add_overlay()`][Self::add_overlay()]
2370    /// ## `xpos`
2371    /// new X position in buffer coordinates
2372    /// ## `ypos`
2373    /// new Y position in buffer coordinates
2374    #[doc(alias = "gtk_text_view_move_overlay")]
2375    fn move_overlay(&self, child: &impl IsA<Widget>, xpos: i32, ypos: i32) {
2376        unsafe {
2377            ffi::gtk_text_view_move_overlay(
2378                self.as_ref().to_glib_none().0,
2379                child.as_ref().to_glib_none().0,
2380                xpos,
2381                ypos,
2382            );
2383        }
2384    }
2385
2386    /// Move the iterator a given number of characters visually, treating
2387    /// it as the strong cursor position.
2388    ///
2389    /// If @count is positive, then the new strong cursor position will
2390    /// be @count positions to the right of the old cursor position.
2391    /// If @count is negative then the new strong cursor position will
2392    /// be @count positions to the left of the old cursor position.
2393    ///
2394    /// In the presence of bi-directional text, the correspondence
2395    /// between logical and visual order will depend on the direction
2396    /// of the current run, and there may be jumps when the cursor
2397    /// is moved off of the end of a run.
2398    /// ## `iter`
2399    /// a [`TextIter`][crate::TextIter]
2400    /// ## `count`
2401    /// number of characters to move (negative moves left,
2402    ///    positive moves right)
2403    ///
2404    /// # Returns
2405    ///
2406    /// [`true`] if @iter moved and is not on the end iterator
2407    #[doc(alias = "gtk_text_view_move_visually")]
2408    fn move_visually(&self, iter: &mut TextIter, count: i32) -> bool {
2409        unsafe {
2410            from_glib(ffi::gtk_text_view_move_visually(
2411                self.as_ref().to_glib_none().0,
2412                iter.to_glib_none_mut().0,
2413                count,
2414            ))
2415        }
2416    }
2417
2418    /// Moves the cursor to the currently visible region of the
2419    /// buffer.
2420    ///
2421    /// # Returns
2422    ///
2423    /// [`true`] if the cursor had to be moved.
2424    #[doc(alias = "gtk_text_view_place_cursor_onscreen")]
2425    fn place_cursor_onscreen(&self) -> bool {
2426        unsafe {
2427            from_glib(ffi::gtk_text_view_place_cursor_onscreen(
2428                self.as_ref().to_glib_none().0,
2429            ))
2430        }
2431    }
2432
2433    /// Removes a child widget from @self.
2434    /// ## `child`
2435    /// the child to remove
2436    #[doc(alias = "gtk_text_view_remove")]
2437    fn remove(&self, child: &impl IsA<Widget>) {
2438        unsafe {
2439            ffi::gtk_text_view_remove(
2440                self.as_ref().to_glib_none().0,
2441                child.as_ref().to_glib_none().0,
2442            );
2443        }
2444    }
2445
2446    /// Ensures that the cursor is shown.
2447    ///
2448    /// This also resets the time that it will stay blinking (or
2449    /// visible, in case blinking is disabled).
2450    ///
2451    /// This function should be called in response to user input
2452    /// (e.g. from derived classes that override the textview's
2453    /// event handlers).
2454    #[doc(alias = "gtk_text_view_reset_cursor_blink")]
2455    fn reset_cursor_blink(&self) {
2456        unsafe {
2457            ffi::gtk_text_view_reset_cursor_blink(self.as_ref().to_glib_none().0);
2458        }
2459    }
2460
2461    /// Reset the input method context of the text view if needed.
2462    ///
2463    /// This can be necessary in the case where modifying the buffer
2464    /// would confuse on-going input method behavior.
2465    #[doc(alias = "gtk_text_view_reset_im_context")]
2466    fn reset_im_context(&self) {
2467        unsafe {
2468            ffi::gtk_text_view_reset_im_context(self.as_ref().to_glib_none().0);
2469        }
2470    }
2471
2472    /// Scrolls @self the minimum distance such that @mark is contained
2473    /// within the visible area of the widget.
2474    /// ## `mark`
2475    /// a mark in the buffer for @self
2476    #[doc(alias = "gtk_text_view_scroll_mark_onscreen")]
2477    fn scroll_mark_onscreen(&self, mark: &impl IsA<TextMark>) {
2478        unsafe {
2479            ffi::gtk_text_view_scroll_mark_onscreen(
2480                self.as_ref().to_glib_none().0,
2481                mark.as_ref().to_glib_none().0,
2482            );
2483        }
2484    }
2485
2486    /// Scrolls @self so that @iter is on the screen in the position
2487    /// indicated by @xalign and @yalign.
2488    ///
2489    /// An alignment of 0.0 indicates left or top, 1.0 indicates right or
2490    /// bottom, 0.5 means center. If @use_align is [`false`], the text scrolls
2491    /// the minimal distance to get the mark onscreen, possibly not scrolling
2492    /// at all. The effective screen for purposes of this function is reduced
2493    /// by a margin of size @within_margin.
2494    ///
2495    /// Note that this function uses the currently-computed height of the
2496    /// lines in the text buffer. Line heights are computed in an idle
2497    /// handler; so this function may not have the desired effect if it’s
2498    /// called before the height computations. To avoid oddness, consider
2499    /// using [`scroll_to_mark()`][Self::scroll_to_mark()] which saves a point to be
2500    /// scrolled to after line validation.
2501    /// ## `iter`
2502    /// a [`TextIter`][crate::TextIter]
2503    /// ## `within_margin`
2504    /// margin as a [0.0,0.5) fraction of screen size
2505    /// ## `use_align`
2506    /// whether to use alignment arguments (if [`false`],
2507    ///    just get the mark onscreen)
2508    /// ## `xalign`
2509    /// horizontal alignment of mark within visible area
2510    /// ## `yalign`
2511    /// vertical alignment of mark within visible area
2512    ///
2513    /// # Returns
2514    ///
2515    /// [`true`] if scrolling occurred
2516    #[doc(alias = "gtk_text_view_scroll_to_iter")]
2517    fn scroll_to_iter(
2518        &self,
2519        iter: &mut TextIter,
2520        within_margin: f64,
2521        use_align: bool,
2522        xalign: f64,
2523        yalign: f64,
2524    ) -> bool {
2525        unsafe {
2526            from_glib(ffi::gtk_text_view_scroll_to_iter(
2527                self.as_ref().to_glib_none().0,
2528                iter.to_glib_none_mut().0,
2529                within_margin,
2530                use_align.into_glib(),
2531                xalign,
2532                yalign,
2533            ))
2534        }
2535    }
2536
2537    /// Scrolls @self so that @mark is on the screen in the position
2538    /// indicated by @xalign and @yalign.
2539    ///
2540    /// An alignment of 0.0 indicates left or top, 1.0 indicates right or
2541    /// bottom, 0.5 means center. If @use_align is [`false`], the text scrolls
2542    /// the minimal distance to get the mark onscreen, possibly not scrolling
2543    /// at all. The effective screen for purposes of this function is reduced
2544    /// by a margin of size @within_margin.
2545    /// ## `mark`
2546    /// a [`TextMark`][crate::TextMark]
2547    /// ## `within_margin`
2548    /// margin as a [0.0,0.5) fraction of screen size
2549    /// ## `use_align`
2550    /// whether to use alignment arguments (if [`false`], just
2551    ///    get the mark onscreen)
2552    /// ## `xalign`
2553    /// horizontal alignment of mark within visible area
2554    /// ## `yalign`
2555    /// vertical alignment of mark within visible area
2556    #[doc(alias = "gtk_text_view_scroll_to_mark")]
2557    fn scroll_to_mark(
2558        &self,
2559        mark: &impl IsA<TextMark>,
2560        within_margin: f64,
2561        use_align: bool,
2562        xalign: f64,
2563        yalign: f64,
2564    ) {
2565        unsafe {
2566            ffi::gtk_text_view_scroll_to_mark(
2567                self.as_ref().to_glib_none().0,
2568                mark.as_ref().to_glib_none().0,
2569                within_margin,
2570                use_align.into_glib(),
2571                xalign,
2572                yalign,
2573            );
2574        }
2575    }
2576
2577    /// .
2578    /// ## `accepts_tab`
2579    /// [`true`] if pressing the Tab key should insert a tab
2580    ///    character, [`false`], if pressing the Tab key should move the
2581    ///    keyboard focus.
2582    #[doc(alias = "gtk_text_view_set_accepts_tab")]
2583    #[doc(alias = "accepts-tab")]
2584    fn set_accepts_tab(&self, accepts_tab: bool) {
2585        unsafe {
2586            ffi::gtk_text_view_set_accepts_tab(
2587                self.as_ref().to_glib_none().0,
2588                accepts_tab.into_glib(),
2589            );
2590        }
2591    }
2592
2593    /// Sets the bottom margin for text in @self.
2594    ///
2595    /// Note that this function is confusingly named.
2596    /// In CSS terms, the value set here is padding.
2597    /// ## `bottom_margin`
2598    /// bottom margin in pixels
2599    #[doc(alias = "gtk_text_view_set_bottom_margin")]
2600    #[doc(alias = "bottom-margin")]
2601    fn set_bottom_margin(&self, bottom_margin: i32) {
2602        unsafe {
2603            ffi::gtk_text_view_set_bottom_margin(self.as_ref().to_glib_none().0, bottom_margin);
2604        }
2605    }
2606
2607    /// Sets @buffer as the buffer being displayed by @self.
2608    ///
2609    /// The previous buffer displayed by the text view is unreferenced, and
2610    /// a reference is added to @buffer. If you owned a reference to @buffer
2611    /// before passing it to this function, you must remove that reference
2612    /// yourself; [`TextView`][crate::TextView] will not “adopt” it.
2613    /// ## `buffer`
2614    /// a [`TextBuffer`][crate::TextBuffer]
2615    #[doc(alias = "gtk_text_view_set_buffer")]
2616    #[doc(alias = "buffer")]
2617    fn set_buffer(&self, buffer: Option<&impl IsA<TextBuffer>>) {
2618        unsafe {
2619            ffi::gtk_text_view_set_buffer(
2620                self.as_ref().to_glib_none().0,
2621                buffer.map(|p| p.as_ref()).to_glib_none().0,
2622            );
2623        }
2624    }
2625
2626    /// Toggles whether the insertion point should be displayed.
2627    ///
2628    /// A buffer with no editable text probably shouldn’t have a visible
2629    /// cursor, so you may want to turn the cursor off.
2630    ///
2631    /// Note that this property may be overridden by the
2632    /// [`gtk-keynav-use-caret`][struct@crate::Settings#gtk-keynav-use-caret] setting.
2633    /// ## `setting`
2634    /// whether to show the insertion cursor
2635    #[doc(alias = "gtk_text_view_set_cursor_visible")]
2636    #[doc(alias = "cursor-visible")]
2637    fn set_cursor_visible(&self, setting: bool) {
2638        unsafe {
2639            ffi::gtk_text_view_set_cursor_visible(
2640                self.as_ref().to_glib_none().0,
2641                setting.into_glib(),
2642            );
2643        }
2644    }
2645
2646    /// Sets the default editability of the [`TextView`][crate::TextView].
2647    ///
2648    /// You can override this default setting with tags in the buffer,
2649    /// using the “editable” attribute of tags.
2650    /// ## `setting`
2651    /// whether it’s editable
2652    #[doc(alias = "gtk_text_view_set_editable")]
2653    #[doc(alias = "editable")]
2654    fn set_editable(&self, setting: bool) {
2655        unsafe {
2656            ffi::gtk_text_view_set_editable(self.as_ref().to_glib_none().0, setting.into_glib());
2657        }
2658    }
2659
2660    /// Sets a menu model to add when constructing the context
2661    /// menu for @self.
2662    ///
2663    /// You can pass [`None`] to remove a previously set extra menu.
2664    /// ## `model`
2665    /// a `GMenuModel`
2666    #[doc(alias = "gtk_text_view_set_extra_menu")]
2667    #[doc(alias = "extra-menu")]
2668    fn set_extra_menu(&self, model: Option<&impl IsA<gio::MenuModel>>) {
2669        unsafe {
2670            ffi::gtk_text_view_set_extra_menu(
2671                self.as_ref().to_glib_none().0,
2672                model.map(|p| p.as_ref()).to_glib_none().0,
2673            );
2674        }
2675    }
2676
2677    /// Places @widget into the gutter specified by @win.
2678    ///
2679    /// @win must be one of [`TextWindowType::Left`][crate::TextWindowType::Left], [`TextWindowType::Right`][crate::TextWindowType::Right],
2680    /// [`TextWindowType::Top`][crate::TextWindowType::Top], or [`TextWindowType::Bottom`][crate::TextWindowType::Bottom].
2681    /// ## `win`
2682    /// a [`TextWindowType`][crate::TextWindowType]
2683    /// ## `widget`
2684    /// a [`Widget`][crate::Widget]
2685    #[doc(alias = "gtk_text_view_set_gutter")]
2686    fn set_gutter(&self, win: TextWindowType, widget: Option<&impl IsA<Widget>>) {
2687        unsafe {
2688            ffi::gtk_text_view_set_gutter(
2689                self.as_ref().to_glib_none().0,
2690                win.into_glib(),
2691                widget.map(|p| p.as_ref()).to_glib_none().0,
2692            );
2693        }
2694    }
2695
2696    /// Sets the default indentation for paragraphs in @self.
2697    ///
2698    /// Tags in the buffer may override the default.
2699    /// ## `indent`
2700    /// indentation in pixels
2701    #[doc(alias = "gtk_text_view_set_indent")]
2702    #[doc(alias = "indent")]
2703    fn set_indent(&self, indent: i32) {
2704        unsafe {
2705            ffi::gtk_text_view_set_indent(self.as_ref().to_glib_none().0, indent);
2706        }
2707    }
2708
2709    /// Sets the `input-hints` of the [`TextView`][crate::TextView].
2710    ///
2711    /// The `input-hints` allow input methods to fine-tune
2712    /// their behaviour.
2713    /// ## `hints`
2714    /// the hints
2715    #[doc(alias = "gtk_text_view_set_input_hints")]
2716    #[doc(alias = "input-hints")]
2717    fn set_input_hints(&self, hints: InputHints) {
2718        unsafe {
2719            ffi::gtk_text_view_set_input_hints(self.as_ref().to_glib_none().0, hints.into_glib());
2720        }
2721    }
2722
2723    /// Sets the `input-purpose` of the [`TextView`][crate::TextView].
2724    ///
2725    /// The `input-purpose` can be used by on-screen keyboards
2726    /// and other input methods to adjust their behaviour.
2727    /// ## `purpose`
2728    /// the purpose
2729    #[doc(alias = "gtk_text_view_set_input_purpose")]
2730    #[doc(alias = "input-purpose")]
2731    fn set_input_purpose(&self, purpose: InputPurpose) {
2732        unsafe {
2733            ffi::gtk_text_view_set_input_purpose(
2734                self.as_ref().to_glib_none().0,
2735                purpose.into_glib(),
2736            );
2737        }
2738    }
2739
2740    /// Sets the default justification of text in @self.
2741    ///
2742    /// Tags in the view’s buffer may override the default.
2743    /// ## `justification`
2744    /// justification
2745    #[doc(alias = "gtk_text_view_set_justification")]
2746    #[doc(alias = "justification")]
2747    fn set_justification(&self, justification: Justification) {
2748        unsafe {
2749            ffi::gtk_text_view_set_justification(
2750                self.as_ref().to_glib_none().0,
2751                justification.into_glib(),
2752            );
2753        }
2754    }
2755
2756    /// Sets the default left margin for text in @self.
2757    ///
2758    /// Tags in the buffer may override the default.
2759    ///
2760    /// Note that this function is confusingly named.
2761    /// In CSS terms, the value set here is padding.
2762    /// ## `left_margin`
2763    /// left margin in pixels
2764    #[doc(alias = "gtk_text_view_set_left_margin")]
2765    #[doc(alias = "left-margin")]
2766    fn set_left_margin(&self, left_margin: i32) {
2767        unsafe {
2768            ffi::gtk_text_view_set_left_margin(self.as_ref().to_glib_none().0, left_margin);
2769        }
2770    }
2771
2772    /// Sets whether the [`TextView`][crate::TextView] should display text in
2773    /// monospace styling.
2774    /// ## `monospace`
2775    /// [`true`] to request monospace styling
2776    #[doc(alias = "gtk_text_view_set_monospace")]
2777    #[doc(alias = "monospace")]
2778    fn set_monospace(&self, monospace: bool) {
2779        unsafe {
2780            ffi::gtk_text_view_set_monospace(self.as_ref().to_glib_none().0, monospace.into_glib());
2781        }
2782    }
2783
2784    /// Changes the [`TextView`][crate::TextView] overwrite mode.
2785    /// ## `overwrite`
2786    /// [`true`] to turn on overwrite mode, [`false`] to turn it off
2787    #[doc(alias = "gtk_text_view_set_overwrite")]
2788    #[doc(alias = "overwrite")]
2789    fn set_overwrite(&self, overwrite: bool) {
2790        unsafe {
2791            ffi::gtk_text_view_set_overwrite(self.as_ref().to_glib_none().0, overwrite.into_glib());
2792        }
2793    }
2794
2795    /// Sets the default number of blank pixels above paragraphs in @self.
2796    ///
2797    /// Tags in the buffer for @self may override the defaults.
2798    /// ## `pixels_above_lines`
2799    /// pixels above paragraphs
2800    #[doc(alias = "gtk_text_view_set_pixels_above_lines")]
2801    #[doc(alias = "pixels-above-lines")]
2802    fn set_pixels_above_lines(&self, pixels_above_lines: i32) {
2803        unsafe {
2804            ffi::gtk_text_view_set_pixels_above_lines(
2805                self.as_ref().to_glib_none().0,
2806                pixels_above_lines,
2807            );
2808        }
2809    }
2810
2811    /// Sets the default number of pixels of blank space
2812    /// to put below paragraphs in @self.
2813    ///
2814    /// May be overridden by tags applied to @self’s buffer.
2815    /// ## `pixels_below_lines`
2816    /// pixels below paragraphs
2817    #[doc(alias = "gtk_text_view_set_pixels_below_lines")]
2818    #[doc(alias = "pixels-below-lines")]
2819    fn set_pixels_below_lines(&self, pixels_below_lines: i32) {
2820        unsafe {
2821            ffi::gtk_text_view_set_pixels_below_lines(
2822                self.as_ref().to_glib_none().0,
2823                pixels_below_lines,
2824            );
2825        }
2826    }
2827
2828    /// Sets the default number of pixels of blank space to leave between
2829    /// display/wrapped lines within a paragraph.
2830    ///
2831    /// May be overridden by tags in @self’s buffer.
2832    /// ## `pixels_inside_wrap`
2833    /// default number of pixels between wrapped lines
2834    #[doc(alias = "gtk_text_view_set_pixels_inside_wrap")]
2835    #[doc(alias = "pixels-inside-wrap")]
2836    fn set_pixels_inside_wrap(&self, pixels_inside_wrap: i32) {
2837        unsafe {
2838            ffi::gtk_text_view_set_pixels_inside_wrap(
2839                self.as_ref().to_glib_none().0,
2840                pixels_inside_wrap,
2841            );
2842        }
2843    }
2844
2845    /// Sets the default right margin for text in the text view.
2846    ///
2847    /// Tags in the buffer may override the default.
2848    ///
2849    /// Note that this function is confusingly named.
2850    /// In CSS terms, the value set here is padding.
2851    /// ## `right_margin`
2852    /// right margin in pixels
2853    #[doc(alias = "gtk_text_view_set_right_margin")]
2854    #[doc(alias = "right-margin")]
2855    fn set_right_margin(&self, right_margin: i32) {
2856        unsafe {
2857            ffi::gtk_text_view_set_right_margin(self.as_ref().to_glib_none().0, right_margin);
2858        }
2859    }
2860
2861    /// Sets the default tab stops for paragraphs in @self.
2862    ///
2863    /// Tags in the buffer may override the default.
2864    /// ## `tabs`
2865    /// tabs as a [`pango::TabArray`][crate::pango::TabArray]
2866    #[doc(alias = "gtk_text_view_set_tabs")]
2867    #[doc(alias = "tabs")]
2868    fn set_tabs(&self, tabs: &pango::TabArray) {
2869        unsafe {
2870            ffi::gtk_text_view_set_tabs(
2871                self.as_ref().to_glib_none().0,
2872                mut_override(tabs.to_glib_none().0),
2873            );
2874        }
2875    }
2876
2877    /// Sets the top margin for text in @self.
2878    ///
2879    /// Note that this function is confusingly named.
2880    /// In CSS terms, the value set here is padding.
2881    /// ## `top_margin`
2882    /// top margin in pixels
2883    #[doc(alias = "gtk_text_view_set_top_margin")]
2884    #[doc(alias = "top-margin")]
2885    fn set_top_margin(&self, top_margin: i32) {
2886        unsafe {
2887            ffi::gtk_text_view_set_top_margin(self.as_ref().to_glib_none().0, top_margin);
2888        }
2889    }
2890
2891    /// Sets the line wrapping for the view.
2892    /// ## `wrap_mode`
2893    /// a [`WrapMode`][crate::WrapMode]
2894    #[doc(alias = "gtk_text_view_set_wrap_mode")]
2895    #[doc(alias = "wrap-mode")]
2896    fn set_wrap_mode(&self, wrap_mode: WrapMode) {
2897        unsafe {
2898            ffi::gtk_text_view_set_wrap_mode(self.as_ref().to_glib_none().0, wrap_mode.into_glib());
2899        }
2900    }
2901
2902    /// Determines whether @iter is at the start of a display line.
2903    ///
2904    /// See [`forward_display_line()`][Self::forward_display_line()] for an
2905    /// explanation of display lines vs. paragraphs.
2906    /// ## `iter`
2907    /// a [`TextIter`][crate::TextIter]
2908    ///
2909    /// # Returns
2910    ///
2911    /// [`true`] if @iter begins a wrapped line
2912    #[doc(alias = "gtk_text_view_starts_display_line")]
2913    fn starts_display_line(&self, iter: &TextIter) -> bool {
2914        unsafe {
2915            from_glib(ffi::gtk_text_view_starts_display_line(
2916                self.as_ref().to_glib_none().0,
2917                iter.to_glib_none().0,
2918            ))
2919        }
2920    }
2921
2922    /// Converts coordinates on the window identified by @win to buffer
2923    /// coordinates.
2924    /// ## `win`
2925    /// a [`TextWindowType`][crate::TextWindowType]
2926    /// ## `window_x`
2927    /// window x coordinate
2928    /// ## `window_y`
2929    /// window y coordinate
2930    ///
2931    /// # Returns
2932    ///
2933    ///
2934    /// ## `buffer_x`
2935    /// buffer x coordinate return location
2936    ///
2937    /// ## `buffer_y`
2938    /// buffer y coordinate return location
2939    #[doc(alias = "gtk_text_view_window_to_buffer_coords")]
2940    fn window_to_buffer_coords(
2941        &self,
2942        win: TextWindowType,
2943        window_x: i32,
2944        window_y: i32,
2945    ) -> (i32, i32) {
2946        unsafe {
2947            let mut buffer_x = std::mem::MaybeUninit::uninit();
2948            let mut buffer_y = std::mem::MaybeUninit::uninit();
2949            ffi::gtk_text_view_window_to_buffer_coords(
2950                self.as_ref().to_glib_none().0,
2951                win.into_glib(),
2952                window_x,
2953                window_y,
2954                buffer_x.as_mut_ptr(),
2955                buffer_y.as_mut_ptr(),
2956            );
2957            (buffer_x.assume_init(), buffer_y.assume_init())
2958        }
2959    }
2960
2961    /// Which IM (input method) module should be used for this text_view.
2962    ///
2963    /// See [`IMMulticontext`][crate::IMMulticontext].
2964    ///
2965    /// Setting this to a non-[`None`] value overrides the system-wide IM module
2966    /// setting. See the GtkSettings [`gtk-im-module`][struct@crate::Settings#gtk-im-module] property.
2967    #[doc(alias = "im-module")]
2968    fn im_module(&self) -> Option<glib::GString> {
2969        ObjectExt::property(self.as_ref(), "im-module")
2970    }
2971
2972    /// Which IM (input method) module should be used for this text_view.
2973    ///
2974    /// See [`IMMulticontext`][crate::IMMulticontext].
2975    ///
2976    /// Setting this to a non-[`None`] value overrides the system-wide IM module
2977    /// setting. See the GtkSettings [`gtk-im-module`][struct@crate::Settings#gtk-im-module] property.
2978    #[doc(alias = "im-module")]
2979    fn set_im_module(&self, im_module: Option<&str>) {
2980        ObjectExt::set_property(self.as_ref(), "im-module", im_module)
2981    }
2982
2983    /// .
2984    #[doc(alias = "backspace")]
2985    fn connect_backspace<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2986        unsafe extern "C" fn backspace_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2987            this: *mut ffi::GtkTextView,
2988            f: glib::ffi::gpointer,
2989        ) {
2990            unsafe {
2991                let f: &F = &*(f as *const F);
2992                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2993            }
2994        }
2995        unsafe {
2996            let f: Box_<F> = Box_::new(f);
2997            connect_raw(
2998                self.as_ptr() as *mut _,
2999                c"backspace".as_ptr(),
3000                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3001                    backspace_trampoline::<Self, F> as *const (),
3002                )),
3003                Box_::into_raw(f),
3004            )
3005        }
3006    }
3007
3008    fn emit_backspace(&self) {
3009        self.emit_by_name::<()>("backspace", &[]);
3010    }
3011
3012    /// .
3013    #[doc(alias = "copy-clipboard")]
3014    fn connect_copy_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3015        unsafe extern "C" fn copy_clipboard_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
3016            this: *mut ffi::GtkTextView,
3017            f: glib::ffi::gpointer,
3018        ) {
3019            unsafe {
3020                let f: &F = &*(f as *const F);
3021                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3022            }
3023        }
3024        unsafe {
3025            let f: Box_<F> = Box_::new(f);
3026            connect_raw(
3027                self.as_ptr() as *mut _,
3028                c"copy-clipboard".as_ptr(),
3029                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3030                    copy_clipboard_trampoline::<Self, F> as *const (),
3031                )),
3032                Box_::into_raw(f),
3033            )
3034        }
3035    }
3036
3037    fn emit_copy_clipboard(&self) {
3038        self.emit_by_name::<()>("copy-clipboard", &[]);
3039    }
3040
3041    /// .
3042    #[doc(alias = "cut-clipboard")]
3043    fn connect_cut_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3044        unsafe extern "C" fn cut_clipboard_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
3045            this: *mut ffi::GtkTextView,
3046            f: glib::ffi::gpointer,
3047        ) {
3048            unsafe {
3049                let f: &F = &*(f as *const F);
3050                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3051            }
3052        }
3053        unsafe {
3054            let f: Box_<F> = Box_::new(f);
3055            connect_raw(
3056                self.as_ptr() as *mut _,
3057                c"cut-clipboard".as_ptr(),
3058                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3059                    cut_clipboard_trampoline::<Self, F> as *const (),
3060                )),
3061                Box_::into_raw(f),
3062            )
3063        }
3064    }
3065
3066    fn emit_cut_clipboard(&self) {
3067        self.emit_by_name::<()>("cut-clipboard", &[]);
3068    }
3069
3070    ///  for
3071    /// deleting a word backwards.
3072    /// ## `type_`
3073    /// the granularity of the deletion, as a [`DeleteType`][crate::DeleteType]
3074    /// ## `count`
3075    /// the number of @type_ units to delete
3076    #[doc(alias = "delete-from-cursor")]
3077    fn connect_delete_from_cursor<F: Fn(&Self, DeleteType, i32) + 'static>(
3078        &self,
3079        f: F,
3080    ) -> SignalHandlerId {
3081        unsafe extern "C" fn delete_from_cursor_trampoline<
3082            P: IsA<TextView>,
3083            F: Fn(&P, DeleteType, i32) + 'static,
3084        >(
3085            this: *mut ffi::GtkTextView,
3086            type_: ffi::GtkDeleteType,
3087            count: std::ffi::c_int,
3088            f: glib::ffi::gpointer,
3089        ) {
3090            unsafe {
3091                let f: &F = &*(f as *const F);
3092                f(
3093                    TextView::from_glib_borrow(this).unsafe_cast_ref(),
3094                    from_glib(type_),
3095                    count,
3096                )
3097            }
3098        }
3099        unsafe {
3100            let f: Box_<F> = Box_::new(f);
3101            connect_raw(
3102                self.as_ptr() as *mut _,
3103                c"delete-from-cursor".as_ptr(),
3104                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3105                    delete_from_cursor_trampoline::<Self, F> as *const (),
3106                )),
3107                Box_::into_raw(f),
3108            )
3109        }
3110    }
3111
3112    fn emit_delete_from_cursor(&self, type_: DeleteType, count: i32) {
3113        self.emit_by_name::<()>("delete-from-cursor", &[&type_, &count]);
3114    }
3115
3116    /// Emitted when the selection needs to be extended at @location.
3117    /// ## `granularity`
3118    /// the granularity type
3119    /// ## `location`
3120    /// the location where to extend the selection
3121    /// ## `start`
3122    /// where the selection should start
3123    /// ## `end`
3124    /// where the selection should end
3125    ///
3126    /// # Returns
3127    ///
3128    /// `GDK_EVENT_STOP` to stop other handlers from being invoked for the
3129    ///   event. `GDK_EVENT_PROPAGATE` to propagate the event further.
3130    #[doc(alias = "extend-selection")]
3131    fn connect_extend_selection<
3132        F: Fn(&Self, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> glib::Propagation
3133            + 'static,
3134    >(
3135        &self,
3136        f: F,
3137    ) -> SignalHandlerId {
3138        unsafe extern "C" fn extend_selection_trampoline<
3139            P: IsA<TextView>,
3140            F: Fn(&P, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> glib::Propagation
3141                + 'static,
3142        >(
3143            this: *mut ffi::GtkTextView,
3144            granularity: ffi::GtkTextExtendSelection,
3145            location: *mut ffi::GtkTextIter,
3146            start: *mut ffi::GtkTextIter,
3147            end: *mut ffi::GtkTextIter,
3148            f: glib::ffi::gpointer,
3149        ) -> glib::ffi::gboolean {
3150            unsafe {
3151                let f: &F = &*(f as *const F);
3152                f(
3153                    TextView::from_glib_borrow(this).unsafe_cast_ref(),
3154                    from_glib(granularity),
3155                    &from_glib_borrow(location),
3156                    &from_glib_borrow(start),
3157                    &from_glib_borrow(end),
3158                )
3159                .into_glib()
3160            }
3161        }
3162        unsafe {
3163            let f: Box_<F> = Box_::new(f);
3164            connect_raw(
3165                self.as_ptr() as *mut _,
3166                c"extend-selection".as_ptr(),
3167                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3168                    extend_selection_trampoline::<Self, F> as *const (),
3169                )),
3170                Box_::into_raw(f),
3171            )
3172        }
3173    }
3174
3175    /// Gets emitted when the user initiates the insertion of a
3176    /// fixed string at the cursor.
3177    ///
3178    /// The ::insert-at-cursor signal is a [keybinding signal](class.SignalAction.html).
3179    ///
3180    /// This signal has no default bindings.
3181    /// ## `string`
3182    /// the string to insert
3183    #[doc(alias = "insert-at-cursor")]
3184    fn connect_insert_at_cursor<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
3185        unsafe extern "C" fn insert_at_cursor_trampoline<
3186            P: IsA<TextView>,
3187            F: Fn(&P, &str) + 'static,
3188        >(
3189            this: *mut ffi::GtkTextView,
3190            string: *mut std::ffi::c_char,
3191            f: glib::ffi::gpointer,
3192        ) {
3193            unsafe {
3194                let f: &F = &*(f as *const F);
3195                f(
3196                    TextView::from_glib_borrow(this).unsafe_cast_ref(),
3197                    &glib::GString::from_glib_borrow(string),
3198                )
3199            }
3200        }
3201        unsafe {
3202            let f: Box_<F> = Box_::new(f);
3203            connect_raw(
3204                self.as_ptr() as *mut _,
3205                c"insert-at-cursor".as_ptr(),
3206                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3207                    insert_at_cursor_trampoline::<Self, F> as *const (),
3208                )),
3209                Box_::into_raw(f),
3210            )
3211        }
3212    }
3213
3214    fn emit_insert_at_cursor(&self, string: &str) {
3215        self.emit_by_name::<()>("insert-at-cursor", &[&string]);
3216    }
3217
3218    /// /kbd
3219    #[doc(alias = "insert-emoji")]
3220    fn connect_insert_emoji<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3221        unsafe extern "C" fn insert_emoji_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
3222            this: *mut ffi::GtkTextView,
3223            f: glib::ffi::gpointer,
3224        ) {
3225            unsafe {
3226                let f: &F = &*(f as *const F);
3227                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3228            }
3229        }
3230        unsafe {
3231            let f: Box_<F> = Box_::new(f);
3232            connect_raw(
3233                self.as_ptr() as *mut _,
3234                c"insert-emoji".as_ptr(),
3235                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3236                    insert_emoji_trampoline::<Self, F> as *const (),
3237                )),
3238                Box_::into_raw(f),
3239            )
3240        }
3241    }
3242
3243    fn emit_insert_emoji(&self) {
3244        self.emit_by_name::<()>("insert-emoji", &[]);
3245    }
3246
3247    ///
3248    ///   move horizontally by pages
3249    /// ## `step`
3250    /// the granularity of the move, as a [`MovementStep`][crate::MovementStep]
3251    /// ## `count`
3252    /// the number of @step units to move
3253    /// ## `extend_selection`
3254    /// [`true`] if the move should extend the selection
3255    #[doc(alias = "move-cursor")]
3256    fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>(
3257        &self,
3258        f: F,
3259    ) -> SignalHandlerId {
3260        unsafe extern "C" fn move_cursor_trampoline<
3261            P: IsA<TextView>,
3262            F: Fn(&P, MovementStep, i32, bool) + 'static,
3263        >(
3264            this: *mut ffi::GtkTextView,
3265            step: ffi::GtkMovementStep,
3266            count: std::ffi::c_int,
3267            extend_selection: glib::ffi::gboolean,
3268            f: glib::ffi::gpointer,
3269        ) {
3270            unsafe {
3271                let f: &F = &*(f as *const F);
3272                f(
3273                    TextView::from_glib_borrow(this).unsafe_cast_ref(),
3274                    from_glib(step),
3275                    count,
3276                    from_glib(extend_selection),
3277                )
3278            }
3279        }
3280        unsafe {
3281            let f: Box_<F> = Box_::new(f);
3282            connect_raw(
3283                self.as_ptr() as *mut _,
3284                c"move-cursor".as_ptr(),
3285                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3286                    move_cursor_trampoline::<Self, F> as *const (),
3287                )),
3288                Box_::into_raw(f),
3289            )
3290        }
3291    }
3292
3293    fn emit_move_cursor(&self, step: MovementStep, count: i32, extend_selection: bool) {
3294        self.emit_by_name::<()>("move-cursor", &[&step, &count, &extend_selection]);
3295    }
3296
3297    /// Gets emitted to move the viewport.
3298    ///
3299    /// The ::move-viewport signal is a [keybinding signal](class.SignalAction.html),
3300    /// which can be bound to key combinations to allow the user to move the viewport,
3301    /// i.e. change what part of the text view is visible in a containing scrolled
3302    /// window.
3303    ///
3304    /// There are no default bindings for this signal.
3305    /// ## `step`
3306    /// the granularity of the movement, as a [`ScrollStep`][crate::ScrollStep]
3307    /// ## `count`
3308    /// the number of @step units to move
3309    #[doc(alias = "move-viewport")]
3310    fn connect_move_viewport<F: Fn(&Self, ScrollStep, i32) + 'static>(
3311        &self,
3312        f: F,
3313    ) -> SignalHandlerId {
3314        unsafe extern "C" fn move_viewport_trampoline<
3315            P: IsA<TextView>,
3316            F: Fn(&P, ScrollStep, i32) + 'static,
3317        >(
3318            this: *mut ffi::GtkTextView,
3319            step: ffi::GtkScrollStep,
3320            count: std::ffi::c_int,
3321            f: glib::ffi::gpointer,
3322        ) {
3323            unsafe {
3324                let f: &F = &*(f as *const F);
3325                f(
3326                    TextView::from_glib_borrow(this).unsafe_cast_ref(),
3327                    from_glib(step),
3328                    count,
3329                )
3330            }
3331        }
3332        unsafe {
3333            let f: Box_<F> = Box_::new(f);
3334            connect_raw(
3335                self.as_ptr() as *mut _,
3336                c"move-viewport".as_ptr(),
3337                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3338                    move_viewport_trampoline::<Self, F> as *const (),
3339                )),
3340                Box_::into_raw(f),
3341            )
3342        }
3343    }
3344
3345    fn emit_move_viewport(&self, step: ScrollStep, count: i32) {
3346        self.emit_by_name::<()>("move-viewport", &[&step, &count]);
3347    }
3348
3349    /// .
3350    #[doc(alias = "paste-clipboard")]
3351    fn connect_paste_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3352        unsafe extern "C" fn paste_clipboard_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
3353            this: *mut ffi::GtkTextView,
3354            f: glib::ffi::gpointer,
3355        ) {
3356            unsafe {
3357                let f: &F = &*(f as *const F);
3358                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3359            }
3360        }
3361        unsafe {
3362            let f: Box_<F> = Box_::new(f);
3363            connect_raw(
3364                self.as_ptr() as *mut _,
3365                c"paste-clipboard".as_ptr(),
3366                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3367                    paste_clipboard_trampoline::<Self, F> as *const (),
3368                )),
3369                Box_::into_raw(f),
3370            )
3371        }
3372    }
3373
3374    fn emit_paste_clipboard(&self) {
3375        self.emit_by_name::<()>("paste-clipboard", &[]);
3376    }
3377
3378    /// Emitted when preedit text of the active IM changes.
3379    ///
3380    /// If an input method is used, the typed text will not immediately
3381    /// be committed to the buffer. So if you are interested in the text,
3382    /// connect to this signal.
3383    ///
3384    /// This signal is only emitted if the text at the given position
3385    /// is actually editable.
3386    /// ## `preedit`
3387    /// the current preedit string
3388    #[doc(alias = "preedit-changed")]
3389    fn connect_preedit_changed<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
3390        unsafe extern "C" fn preedit_changed_trampoline<
3391            P: IsA<TextView>,
3392            F: Fn(&P, &str) + 'static,
3393        >(
3394            this: *mut ffi::GtkTextView,
3395            preedit: *mut std::ffi::c_char,
3396            f: glib::ffi::gpointer,
3397        ) {
3398            unsafe {
3399                let f: &F = &*(f as *const F);
3400                f(
3401                    TextView::from_glib_borrow(this).unsafe_cast_ref(),
3402                    &glib::GString::from_glib_borrow(preedit),
3403                )
3404            }
3405        }
3406        unsafe {
3407            let f: Box_<F> = Box_::new(f);
3408            connect_raw(
3409                self.as_ptr() as *mut _,
3410                c"preedit-changed".as_ptr(),
3411                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3412                    preedit_changed_trampoline::<Self, F> as *const (),
3413                )),
3414                Box_::into_raw(f),
3415            )
3416        }
3417    }
3418
3419    fn emit_preedit_changed(&self, preedit: &str) {
3420        self.emit_by_name::<()>("preedit-changed", &[&preedit]);
3421    }
3422
3423    ///  for unselecting.
3424    /// ## `select`
3425    /// [`true`] to select, [`false`] to unselect
3426    #[doc(alias = "select-all")]
3427    fn connect_select_all<F: Fn(&Self, bool) + 'static>(&self, f: F) -> SignalHandlerId {
3428        unsafe extern "C" fn select_all_trampoline<P: IsA<TextView>, F: Fn(&P, bool) + 'static>(
3429            this: *mut ffi::GtkTextView,
3430            select: glib::ffi::gboolean,
3431            f: glib::ffi::gpointer,
3432        ) {
3433            unsafe {
3434                let f: &F = &*(f as *const F);
3435                f(
3436                    TextView::from_glib_borrow(this).unsafe_cast_ref(),
3437                    from_glib(select),
3438                )
3439            }
3440        }
3441        unsafe {
3442            let f: Box_<F> = Box_::new(f);
3443            connect_raw(
3444                self.as_ptr() as *mut _,
3445                c"select-all".as_ptr(),
3446                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3447                    select_all_trampoline::<Self, F> as *const (),
3448                )),
3449                Box_::into_raw(f),
3450            )
3451        }
3452    }
3453
3454    fn emit_select_all(&self, select: bool) {
3455        self.emit_by_name::<()>("select-all", &[&select]);
3456    }
3457
3458    /// Gets emitted when the user initiates settings the "anchor" mark.
3459    ///
3460    /// The ::set-anchor signal is a [keybinding signal](class.SignalAction.html)
3461    /// which gets emitted when the user initiates setting the "anchor"
3462    /// mark. The "anchor" mark gets placed at the same position as the
3463    /// "insert" mark.
3464    ///
3465    /// This signal has no default bindings.
3466    #[doc(alias = "set-anchor")]
3467    fn connect_set_anchor<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3468        unsafe extern "C" fn set_anchor_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
3469            this: *mut ffi::GtkTextView,
3470            f: glib::ffi::gpointer,
3471        ) {
3472            unsafe {
3473                let f: &F = &*(f as *const F);
3474                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3475            }
3476        }
3477        unsafe {
3478            let f: Box_<F> = Box_::new(f);
3479            connect_raw(
3480                self.as_ptr() as *mut _,
3481                c"set-anchor".as_ptr(),
3482                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3483                    set_anchor_trampoline::<Self, F> as *const (),
3484                )),
3485                Box_::into_raw(f),
3486            )
3487        }
3488    }
3489
3490    fn emit_set_anchor(&self) {
3491        self.emit_by_name::<()>("set-anchor", &[]);
3492    }
3493
3494    /// .
3495    #[doc(alias = "toggle-cursor-visible")]
3496    fn connect_toggle_cursor_visible<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3497        unsafe extern "C" fn toggle_cursor_visible_trampoline<
3498            P: IsA<TextView>,
3499            F: Fn(&P) + 'static,
3500        >(
3501            this: *mut ffi::GtkTextView,
3502            f: glib::ffi::gpointer,
3503        ) {
3504            unsafe {
3505                let f: &F = &*(f as *const F);
3506                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3507            }
3508        }
3509        unsafe {
3510            let f: Box_<F> = Box_::new(f);
3511            connect_raw(
3512                self.as_ptr() as *mut _,
3513                c"toggle-cursor-visible".as_ptr(),
3514                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3515                    toggle_cursor_visible_trampoline::<Self, F> as *const (),
3516                )),
3517                Box_::into_raw(f),
3518            )
3519        }
3520    }
3521
3522    fn emit_toggle_cursor_visible(&self) {
3523        self.emit_by_name::<()>("toggle-cursor-visible", &[]);
3524    }
3525
3526    /// .
3527    #[doc(alias = "toggle-overwrite")]
3528    fn connect_toggle_overwrite<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3529        unsafe extern "C" fn toggle_overwrite_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
3530            this: *mut ffi::GtkTextView,
3531            f: glib::ffi::gpointer,
3532        ) {
3533            unsafe {
3534                let f: &F = &*(f as *const F);
3535                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3536            }
3537        }
3538        unsafe {
3539            let f: Box_<F> = Box_::new(f);
3540            connect_raw(
3541                self.as_ptr() as *mut _,
3542                c"toggle-overwrite".as_ptr(),
3543                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3544                    toggle_overwrite_trampoline::<Self, F> as *const (),
3545                )),
3546                Box_::into_raw(f),
3547            )
3548        }
3549    }
3550
3551    fn emit_toggle_overwrite(&self) {
3552        self.emit_by_name::<()>("toggle-overwrite", &[]);
3553    }
3554
3555    #[doc(alias = "accepts-tab")]
3556    fn connect_accepts_tab_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3557        unsafe extern "C" fn notify_accepts_tab_trampoline<
3558            P: IsA<TextView>,
3559            F: Fn(&P) + 'static,
3560        >(
3561            this: *mut ffi::GtkTextView,
3562            _param_spec: glib::ffi::gpointer,
3563            f: glib::ffi::gpointer,
3564        ) {
3565            unsafe {
3566                let f: &F = &*(f as *const F);
3567                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3568            }
3569        }
3570        unsafe {
3571            let f: Box_<F> = Box_::new(f);
3572            connect_raw(
3573                self.as_ptr() as *mut _,
3574                c"notify::accepts-tab".as_ptr(),
3575                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3576                    notify_accepts_tab_trampoline::<Self, F> as *const (),
3577                )),
3578                Box_::into_raw(f),
3579            )
3580        }
3581    }
3582
3583    #[doc(alias = "bottom-margin")]
3584    fn connect_bottom_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3585        unsafe extern "C" fn notify_bottom_margin_trampoline<
3586            P: IsA<TextView>,
3587            F: Fn(&P) + 'static,
3588        >(
3589            this: *mut ffi::GtkTextView,
3590            _param_spec: glib::ffi::gpointer,
3591            f: glib::ffi::gpointer,
3592        ) {
3593            unsafe {
3594                let f: &F = &*(f as *const F);
3595                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3596            }
3597        }
3598        unsafe {
3599            let f: Box_<F> = Box_::new(f);
3600            connect_raw(
3601                self.as_ptr() as *mut _,
3602                c"notify::bottom-margin".as_ptr(),
3603                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3604                    notify_bottom_margin_trampoline::<Self, F> as *const (),
3605                )),
3606                Box_::into_raw(f),
3607            )
3608        }
3609    }
3610
3611    #[doc(alias = "buffer")]
3612    fn connect_buffer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3613        unsafe extern "C" fn notify_buffer_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
3614            this: *mut ffi::GtkTextView,
3615            _param_spec: glib::ffi::gpointer,
3616            f: glib::ffi::gpointer,
3617        ) {
3618            unsafe {
3619                let f: &F = &*(f as *const F);
3620                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3621            }
3622        }
3623        unsafe {
3624            let f: Box_<F> = Box_::new(f);
3625            connect_raw(
3626                self.as_ptr() as *mut _,
3627                c"notify::buffer".as_ptr(),
3628                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3629                    notify_buffer_trampoline::<Self, F> as *const (),
3630                )),
3631                Box_::into_raw(f),
3632            )
3633        }
3634    }
3635
3636    #[doc(alias = "cursor-visible")]
3637    fn connect_cursor_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3638        unsafe extern "C" fn notify_cursor_visible_trampoline<
3639            P: IsA<TextView>,
3640            F: Fn(&P) + 'static,
3641        >(
3642            this: *mut ffi::GtkTextView,
3643            _param_spec: glib::ffi::gpointer,
3644            f: glib::ffi::gpointer,
3645        ) {
3646            unsafe {
3647                let f: &F = &*(f as *const F);
3648                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3649            }
3650        }
3651        unsafe {
3652            let f: Box_<F> = Box_::new(f);
3653            connect_raw(
3654                self.as_ptr() as *mut _,
3655                c"notify::cursor-visible".as_ptr(),
3656                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3657                    notify_cursor_visible_trampoline::<Self, F> as *const (),
3658                )),
3659                Box_::into_raw(f),
3660            )
3661        }
3662    }
3663
3664    #[doc(alias = "editable")]
3665    fn connect_editable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3666        unsafe extern "C" fn notify_editable_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
3667            this: *mut ffi::GtkTextView,
3668            _param_spec: glib::ffi::gpointer,
3669            f: glib::ffi::gpointer,
3670        ) {
3671            unsafe {
3672                let f: &F = &*(f as *const F);
3673                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3674            }
3675        }
3676        unsafe {
3677            let f: Box_<F> = Box_::new(f);
3678            connect_raw(
3679                self.as_ptr() as *mut _,
3680                c"notify::editable".as_ptr(),
3681                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3682                    notify_editable_trampoline::<Self, F> as *const (),
3683                )),
3684                Box_::into_raw(f),
3685            )
3686        }
3687    }
3688
3689    #[doc(alias = "extra-menu")]
3690    fn connect_extra_menu_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3691        unsafe extern "C" fn notify_extra_menu_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
3692            this: *mut ffi::GtkTextView,
3693            _param_spec: glib::ffi::gpointer,
3694            f: glib::ffi::gpointer,
3695        ) {
3696            unsafe {
3697                let f: &F = &*(f as *const F);
3698                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3699            }
3700        }
3701        unsafe {
3702            let f: Box_<F> = Box_::new(f);
3703            connect_raw(
3704                self.as_ptr() as *mut _,
3705                c"notify::extra-menu".as_ptr(),
3706                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3707                    notify_extra_menu_trampoline::<Self, F> as *const (),
3708                )),
3709                Box_::into_raw(f),
3710            )
3711        }
3712    }
3713
3714    #[doc(alias = "im-module")]
3715    fn connect_im_module_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3716        unsafe extern "C" fn notify_im_module_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
3717            this: *mut ffi::GtkTextView,
3718            _param_spec: glib::ffi::gpointer,
3719            f: glib::ffi::gpointer,
3720        ) {
3721            unsafe {
3722                let f: &F = &*(f as *const F);
3723                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3724            }
3725        }
3726        unsafe {
3727            let f: Box_<F> = Box_::new(f);
3728            connect_raw(
3729                self.as_ptr() as *mut _,
3730                c"notify::im-module".as_ptr(),
3731                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3732                    notify_im_module_trampoline::<Self, F> as *const (),
3733                )),
3734                Box_::into_raw(f),
3735            )
3736        }
3737    }
3738
3739    #[doc(alias = "indent")]
3740    fn connect_indent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3741        unsafe extern "C" fn notify_indent_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
3742            this: *mut ffi::GtkTextView,
3743            _param_spec: glib::ffi::gpointer,
3744            f: glib::ffi::gpointer,
3745        ) {
3746            unsafe {
3747                let f: &F = &*(f as *const F);
3748                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3749            }
3750        }
3751        unsafe {
3752            let f: Box_<F> = Box_::new(f);
3753            connect_raw(
3754                self.as_ptr() as *mut _,
3755                c"notify::indent".as_ptr(),
3756                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3757                    notify_indent_trampoline::<Self, F> as *const (),
3758                )),
3759                Box_::into_raw(f),
3760            )
3761        }
3762    }
3763
3764    #[doc(alias = "input-hints")]
3765    fn connect_input_hints_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3766        unsafe extern "C" fn notify_input_hints_trampoline<
3767            P: IsA<TextView>,
3768            F: Fn(&P) + 'static,
3769        >(
3770            this: *mut ffi::GtkTextView,
3771            _param_spec: glib::ffi::gpointer,
3772            f: glib::ffi::gpointer,
3773        ) {
3774            unsafe {
3775                let f: &F = &*(f as *const F);
3776                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3777            }
3778        }
3779        unsafe {
3780            let f: Box_<F> = Box_::new(f);
3781            connect_raw(
3782                self.as_ptr() as *mut _,
3783                c"notify::input-hints".as_ptr(),
3784                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3785                    notify_input_hints_trampoline::<Self, F> as *const (),
3786                )),
3787                Box_::into_raw(f),
3788            )
3789        }
3790    }
3791
3792    #[doc(alias = "input-purpose")]
3793    fn connect_input_purpose_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3794        unsafe extern "C" fn notify_input_purpose_trampoline<
3795            P: IsA<TextView>,
3796            F: Fn(&P) + 'static,
3797        >(
3798            this: *mut ffi::GtkTextView,
3799            _param_spec: glib::ffi::gpointer,
3800            f: glib::ffi::gpointer,
3801        ) {
3802            unsafe {
3803                let f: &F = &*(f as *const F);
3804                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3805            }
3806        }
3807        unsafe {
3808            let f: Box_<F> = Box_::new(f);
3809            connect_raw(
3810                self.as_ptr() as *mut _,
3811                c"notify::input-purpose".as_ptr(),
3812                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3813                    notify_input_purpose_trampoline::<Self, F> as *const (),
3814                )),
3815                Box_::into_raw(f),
3816            )
3817        }
3818    }
3819
3820    #[doc(alias = "justification")]
3821    fn connect_justification_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3822        unsafe extern "C" fn notify_justification_trampoline<
3823            P: IsA<TextView>,
3824            F: Fn(&P) + 'static,
3825        >(
3826            this: *mut ffi::GtkTextView,
3827            _param_spec: glib::ffi::gpointer,
3828            f: glib::ffi::gpointer,
3829        ) {
3830            unsafe {
3831                let f: &F = &*(f as *const F);
3832                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3833            }
3834        }
3835        unsafe {
3836            let f: Box_<F> = Box_::new(f);
3837            connect_raw(
3838                self.as_ptr() as *mut _,
3839                c"notify::justification".as_ptr(),
3840                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3841                    notify_justification_trampoline::<Self, F> as *const (),
3842                )),
3843                Box_::into_raw(f),
3844            )
3845        }
3846    }
3847
3848    #[doc(alias = "left-margin")]
3849    fn connect_left_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3850        unsafe extern "C" fn notify_left_margin_trampoline<
3851            P: IsA<TextView>,
3852            F: Fn(&P) + 'static,
3853        >(
3854            this: *mut ffi::GtkTextView,
3855            _param_spec: glib::ffi::gpointer,
3856            f: glib::ffi::gpointer,
3857        ) {
3858            unsafe {
3859                let f: &F = &*(f as *const F);
3860                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3861            }
3862        }
3863        unsafe {
3864            let f: Box_<F> = Box_::new(f);
3865            connect_raw(
3866                self.as_ptr() as *mut _,
3867                c"notify::left-margin".as_ptr(),
3868                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3869                    notify_left_margin_trampoline::<Self, F> as *const (),
3870                )),
3871                Box_::into_raw(f),
3872            )
3873        }
3874    }
3875
3876    #[doc(alias = "monospace")]
3877    fn connect_monospace_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3878        unsafe extern "C" fn notify_monospace_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
3879            this: *mut ffi::GtkTextView,
3880            _param_spec: glib::ffi::gpointer,
3881            f: glib::ffi::gpointer,
3882        ) {
3883            unsafe {
3884                let f: &F = &*(f as *const F);
3885                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3886            }
3887        }
3888        unsafe {
3889            let f: Box_<F> = Box_::new(f);
3890            connect_raw(
3891                self.as_ptr() as *mut _,
3892                c"notify::monospace".as_ptr(),
3893                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3894                    notify_monospace_trampoline::<Self, F> as *const (),
3895                )),
3896                Box_::into_raw(f),
3897            )
3898        }
3899    }
3900
3901    #[doc(alias = "overwrite")]
3902    fn connect_overwrite_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3903        unsafe extern "C" fn notify_overwrite_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
3904            this: *mut ffi::GtkTextView,
3905            _param_spec: glib::ffi::gpointer,
3906            f: glib::ffi::gpointer,
3907        ) {
3908            unsafe {
3909                let f: &F = &*(f as *const F);
3910                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3911            }
3912        }
3913        unsafe {
3914            let f: Box_<F> = Box_::new(f);
3915            connect_raw(
3916                self.as_ptr() as *mut _,
3917                c"notify::overwrite".as_ptr(),
3918                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3919                    notify_overwrite_trampoline::<Self, F> as *const (),
3920                )),
3921                Box_::into_raw(f),
3922            )
3923        }
3924    }
3925
3926    #[doc(alias = "pixels-above-lines")]
3927    fn connect_pixels_above_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3928        unsafe extern "C" fn notify_pixels_above_lines_trampoline<
3929            P: IsA<TextView>,
3930            F: Fn(&P) + 'static,
3931        >(
3932            this: *mut ffi::GtkTextView,
3933            _param_spec: glib::ffi::gpointer,
3934            f: glib::ffi::gpointer,
3935        ) {
3936            unsafe {
3937                let f: &F = &*(f as *const F);
3938                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3939            }
3940        }
3941        unsafe {
3942            let f: Box_<F> = Box_::new(f);
3943            connect_raw(
3944                self.as_ptr() as *mut _,
3945                c"notify::pixels-above-lines".as_ptr(),
3946                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3947                    notify_pixels_above_lines_trampoline::<Self, F> as *const (),
3948                )),
3949                Box_::into_raw(f),
3950            )
3951        }
3952    }
3953
3954    #[doc(alias = "pixels-below-lines")]
3955    fn connect_pixels_below_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3956        unsafe extern "C" fn notify_pixels_below_lines_trampoline<
3957            P: IsA<TextView>,
3958            F: Fn(&P) + 'static,
3959        >(
3960            this: *mut ffi::GtkTextView,
3961            _param_spec: glib::ffi::gpointer,
3962            f: glib::ffi::gpointer,
3963        ) {
3964            unsafe {
3965                let f: &F = &*(f as *const F);
3966                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3967            }
3968        }
3969        unsafe {
3970            let f: Box_<F> = Box_::new(f);
3971            connect_raw(
3972                self.as_ptr() as *mut _,
3973                c"notify::pixels-below-lines".as_ptr(),
3974                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3975                    notify_pixels_below_lines_trampoline::<Self, F> as *const (),
3976                )),
3977                Box_::into_raw(f),
3978            )
3979        }
3980    }
3981
3982    #[doc(alias = "pixels-inside-wrap")]
3983    fn connect_pixels_inside_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3984        unsafe extern "C" fn notify_pixels_inside_wrap_trampoline<
3985            P: IsA<TextView>,
3986            F: Fn(&P) + 'static,
3987        >(
3988            this: *mut ffi::GtkTextView,
3989            _param_spec: glib::ffi::gpointer,
3990            f: glib::ffi::gpointer,
3991        ) {
3992            unsafe {
3993                let f: &F = &*(f as *const F);
3994                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3995            }
3996        }
3997        unsafe {
3998            let f: Box_<F> = Box_::new(f);
3999            connect_raw(
4000                self.as_ptr() as *mut _,
4001                c"notify::pixels-inside-wrap".as_ptr(),
4002                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4003                    notify_pixels_inside_wrap_trampoline::<Self, F> as *const (),
4004                )),
4005                Box_::into_raw(f),
4006            )
4007        }
4008    }
4009
4010    #[doc(alias = "right-margin")]
4011    fn connect_right_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4012        unsafe extern "C" fn notify_right_margin_trampoline<
4013            P: IsA<TextView>,
4014            F: Fn(&P) + 'static,
4015        >(
4016            this: *mut ffi::GtkTextView,
4017            _param_spec: glib::ffi::gpointer,
4018            f: glib::ffi::gpointer,
4019        ) {
4020            unsafe {
4021                let f: &F = &*(f as *const F);
4022                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4023            }
4024        }
4025        unsafe {
4026            let f: Box_<F> = Box_::new(f);
4027            connect_raw(
4028                self.as_ptr() as *mut _,
4029                c"notify::right-margin".as_ptr(),
4030                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4031                    notify_right_margin_trampoline::<Self, F> as *const (),
4032                )),
4033                Box_::into_raw(f),
4034            )
4035        }
4036    }
4037
4038    #[doc(alias = "tabs")]
4039    fn connect_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4040        unsafe extern "C" fn notify_tabs_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
4041            this: *mut ffi::GtkTextView,
4042            _param_spec: glib::ffi::gpointer,
4043            f: glib::ffi::gpointer,
4044        ) {
4045            unsafe {
4046                let f: &F = &*(f as *const F);
4047                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4048            }
4049        }
4050        unsafe {
4051            let f: Box_<F> = Box_::new(f);
4052            connect_raw(
4053                self.as_ptr() as *mut _,
4054                c"notify::tabs".as_ptr(),
4055                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4056                    notify_tabs_trampoline::<Self, F> as *const (),
4057                )),
4058                Box_::into_raw(f),
4059            )
4060        }
4061    }
4062
4063    #[doc(alias = "top-margin")]
4064    fn connect_top_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4065        unsafe extern "C" fn notify_top_margin_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
4066            this: *mut ffi::GtkTextView,
4067            _param_spec: glib::ffi::gpointer,
4068            f: glib::ffi::gpointer,
4069        ) {
4070            unsafe {
4071                let f: &F = &*(f as *const F);
4072                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4073            }
4074        }
4075        unsafe {
4076            let f: Box_<F> = Box_::new(f);
4077            connect_raw(
4078                self.as_ptr() as *mut _,
4079                c"notify::top-margin".as_ptr(),
4080                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4081                    notify_top_margin_trampoline::<Self, F> as *const (),
4082                )),
4083                Box_::into_raw(f),
4084            )
4085        }
4086    }
4087
4088    #[doc(alias = "wrap-mode")]
4089    fn connect_wrap_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4090        unsafe extern "C" fn notify_wrap_mode_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
4091            this: *mut ffi::GtkTextView,
4092            _param_spec: glib::ffi::gpointer,
4093            f: glib::ffi::gpointer,
4094        ) {
4095            unsafe {
4096                let f: &F = &*(f as *const F);
4097                f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4098            }
4099        }
4100        unsafe {
4101            let f: Box_<F> = Box_::new(f);
4102            connect_raw(
4103                self.as_ptr() as *mut _,
4104                c"notify::wrap-mode".as_ptr(),
4105                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4106                    notify_wrap_mode_trampoline::<Self, F> as *const (),
4107                )),
4108                Box_::into_raw(f),
4109            )
4110        }
4111    }
4112}
4113
4114impl<O: IsA<TextView>> TextViewExt for O {}