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