Skip to main content

gtk/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
5use crate::{
6    Adjustment, Align, Buildable, Container, DeleteType, InputHints, InputPurpose, Justification,
7    MovementStep, ResizeMode, ScrollStep, Scrollable, ScrollablePolicy, TextAttributes, TextBuffer,
8    TextChildAnchor, TextExtendSelection, TextIter, TextMark, TextWindowType, Widget, WrapMode,
9};
10use glib::{
11    prelude::*,
12    signal::{connect_raw, SignalHandlerId},
13    translate::*,
14};
15use std::{boxed::Box as Box_, fmt, mem, mem::transmute};
16
17glib::wrapper! {
18    /// You may wish to begin by reading the
19    /// [text widget conceptual overview](TextWidget.html)
20    /// which gives an overview of all the objects and data
21    /// types related to the text widget and how they work together.
22    ///
23    /// # CSS nodes
24    ///
25    ///
26    ///
27    /// **⚠️ The following code is in plain ⚠️**
28    ///
29    /// ```plain
30    /// textview.view
31    /// ├── border.top
32    /// ├── border.left
33    /// ├── text
34    /// │   ╰── [selection]
35    /// ├── border.right
36    /// ├── border.bottom
37    /// ╰── [window.popup]
38    /// ```
39    ///
40    /// GtkTextView has a main css node with name textview and style class .view,
41    /// and subnodes for each of the border windows, and the main text area,
42    /// with names border and text, respectively. The border nodes each get
43    /// one of the style classes .left, .right, .top or .bottom.
44    ///
45    /// A node representing the selection will appear below the text node.
46    ///
47    /// If a context menu is opened, the window node will appear as a subnode
48    /// of the main node.
49    ///
50    /// ## Properties
51    ///
52    ///
53    /// #### `accepts-tab`
54    ///  Readable | Writeable
55    ///
56    ///
57    /// #### `bottom-margin`
58    ///  The bottom margin for text in the text view.
59    ///
60    /// Note that this property is confusingly named. In CSS terms,
61    /// the value set here is padding, and it is applied in addition
62    /// to the padding from the theme.
63    ///
64    /// Don't confuse this property with [`margin-bottom`][struct@crate::Widget#margin-bottom].
65    ///
66    /// Readable | Writeable
67    ///
68    ///
69    /// #### `buffer`
70    ///  Readable | Writeable
71    ///
72    ///
73    /// #### `cursor-visible`
74    ///  Readable | Writeable
75    ///
76    ///
77    /// #### `editable`
78    ///  Readable | Writeable
79    ///
80    ///
81    /// #### `im-module`
82    ///  Which IM (input method) module should be used for this text_view.
83    /// See [`IMContext`][crate::IMContext].
84    ///
85    /// Setting this to a non-[`None`] value overrides the
86    /// system-wide IM module setting. See the GtkSettings
87    /// [`gtk-im-module`][struct@crate::Settings#gtk-im-module] property.
88    ///
89    /// Readable | Writeable
90    ///
91    ///
92    /// #### `indent`
93    ///  Readable | Writeable
94    ///
95    ///
96    /// #### `input-hints`
97    ///  Additional hints (beyond [`input-purpose`][struct@crate::TextView#input-purpose]) that
98    /// allow input methods to fine-tune their behaviour.
99    ///
100    /// Readable | Writeable
101    ///
102    ///
103    /// #### `input-purpose`
104    ///  The purpose of this text field.
105    ///
106    /// This property can be used by on-screen keyboards and other input
107    /// methods to adjust their behaviour.
108    ///
109    /// Readable | Writeable
110    ///
111    ///
112    /// #### `justification`
113    ///  Readable | Writeable
114    ///
115    ///
116    /// #### `left-margin`
117    ///  The default left margin for text in the text view.
118    /// Tags in the buffer may override the default.
119    ///
120    /// Note that this property is confusingly named. In CSS terms,
121    /// the value set here is padding, and it is applied in addition
122    /// to the padding from the theme.
123    ///
124    /// Don't confuse this property with [`margin-left`][struct@crate::Widget#margin-left].
125    ///
126    /// Readable | Writeable
127    ///
128    ///
129    /// #### `monospace`
130    ///  Readable | Writeable
131    ///
132    ///
133    /// #### `overwrite`
134    ///  Readable | Writeable
135    ///
136    ///
137    /// #### `pixels-above-lines`
138    ///  Readable | Writeable
139    ///
140    ///
141    /// #### `pixels-below-lines`
142    ///  Readable | Writeable
143    ///
144    ///
145    /// #### `pixels-inside-wrap`
146    ///  Readable | Writeable
147    ///
148    ///
149    /// #### `populate-all`
150    ///  If :populate-all is [`true`], the [`populate-popup`][struct@crate::TextView#populate-popup]
151    /// signal is also emitted for touch popups.
152    ///
153    /// Readable | Writeable
154    ///
155    ///
156    /// #### `right-margin`
157    ///  The default right margin for text in the text view.
158    /// Tags in the buffer may override the default.
159    ///
160    /// Note that this property is confusingly named. In CSS terms,
161    /// the value set here is padding, and it is applied in addition
162    /// to the padding from the theme.
163    ///
164    /// Don't confuse this property with [`margin-right`][struct@crate::Widget#margin-right].
165    ///
166    /// Readable | Writeable
167    ///
168    ///
169    /// #### `tabs`
170    ///  Readable | Writeable
171    ///
172    ///
173    /// #### `top-margin`
174    ///  The top margin for text in the text view.
175    ///
176    /// Note that this property is confusingly named. In CSS terms,
177    /// the value set here is padding, and it is applied in addition
178    /// to the padding from the theme.
179    ///
180    /// Don't confuse this property with [`margin-top`][struct@crate::Widget#margin-top].
181    ///
182    /// Readable | Writeable
183    ///
184    ///
185    /// #### `wrap-mode`
186    ///  Readable | Writeable
187    /// <details><summary><h4>Container</h4></summary>
188    ///
189    ///
190    /// #### `border-width`
191    ///  Readable | Writeable
192    ///
193    ///
194    /// #### `child`
195    ///  Writeable
196    ///
197    ///
198    /// #### `resize-mode`
199    ///  Readable | Writeable
200    /// </details>
201    /// <details><summary><h4>Widget</h4></summary>
202    ///
203    ///
204    /// #### `app-paintable`
205    ///  Readable | Writeable
206    ///
207    ///
208    /// #### `can-default`
209    ///  Readable | Writeable
210    ///
211    ///
212    /// #### `can-focus`
213    ///  Readable | Writeable
214    ///
215    ///
216    /// #### `composite-child`
217    ///  Readable
218    ///
219    ///
220    /// #### `double-buffered`
221    ///  Whether the widget is double buffered.
222    ///
223    /// Readable | Writeable
224    ///
225    ///
226    /// #### `events`
227    ///  Readable | Writeable
228    ///
229    ///
230    /// #### `expand`
231    ///  Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
232    ///
233    /// Readable | Writeable
234    ///
235    ///
236    /// #### `focus-on-click`
237    ///  Whether the widget should grab focus when it is clicked with the mouse.
238    ///
239    /// This property is only relevant for widgets that can take focus.
240    ///
241    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
242    /// GtkComboBox) implemented this property individually.
243    ///
244    /// Readable | Writeable
245    ///
246    ///
247    /// #### `halign`
248    ///  How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
249    ///
250    /// Readable | Writeable
251    ///
252    ///
253    /// #### `has-default`
254    ///  Readable | Writeable
255    ///
256    ///
257    /// #### `has-focus`
258    ///  Readable | Writeable
259    ///
260    ///
261    /// #### `has-tooltip`
262    ///  Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
263    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
264    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
265    /// whether it will provide a tooltip or not.
266    ///
267    /// Note that setting this property to [`true`] for the first time will change
268    /// the event masks of the GdkWindows of this widget to include leave-notify
269    /// and motion-notify events. This cannot and will not be undone when the
270    /// property is set to [`false`] again.
271    ///
272    /// Readable | Writeable
273    ///
274    ///
275    /// #### `height-request`
276    ///  Readable | Writeable
277    ///
278    ///
279    /// #### `hexpand`
280    ///  Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
281    ///
282    /// Readable | Writeable
283    ///
284    ///
285    /// #### `hexpand-set`
286    ///  Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
287    ///
288    /// Readable | Writeable
289    ///
290    ///
291    /// #### `is-focus`
292    ///  Readable | Writeable
293    ///
294    ///
295    /// #### `margin`
296    ///  Sets all four sides' margin at once. If read, returns max
297    /// margin on any side.
298    ///
299    /// Readable | Writeable
300    ///
301    ///
302    /// #### `margin-bottom`
303    ///  Margin on bottom side of widget.
304    ///
305    /// This property adds margin outside of the widget's normal size
306    /// request, the margin will be added in addition to the size from
307    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
308    ///
309    /// Readable | Writeable
310    ///
311    ///
312    /// #### `margin-end`
313    ///  Margin on end of widget, horizontally. This property supports
314    /// left-to-right and right-to-left text directions.
315    ///
316    /// This property adds margin outside of the widget's normal size
317    /// request, the margin will be added in addition to the size from
318    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
319    ///
320    /// Readable | Writeable
321    ///
322    ///
323    /// #### `margin-left`
324    ///  Margin on left side of widget.
325    ///
326    /// This property adds margin outside of the widget's normal size
327    /// request, the margin will be added in addition to the size from
328    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
329    ///
330    /// Readable | Writeable
331    ///
332    ///
333    /// #### `margin-right`
334    ///  Margin on right side of widget.
335    ///
336    /// This property adds margin outside of the widget's normal size
337    /// request, the margin will be added in addition to the size from
338    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
339    ///
340    /// Readable | Writeable
341    ///
342    ///
343    /// #### `margin-start`
344    ///  Margin on start of widget, horizontally. This property supports
345    /// left-to-right and right-to-left text directions.
346    ///
347    /// This property adds margin outside of the widget's normal size
348    /// request, the margin will be added in addition to the size from
349    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
350    ///
351    /// Readable | Writeable
352    ///
353    ///
354    /// #### `margin-top`
355    ///  Margin on top side of widget.
356    ///
357    /// This property adds margin outside of the widget's normal size
358    /// request, the margin will be added in addition to the size from
359    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
360    ///
361    /// Readable | Writeable
362    ///
363    ///
364    /// #### `name`
365    ///  Readable | Writeable
366    ///
367    ///
368    /// #### `no-show-all`
369    ///  Readable | Writeable
370    ///
371    ///
372    /// #### `opacity`
373    ///  The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
374    /// more details about window opacity.
375    ///
376    /// Before 3.8 this was only available in GtkWindow
377    ///
378    /// Readable | Writeable
379    ///
380    ///
381    /// #### `parent`
382    ///  Readable | Writeable
383    ///
384    ///
385    /// #### `receives-default`
386    ///  Readable | Writeable
387    ///
388    ///
389    /// #### `scale-factor`
390    ///  The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
391    /// more details about widget scaling.
392    ///
393    /// Readable
394    ///
395    ///
396    /// #### `sensitive`
397    ///  Readable | Writeable
398    ///
399    ///
400    /// #### `style`
401    ///  The style of the widget, which contains information about how it will look (colors, etc).
402    ///
403    /// Readable | Writeable
404    ///
405    ///
406    /// #### `tooltip-markup`
407    ///  Sets the text of tooltip to be the given string, which is marked up
408    /// with the [Pango text markup language][PangoMarkupFormat].
409    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
410    ///
411    /// This is a convenience property which will take care of getting the
412    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
413    /// will automatically be set to [`true`] and there will be taken care of
414    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
415    ///
416    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
417    /// are set, the last one wins.
418    ///
419    /// Readable | Writeable
420    ///
421    ///
422    /// #### `tooltip-text`
423    ///  Sets the text of tooltip to be the given string.
424    ///
425    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
426    ///
427    /// This is a convenience property which will take care of getting the
428    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
429    /// will automatically be set to [`true`] and there will be taken care of
430    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
431    ///
432    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
433    /// are set, the last one wins.
434    ///
435    /// Readable | Writeable
436    ///
437    ///
438    /// #### `valign`
439    ///  How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
440    ///
441    /// Readable | Writeable
442    ///
443    ///
444    /// #### `vexpand`
445    ///  Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
446    ///
447    /// Readable | Writeable
448    ///
449    ///
450    /// #### `vexpand-set`
451    ///  Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
452    ///
453    /// Readable | Writeable
454    ///
455    ///
456    /// #### `visible`
457    ///  Readable | Writeable
458    ///
459    ///
460    /// #### `width-request`
461    ///  Readable | Writeable
462    ///
463    ///
464    /// #### `window`
465    ///  The widget's window if it is realized, [`None`] otherwise.
466    ///
467    /// Readable
468    /// </details>
469    /// <details><summary><h4>Scrollable</h4></summary>
470    ///
471    ///
472    /// #### `hadjustment`
473    ///  Horizontal [`Adjustment`][crate::Adjustment] of the scrollable widget. This adjustment is
474    /// shared between the scrollable widget and its parent.
475    ///
476    /// Readable | Writeable | Construct
477    ///
478    ///
479    /// #### `hscroll-policy`
480    ///  Determines whether horizontal scrolling should start once the scrollable
481    /// widget is allocated less than its minimum width or less than its natural width.
482    ///
483    /// Readable | Writeable
484    ///
485    ///
486    /// #### `vadjustment`
487    ///  Verical [`Adjustment`][crate::Adjustment] of the scrollable widget. This adjustment is shared
488    /// between the scrollable widget and its parent.
489    ///
490    /// Readable | Writeable | Construct
491    ///
492    ///
493    /// #### `vscroll-policy`
494    ///  Determines whether vertical scrolling should start once the scrollable
495    /// widget is allocated less than its minimum height or less than its natural height.
496    ///
497    /// Readable | Writeable
498    /// </details>
499    ///
500    /// ## Signals
501    ///
502    ///
503    /// #### `backspace`
504    ///  The ::backspace signal is a
505    /// [keybinding signal][GtkBindingSignal]
506    /// which gets emitted when the user asks for it.
507    ///
508    /// The default bindings for this signal are
509    /// Backspace and Shift-Backspace.
510    ///
511    /// Action
512    ///
513    ///
514    /// #### `copy-clipboard`
515    ///  The ::copy-clipboard signal is a
516    /// [keybinding signal][GtkBindingSignal]
517    /// which gets emitted to copy the selection to the clipboard.
518    ///
519    /// The default bindings for this signal are
520    /// Ctrl-c and Ctrl-Insert.
521    ///
522    /// Action
523    ///
524    ///
525    /// #### `cut-clipboard`
526    ///  The ::cut-clipboard signal is a
527    /// [keybinding signal][GtkBindingSignal]
528    /// which gets emitted to cut the selection to the clipboard.
529    ///
530    /// The default bindings for this signal are
531    /// Ctrl-x and Shift-Delete.
532    ///
533    /// Action
534    ///
535    ///
536    /// #### `delete-from-cursor`
537    ///  The ::delete-from-cursor signal is a
538    /// [keybinding signal][GtkBindingSignal]
539    /// which gets emitted when the user initiates a text deletion.
540    ///
541    /// If the `type_` is [`DeleteType::Chars`][crate::DeleteType::Chars], GTK+ deletes the selection
542    /// if there is one, otherwise it deletes the requested number
543    /// of characters.
544    ///
545    /// The default bindings for this signal are
546    /// Delete for deleting a character, Ctrl-Delete for
547    /// deleting a word and Ctrl-Backspace for deleting a word
548    /// backwords.
549    ///
550    /// Action
551    ///
552    ///
553    /// #### `extend-selection`
554    ///  The ::extend-selection signal is emitted when the selection needs to be
555    /// extended at `location`.
556    ///
557    ///
558    ///
559    ///
560    /// #### `insert-at-cursor`
561    ///  The ::insert-at-cursor signal is a
562    /// [keybinding signal][GtkBindingSignal]
563    /// which gets emitted when the user initiates the insertion of a
564    /// fixed string at the cursor.
565    ///
566    /// This signal has no default bindings.
567    ///
568    /// Action
569    ///
570    ///
571    /// #### `insert-emoji`
572    ///  The ::insert-emoji signal is a
573    /// [keybinding signal][GtkBindingSignal]
574    /// which gets emitted to present the Emoji chooser for the `text_view`.
575    ///
576    /// The default bindings for this signal are Ctrl-. and Ctrl-;
577    ///
578    /// Action
579    ///
580    ///
581    /// #### `move-cursor`
582    ///  The ::move-cursor signal is a
583    /// [keybinding signal][GtkBindingSignal]
584    /// which gets emitted when the user initiates a cursor movement.
585    /// If the cursor is not visible in `text_view`, this signal causes
586    /// the viewport to be moved instead.
587    ///
588    /// Applications should not connect to it, but may emit it with
589    /// `g_signal_emit_by_name()` if they need to control the cursor
590    /// programmatically.
591    ///
592    /// The default bindings for this signal come in two variants,
593    /// the variant with the Shift modifier extends the selection,
594    /// the variant without the Shift modifer does not.
595    /// There are too many key combinations to list them all here.
596    /// - Arrow keys move by individual characters/lines
597    /// - Ctrl-arrow key combinations move by words/paragraphs
598    /// - Home/End keys move to the ends of the buffer
599    /// - PageUp/PageDown keys move vertically by pages
600    /// - Ctrl-PageUp/PageDown keys move horizontally by pages
601    ///
602    /// Action
603    ///
604    ///
605    /// #### `move-viewport`
606    ///  The ::move-viewport signal is a
607    /// [keybinding signal][GtkBindingSignal]
608    /// which can be bound to key combinations to allow the user
609    /// to move the viewport, i.e. change what part of the text view
610    /// is visible in a containing scrolled window.
611    ///
612    /// There are no default bindings for this signal.
613    ///
614    /// Action
615    ///
616    ///
617    /// #### `paste-clipboard`
618    ///  The ::paste-clipboard signal is a
619    /// [keybinding signal][GtkBindingSignal]
620    /// which gets emitted to paste the contents of the clipboard
621    /// into the text view.
622    ///
623    /// The default bindings for this signal are
624    /// Ctrl-v and Shift-Insert.
625    ///
626    /// Action
627    ///
628    ///
629    /// #### `populate-popup`
630    ///  The ::populate-popup signal gets emitted before showing the
631    /// context menu of the text view.
632    ///
633    /// If you need to add items to the context menu, connect
634    /// to this signal and append your items to the `popup`, which
635    /// will be a [`Menu`][crate::Menu] in this case.
636    ///
637    /// If [`populate-all`][struct@crate::TextView#populate-all] is [`true`], this signal will
638    /// also be emitted to populate touch popups. In this case,
639    /// `popup` will be a different container, e.g. a [`Toolbar`][crate::Toolbar].
640    ///
641    /// The signal handler should not make assumptions about the
642    /// type of `widget`, but check whether `popup` is a [`Menu`][crate::Menu]
643    /// or [`Toolbar`][crate::Toolbar] or another kind of container.
644    ///
645    ///
646    ///
647    ///
648    /// #### `preedit-changed`
649    ///  If an input method is used, the typed text will not immediately
650    /// be committed to the buffer. So if you are interested in the text,
651    /// connect to this signal.
652    ///
653    /// This signal is only emitted if the text at the given position
654    /// is actually editable.
655    ///
656    /// Action
657    ///
658    ///
659    /// #### `select-all`
660    ///  The ::select-all signal is a
661    /// [keybinding signal][GtkBindingSignal]
662    /// which gets emitted to select or unselect the complete
663    /// contents of the text view.
664    ///
665    /// The default bindings for this signal are Ctrl-a and Ctrl-/
666    /// for selecting and Shift-Ctrl-a and Ctrl-\ for unselecting.
667    ///
668    /// Action
669    ///
670    ///
671    /// #### `set-anchor`
672    ///  The ::set-anchor signal is a
673    /// [keybinding signal][GtkBindingSignal]
674    /// which gets emitted when the user initiates setting the "anchor"
675    /// mark. The "anchor" mark gets placed at the same position as the
676    /// "insert" mark.
677    ///
678    /// This signal has no default bindings.
679    ///
680    /// Action
681    ///
682    ///
683    /// #### `toggle-cursor-visible`
684    ///  The ::toggle-cursor-visible signal is a
685    /// [keybinding signal][GtkBindingSignal]
686    /// which gets emitted to toggle the [`cursor-visible`][struct@crate::TextView#cursor-visible]
687    /// property.
688    ///
689    /// The default binding for this signal is F7.
690    ///
691    /// Action
692    ///
693    ///
694    /// #### `toggle-overwrite`
695    ///  The ::toggle-overwrite signal is a
696    /// [keybinding signal][GtkBindingSignal]
697    /// which gets emitted to toggle the overwrite mode of the text view.
698    ///
699    /// The default bindings for this signal is Insert.
700    ///
701    /// Action
702    /// <details><summary><h4>Container</h4></summary>
703    ///
704    ///
705    /// #### `add`
706    ///
707    ///
708    ///
709    /// #### `check-resize`
710    ///
711    ///
712    ///
713    /// #### `remove`
714    ///
715    ///
716    ///
717    /// #### `set-focus-child`
718    ///
719    /// </details>
720    /// <details><summary><h4>Widget</h4></summary>
721    ///
722    ///
723    /// #### `accel-closures-changed`
724    ///
725    ///
726    ///
727    /// #### `button-press-event`
728    ///  The ::button-press-event signal will be emitted when a button
729    /// (typically from a mouse) is pressed.
730    ///
731    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
732    /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
733    ///
734    /// This signal will be sent to the grab widget if there is one.
735    ///
736    ///
737    ///
738    ///
739    /// #### `button-release-event`
740    ///  The ::button-release-event signal will be emitted when a button
741    /// (typically from a mouse) is released.
742    ///
743    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
744    /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
745    ///
746    /// This signal will be sent to the grab widget if there is one.
747    ///
748    ///
749    ///
750    ///
751    /// #### `can-activate-accel`
752    ///  Determines whether an accelerator that activates the signal
753    /// identified by `signal_id` can currently be activated.
754    /// This signal is present to allow applications and derived
755    /// widgets to override the default [`Widget`][crate::Widget] handling
756    /// for determining whether an accelerator can be activated.
757    ///
758    ///
759    ///
760    ///
761    /// #### `child-notify`
762    ///  The ::child-notify signal is emitted for each
763    /// [child property][child-properties] that has
764    /// changed on an object. The signal's detail holds the property name.
765    ///
766    /// Detailed
767    ///
768    ///
769    /// #### `composited-changed`
770    ///  The ::composited-changed signal is emitted when the composited
771    /// status of `widgets` screen changes.
772    /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
773    ///
774    /// Action
775    ///
776    ///
777    /// #### `configure-event`
778    ///  The ::configure-event signal will be emitted when the size, position or
779    /// stacking of the `widget`'s window has changed.
780    ///
781    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
782    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
783    /// automatically for all new windows.
784    ///
785    ///
786    ///
787    ///
788    /// #### `damage-event`
789    ///  Emitted when a redirected window belonging to `widget` gets drawn into.
790    /// The region/area members of the event shows what area of the redirected
791    /// drawable was drawn into.
792    ///
793    ///
794    ///
795    ///
796    /// #### `delete-event`
797    ///  The ::delete-event signal is emitted if a user requests that
798    /// a toplevel window is closed. The default handler for this signal
799    /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
800    /// this signal will cause the window to be hidden instead, so that
801    /// it can later be shown again without reconstructing it.
802    ///
803    ///
804    ///
805    ///
806    /// #### `destroy`
807    ///  Signals that all holders of a reference to the widget should release
808    /// the reference that they hold. May result in finalization of the widget
809    /// if all references are released.
810    ///
811    /// This signal is not suitable for saving widget state.
812    ///
813    ///
814    ///
815    ///
816    /// #### `destroy-event`
817    ///  The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
818    /// You rarely get this signal, because most widgets disconnect themselves
819    /// from their window before they destroy it, so no widget owns the
820    /// window at destroy time.
821    ///
822    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
823    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
824    /// automatically for all new windows.
825    ///
826    ///
827    ///
828    ///
829    /// #### `direction-changed`
830    ///  The ::direction-changed signal is emitted when the text direction
831    /// of a widget changes.
832    ///
833    ///
834    ///
835    ///
836    /// #### `drag-begin`
837    ///  The ::drag-begin signal is emitted on the drag source when a drag is
838    /// started. A typical reason to connect to this signal is to set up a
839    /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
840    ///
841    /// Note that some widgets set up a drag icon in the default handler of
842    /// this signal, so you may have to use `g_signal_connect_after()` to
843    /// override what the default handler did.
844    ///
845    ///
846    ///
847    ///
848    /// #### `drag-data-delete`
849    ///  The ::drag-data-delete signal is emitted on the drag source when a drag
850    /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
851    /// handler is responsible for deleting the data that has been dropped. What
852    /// "delete" means depends on the context of the drag operation.
853    ///
854    ///
855    ///
856    ///
857    /// #### `drag-data-get`
858    ///  The ::drag-data-get signal is emitted on the drag source when the drop
859    /// site requests the data which is dragged. It is the responsibility of
860    /// the signal handler to fill `data` with the data in the format which
861    /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
862    /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
863    ///
864    ///
865    ///
866    ///
867    /// #### `drag-data-received`
868    ///  The ::drag-data-received signal is emitted on the drop site when the
869    /// dragged data has been received. If the data was received in order to
870    /// determine whether the drop will be accepted, the handler is expected
871    /// to call `gdk_drag_status()` and not finish the drag.
872    /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
873    /// (and this is the last target to be received), the handler for this
874    /// signal is expected to process the received data and then call
875    /// `gtk_drag_finish()`, setting the `success` parameter depending on
876    /// whether the data was processed successfully.
877    ///
878    /// Applications must create some means to determine why the signal was emitted
879    /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
880    ///
881    /// The handler may inspect the selected action with
882    /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
883    /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
884    /// shown in the following example:
885    ///
886    ///
887    /// **⚠️ The following code is in C ⚠️**
888    ///
889    /// ```C
890    /// void
891    /// drag_data_received (GtkWidget          *widget,
892    ///                     GdkDragContext     *context,
893    ///                     gint                x,
894    ///                     gint                y,
895    ///                     GtkSelectionData   *data,
896    ///                     guint               info,
897    ///                     guint               time)
898    /// {
899    ///   if ((data->length >= 0) && (data->format == 8))
900    ///     {
901    ///       GdkDragAction action;
902    ///
903    ///       // handle data here
904    ///
905    ///       action = gdk_drag_context_get_selected_action (context);
906    ///       if (action == GDK_ACTION_ASK)
907    ///         {
908    ///           GtkWidget *dialog;
909    ///           gint response;
910    ///
911    ///           dialog = gtk_message_dialog_new (NULL,
912    ///                                            GTK_DIALOG_MODAL |
913    ///                                            GTK_DIALOG_DESTROY_WITH_PARENT,
914    ///                                            GTK_MESSAGE_INFO,
915    ///                                            GTK_BUTTONS_YES_NO,
916    ///                                            "Move the data ?\n");
917    ///           response = gtk_dialog_run (GTK_DIALOG (dialog));
918    ///           gtk_widget_destroy (dialog);
919    ///
920    ///           if (response == GTK_RESPONSE_YES)
921    ///             action = GDK_ACTION_MOVE;
922    ///           else
923    ///             action = GDK_ACTION_COPY;
924    ///          }
925    ///
926    ///       gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
927    ///     }
928    ///   else
929    ///     gtk_drag_finish (context, FALSE, FALSE, time);
930    ///  }
931    /// ```
932    ///
933    ///
934    ///
935    ///
936    /// #### `drag-drop`
937    ///  The ::drag-drop signal is emitted on the drop site when the user drops
938    /// the data onto the widget. The signal handler must determine whether
939    /// the cursor position is in a drop zone or not. If it is not in a drop
940    /// zone, it returns [`false`] and no further processing is necessary.
941    /// Otherwise, the handler returns [`true`]. In this case, the handler must
942    /// ensure that `gtk_drag_finish()` is called to let the source know that
943    /// the drop is done. The call to `gtk_drag_finish()` can be done either
944    /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
945    /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
946    /// or more of the supported targets.
947    ///
948    ///
949    ///
950    ///
951    /// #### `drag-end`
952    ///  The ::drag-end signal is emitted on the drag source when a drag is
953    /// finished. A typical reason to connect to this signal is to undo
954    /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
955    ///
956    ///
957    ///
958    ///
959    /// #### `drag-failed`
960    ///  The ::drag-failed signal is emitted on the drag source when a drag has
961    /// failed. The signal handler may hook custom code to handle a failed DnD
962    /// operation based on the type of error, it returns [`true`] is the failure has
963    /// been already handled (not showing the default "drag operation failed"
964    /// animation), otherwise it returns [`false`].
965    ///
966    ///
967    ///
968    ///
969    /// #### `drag-leave`
970    ///  The ::drag-leave signal is emitted on the drop site when the cursor
971    /// leaves the widget. A typical reason to connect to this signal is to
972    /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
973    /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
974    ///
975    ///
976    /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
977    /// ::drag-drop signal, for instance to allow cleaning up of a preview item
978    /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
979    ///
980    ///
981    ///
982    ///
983    /// #### `drag-motion`
984    ///  The ::drag-motion signal is emitted on the drop site when the user
985    /// moves the cursor over the widget during a drag. The signal handler
986    /// must determine whether the cursor position is in a drop zone or not.
987    /// If it is not in a drop zone, it returns [`false`] and no further processing
988    /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
989    /// handler is responsible for providing the necessary information for
990    /// displaying feedback to the user, by calling `gdk_drag_status()`.
991    ///
992    /// If the decision whether the drop will be accepted or rejected can't be
993    /// made based solely on the cursor position and the type of the data, the
994    /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
995    /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
996    /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
997    /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
998    /// when using the drag-motion signal that way.
999    ///
1000    /// Also note that there is no drag-enter signal. The drag receiver has to
1001    /// keep track of whether he has received any drag-motion signals since the
1002    /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
1003    /// an "enter" signal. Upon an "enter", the handler will typically highlight
1004    /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
1005    ///
1006    ///
1007    /// **⚠️ The following code is in C ⚠️**
1008    ///
1009    /// ```C
1010    /// static void
1011    /// drag_motion (GtkWidget      *widget,
1012    ///              GdkDragContext *context,
1013    ///              gint            x,
1014    ///              gint            y,
1015    ///              guint           time)
1016    /// {
1017    ///   GdkAtom target;
1018    ///
1019    ///   PrivateData *private_data = GET_PRIVATE_DATA (widget);
1020    ///
1021    ///   if (!private_data->drag_highlight)
1022    ///    {
1023    ///      private_data->drag_highlight = 1;
1024    ///      gtk_drag_highlight (widget);
1025    ///    }
1026    ///
1027    ///   target = gtk_drag_dest_find_target (widget, context, NULL);
1028    ///   if (target == GDK_NONE)
1029    ///     gdk_drag_status (context, 0, time);
1030    ///   else
1031    ///    {
1032    ///      private_data->pending_status
1033    ///         = gdk_drag_context_get_suggested_action (context);
1034    ///      gtk_drag_get_data (widget, context, target, time);
1035    ///    }
1036    ///
1037    ///   return TRUE;
1038    /// }
1039    ///
1040    /// static void
1041    /// drag_data_received (GtkWidget        *widget,
1042    ///                     GdkDragContext   *context,
1043    ///                     gint              x,
1044    ///                     gint              y,
1045    ///                     GtkSelectionData *selection_data,
1046    ///                     guint             info,
1047    ///                     guint             time)
1048    /// {
1049    ///   PrivateData *private_data = GET_PRIVATE_DATA (widget);
1050    ///
1051    ///   if (private_data->suggested_action)
1052    ///    {
1053    ///      private_data->suggested_action = 0;
1054    ///
1055    ///      // We are getting this data due to a request in drag_motion,
1056    ///      // rather than due to a request in drag_drop, so we are just
1057    ///      // supposed to call gdk_drag_status(), not actually paste in
1058    ///      // the data.
1059    ///
1060    ///      str = gtk_selection_data_get_text (selection_data);
1061    ///      if (!data_is_acceptable (str))
1062    ///        gdk_drag_status (context, 0, time);
1063    ///      else
1064    ///        gdk_drag_status (context,
1065    ///                         private_data->suggested_action,
1066    ///                         time);
1067    ///    }
1068    ///   else
1069    ///    {
1070    ///      // accept the drop
1071    ///    }
1072    /// }
1073    /// ```
1074    ///
1075    ///
1076    ///
1077    ///
1078    /// #### `draw`
1079    ///  This signal is emitted when a widget is supposed to render itself.
1080    /// The `widget`'s top left corner must be painted at the origin of
1081    /// the passed in context and be sized to the values returned by
1082    /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
1083    /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
1084    ///
1085    /// Signal handlers connected to this signal can modify the cairo
1086    /// context passed as `cr` in any way they like and don't need to
1087    /// restore it. The signal emission takes care of calling `cairo_save()`
1088    /// before and `cairo_restore()` after invoking the handler.
1089    ///
1090    /// The signal handler will get a `cr` with a clip region already set to the
1091    /// widget's dirty region, i.e. to the area that needs repainting. Complicated
1092    /// widgets that want to avoid redrawing themselves completely can get the full
1093    /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
1094    /// get a finer-grained representation of the dirty region with
1095    /// `cairo_copy_clip_rectangle_list()`.
1096    ///
1097    ///
1098    ///
1099    ///
1100    /// #### `enter-notify-event`
1101    ///  The ::enter-notify-event will be emitted when the pointer enters
1102    /// the `widget`'s window.
1103    ///
1104    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1105    /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
1106    ///
1107    /// This signal will be sent to the grab widget if there is one.
1108    ///
1109    ///
1110    ///
1111    ///
1112    /// #### `event`
1113    ///  The GTK+ main loop will emit three signals for each GDK event delivered
1114    /// to a widget: one generic ::event signal, another, more specific,
1115    /// signal that matches the type of event delivered (e.g.
1116    /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
1117    /// [`event-after`][struct@crate::Widget#event-after] signal.
1118    ///
1119    ///
1120    ///
1121    ///
1122    /// #### `event-after`
1123    ///  After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
1124    /// the second more specific signal, ::event-after will be emitted
1125    /// regardless of the previous two signals handlers return values.
1126    ///
1127    ///
1128    ///
1129    ///
1130    /// #### `focus`
1131    ///
1132    ///
1133    ///
1134    /// #### `focus-in-event`
1135    ///  The ::focus-in-event signal will be emitted when the keyboard focus
1136    /// enters the `widget`'s window.
1137    ///
1138    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1139    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1140    ///
1141    ///
1142    ///
1143    ///
1144    /// #### `focus-out-event`
1145    ///  The ::focus-out-event signal will be emitted when the keyboard focus
1146    /// leaves the `widget`'s window.
1147    ///
1148    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1149    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1150    ///
1151    ///
1152    ///
1153    ///
1154    /// #### `grab-broken-event`
1155    ///  Emitted when a pointer or keyboard grab on a window belonging
1156    /// to `widget` gets broken.
1157    ///
1158    /// On X11, this happens when the grab window becomes unviewable
1159    /// (i.e. it or one of its ancestors is unmapped), or if the same
1160    /// application grabs the pointer or keyboard again.
1161    ///
1162    ///
1163    ///
1164    ///
1165    /// #### `grab-focus`
1166    ///  Action
1167    ///
1168    ///
1169    /// #### `grab-notify`
1170    ///  The ::grab-notify signal is emitted when a widget becomes
1171    /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
1172    /// another widget, or when it becomes unshadowed due to a grab
1173    /// being removed.
1174    ///
1175    /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
1176    /// grab widget in the grab stack of its window group is not
1177    /// its ancestor.
1178    ///
1179    ///
1180    ///
1181    ///
1182    /// #### `hide`
1183    ///  The ::hide signal is emitted when `widget` is hidden, for example with
1184    /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
1185    ///
1186    ///
1187    ///
1188    ///
1189    /// #### `hierarchy-changed`
1190    ///  The ::hierarchy-changed signal is emitted when the
1191    /// anchored state of a widget changes. A widget is
1192    /// “anchored” when its toplevel
1193    /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
1194    /// a widget changes from un-anchored to anchored or vice-versa.
1195    ///
1196    ///
1197    ///
1198    ///
1199    /// #### `key-press-event`
1200    ///  The ::key-press-event signal is emitted when a key is pressed. The signal
1201    /// emission will reoccur at the key-repeat rate when the key is kept pressed.
1202    ///
1203    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1204    /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
1205    ///
1206    /// This signal will be sent to the grab widget if there is one.
1207    ///
1208    ///
1209    ///
1210    ///
1211    /// #### `key-release-event`
1212    ///  The ::key-release-event signal is emitted when a key is released.
1213    ///
1214    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1215    /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
1216    ///
1217    /// This signal will be sent to the grab widget if there is one.
1218    ///
1219    ///
1220    ///
1221    ///
1222    /// #### `keynav-failed`
1223    ///  Gets emitted if keyboard navigation fails.
1224    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
1225    ///
1226    ///
1227    ///
1228    ///
1229    /// #### `leave-notify-event`
1230    ///  The ::leave-notify-event will be emitted when the pointer leaves
1231    /// the `widget`'s window.
1232    ///
1233    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1234    /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
1235    ///
1236    /// This signal will be sent to the grab widget if there is one.
1237    ///
1238    ///
1239    ///
1240    ///
1241    /// #### `map`
1242    ///  The ::map signal is emitted when `widget` is going to be mapped, that is
1243    /// when the widget is visible (which is controlled with
1244    /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
1245    /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
1246    /// be emitted.
1247    ///
1248    /// The ::map signal can be used to determine whether a widget will be drawn,
1249    /// for instance it can resume an animation that was stopped during the
1250    /// emission of [`unmap`][struct@crate::Widget#unmap].
1251    ///
1252    ///
1253    ///
1254    ///
1255    /// #### `map-event`
1256    ///  The ::map-event signal will be emitted when the `widget`'s window is
1257    /// mapped. A window is mapped when it becomes visible on the screen.
1258    ///
1259    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1260    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1261    /// automatically for all new windows.
1262    ///
1263    ///
1264    ///
1265    ///
1266    /// #### `mnemonic-activate`
1267    ///  The default handler for this signal activates `widget` if `group_cycling`
1268    /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1269    ///
1270    ///
1271    ///
1272    ///
1273    /// #### `motion-notify-event`
1274    ///  The ::motion-notify-event signal is emitted when the pointer moves
1275    /// over the widget's [`gdk::Window`][crate::gdk::Window].
1276    ///
1277    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1278    /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1279    ///
1280    /// This signal will be sent to the grab widget if there is one.
1281    ///
1282    ///
1283    ///
1284    ///
1285    /// #### `move-focus`
1286    ///  Action
1287    ///
1288    ///
1289    /// #### `parent-set`
1290    ///  The ::parent-set signal is emitted when a new parent
1291    /// has been set on a widget.
1292    ///
1293    ///
1294    ///
1295    ///
1296    /// #### `popup-menu`
1297    ///  This signal gets emitted whenever a widget should pop up a context
1298    /// menu. This usually happens through the standard key binding mechanism;
1299    /// by pressing a certain key while a widget is focused, the user can cause
1300    /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1301    /// a menu with clipboard commands. See the
1302    /// [Popup Menu Migration Checklist][checklist-popup-menu]
1303    /// for an example of how to use this signal.
1304    ///
1305    /// Action
1306    ///
1307    ///
1308    /// #### `property-notify-event`
1309    ///  The ::property-notify-event signal will be emitted when a property on
1310    /// the `widget`'s window has been changed or deleted.
1311    ///
1312    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1313    /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1314    ///
1315    ///
1316    ///
1317    ///
1318    /// #### `proximity-in-event`
1319    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1320    /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1321    ///
1322    /// This signal will be sent to the grab widget if there is one.
1323    ///
1324    ///
1325    ///
1326    ///
1327    /// #### `proximity-out-event`
1328    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1329    /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1330    ///
1331    /// This signal will be sent to the grab widget if there is one.
1332    ///
1333    ///
1334    ///
1335    ///
1336    /// #### `query-tooltip`
1337    ///  Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1338    /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1339    /// focus in keyboard mode.
1340    ///
1341    /// Using the given coordinates, the signal handler should determine
1342    /// whether a tooltip should be shown for `widget`. If this is the case
1343    /// [`true`] should be returned, [`false`] otherwise. Note that if
1344    /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1345    /// should not be used.
1346    ///
1347    /// The signal handler is free to manipulate `tooltip` with the therefore
1348    /// destined function calls.
1349    ///
1350    ///
1351    ///
1352    ///
1353    /// #### `realize`
1354    ///  The ::realize signal is emitted when `widget` is associated with a
1355    /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1356    /// widget has been mapped (that is, it is going to be drawn).
1357    ///
1358    ///
1359    ///
1360    ///
1361    /// #### `screen-changed`
1362    ///  The ::screen-changed signal gets emitted when the
1363    /// screen of a widget has changed.
1364    ///
1365    ///
1366    ///
1367    ///
1368    /// #### `scroll-event`
1369    ///  The ::scroll-event signal is emitted when a button in the 4 to 7
1370    /// range is pressed. Wheel mice are usually configured to generate
1371    /// button press events for buttons 4 and 5 when the wheel is turned.
1372    ///
1373    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1374    /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1375    ///
1376    /// This signal will be sent to the grab widget if there is one.
1377    ///
1378    ///
1379    ///
1380    ///
1381    /// #### `selection-clear-event`
1382    ///  The ::selection-clear-event signal will be emitted when the
1383    /// the `widget`'s window has lost ownership of a selection.
1384    ///
1385    ///
1386    ///
1387    ///
1388    /// #### `selection-get`
1389    ///
1390    ///
1391    ///
1392    /// #### `selection-notify-event`
1393    ///
1394    ///
1395    ///
1396    /// #### `selection-received`
1397    ///
1398    ///
1399    ///
1400    /// #### `selection-request-event`
1401    ///  The ::selection-request-event signal will be emitted when
1402    /// another client requests ownership of the selection owned by
1403    /// the `widget`'s window.
1404    ///
1405    ///
1406    ///
1407    ///
1408    /// #### `show`
1409    ///  The ::show signal is emitted when `widget` is shown, for example with
1410    /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1411    ///
1412    ///
1413    ///
1414    ///
1415    /// #### `show-help`
1416    ///  Action
1417    ///
1418    ///
1419    /// #### `size-allocate`
1420    ///
1421    ///
1422    ///
1423    /// #### `state-changed`
1424    ///  The ::state-changed signal is emitted when the widget state changes.
1425    /// See `gtk_widget_get_state()`.
1426    ///
1427    ///
1428    ///
1429    ///
1430    /// #### `state-flags-changed`
1431    ///  The ::state-flags-changed signal is emitted when the widget state
1432    /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1433    ///
1434    ///
1435    ///
1436    ///
1437    /// #### `style-set`
1438    ///  The ::style-set signal is emitted when a new style has been set
1439    /// on a widget. Note that style-modifying functions like
1440    /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1441    ///
1442    /// Note that this signal is emitted for changes to the deprecated
1443    /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1444    /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1445    ///
1446    ///
1447    ///
1448    ///
1449    /// #### `style-updated`
1450    ///  The ::style-updated signal is a convenience signal that is emitted when the
1451    /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1452    /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1453    ///
1454    /// Note that style-modifying functions like `gtk_widget_override_color()` also
1455    /// cause this signal to be emitted.
1456    ///
1457    ///
1458    ///
1459    ///
1460    /// #### `touch-event`
1461    ///
1462    ///
1463    ///
1464    /// #### `unmap`
1465    ///  The ::unmap signal is emitted when `widget` is going to be unmapped, which
1466    /// means that either it or any of its parents up to the toplevel widget have
1467    /// been set as hidden.
1468    ///
1469    /// As ::unmap indicates that a widget will not be shown any longer, it can be
1470    /// used to, for example, stop an animation on the widget.
1471    ///
1472    ///
1473    ///
1474    ///
1475    /// #### `unmap-event`
1476    ///  The ::unmap-event signal will be emitted when the `widget`'s window is
1477    /// unmapped. A window is unmapped when it becomes invisible on the screen.
1478    ///
1479    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1480    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1481    /// automatically for all new windows.
1482    ///
1483    ///
1484    ///
1485    ///
1486    /// #### `unrealize`
1487    ///  The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1488    /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1489    /// called or the widget has been unmapped (that is, it is going to be
1490    /// hidden).
1491    ///
1492    ///
1493    ///
1494    ///
1495    /// #### `visibility-notify-event`
1496    ///  The ::visibility-notify-event will be emitted when the `widget`'s
1497    /// window is obscured or unobscured.
1498    ///
1499    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1500    /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1501    ///
1502    ///
1503    ///
1504    ///
1505    /// #### `window-state-event`
1506    ///  The ::window-state-event will be emitted when the state of the
1507    /// toplevel window associated to the `widget` changes.
1508    ///
1509    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1510    /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1511    /// this mask automatically for all new windows.
1512    ///
1513    ///
1514    /// </details>
1515    ///
1516    /// # Implements
1517    ///
1518    /// [`TextViewExt`][trait@crate::prelude::TextViewExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ScrollableExt`][trait@crate::prelude::ScrollableExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1519    #[doc(alias = "GtkTextView")]
1520    pub struct TextView(Object<ffi::GtkTextView, ffi::GtkTextViewClass>) @extends Container, Widget, @implements Buildable, Scrollable;
1521
1522    match fn {
1523        type_ => || ffi::gtk_text_view_get_type(),
1524    }
1525}
1526
1527impl TextView {
1528    pub const NONE: Option<&'static TextView> = None;
1529
1530    /// Creates a new [`TextView`][crate::TextView]. If you don’t call [`TextViewExt::set_buffer()`][crate::prelude::TextViewExt::set_buffer()]
1531    /// before using the text view, an empty default buffer will be created
1532    /// for you. Get the buffer with [`TextViewExt::buffer()`][crate::prelude::TextViewExt::buffer()]. If you want
1533    /// to specify your own buffer, consider [`with_buffer()`][Self::with_buffer()].
1534    ///
1535    /// # Returns
1536    ///
1537    /// a new [`TextView`][crate::TextView]
1538    #[doc(alias = "gtk_text_view_new")]
1539    pub fn new() -> TextView {
1540        assert_initialized_main_thread!();
1541        unsafe { Widget::from_glib_none(ffi::gtk_text_view_new()).unsafe_cast() }
1542    }
1543
1544    /// Creates a new [`TextView`][crate::TextView] widget displaying the buffer
1545    /// `buffer`. One buffer can be shared among many widgets.
1546    /// `buffer` may be [`None`] to create a default buffer, in which case
1547    /// this function is equivalent to [`new()`][Self::new()]. The
1548    /// text view adds its own reference count to the buffer; it does not
1549    /// take over an existing reference.
1550    /// ## `buffer`
1551    /// a [`TextBuffer`][crate::TextBuffer]
1552    ///
1553    /// # Returns
1554    ///
1555    /// a new [`TextView`][crate::TextView].
1556    #[doc(alias = "gtk_text_view_new_with_buffer")]
1557    #[doc(alias = "new_with_buffer")]
1558    pub fn with_buffer(buffer: &impl IsA<TextBuffer>) -> TextView {
1559        skip_assert_initialized!();
1560        unsafe {
1561            Widget::from_glib_none(ffi::gtk_text_view_new_with_buffer(
1562                buffer.as_ref().to_glib_none().0,
1563            ))
1564            .unsafe_cast()
1565        }
1566    }
1567
1568    // rustdoc-stripper-ignore-next
1569    /// Creates a new builder-pattern struct instance to construct [`TextView`] objects.
1570    ///
1571    /// This method returns an instance of [`TextViewBuilder`](crate::builders::TextViewBuilder) which can be used to create [`TextView`] objects.
1572    pub fn builder() -> TextViewBuilder {
1573        TextViewBuilder::new()
1574    }
1575}
1576
1577impl Default for TextView {
1578    fn default() -> Self {
1579        Self::new()
1580    }
1581}
1582
1583// rustdoc-stripper-ignore-next
1584/// A [builder-pattern] type to construct [`TextView`] objects.
1585///
1586/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1587#[must_use = "The builder must be built to be used"]
1588pub struct TextViewBuilder {
1589    builder: glib::object::ObjectBuilder<'static, TextView>,
1590}
1591
1592impl TextViewBuilder {
1593    fn new() -> Self {
1594        Self {
1595            builder: glib::object::Object::builder(),
1596        }
1597    }
1598
1599    pub fn accepts_tab(self, accepts_tab: bool) -> Self {
1600        Self {
1601            builder: self.builder.property("accepts-tab", accepts_tab),
1602        }
1603    }
1604
1605    /// The bottom margin for text in the text view.
1606    ///
1607    /// Note that this property is confusingly named. In CSS terms,
1608    /// the value set here is padding, and it is applied in addition
1609    /// to the padding from the theme.
1610    ///
1611    /// Don't confuse this property with [`margin-bottom`][struct@crate::Widget#margin-bottom].
1612    pub fn bottom_margin(self, bottom_margin: i32) -> Self {
1613        Self {
1614            builder: self.builder.property("bottom-margin", bottom_margin),
1615        }
1616    }
1617
1618    pub fn buffer(self, buffer: &impl IsA<TextBuffer>) -> Self {
1619        Self {
1620            builder: self.builder.property("buffer", buffer.clone().upcast()),
1621        }
1622    }
1623
1624    pub fn cursor_visible(self, cursor_visible: bool) -> Self {
1625        Self {
1626            builder: self.builder.property("cursor-visible", cursor_visible),
1627        }
1628    }
1629
1630    pub fn editable(self, editable: bool) -> Self {
1631        Self {
1632            builder: self.builder.property("editable", editable),
1633        }
1634    }
1635
1636    /// Which IM (input method) module should be used for this text_view.
1637    /// See [`IMContext`][crate::IMContext].
1638    ///
1639    /// Setting this to a non-[`None`] value overrides the
1640    /// system-wide IM module setting. See the GtkSettings
1641    /// [`gtk-im-module`][struct@crate::Settings#gtk-im-module] property.
1642    pub fn im_module(self, im_module: impl Into<glib::GString>) -> Self {
1643        Self {
1644            builder: self.builder.property("im-module", im_module.into()),
1645        }
1646    }
1647
1648    pub fn indent(self, indent: i32) -> Self {
1649        Self {
1650            builder: self.builder.property("indent", indent),
1651        }
1652    }
1653
1654    /// Additional hints (beyond [`input-purpose`][struct@crate::TextView#input-purpose]) that
1655    /// allow input methods to fine-tune their behaviour.
1656    pub fn input_hints(self, input_hints: InputHints) -> Self {
1657        Self {
1658            builder: self.builder.property("input-hints", input_hints),
1659        }
1660    }
1661
1662    /// The purpose of this text field.
1663    ///
1664    /// This property can be used by on-screen keyboards and other input
1665    /// methods to adjust their behaviour.
1666    pub fn input_purpose(self, input_purpose: InputPurpose) -> Self {
1667        Self {
1668            builder: self.builder.property("input-purpose", input_purpose),
1669        }
1670    }
1671
1672    pub fn justification(self, justification: Justification) -> Self {
1673        Self {
1674            builder: self.builder.property("justification", justification),
1675        }
1676    }
1677
1678    /// The default left margin for text in the text view.
1679    /// Tags in the buffer may override the default.
1680    ///
1681    /// Note that this property is confusingly named. In CSS terms,
1682    /// the value set here is padding, and it is applied in addition
1683    /// to the padding from the theme.
1684    ///
1685    /// Don't confuse this property with [`margin-left`][struct@crate::Widget#margin-left].
1686    pub fn left_margin(self, left_margin: i32) -> Self {
1687        Self {
1688            builder: self.builder.property("left-margin", left_margin),
1689        }
1690    }
1691
1692    pub fn monospace(self, monospace: bool) -> Self {
1693        Self {
1694            builder: self.builder.property("monospace", monospace),
1695        }
1696    }
1697
1698    pub fn overwrite(self, overwrite: bool) -> Self {
1699        Self {
1700            builder: self.builder.property("overwrite", overwrite),
1701        }
1702    }
1703
1704    pub fn pixels_above_lines(self, pixels_above_lines: i32) -> Self {
1705        Self {
1706            builder: self
1707                .builder
1708                .property("pixels-above-lines", pixels_above_lines),
1709        }
1710    }
1711
1712    pub fn pixels_below_lines(self, pixels_below_lines: i32) -> Self {
1713        Self {
1714            builder: self
1715                .builder
1716                .property("pixels-below-lines", pixels_below_lines),
1717        }
1718    }
1719
1720    pub fn pixels_inside_wrap(self, pixels_inside_wrap: i32) -> Self {
1721        Self {
1722            builder: self
1723                .builder
1724                .property("pixels-inside-wrap", pixels_inside_wrap),
1725        }
1726    }
1727
1728    /// If :populate-all is [`true`], the [`populate-popup`][struct@crate::TextView#populate-popup]
1729    /// signal is also emitted for touch popups.
1730    pub fn populate_all(self, populate_all: bool) -> Self {
1731        Self {
1732            builder: self.builder.property("populate-all", populate_all),
1733        }
1734    }
1735
1736    /// The default right margin for text in the text view.
1737    /// Tags in the buffer may override the default.
1738    ///
1739    /// Note that this property is confusingly named. In CSS terms,
1740    /// the value set here is padding, and it is applied in addition
1741    /// to the padding from the theme.
1742    ///
1743    /// Don't confuse this property with [`margin-right`][struct@crate::Widget#margin-right].
1744    pub fn right_margin(self, right_margin: i32) -> Self {
1745        Self {
1746            builder: self.builder.property("right-margin", right_margin),
1747        }
1748    }
1749
1750    pub fn tabs(self, tabs: &pango::TabArray) -> Self {
1751        Self {
1752            builder: self.builder.property("tabs", tabs),
1753        }
1754    }
1755
1756    /// The top margin for text in the text view.
1757    ///
1758    /// Note that this property is confusingly named. In CSS terms,
1759    /// the value set here is padding, and it is applied in addition
1760    /// to the padding from the theme.
1761    ///
1762    /// Don't confuse this property with [`margin-top`][struct@crate::Widget#margin-top].
1763    pub fn top_margin(self, top_margin: i32) -> Self {
1764        Self {
1765            builder: self.builder.property("top-margin", top_margin),
1766        }
1767    }
1768
1769    pub fn wrap_mode(self, wrap_mode: WrapMode) -> Self {
1770        Self {
1771            builder: self.builder.property("wrap-mode", wrap_mode),
1772        }
1773    }
1774
1775    pub fn border_width(self, border_width: u32) -> Self {
1776        Self {
1777            builder: self.builder.property("border-width", border_width),
1778        }
1779    }
1780
1781    pub fn child(self, child: &impl IsA<Widget>) -> Self {
1782        Self {
1783            builder: self.builder.property("child", child.clone().upcast()),
1784        }
1785    }
1786
1787    pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1788        Self {
1789            builder: self.builder.property("resize-mode", resize_mode),
1790        }
1791    }
1792
1793    pub fn app_paintable(self, app_paintable: bool) -> Self {
1794        Self {
1795            builder: self.builder.property("app-paintable", app_paintable),
1796        }
1797    }
1798
1799    pub fn can_default(self, can_default: bool) -> Self {
1800        Self {
1801            builder: self.builder.property("can-default", can_default),
1802        }
1803    }
1804
1805    pub fn can_focus(self, can_focus: bool) -> Self {
1806        Self {
1807            builder: self.builder.property("can-focus", can_focus),
1808        }
1809    }
1810
1811    pub fn events(self, events: gdk::EventMask) -> Self {
1812        Self {
1813            builder: self.builder.property("events", events),
1814        }
1815    }
1816
1817    /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1818    pub fn expand(self, expand: bool) -> Self {
1819        Self {
1820            builder: self.builder.property("expand", expand),
1821        }
1822    }
1823
1824    /// Whether the widget should grab focus when it is clicked with the mouse.
1825    ///
1826    /// This property is only relevant for widgets that can take focus.
1827    ///
1828    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1829    /// GtkComboBox) implemented this property individually.
1830    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1831        Self {
1832            builder: self.builder.property("focus-on-click", focus_on_click),
1833        }
1834    }
1835
1836    /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1837    pub fn halign(self, halign: Align) -> Self {
1838        Self {
1839            builder: self.builder.property("halign", halign),
1840        }
1841    }
1842
1843    pub fn has_default(self, has_default: bool) -> Self {
1844        Self {
1845            builder: self.builder.property("has-default", has_default),
1846        }
1847    }
1848
1849    pub fn has_focus(self, has_focus: bool) -> Self {
1850        Self {
1851            builder: self.builder.property("has-focus", has_focus),
1852        }
1853    }
1854
1855    /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1856    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1857    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1858    /// whether it will provide a tooltip or not.
1859    ///
1860    /// Note that setting this property to [`true`] for the first time will change
1861    /// the event masks of the GdkWindows of this widget to include leave-notify
1862    /// and motion-notify events. This cannot and will not be undone when the
1863    /// property is set to [`false`] again.
1864    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1865        Self {
1866            builder: self.builder.property("has-tooltip", has_tooltip),
1867        }
1868    }
1869
1870    pub fn height_request(self, height_request: i32) -> Self {
1871        Self {
1872            builder: self.builder.property("height-request", height_request),
1873        }
1874    }
1875
1876    /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1877    pub fn hexpand(self, hexpand: bool) -> Self {
1878        Self {
1879            builder: self.builder.property("hexpand", hexpand),
1880        }
1881    }
1882
1883    /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1884    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1885        Self {
1886            builder: self.builder.property("hexpand-set", hexpand_set),
1887        }
1888    }
1889
1890    pub fn is_focus(self, is_focus: bool) -> Self {
1891        Self {
1892            builder: self.builder.property("is-focus", is_focus),
1893        }
1894    }
1895
1896    /// Sets all four sides' margin at once. If read, returns max
1897    /// margin on any side.
1898    pub fn margin(self, margin: i32) -> Self {
1899        Self {
1900            builder: self.builder.property("margin", margin),
1901        }
1902    }
1903
1904    /// Margin on bottom side of widget.
1905    ///
1906    /// This property adds margin outside of the widget's normal size
1907    /// request, the margin will be added in addition to the size from
1908    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1909    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1910        Self {
1911            builder: self.builder.property("margin-bottom", margin_bottom),
1912        }
1913    }
1914
1915    /// Margin on end of widget, horizontally. This property supports
1916    /// left-to-right and right-to-left text directions.
1917    ///
1918    /// This property adds margin outside of the widget's normal size
1919    /// request, the margin will be added in addition to the size from
1920    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1921    pub fn margin_end(self, margin_end: i32) -> Self {
1922        Self {
1923            builder: self.builder.property("margin-end", margin_end),
1924        }
1925    }
1926
1927    /// Margin on start of widget, horizontally. This property supports
1928    /// left-to-right and right-to-left text directions.
1929    ///
1930    /// This property adds margin outside of the widget's normal size
1931    /// request, the margin will be added in addition to the size from
1932    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1933    pub fn margin_start(self, margin_start: i32) -> Self {
1934        Self {
1935            builder: self.builder.property("margin-start", margin_start),
1936        }
1937    }
1938
1939    /// Margin on top side of widget.
1940    ///
1941    /// This property adds margin outside of the widget's normal size
1942    /// request, the margin will be added in addition to the size from
1943    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1944    pub fn margin_top(self, margin_top: i32) -> Self {
1945        Self {
1946            builder: self.builder.property("margin-top", margin_top),
1947        }
1948    }
1949
1950    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1951        Self {
1952            builder: self.builder.property("name", name.into()),
1953        }
1954    }
1955
1956    pub fn no_show_all(self, no_show_all: bool) -> Self {
1957        Self {
1958            builder: self.builder.property("no-show-all", no_show_all),
1959        }
1960    }
1961
1962    /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1963    /// more details about window opacity.
1964    ///
1965    /// Before 3.8 this was only available in GtkWindow
1966    pub fn opacity(self, opacity: f64) -> Self {
1967        Self {
1968            builder: self.builder.property("opacity", opacity),
1969        }
1970    }
1971
1972    pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1973        Self {
1974            builder: self.builder.property("parent", parent.clone().upcast()),
1975        }
1976    }
1977
1978    pub fn receives_default(self, receives_default: bool) -> Self {
1979        Self {
1980            builder: self.builder.property("receives-default", receives_default),
1981        }
1982    }
1983
1984    pub fn sensitive(self, sensitive: bool) -> Self {
1985        Self {
1986            builder: self.builder.property("sensitive", sensitive),
1987        }
1988    }
1989
1990    /// Sets the text of tooltip to be the given string, which is marked up
1991    /// with the [Pango text markup language][PangoMarkupFormat].
1992    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1993    ///
1994    /// This is a convenience property which will take care of getting the
1995    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1996    /// will automatically be set to [`true`] and there will be taken care of
1997    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1998    ///
1999    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
2000    /// are set, the last one wins.
2001    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
2002        Self {
2003            builder: self
2004                .builder
2005                .property("tooltip-markup", tooltip_markup.into()),
2006        }
2007    }
2008
2009    /// Sets the text of tooltip to be the given string.
2010    ///
2011    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
2012    ///
2013    /// This is a convenience property which will take care of getting the
2014    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
2015    /// will automatically be set to [`true`] and there will be taken care of
2016    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
2017    ///
2018    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
2019    /// are set, the last one wins.
2020    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
2021        Self {
2022            builder: self.builder.property("tooltip-text", tooltip_text.into()),
2023        }
2024    }
2025
2026    /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
2027    pub fn valign(self, valign: Align) -> Self {
2028        Self {
2029            builder: self.builder.property("valign", valign),
2030        }
2031    }
2032
2033    /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
2034    pub fn vexpand(self, vexpand: bool) -> Self {
2035        Self {
2036            builder: self.builder.property("vexpand", vexpand),
2037        }
2038    }
2039
2040    /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
2041    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
2042        Self {
2043            builder: self.builder.property("vexpand-set", vexpand_set),
2044        }
2045    }
2046
2047    pub fn visible(self, visible: bool) -> Self {
2048        Self {
2049            builder: self.builder.property("visible", visible),
2050        }
2051    }
2052
2053    pub fn width_request(self, width_request: i32) -> Self {
2054        Self {
2055            builder: self.builder.property("width-request", width_request),
2056        }
2057    }
2058
2059    /// Horizontal [`Adjustment`][crate::Adjustment] of the scrollable widget. This adjustment is
2060    /// shared between the scrollable widget and its parent.
2061    pub fn hadjustment(self, hadjustment: &impl IsA<Adjustment>) -> Self {
2062        Self {
2063            builder: self
2064                .builder
2065                .property("hadjustment", hadjustment.clone().upcast()),
2066        }
2067    }
2068
2069    /// Determines whether horizontal scrolling should start once the scrollable
2070    /// widget is allocated less than its minimum width or less than its natural width.
2071    pub fn hscroll_policy(self, hscroll_policy: ScrollablePolicy) -> Self {
2072        Self {
2073            builder: self.builder.property("hscroll-policy", hscroll_policy),
2074        }
2075    }
2076
2077    /// Verical [`Adjustment`][crate::Adjustment] of the scrollable widget. This adjustment is shared
2078    /// between the scrollable widget and its parent.
2079    pub fn vadjustment(self, vadjustment: &impl IsA<Adjustment>) -> Self {
2080        Self {
2081            builder: self
2082                .builder
2083                .property("vadjustment", vadjustment.clone().upcast()),
2084        }
2085    }
2086
2087    /// Determines whether vertical scrolling should start once the scrollable
2088    /// widget is allocated less than its minimum height or less than its natural height.
2089    pub fn vscroll_policy(self, vscroll_policy: ScrollablePolicy) -> Self {
2090        Self {
2091            builder: self.builder.property("vscroll-policy", vscroll_policy),
2092        }
2093    }
2094
2095    // rustdoc-stripper-ignore-next
2096    /// Build the [`TextView`].
2097    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
2098    pub fn build(self) -> TextView {
2099        self.builder.build()
2100    }
2101}
2102
2103mod sealed {
2104    pub trait Sealed {}
2105    impl<T: super::IsA<super::TextView>> Sealed for T {}
2106}
2107
2108/// Trait containing all [`struct@TextView`] methods.
2109///
2110/// # Implementors
2111///
2112/// [`TextView`][struct@crate::TextView]
2113pub trait TextViewExt: IsA<TextView> + sealed::Sealed + 'static {
2114    /// Adds a child widget in the text buffer, at the given `anchor`.
2115    /// ## `child`
2116    /// a [`Widget`][crate::Widget]
2117    /// ## `anchor`
2118    /// a [`TextChildAnchor`][crate::TextChildAnchor] in the [`TextBuffer`][crate::TextBuffer] for `self`
2119    #[doc(alias = "gtk_text_view_add_child_at_anchor")]
2120    fn add_child_at_anchor(&self, child: &impl IsA<Widget>, anchor: &impl IsA<TextChildAnchor>) {
2121        unsafe {
2122            ffi::gtk_text_view_add_child_at_anchor(
2123                self.as_ref().to_glib_none().0,
2124                child.as_ref().to_glib_none().0,
2125                anchor.as_ref().to_glib_none().0,
2126            );
2127        }
2128    }
2129
2130    /// Adds a child at fixed coordinates in one of the text widget's
2131    /// windows.
2132    ///
2133    /// The window must have nonzero size (see
2134    /// [`set_border_window_size()`][Self::set_border_window_size()]). Note that the child
2135    /// coordinates are given relative to scrolling. When
2136    /// placing a child in [`TextWindowType::Widget`][crate::TextWindowType::Widget], scrolling is
2137    /// irrelevant, the child floats above all scrollable areas. But when
2138    /// placing a child in one of the scrollable windows (border windows or
2139    /// text window) it will move with the scrolling as needed.
2140    /// ## `child`
2141    /// a [`Widget`][crate::Widget]
2142    /// ## `which_window`
2143    /// which window the child should appear in
2144    /// ## `xpos`
2145    /// X position of child in window coordinates
2146    /// ## `ypos`
2147    /// Y position of child in window coordinates
2148    #[doc(alias = "gtk_text_view_add_child_in_window")]
2149    fn add_child_in_window(
2150        &self,
2151        child: &impl IsA<Widget>,
2152        which_window: TextWindowType,
2153        xpos: i32,
2154        ypos: i32,
2155    ) {
2156        unsafe {
2157            ffi::gtk_text_view_add_child_in_window(
2158                self.as_ref().to_glib_none().0,
2159                child.as_ref().to_glib_none().0,
2160                which_window.into_glib(),
2161                xpos,
2162                ypos,
2163            );
2164        }
2165    }
2166
2167    /// Moves the given `iter` backward by one display (wrapped) line.
2168    /// A display line is different from a paragraph. Paragraphs are
2169    /// separated by newlines or other paragraph separator characters.
2170    /// Display lines are created by line-wrapping a paragraph. If
2171    /// wrapping is turned off, display lines and paragraphs will be the
2172    /// same. Display lines are divided differently for each view, since
2173    /// they depend on the view’s width; paragraphs are the same in all
2174    /// views, since they depend on the contents of the [`TextBuffer`][crate::TextBuffer].
2175    /// ## `iter`
2176    /// a [`TextIter`][crate::TextIter]
2177    ///
2178    /// # Returns
2179    ///
2180    /// [`true`] if `iter` was moved and is not on the end iterator
2181    #[doc(alias = "gtk_text_view_backward_display_line")]
2182    fn backward_display_line(&self, iter: &mut TextIter) -> bool {
2183        unsafe {
2184            from_glib(ffi::gtk_text_view_backward_display_line(
2185                self.as_ref().to_glib_none().0,
2186                iter.to_glib_none_mut().0,
2187            ))
2188        }
2189    }
2190
2191    /// Moves the given `iter` backward to the next display line start.
2192    /// A display line is different from a paragraph. Paragraphs are
2193    /// separated by newlines or other paragraph separator characters.
2194    /// Display lines are created by line-wrapping a paragraph. If
2195    /// wrapping is turned off, display lines and paragraphs will be the
2196    /// same. Display lines are divided differently for each view, since
2197    /// they depend on the view’s width; paragraphs are the same in all
2198    /// views, since they depend on the contents of the [`TextBuffer`][crate::TextBuffer].
2199    /// ## `iter`
2200    /// a [`TextIter`][crate::TextIter]
2201    ///
2202    /// # Returns
2203    ///
2204    /// [`true`] if `iter` was moved and is not on the end iterator
2205    #[doc(alias = "gtk_text_view_backward_display_line_start")]
2206    fn backward_display_line_start(&self, iter: &mut TextIter) -> bool {
2207        unsafe {
2208            from_glib(ffi::gtk_text_view_backward_display_line_start(
2209                self.as_ref().to_glib_none().0,
2210                iter.to_glib_none_mut().0,
2211            ))
2212        }
2213    }
2214
2215    /// Converts coordinate (`buffer_x`, `buffer_y`) to coordinates for the window
2216    /// `win`, and stores the result in (`window_x`, `window_y`).
2217    ///
2218    /// Note that you can’t convert coordinates for a nonexisting window (see
2219    /// [`set_border_window_size()`][Self::set_border_window_size()]).
2220    /// ## `win`
2221    /// a [`TextWindowType`][crate::TextWindowType], except [`TextWindowType::Private`][crate::TextWindowType::Private]
2222    /// ## `buffer_x`
2223    /// buffer x coordinate
2224    /// ## `buffer_y`
2225    /// buffer y coordinate
2226    ///
2227    /// # Returns
2228    ///
2229    ///
2230    /// ## `window_x`
2231    /// window x coordinate return location or [`None`]
2232    ///
2233    /// ## `window_y`
2234    /// window y coordinate return location or [`None`]
2235    #[doc(alias = "gtk_text_view_buffer_to_window_coords")]
2236    fn buffer_to_window_coords(
2237        &self,
2238        win: TextWindowType,
2239        buffer_x: i32,
2240        buffer_y: i32,
2241    ) -> (i32, i32) {
2242        unsafe {
2243            let mut window_x = mem::MaybeUninit::uninit();
2244            let mut window_y = mem::MaybeUninit::uninit();
2245            ffi::gtk_text_view_buffer_to_window_coords(
2246                self.as_ref().to_glib_none().0,
2247                win.into_glib(),
2248                buffer_x,
2249                buffer_y,
2250                window_x.as_mut_ptr(),
2251                window_y.as_mut_ptr(),
2252            );
2253            (window_x.assume_init(), window_y.assume_init())
2254        }
2255    }
2256
2257    /// Moves the given `iter` forward by one display (wrapped) line.
2258    /// A display line is different from a paragraph. Paragraphs are
2259    /// separated by newlines or other paragraph separator characters.
2260    /// Display lines are created by line-wrapping a paragraph. If
2261    /// wrapping is turned off, display lines and paragraphs will be the
2262    /// same. Display lines are divided differently for each view, since
2263    /// they depend on the view’s width; paragraphs are the same in all
2264    /// views, since they depend on the contents of the [`TextBuffer`][crate::TextBuffer].
2265    /// ## `iter`
2266    /// a [`TextIter`][crate::TextIter]
2267    ///
2268    /// # Returns
2269    ///
2270    /// [`true`] if `iter` was moved and is not on the end iterator
2271    #[doc(alias = "gtk_text_view_forward_display_line")]
2272    fn forward_display_line(&self, iter: &mut TextIter) -> bool {
2273        unsafe {
2274            from_glib(ffi::gtk_text_view_forward_display_line(
2275                self.as_ref().to_glib_none().0,
2276                iter.to_glib_none_mut().0,
2277            ))
2278        }
2279    }
2280
2281    /// Moves the given `iter` forward to the next display line end.
2282    /// A display line is different from a paragraph. Paragraphs are
2283    /// separated by newlines or other paragraph separator characters.
2284    /// Display lines are created by line-wrapping a paragraph. If
2285    /// wrapping is turned off, display lines and paragraphs will be the
2286    /// same. Display lines are divided differently for each view, since
2287    /// they depend on the view’s width; paragraphs are the same in all
2288    /// views, since they depend on the contents of the [`TextBuffer`][crate::TextBuffer].
2289    /// ## `iter`
2290    /// a [`TextIter`][crate::TextIter]
2291    ///
2292    /// # Returns
2293    ///
2294    /// [`true`] if `iter` was moved and is not on the end iterator
2295    #[doc(alias = "gtk_text_view_forward_display_line_end")]
2296    fn forward_display_line_end(&self, iter: &mut TextIter) -> bool {
2297        unsafe {
2298            from_glib(ffi::gtk_text_view_forward_display_line_end(
2299                self.as_ref().to_glib_none().0,
2300                iter.to_glib_none_mut().0,
2301            ))
2302        }
2303    }
2304
2305    /// Returns whether pressing the Tab key inserts a tab characters.
2306    /// [`set_accepts_tab()`][Self::set_accepts_tab()].
2307    ///
2308    /// # Returns
2309    ///
2310    /// [`true`] if pressing the Tab key inserts a tab character,
2311    ///  [`false`] if pressing the Tab key moves the keyboard focus.
2312    #[doc(alias = "gtk_text_view_get_accepts_tab")]
2313    #[doc(alias = "get_accepts_tab")]
2314    fn accepts_tab(&self) -> bool {
2315        unsafe {
2316            from_glib(ffi::gtk_text_view_get_accepts_tab(
2317                self.as_ref().to_glib_none().0,
2318            ))
2319        }
2320    }
2321
2322    /// Gets the width of the specified border window. See
2323    /// [`set_border_window_size()`][Self::set_border_window_size()].
2324    /// ## `type_`
2325    /// window to return size from
2326    ///
2327    /// # Returns
2328    ///
2329    /// width of window
2330    #[doc(alias = "gtk_text_view_get_border_window_size")]
2331    #[doc(alias = "get_border_window_size")]
2332    fn border_window_size(&self, type_: TextWindowType) -> i32 {
2333        unsafe {
2334            ffi::gtk_text_view_get_border_window_size(
2335                self.as_ref().to_glib_none().0,
2336                type_.into_glib(),
2337            )
2338        }
2339    }
2340
2341    /// Gets the bottom margin for text in the `self`.
2342    ///
2343    /// # Returns
2344    ///
2345    /// bottom margin in pixels
2346    #[doc(alias = "gtk_text_view_get_bottom_margin")]
2347    #[doc(alias = "get_bottom_margin")]
2348    fn bottom_margin(&self) -> i32 {
2349        unsafe { ffi::gtk_text_view_get_bottom_margin(self.as_ref().to_glib_none().0) }
2350    }
2351
2352    /// Returns the [`TextBuffer`][crate::TextBuffer] being displayed by this text view.
2353    /// The reference count on the buffer is not incremented; the caller
2354    /// of this function won’t own a new reference.
2355    ///
2356    /// # Returns
2357    ///
2358    /// a [`TextBuffer`][crate::TextBuffer]
2359    #[doc(alias = "gtk_text_view_get_buffer")]
2360    #[doc(alias = "get_buffer")]
2361    fn buffer(&self) -> Option<TextBuffer> {
2362        unsafe {
2363            from_glib_none(ffi::gtk_text_view_get_buffer(
2364                self.as_ref().to_glib_none().0,
2365            ))
2366        }
2367    }
2368
2369    /// Given an `iter` within a text layout, determine the positions of the
2370    /// strong and weak cursors if the insertion point is at that
2371    /// iterator. The position of each cursor is stored as a zero-width
2372    /// rectangle. The strong cursor location is the location where
2373    /// characters of the directionality equal to the base direction of the
2374    /// paragraph are inserted. The weak cursor location is the location
2375    /// where characters of the directionality opposite to the base
2376    /// direction of the paragraph are inserted.
2377    ///
2378    /// If `iter` is [`None`], the actual cursor position is used.
2379    ///
2380    /// Note that if `iter` happens to be the actual cursor position, and
2381    /// there is currently an IM preedit sequence being entered, the
2382    /// returned locations will be adjusted to account for the preedit
2383    /// cursor’s offset within the preedit sequence.
2384    ///
2385    /// The rectangle position is in buffer coordinates; use
2386    /// [`buffer_to_window_coords()`][Self::buffer_to_window_coords()] to convert these
2387    /// coordinates to coordinates for one of the windows in the text view.
2388    /// ## `iter`
2389    /// a [`TextIter`][crate::TextIter]
2390    ///
2391    /// # Returns
2392    ///
2393    ///
2394    /// ## `strong`
2395    /// location to store the strong
2396    ///  cursor position (may be [`None`])
2397    ///
2398    /// ## `weak`
2399    /// location to store the weak
2400    ///  cursor position (may be [`None`])
2401    #[doc(alias = "gtk_text_view_get_cursor_locations")]
2402    #[doc(alias = "get_cursor_locations")]
2403    fn cursor_locations(&self, iter: Option<&TextIter>) -> (gdk::Rectangle, gdk::Rectangle) {
2404        unsafe {
2405            let mut strong = gdk::Rectangle::uninitialized();
2406            let mut weak = gdk::Rectangle::uninitialized();
2407            ffi::gtk_text_view_get_cursor_locations(
2408                self.as_ref().to_glib_none().0,
2409                iter.to_glib_none().0,
2410                strong.to_glib_none_mut().0,
2411                weak.to_glib_none_mut().0,
2412            );
2413            (strong, weak)
2414        }
2415    }
2416
2417    /// Find out whether the cursor should be displayed.
2418    ///
2419    /// # Returns
2420    ///
2421    /// whether the insertion mark is visible
2422    #[doc(alias = "gtk_text_view_get_cursor_visible")]
2423    #[doc(alias = "get_cursor_visible")]
2424    fn is_cursor_visible(&self) -> bool {
2425        unsafe {
2426            from_glib(ffi::gtk_text_view_get_cursor_visible(
2427                self.as_ref().to_glib_none().0,
2428            ))
2429        }
2430    }
2431
2432    /// Obtains a copy of the default text attributes. These are the
2433    /// attributes used for text unless a tag overrides them.
2434    /// You’d typically pass the default attributes in to
2435    /// [`TextIter::is_attributes()`][crate::TextIter::is_attributes()] in order to get the
2436    /// attributes in effect at a given text position.
2437    ///
2438    /// The return value is a copy owned by the caller of this function,
2439    /// and should be freed with `gtk_text_attributes_unref()`.
2440    ///
2441    /// # Returns
2442    ///
2443    /// a new [`TextAttributes`][crate::TextAttributes]
2444    #[doc(alias = "gtk_text_view_get_default_attributes")]
2445    #[doc(alias = "get_default_attributes")]
2446    fn default_attributes(&self) -> TextAttributes {
2447        unsafe {
2448            from_glib_full(ffi::gtk_text_view_get_default_attributes(
2449                self.as_ref().to_glib_none().0,
2450            ))
2451        }
2452    }
2453
2454    /// Returns the default editability of the [`TextView`][crate::TextView]. Tags in the
2455    /// buffer may override this setting for some ranges of text.
2456    ///
2457    /// # Returns
2458    ///
2459    /// whether text is editable by default
2460    #[doc(alias = "gtk_text_view_get_editable")]
2461    #[doc(alias = "get_editable")]
2462    fn is_editable(&self) -> bool {
2463        unsafe {
2464            from_glib(ffi::gtk_text_view_get_editable(
2465                self.as_ref().to_glib_none().0,
2466            ))
2467        }
2468    }
2469
2470    /// Gets the default indentation of paragraphs in `self`.
2471    /// Tags in the view’s buffer may override the default.
2472    /// The indentation may be negative.
2473    ///
2474    /// # Returns
2475    ///
2476    /// number of pixels of indentation
2477    #[doc(alias = "gtk_text_view_get_indent")]
2478    #[doc(alias = "get_indent")]
2479    fn indent(&self) -> i32 {
2480        unsafe { ffi::gtk_text_view_get_indent(self.as_ref().to_glib_none().0) }
2481    }
2482
2483    /// Gets the value of the [`input-hints`][struct@crate::TextView#input-hints] property.
2484    #[doc(alias = "gtk_text_view_get_input_hints")]
2485    #[doc(alias = "get_input_hints")]
2486    fn input_hints(&self) -> InputHints {
2487        unsafe {
2488            from_glib(ffi::gtk_text_view_get_input_hints(
2489                self.as_ref().to_glib_none().0,
2490            ))
2491        }
2492    }
2493
2494    /// Gets the value of the [`input-purpose`][struct@crate::TextView#input-purpose] property.
2495    #[doc(alias = "gtk_text_view_get_input_purpose")]
2496    #[doc(alias = "get_input_purpose")]
2497    fn input_purpose(&self) -> InputPurpose {
2498        unsafe {
2499            from_glib(ffi::gtk_text_view_get_input_purpose(
2500                self.as_ref().to_glib_none().0,
2501            ))
2502        }
2503    }
2504
2505    /// Retrieves the iterator at buffer coordinates `x` and `y`. Buffer
2506    /// coordinates are coordinates for the entire buffer, not just the
2507    /// currently-displayed portion. If you have coordinates from an
2508    /// event, you have to convert those to buffer coordinates with
2509    /// [`window_to_buffer_coords()`][Self::window_to_buffer_coords()].
2510    /// ## `x`
2511    /// x position, in buffer coordinates
2512    /// ## `y`
2513    /// y position, in buffer coordinates
2514    ///
2515    /// # Returns
2516    ///
2517    /// [`true`] if the position is over text
2518    ///
2519    /// ## `iter`
2520    /// a [`TextIter`][crate::TextIter]
2521    #[doc(alias = "gtk_text_view_get_iter_at_location")]
2522    #[doc(alias = "get_iter_at_location")]
2523    fn iter_at_location(&self, x: i32, y: i32) -> Option<TextIter> {
2524        unsafe {
2525            let mut iter = TextIter::uninitialized();
2526            let ret = from_glib(ffi::gtk_text_view_get_iter_at_location(
2527                self.as_ref().to_glib_none().0,
2528                iter.to_glib_none_mut().0,
2529                x,
2530                y,
2531            ));
2532            if ret {
2533                Some(iter)
2534            } else {
2535                None
2536            }
2537        }
2538    }
2539
2540    /// Retrieves the iterator pointing to the character at buffer
2541    /// coordinates `x` and `y`. Buffer coordinates are coordinates for
2542    /// the entire buffer, not just the currently-displayed portion.
2543    /// If you have coordinates from an event, you have to convert
2544    /// those to buffer coordinates with
2545    /// [`window_to_buffer_coords()`][Self::window_to_buffer_coords()].
2546    ///
2547    /// Note that this is different from [`iter_at_location()`][Self::iter_at_location()],
2548    /// which returns cursor locations, i.e. positions between
2549    /// characters.
2550    /// ## `x`
2551    /// x position, in buffer coordinates
2552    /// ## `y`
2553    /// y position, in buffer coordinates
2554    ///
2555    /// # Returns
2556    ///
2557    /// [`true`] if the position is over text
2558    ///
2559    /// ## `iter`
2560    /// a [`TextIter`][crate::TextIter]
2561    ///
2562    /// ## `trailing`
2563    /// if non-[`None`], location to store an integer indicating where
2564    ///  in the grapheme the user clicked. It will either be
2565    ///  zero, or the number of characters in the grapheme.
2566    ///  0 represents the trailing edge of the grapheme.
2567    #[doc(alias = "gtk_text_view_get_iter_at_position")]
2568    #[doc(alias = "get_iter_at_position")]
2569    fn iter_at_position(&self, x: i32, y: i32) -> Option<(TextIter, i32)> {
2570        unsafe {
2571            let mut iter = TextIter::uninitialized();
2572            let mut trailing = mem::MaybeUninit::uninit();
2573            let ret = from_glib(ffi::gtk_text_view_get_iter_at_position(
2574                self.as_ref().to_glib_none().0,
2575                iter.to_glib_none_mut().0,
2576                trailing.as_mut_ptr(),
2577                x,
2578                y,
2579            ));
2580            if ret {
2581                Some((iter, trailing.assume_init()))
2582            } else {
2583                None
2584            }
2585        }
2586    }
2587
2588    /// Gets a rectangle which roughly contains the character at `iter`.
2589    /// The rectangle position is in buffer coordinates; use
2590    /// [`buffer_to_window_coords()`][Self::buffer_to_window_coords()] to convert these
2591    /// coordinates to coordinates for one of the windows in the text view.
2592    /// ## `iter`
2593    /// a [`TextIter`][crate::TextIter]
2594    ///
2595    /// # Returns
2596    ///
2597    ///
2598    /// ## `location`
2599    /// bounds of the character at `iter`
2600    #[doc(alias = "gtk_text_view_get_iter_location")]
2601    #[doc(alias = "get_iter_location")]
2602    fn iter_location(&self, iter: &TextIter) -> gdk::Rectangle {
2603        unsafe {
2604            let mut location = gdk::Rectangle::uninitialized();
2605            ffi::gtk_text_view_get_iter_location(
2606                self.as_ref().to_glib_none().0,
2607                iter.to_glib_none().0,
2608                location.to_glib_none_mut().0,
2609            );
2610            location
2611        }
2612    }
2613
2614    /// Gets the default justification of paragraphs in `self`.
2615    /// Tags in the buffer may override the default.
2616    ///
2617    /// # Returns
2618    ///
2619    /// default justification
2620    #[doc(alias = "gtk_text_view_get_justification")]
2621    #[doc(alias = "get_justification")]
2622    fn justification(&self) -> Justification {
2623        unsafe {
2624            from_glib(ffi::gtk_text_view_get_justification(
2625                self.as_ref().to_glib_none().0,
2626            ))
2627        }
2628    }
2629
2630    /// Gets the default left margin size of paragraphs in the `self`.
2631    /// Tags in the buffer may override the default.
2632    ///
2633    /// # Returns
2634    ///
2635    /// left margin in pixels
2636    #[doc(alias = "gtk_text_view_get_left_margin")]
2637    #[doc(alias = "get_left_margin")]
2638    fn left_margin(&self) -> i32 {
2639        unsafe { ffi::gtk_text_view_get_left_margin(self.as_ref().to_glib_none().0) }
2640    }
2641
2642    /// Gets the [`TextIter`][crate::TextIter] at the start of the line containing
2643    /// the coordinate `y`. `y` is in buffer coordinates, convert from
2644    /// window coordinates with [`window_to_buffer_coords()`][Self::window_to_buffer_coords()].
2645    /// If non-[`None`], `line_top` will be filled with the coordinate of the top
2646    /// edge of the line.
2647    /// ## `y`
2648    /// a y coordinate
2649    ///
2650    /// # Returns
2651    ///
2652    ///
2653    /// ## `target_iter`
2654    /// a [`TextIter`][crate::TextIter]
2655    ///
2656    /// ## `line_top`
2657    /// return location for top coordinate of the line
2658    #[doc(alias = "gtk_text_view_get_line_at_y")]
2659    #[doc(alias = "get_line_at_y")]
2660    fn line_at_y(&self, y: i32) -> (TextIter, i32) {
2661        unsafe {
2662            let mut target_iter = TextIter::uninitialized();
2663            let mut line_top = mem::MaybeUninit::uninit();
2664            ffi::gtk_text_view_get_line_at_y(
2665                self.as_ref().to_glib_none().0,
2666                target_iter.to_glib_none_mut().0,
2667                y,
2668                line_top.as_mut_ptr(),
2669            );
2670            (target_iter, line_top.assume_init())
2671        }
2672    }
2673
2674    /// Gets the y coordinate of the top of the line containing `iter`,
2675    /// and the height of the line. The coordinate is a buffer coordinate;
2676    /// convert to window coordinates with [`buffer_to_window_coords()`][Self::buffer_to_window_coords()].
2677    /// ## `iter`
2678    /// a [`TextIter`][crate::TextIter]
2679    ///
2680    /// # Returns
2681    ///
2682    ///
2683    /// ## `y`
2684    /// return location for a y coordinate
2685    ///
2686    /// ## `height`
2687    /// return location for a height
2688    #[doc(alias = "gtk_text_view_get_line_yrange")]
2689    #[doc(alias = "get_line_yrange")]
2690    fn line_yrange(&self, iter: &TextIter) -> (i32, i32) {
2691        unsafe {
2692            let mut y = mem::MaybeUninit::uninit();
2693            let mut height = mem::MaybeUninit::uninit();
2694            ffi::gtk_text_view_get_line_yrange(
2695                self.as_ref().to_glib_none().0,
2696                iter.to_glib_none().0,
2697                y.as_mut_ptr(),
2698                height.as_mut_ptr(),
2699            );
2700            (y.assume_init(), height.assume_init())
2701        }
2702    }
2703
2704    /// Gets the value of the [`monospace`][struct@crate::TextView#monospace] property.
2705    ///
2706    /// # Returns
2707    ///
2708    /// [`true`] if monospace fonts are desired
2709    #[doc(alias = "gtk_text_view_get_monospace")]
2710    #[doc(alias = "get_monospace")]
2711    fn is_monospace(&self) -> bool {
2712        unsafe {
2713            from_glib(ffi::gtk_text_view_get_monospace(
2714                self.as_ref().to_glib_none().0,
2715            ))
2716        }
2717    }
2718
2719    /// Returns whether the [`TextView`][crate::TextView] is in overwrite mode or not.
2720    ///
2721    /// # Returns
2722    ///
2723    /// whether `self` is in overwrite mode or not.
2724    #[doc(alias = "gtk_text_view_get_overwrite")]
2725    #[doc(alias = "get_overwrite")]
2726    fn overwrites(&self) -> bool {
2727        unsafe {
2728            from_glib(ffi::gtk_text_view_get_overwrite(
2729                self.as_ref().to_glib_none().0,
2730            ))
2731        }
2732    }
2733
2734    /// Gets the default number of pixels to put above paragraphs.
2735    /// Adding this function with [`pixels_below_lines()`][Self::pixels_below_lines()]
2736    /// is equal to the line space between each paragraph.
2737    ///
2738    /// # Returns
2739    ///
2740    /// default number of pixels above paragraphs
2741    #[doc(alias = "gtk_text_view_get_pixels_above_lines")]
2742    #[doc(alias = "get_pixels_above_lines")]
2743    fn pixels_above_lines(&self) -> i32 {
2744        unsafe { ffi::gtk_text_view_get_pixels_above_lines(self.as_ref().to_glib_none().0) }
2745    }
2746
2747    /// Gets the value set by [`set_pixels_below_lines()`][Self::set_pixels_below_lines()].
2748    ///
2749    /// The line space is the sum of the value returned by this function and the
2750    /// value returned by [`pixels_above_lines()`][Self::pixels_above_lines()].
2751    ///
2752    /// # Returns
2753    ///
2754    /// default number of blank pixels below paragraphs
2755    #[doc(alias = "gtk_text_view_get_pixels_below_lines")]
2756    #[doc(alias = "get_pixels_below_lines")]
2757    fn pixels_below_lines(&self) -> i32 {
2758        unsafe { ffi::gtk_text_view_get_pixels_below_lines(self.as_ref().to_glib_none().0) }
2759    }
2760
2761    /// Gets the value set by [`set_pixels_inside_wrap()`][Self::set_pixels_inside_wrap()].
2762    ///
2763    /// # Returns
2764    ///
2765    /// default number of pixels of blank space between wrapped lines
2766    #[doc(alias = "gtk_text_view_get_pixels_inside_wrap")]
2767    #[doc(alias = "get_pixels_inside_wrap")]
2768    fn pixels_inside_wrap(&self) -> i32 {
2769        unsafe { ffi::gtk_text_view_get_pixels_inside_wrap(self.as_ref().to_glib_none().0) }
2770    }
2771
2772    /// Gets the default right margin for text in `self`. Tags
2773    /// in the buffer may override the default.
2774    ///
2775    /// # Returns
2776    ///
2777    /// right margin in pixels
2778    #[doc(alias = "gtk_text_view_get_right_margin")]
2779    #[doc(alias = "get_right_margin")]
2780    fn right_margin(&self) -> i32 {
2781        unsafe { ffi::gtk_text_view_get_right_margin(self.as_ref().to_glib_none().0) }
2782    }
2783
2784    /// Gets the default tabs for `self`. Tags in the buffer may
2785    /// override the defaults. The returned array will be [`None`] if
2786    /// “standard” (8-space) tabs are used. Free the return value
2787    /// with `pango_tab_array_free()`.
2788    ///
2789    /// # Returns
2790    ///
2791    /// copy of default tab array, or [`None`] if
2792    ///  “standard" tabs are used; must be freed with `pango_tab_array_free()`.
2793    #[doc(alias = "gtk_text_view_get_tabs")]
2794    #[doc(alias = "get_tabs")]
2795    fn tabs(&self) -> Option<pango::TabArray> {
2796        unsafe { from_glib_full(ffi::gtk_text_view_get_tabs(self.as_ref().to_glib_none().0)) }
2797    }
2798
2799    /// Gets the top margin for text in the `self`.
2800    ///
2801    /// # Returns
2802    ///
2803    /// top margin in pixels
2804    #[doc(alias = "gtk_text_view_get_top_margin")]
2805    #[doc(alias = "get_top_margin")]
2806    fn top_margin(&self) -> i32 {
2807        unsafe { ffi::gtk_text_view_get_top_margin(self.as_ref().to_glib_none().0) }
2808    }
2809
2810    /// Fills `visible_rect` with the currently-visible
2811    /// region of the buffer, in buffer coordinates. Convert to window coordinates
2812    /// with [`buffer_to_window_coords()`][Self::buffer_to_window_coords()].
2813    ///
2814    /// # Returns
2815    ///
2816    ///
2817    /// ## `visible_rect`
2818    /// rectangle to fill
2819    #[doc(alias = "gtk_text_view_get_visible_rect")]
2820    #[doc(alias = "get_visible_rect")]
2821    fn visible_rect(&self) -> gdk::Rectangle {
2822        unsafe {
2823            let mut visible_rect = gdk::Rectangle::uninitialized();
2824            ffi::gtk_text_view_get_visible_rect(
2825                self.as_ref().to_glib_none().0,
2826                visible_rect.to_glib_none_mut().0,
2827            );
2828            visible_rect
2829        }
2830    }
2831
2832    /// Retrieves the [`gdk::Window`][crate::gdk::Window] corresponding to an area of the text view;
2833    /// possible windows include the overall widget window, child windows
2834    /// on the left, right, top, bottom, and the window that displays the
2835    /// text buffer. Windows are [`None`] and nonexistent if their width or
2836    /// height is 0, and are nonexistent before the widget has been
2837    /// realized.
2838    /// ## `win`
2839    /// window to get
2840    ///
2841    /// # Returns
2842    ///
2843    /// a [`gdk::Window`][crate::gdk::Window], or [`None`]
2844    #[doc(alias = "gtk_text_view_get_window")]
2845    #[doc(alias = "get_window")]
2846    fn window(&self, win: TextWindowType) -> Option<gdk::Window> {
2847        unsafe {
2848            from_glib_none(ffi::gtk_text_view_get_window(
2849                self.as_ref().to_glib_none().0,
2850                win.into_glib(),
2851            ))
2852        }
2853    }
2854
2855    /// Usually used to find out which window an event corresponds to.
2856    ///
2857    /// If you connect to an event signal on `self`, this function
2858    /// should be called on `event->window` to see which window it was.
2859    /// ## `window`
2860    /// a window type
2861    ///
2862    /// # Returns
2863    ///
2864    /// the window type.
2865    #[doc(alias = "gtk_text_view_get_window_type")]
2866    #[doc(alias = "get_window_type")]
2867    fn window_type(&self, window: &gdk::Window) -> TextWindowType {
2868        unsafe {
2869            from_glib(ffi::gtk_text_view_get_window_type(
2870                self.as_ref().to_glib_none().0,
2871                window.to_glib_none().0,
2872            ))
2873        }
2874    }
2875
2876    /// Gets the line wrapping for the view.
2877    ///
2878    /// # Returns
2879    ///
2880    /// the line wrap setting
2881    #[doc(alias = "gtk_text_view_get_wrap_mode")]
2882    #[doc(alias = "get_wrap_mode")]
2883    fn wrap_mode(&self) -> WrapMode {
2884        unsafe {
2885            from_glib(ffi::gtk_text_view_get_wrap_mode(
2886                self.as_ref().to_glib_none().0,
2887            ))
2888        }
2889    }
2890
2891    /// Allow the [`TextView`][crate::TextView] input method to internally handle key press
2892    /// and release events. If this function returns [`true`], then no further
2893    /// processing should be done for this key event. See
2894    /// [`IMContextExt::filter_keypress()`][crate::prelude::IMContextExt::filter_keypress()].
2895    ///
2896    /// Note that you are expected to call this function from your handler
2897    /// when overriding key event handling. This is needed in the case when
2898    /// you need to insert your own key handling between the input method
2899    /// and the default key event handling of the [`TextView`][crate::TextView].
2900    ///
2901    ///
2902    ///
2903    /// **⚠️ The following code is in C ⚠️**
2904    ///
2905    /// ```C
2906    /// static gboolean
2907    /// gtk_foo_bar_key_press_event (GtkWidget   *widget,
2908    ///                              GdkEventKey *event)
2909    /// {
2910    ///   guint keyval;
2911    ///
2912    ///   gdk_event_get_keyval ((GdkEvent*)event, &keyval);
2913    ///
2914    ///   if (keyval == GDK_KEY_Return || keyval == GDK_KEY_KP_Enter)
2915    ///     {
2916    ///       if (gtk_text_view_im_context_filter_keypress (GTK_TEXT_VIEW (widget), event))
2917    ///         return TRUE;
2918    ///     }
2919    ///
2920    ///   // Do some stuff
2921    ///
2922    ///   return GTK_WIDGET_CLASS (gtk_foo_bar_parent_class)->key_press_event (widget, event);
2923    /// }
2924    /// ```
2925    /// ## `event`
2926    /// the key event
2927    ///
2928    /// # Returns
2929    ///
2930    /// [`true`] if the input method handled the key event.
2931    #[doc(alias = "gtk_text_view_im_context_filter_keypress")]
2932    fn im_context_filter_keypress(&self, event: &gdk::EventKey) -> bool {
2933        unsafe {
2934            from_glib(ffi::gtk_text_view_im_context_filter_keypress(
2935                self.as_ref().to_glib_none().0,
2936                mut_override(event.to_glib_none().0),
2937            ))
2938        }
2939    }
2940
2941    /// Updates the position of a child, as for [`add_child_in_window()`][Self::add_child_in_window()].
2942    /// ## `child`
2943    /// child widget already added to the text view
2944    /// ## `xpos`
2945    /// new X position in window coordinates
2946    /// ## `ypos`
2947    /// new Y position in window coordinates
2948    #[doc(alias = "gtk_text_view_move_child")]
2949    fn move_child(&self, child: &impl IsA<Widget>, xpos: i32, ypos: i32) {
2950        unsafe {
2951            ffi::gtk_text_view_move_child(
2952                self.as_ref().to_glib_none().0,
2953                child.as_ref().to_glib_none().0,
2954                xpos,
2955                ypos,
2956            );
2957        }
2958    }
2959
2960    /// Moves a mark within the buffer so that it's
2961    /// located within the currently-visible text area.
2962    /// ## `mark`
2963    /// a [`TextMark`][crate::TextMark]
2964    ///
2965    /// # Returns
2966    ///
2967    /// [`true`] if the mark moved (wasn’t already onscreen)
2968    #[doc(alias = "gtk_text_view_move_mark_onscreen")]
2969    fn move_mark_onscreen(&self, mark: &impl IsA<TextMark>) -> bool {
2970        unsafe {
2971            from_glib(ffi::gtk_text_view_move_mark_onscreen(
2972                self.as_ref().to_glib_none().0,
2973                mark.as_ref().to_glib_none().0,
2974            ))
2975        }
2976    }
2977
2978    /// Move the iterator a given number of characters visually, treating
2979    /// it as the strong cursor position. If `count` is positive, then the
2980    /// new strong cursor position will be `count` positions to the right of
2981    /// the old cursor position. If `count` is negative then the new strong
2982    /// cursor position will be `count` positions to the left of the old
2983    /// cursor position.
2984    ///
2985    /// In the presence of bi-directional text, the correspondence
2986    /// between logical and visual order will depend on the direction
2987    /// of the current run, and there may be jumps when the cursor
2988    /// is moved off of the end of a run.
2989    /// ## `iter`
2990    /// a [`TextIter`][crate::TextIter]
2991    /// ## `count`
2992    /// number of characters to move (negative moves left,
2993    ///  positive moves right)
2994    ///
2995    /// # Returns
2996    ///
2997    /// [`true`] if `iter` moved and is not on the end iterator
2998    #[doc(alias = "gtk_text_view_move_visually")]
2999    fn move_visually(&self, iter: &mut TextIter, count: i32) -> bool {
3000        unsafe {
3001            from_glib(ffi::gtk_text_view_move_visually(
3002                self.as_ref().to_glib_none().0,
3003                iter.to_glib_none_mut().0,
3004                count,
3005            ))
3006        }
3007    }
3008
3009    /// Moves the cursor to the currently visible region of the
3010    /// buffer, it it isn’t there already.
3011    ///
3012    /// # Returns
3013    ///
3014    /// [`true`] if the cursor had to be moved.
3015    #[doc(alias = "gtk_text_view_place_cursor_onscreen")]
3016    fn place_cursor_onscreen(&self) -> bool {
3017        unsafe {
3018            from_glib(ffi::gtk_text_view_place_cursor_onscreen(
3019                self.as_ref().to_glib_none().0,
3020            ))
3021        }
3022    }
3023
3024    /// Ensures that the cursor is shown (i.e. not in an 'off' blink
3025    /// interval) and resets the time that it will stay blinking (or
3026    /// visible, in case blinking is disabled).
3027    ///
3028    /// This function should be called in response to user input
3029    /// (e.g. from derived classes that override the textview's
3030    /// [`key-press-event`][struct@crate::Widget#key-press-event] handler).
3031    #[doc(alias = "gtk_text_view_reset_cursor_blink")]
3032    fn reset_cursor_blink(&self) {
3033        unsafe {
3034            ffi::gtk_text_view_reset_cursor_blink(self.as_ref().to_glib_none().0);
3035        }
3036    }
3037
3038    /// Reset the input method context of the text view if needed.
3039    ///
3040    /// This can be necessary in the case where modifying the buffer
3041    /// would confuse on-going input method behavior.
3042    #[doc(alias = "gtk_text_view_reset_im_context")]
3043    fn reset_im_context(&self) {
3044        unsafe {
3045            ffi::gtk_text_view_reset_im_context(self.as_ref().to_glib_none().0);
3046        }
3047    }
3048
3049    /// Scrolls `self` the minimum distance such that `mark` is contained
3050    /// within the visible area of the widget.
3051    /// ## `mark`
3052    /// a mark in the buffer for `self`
3053    #[doc(alias = "gtk_text_view_scroll_mark_onscreen")]
3054    fn scroll_mark_onscreen(&self, mark: &impl IsA<TextMark>) {
3055        unsafe {
3056            ffi::gtk_text_view_scroll_mark_onscreen(
3057                self.as_ref().to_glib_none().0,
3058                mark.as_ref().to_glib_none().0,
3059            );
3060        }
3061    }
3062
3063    /// Scrolls `self` so that `iter` is on the screen in the position
3064    /// indicated by `xalign` and `yalign`. An alignment of 0.0 indicates
3065    /// left or top, 1.0 indicates right or bottom, 0.5 means center.
3066    /// If `use_align` is [`false`], the text scrolls the minimal distance to
3067    /// get the mark onscreen, possibly not scrolling at all. The effective
3068    /// screen for purposes of this function is reduced by a margin of size
3069    /// `within_margin`.
3070    ///
3071    /// Note that this function uses the currently-computed height of the
3072    /// lines in the text buffer. Line heights are computed in an idle
3073    /// handler; so this function may not have the desired effect if it’s
3074    /// called before the height computations. To avoid oddness, consider
3075    /// using [`scroll_to_mark()`][Self::scroll_to_mark()] which saves a point to be
3076    /// scrolled to after line validation.
3077    /// ## `iter`
3078    /// a [`TextIter`][crate::TextIter]
3079    /// ## `within_margin`
3080    /// margin as a [0.0,0.5) fraction of screen size
3081    /// ## `use_align`
3082    /// whether to use alignment arguments (if [`false`],
3083    ///  just get the mark onscreen)
3084    /// ## `xalign`
3085    /// horizontal alignment of mark within visible area
3086    /// ## `yalign`
3087    /// vertical alignment of mark within visible area
3088    ///
3089    /// # Returns
3090    ///
3091    /// [`true`] if scrolling occurred
3092    #[doc(alias = "gtk_text_view_scroll_to_iter")]
3093    fn scroll_to_iter(
3094        &self,
3095        iter: &mut TextIter,
3096        within_margin: f64,
3097        use_align: bool,
3098        xalign: f64,
3099        yalign: f64,
3100    ) -> bool {
3101        unsafe {
3102            from_glib(ffi::gtk_text_view_scroll_to_iter(
3103                self.as_ref().to_glib_none().0,
3104                iter.to_glib_none_mut().0,
3105                within_margin,
3106                use_align.into_glib(),
3107                xalign,
3108                yalign,
3109            ))
3110        }
3111    }
3112
3113    /// Scrolls `self` so that `mark` is on the screen in the position
3114    /// indicated by `xalign` and `yalign`. An alignment of 0.0 indicates
3115    /// left or top, 1.0 indicates right or bottom, 0.5 means center.
3116    /// If `use_align` is [`false`], the text scrolls the minimal distance to
3117    /// get the mark onscreen, possibly not scrolling at all. The effective
3118    /// screen for purposes of this function is reduced by a margin of size
3119    /// `within_margin`.
3120    /// ## `mark`
3121    /// a [`TextMark`][crate::TextMark]
3122    /// ## `within_margin`
3123    /// margin as a [0.0,0.5) fraction of screen size
3124    /// ## `use_align`
3125    /// whether to use alignment arguments (if [`false`], just
3126    ///  get the mark onscreen)
3127    /// ## `xalign`
3128    /// horizontal alignment of mark within visible area
3129    /// ## `yalign`
3130    /// vertical alignment of mark within visible area
3131    #[doc(alias = "gtk_text_view_scroll_to_mark")]
3132    fn scroll_to_mark(
3133        &self,
3134        mark: &impl IsA<TextMark>,
3135        within_margin: f64,
3136        use_align: bool,
3137        xalign: f64,
3138        yalign: f64,
3139    ) {
3140        unsafe {
3141            ffi::gtk_text_view_scroll_to_mark(
3142                self.as_ref().to_glib_none().0,
3143                mark.as_ref().to_glib_none().0,
3144                within_margin,
3145                use_align.into_glib(),
3146                xalign,
3147                yalign,
3148            );
3149        }
3150    }
3151
3152    /// Sets the behavior of the text widget when the Tab key is pressed.
3153    /// If `accepts_tab` is [`true`], a tab character is inserted. If `accepts_tab`
3154    /// is [`false`] the keyboard focus is moved to the next widget in the focus
3155    /// chain.
3156    /// ## `accepts_tab`
3157    /// [`true`] if pressing the Tab key should insert a tab
3158    ///  character, [`false`], if pressing the Tab key should move the
3159    ///  keyboard focus.
3160    #[doc(alias = "gtk_text_view_set_accepts_tab")]
3161    fn set_accepts_tab(&self, accepts_tab: bool) {
3162        unsafe {
3163            ffi::gtk_text_view_set_accepts_tab(
3164                self.as_ref().to_glib_none().0,
3165                accepts_tab.into_glib(),
3166            );
3167        }
3168    }
3169
3170    /// Sets the width of [`TextWindowType::Left`][crate::TextWindowType::Left] or [`TextWindowType::Right`][crate::TextWindowType::Right],
3171    /// or the height of [`TextWindowType::Top`][crate::TextWindowType::Top] or [`TextWindowType::Bottom`][crate::TextWindowType::Bottom].
3172    /// Automatically destroys the corresponding window if the size is set
3173    /// to 0, and creates the window if the size is set to non-zero. This
3174    /// function can only be used for the “border windows”, and it won’t
3175    /// work with [`TextWindowType::Widget`][crate::TextWindowType::Widget], [`TextWindowType::Text`][crate::TextWindowType::Text], or
3176    /// [`TextWindowType::Private`][crate::TextWindowType::Private].
3177    /// ## `type_`
3178    /// window to affect
3179    /// ## `size`
3180    /// width or height of the window
3181    #[doc(alias = "gtk_text_view_set_border_window_size")]
3182    fn set_border_window_size(&self, type_: TextWindowType, size: i32) {
3183        unsafe {
3184            ffi::gtk_text_view_set_border_window_size(
3185                self.as_ref().to_glib_none().0,
3186                type_.into_glib(),
3187                size,
3188            );
3189        }
3190    }
3191
3192    /// Sets the bottom margin for text in `self`.
3193    ///
3194    /// Note that this function is confusingly named.
3195    /// In CSS terms, the value set here is padding.
3196    /// ## `bottom_margin`
3197    /// bottom margin in pixels
3198    #[doc(alias = "gtk_text_view_set_bottom_margin")]
3199    fn set_bottom_margin(&self, bottom_margin: i32) {
3200        unsafe {
3201            ffi::gtk_text_view_set_bottom_margin(self.as_ref().to_glib_none().0, bottom_margin);
3202        }
3203    }
3204
3205    /// Sets `buffer` as the buffer being displayed by `self`. The previous
3206    /// buffer displayed by the text view is unreferenced, and a reference is
3207    /// added to `buffer`. If you owned a reference to `buffer` before passing it
3208    /// to this function, you must remove that reference yourself; [`TextView`][crate::TextView]
3209    /// will not “adopt” it.
3210    /// ## `buffer`
3211    /// a [`TextBuffer`][crate::TextBuffer]
3212    #[doc(alias = "gtk_text_view_set_buffer")]
3213    fn set_buffer(&self, buffer: Option<&impl IsA<TextBuffer>>) {
3214        unsafe {
3215            ffi::gtk_text_view_set_buffer(
3216                self.as_ref().to_glib_none().0,
3217                buffer.map(|p| p.as_ref()).to_glib_none().0,
3218            );
3219        }
3220    }
3221
3222    /// Toggles whether the insertion point should be displayed. A buffer with
3223    /// no editable text probably shouldn’t have a visible cursor, so you may
3224    /// want to turn the cursor off.
3225    ///
3226    /// Note that this property may be overridden by the
3227    /// [`gtk-keynave-use-caret`][struct@crate::Settings#gtk-keynave-use-caret] settings.
3228    /// ## `setting`
3229    /// whether to show the insertion cursor
3230    #[doc(alias = "gtk_text_view_set_cursor_visible")]
3231    fn set_cursor_visible(&self, setting: bool) {
3232        unsafe {
3233            ffi::gtk_text_view_set_cursor_visible(
3234                self.as_ref().to_glib_none().0,
3235                setting.into_glib(),
3236            );
3237        }
3238    }
3239
3240    /// Sets the default editability of the [`TextView`][crate::TextView]. You can override
3241    /// this default setting with tags in the buffer, using the “editable”
3242    /// attribute of tags.
3243    /// ## `setting`
3244    /// whether it’s editable
3245    #[doc(alias = "gtk_text_view_set_editable")]
3246    fn set_editable(&self, setting: bool) {
3247        unsafe {
3248            ffi::gtk_text_view_set_editable(self.as_ref().to_glib_none().0, setting.into_glib());
3249        }
3250    }
3251
3252    /// Sets the default indentation for paragraphs in `self`.
3253    /// Tags in the buffer may override the default.
3254    /// ## `indent`
3255    /// indentation in pixels
3256    #[doc(alias = "gtk_text_view_set_indent")]
3257    fn set_indent(&self, indent: i32) {
3258        unsafe {
3259            ffi::gtk_text_view_set_indent(self.as_ref().to_glib_none().0, indent);
3260        }
3261    }
3262
3263    /// Sets the [`input-hints`][struct@crate::TextView#input-hints] property, which
3264    /// allows input methods to fine-tune their behaviour.
3265    /// ## `hints`
3266    /// the hints
3267    #[doc(alias = "gtk_text_view_set_input_hints")]
3268    fn set_input_hints(&self, hints: InputHints) {
3269        unsafe {
3270            ffi::gtk_text_view_set_input_hints(self.as_ref().to_glib_none().0, hints.into_glib());
3271        }
3272    }
3273
3274    /// Sets the [`input-purpose`][struct@crate::TextView#input-purpose] property which
3275    /// can be used by on-screen keyboards and other input
3276    /// methods to adjust their behaviour.
3277    /// ## `purpose`
3278    /// the purpose
3279    #[doc(alias = "gtk_text_view_set_input_purpose")]
3280    fn set_input_purpose(&self, purpose: InputPurpose) {
3281        unsafe {
3282            ffi::gtk_text_view_set_input_purpose(
3283                self.as_ref().to_glib_none().0,
3284                purpose.into_glib(),
3285            );
3286        }
3287    }
3288
3289    /// Sets the default justification of text in `self`.
3290    /// Tags in the view’s buffer may override the default.
3291    /// ## `justification`
3292    /// justification
3293    #[doc(alias = "gtk_text_view_set_justification")]
3294    fn set_justification(&self, justification: Justification) {
3295        unsafe {
3296            ffi::gtk_text_view_set_justification(
3297                self.as_ref().to_glib_none().0,
3298                justification.into_glib(),
3299            );
3300        }
3301    }
3302
3303    /// Sets the default left margin for text in `self`.
3304    /// Tags in the buffer may override the default.
3305    ///
3306    /// Note that this function is confusingly named.
3307    /// In CSS terms, the value set here is padding.
3308    /// ## `left_margin`
3309    /// left margin in pixels
3310    #[doc(alias = "gtk_text_view_set_left_margin")]
3311    fn set_left_margin(&self, left_margin: i32) {
3312        unsafe {
3313            ffi::gtk_text_view_set_left_margin(self.as_ref().to_glib_none().0, left_margin);
3314        }
3315    }
3316
3317    /// Sets the [`monospace`][struct@crate::TextView#monospace] property, which
3318    /// indicates that the text view should use monospace
3319    /// fonts.
3320    /// ## `monospace`
3321    /// [`true`] to request monospace styling
3322    #[doc(alias = "gtk_text_view_set_monospace")]
3323    fn set_monospace(&self, monospace: bool) {
3324        unsafe {
3325            ffi::gtk_text_view_set_monospace(self.as_ref().to_glib_none().0, monospace.into_glib());
3326        }
3327    }
3328
3329    /// Changes the [`TextView`][crate::TextView] overwrite mode.
3330    /// ## `overwrite`
3331    /// [`true`] to turn on overwrite mode, [`false`] to turn it off
3332    #[doc(alias = "gtk_text_view_set_overwrite")]
3333    fn set_overwrite(&self, overwrite: bool) {
3334        unsafe {
3335            ffi::gtk_text_view_set_overwrite(self.as_ref().to_glib_none().0, overwrite.into_glib());
3336        }
3337    }
3338
3339    /// Sets the default number of blank pixels above paragraphs in `self`.
3340    /// Tags in the buffer for `self` may override the defaults.
3341    /// ## `pixels_above_lines`
3342    /// pixels above paragraphs
3343    #[doc(alias = "gtk_text_view_set_pixels_above_lines")]
3344    fn set_pixels_above_lines(&self, pixels_above_lines: i32) {
3345        unsafe {
3346            ffi::gtk_text_view_set_pixels_above_lines(
3347                self.as_ref().to_glib_none().0,
3348                pixels_above_lines,
3349            );
3350        }
3351    }
3352
3353    /// Sets the default number of pixels of blank space
3354    /// to put below paragraphs in `self`. May be overridden
3355    /// by tags applied to `self`’s buffer.
3356    /// ## `pixels_below_lines`
3357    /// pixels below paragraphs
3358    #[doc(alias = "gtk_text_view_set_pixels_below_lines")]
3359    fn set_pixels_below_lines(&self, pixels_below_lines: i32) {
3360        unsafe {
3361            ffi::gtk_text_view_set_pixels_below_lines(
3362                self.as_ref().to_glib_none().0,
3363                pixels_below_lines,
3364            );
3365        }
3366    }
3367
3368    /// Sets the default number of pixels of blank space to leave between
3369    /// display/wrapped lines within a paragraph. May be overridden by
3370    /// tags in `self`’s buffer.
3371    /// ## `pixels_inside_wrap`
3372    /// default number of pixels between wrapped lines
3373    #[doc(alias = "gtk_text_view_set_pixels_inside_wrap")]
3374    fn set_pixels_inside_wrap(&self, pixels_inside_wrap: i32) {
3375        unsafe {
3376            ffi::gtk_text_view_set_pixels_inside_wrap(
3377                self.as_ref().to_glib_none().0,
3378                pixels_inside_wrap,
3379            );
3380        }
3381    }
3382
3383    /// Sets the default right margin for text in the text view.
3384    /// Tags in the buffer may override the default.
3385    ///
3386    /// Note that this function is confusingly named.
3387    /// In CSS terms, the value set here is padding.
3388    /// ## `right_margin`
3389    /// right margin in pixels
3390    #[doc(alias = "gtk_text_view_set_right_margin")]
3391    fn set_right_margin(&self, right_margin: i32) {
3392        unsafe {
3393            ffi::gtk_text_view_set_right_margin(self.as_ref().to_glib_none().0, right_margin);
3394        }
3395    }
3396
3397    /// Sets the default tab stops for paragraphs in `self`.
3398    /// Tags in the buffer may override the default.
3399    /// ## `tabs`
3400    /// tabs as a [`pango::TabArray`][crate::pango::TabArray]
3401    #[doc(alias = "gtk_text_view_set_tabs")]
3402    fn set_tabs(&self, tabs: &pango::TabArray) {
3403        unsafe {
3404            ffi::gtk_text_view_set_tabs(
3405                self.as_ref().to_glib_none().0,
3406                mut_override(tabs.to_glib_none().0),
3407            );
3408        }
3409    }
3410
3411    /// Sets the top margin for text in `self`.
3412    ///
3413    /// Note that this function is confusingly named.
3414    /// In CSS terms, the value set here is padding.
3415    /// ## `top_margin`
3416    /// top margin in pixels
3417    #[doc(alias = "gtk_text_view_set_top_margin")]
3418    fn set_top_margin(&self, top_margin: i32) {
3419        unsafe {
3420            ffi::gtk_text_view_set_top_margin(self.as_ref().to_glib_none().0, top_margin);
3421        }
3422    }
3423
3424    /// Sets the line wrapping for the view.
3425    /// ## `wrap_mode`
3426    /// a [`WrapMode`][crate::WrapMode]
3427    #[doc(alias = "gtk_text_view_set_wrap_mode")]
3428    fn set_wrap_mode(&self, wrap_mode: WrapMode) {
3429        unsafe {
3430            ffi::gtk_text_view_set_wrap_mode(self.as_ref().to_glib_none().0, wrap_mode.into_glib());
3431        }
3432    }
3433
3434    /// Determines whether `iter` is at the start of a display line.
3435    /// See [`forward_display_line()`][Self::forward_display_line()] for an explanation of
3436    /// display lines vs. paragraphs.
3437    /// ## `iter`
3438    /// a [`TextIter`][crate::TextIter]
3439    ///
3440    /// # Returns
3441    ///
3442    /// [`true`] if `iter` begins a wrapped line
3443    #[doc(alias = "gtk_text_view_starts_display_line")]
3444    fn starts_display_line(&self, iter: &TextIter) -> bool {
3445        unsafe {
3446            from_glib(ffi::gtk_text_view_starts_display_line(
3447                self.as_ref().to_glib_none().0,
3448                iter.to_glib_none().0,
3449            ))
3450        }
3451    }
3452
3453    /// Converts coordinates on the window identified by `win` to buffer
3454    /// coordinates, storing the result in (`buffer_x`,`buffer_y`).
3455    ///
3456    /// Note that you can’t convert coordinates for a nonexisting window (see
3457    /// [`set_border_window_size()`][Self::set_border_window_size()]).
3458    /// ## `win`
3459    /// a [`TextWindowType`][crate::TextWindowType] except [`TextWindowType::Private`][crate::TextWindowType::Private]
3460    /// ## `window_x`
3461    /// window x coordinate
3462    /// ## `window_y`
3463    /// window y coordinate
3464    ///
3465    /// # Returns
3466    ///
3467    ///
3468    /// ## `buffer_x`
3469    /// buffer x coordinate return location or [`None`]
3470    ///
3471    /// ## `buffer_y`
3472    /// buffer y coordinate return location or [`None`]
3473    #[doc(alias = "gtk_text_view_window_to_buffer_coords")]
3474    fn window_to_buffer_coords(
3475        &self,
3476        win: TextWindowType,
3477        window_x: i32,
3478        window_y: i32,
3479    ) -> (i32, i32) {
3480        unsafe {
3481            let mut buffer_x = mem::MaybeUninit::uninit();
3482            let mut buffer_y = mem::MaybeUninit::uninit();
3483            ffi::gtk_text_view_window_to_buffer_coords(
3484                self.as_ref().to_glib_none().0,
3485                win.into_glib(),
3486                window_x,
3487                window_y,
3488                buffer_x.as_mut_ptr(),
3489                buffer_y.as_mut_ptr(),
3490            );
3491            (buffer_x.assume_init(), buffer_y.assume_init())
3492        }
3493    }
3494
3495    /// Which IM (input method) module should be used for this text_view.
3496    /// See [`IMContext`][crate::IMContext].
3497    ///
3498    /// Setting this to a non-[`None`] value overrides the
3499    /// system-wide IM module setting. See the GtkSettings
3500    /// [`gtk-im-module`][struct@crate::Settings#gtk-im-module] property.
3501    #[doc(alias = "im-module")]
3502    fn im_module(&self) -> Option<glib::GString> {
3503        ObjectExt::property(self.as_ref(), "im-module")
3504    }
3505
3506    /// Which IM (input method) module should be used for this text_view.
3507    /// See [`IMContext`][crate::IMContext].
3508    ///
3509    /// Setting this to a non-[`None`] value overrides the
3510    /// system-wide IM module setting. See the GtkSettings
3511    /// [`gtk-im-module`][struct@crate::Settings#gtk-im-module] property.
3512    #[doc(alias = "im-module")]
3513    fn set_im_module(&self, im_module: Option<&str>) {
3514        ObjectExt::set_property(self.as_ref(), "im-module", im_module)
3515    }
3516
3517    /// If :populate-all is [`true`], the [`populate-popup`][struct@crate::TextView#populate-popup]
3518    /// signal is also emitted for touch popups.
3519    #[doc(alias = "populate-all")]
3520    fn populates_all(&self) -> bool {
3521        ObjectExt::property(self.as_ref(), "populate-all")
3522    }
3523
3524    /// If :populate-all is [`true`], the [`populate-popup`][struct@crate::TextView#populate-popup]
3525    /// signal is also emitted for touch popups.
3526    #[doc(alias = "populate-all")]
3527    fn set_populate_all(&self, populate_all: bool) {
3528        ObjectExt::set_property(self.as_ref(), "populate-all", populate_all)
3529    }
3530
3531    /// The ::backspace signal is a
3532    /// [keybinding signal][GtkBindingSignal]
3533    /// which gets emitted when the user asks for it.
3534    ///
3535    /// The default bindings for this signal are
3536    /// Backspace and Shift-Backspace.
3537    #[doc(alias = "backspace")]
3538    fn connect_backspace<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3539        unsafe extern "C" fn backspace_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
3540            this: *mut ffi::GtkTextView,
3541            f: glib::ffi::gpointer,
3542        ) {
3543            let f: &F = &*(f as *const F);
3544            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3545        }
3546        unsafe {
3547            let f: Box_<F> = Box_::new(f);
3548            connect_raw(
3549                self.as_ptr() as *mut _,
3550                b"backspace\0".as_ptr() as *const _,
3551                Some(transmute::<_, unsafe extern "C" fn()>(
3552                    backspace_trampoline::<Self, F> as *const (),
3553                )),
3554                Box_::into_raw(f),
3555            )
3556        }
3557    }
3558
3559    fn emit_backspace(&self) {
3560        self.emit_by_name::<()>("backspace", &[]);
3561    }
3562
3563    /// The ::copy-clipboard signal is a
3564    /// [keybinding signal][GtkBindingSignal]
3565    /// which gets emitted to copy the selection to the clipboard.
3566    ///
3567    /// The default bindings for this signal are
3568    /// Ctrl-c and Ctrl-Insert.
3569    #[doc(alias = "copy-clipboard")]
3570    fn connect_copy_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3571        unsafe extern "C" fn copy_clipboard_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
3572            this: *mut ffi::GtkTextView,
3573            f: glib::ffi::gpointer,
3574        ) {
3575            let f: &F = &*(f as *const F);
3576            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3577        }
3578        unsafe {
3579            let f: Box_<F> = Box_::new(f);
3580            connect_raw(
3581                self.as_ptr() as *mut _,
3582                b"copy-clipboard\0".as_ptr() as *const _,
3583                Some(transmute::<_, unsafe extern "C" fn()>(
3584                    copy_clipboard_trampoline::<Self, F> as *const (),
3585                )),
3586                Box_::into_raw(f),
3587            )
3588        }
3589    }
3590
3591    fn emit_copy_clipboard(&self) {
3592        self.emit_by_name::<()>("copy-clipboard", &[]);
3593    }
3594
3595    /// The ::cut-clipboard signal is a
3596    /// [keybinding signal][GtkBindingSignal]
3597    /// which gets emitted to cut the selection to the clipboard.
3598    ///
3599    /// The default bindings for this signal are
3600    /// Ctrl-x and Shift-Delete.
3601    #[doc(alias = "cut-clipboard")]
3602    fn connect_cut_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3603        unsafe extern "C" fn cut_clipboard_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
3604            this: *mut ffi::GtkTextView,
3605            f: glib::ffi::gpointer,
3606        ) {
3607            let f: &F = &*(f as *const F);
3608            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3609        }
3610        unsafe {
3611            let f: Box_<F> = Box_::new(f);
3612            connect_raw(
3613                self.as_ptr() as *mut _,
3614                b"cut-clipboard\0".as_ptr() as *const _,
3615                Some(transmute::<_, unsafe extern "C" fn()>(
3616                    cut_clipboard_trampoline::<Self, F> as *const (),
3617                )),
3618                Box_::into_raw(f),
3619            )
3620        }
3621    }
3622
3623    fn emit_cut_clipboard(&self) {
3624        self.emit_by_name::<()>("cut-clipboard", &[]);
3625    }
3626
3627    /// The ::delete-from-cursor signal is a
3628    /// [keybinding signal][GtkBindingSignal]
3629    /// which gets emitted when the user initiates a text deletion.
3630    ///
3631    /// If the `type_` is [`DeleteType::Chars`][crate::DeleteType::Chars], GTK+ deletes the selection
3632    /// if there is one, otherwise it deletes the requested number
3633    /// of characters.
3634    ///
3635    /// The default bindings for this signal are
3636    /// Delete for deleting a character, Ctrl-Delete for
3637    /// deleting a word and Ctrl-Backspace for deleting a word
3638    /// backwords.
3639    /// ## `type_`
3640    /// the granularity of the deletion, as a [`DeleteType`][crate::DeleteType]
3641    /// ## `count`
3642    /// the number of `type_` units to delete
3643    #[doc(alias = "delete-from-cursor")]
3644    fn connect_delete_from_cursor<F: Fn(&Self, DeleteType, i32) + 'static>(
3645        &self,
3646        f: F,
3647    ) -> SignalHandlerId {
3648        unsafe extern "C" fn delete_from_cursor_trampoline<
3649            P: IsA<TextView>,
3650            F: Fn(&P, DeleteType, i32) + 'static,
3651        >(
3652            this: *mut ffi::GtkTextView,
3653            type_: ffi::GtkDeleteType,
3654            count: libc::c_int,
3655            f: glib::ffi::gpointer,
3656        ) {
3657            let f: &F = &*(f as *const F);
3658            f(
3659                TextView::from_glib_borrow(this).unsafe_cast_ref(),
3660                from_glib(type_),
3661                count,
3662            )
3663        }
3664        unsafe {
3665            let f: Box_<F> = Box_::new(f);
3666            connect_raw(
3667                self.as_ptr() as *mut _,
3668                b"delete-from-cursor\0".as_ptr() as *const _,
3669                Some(transmute::<_, unsafe extern "C" fn()>(
3670                    delete_from_cursor_trampoline::<Self, F> as *const (),
3671                )),
3672                Box_::into_raw(f),
3673            )
3674        }
3675    }
3676
3677    fn emit_delete_from_cursor(&self, type_: DeleteType, count: i32) {
3678        self.emit_by_name::<()>("delete-from-cursor", &[&type_, &count]);
3679    }
3680
3681    /// The ::extend-selection signal is emitted when the selection needs to be
3682    /// extended at `location`.
3683    /// ## `granularity`
3684    /// the granularity type
3685    /// ## `location`
3686    /// the location where to extend the selection
3687    /// ## `start`
3688    /// where the selection should start
3689    /// ## `end`
3690    /// where the selection should end
3691    ///
3692    /// # Returns
3693    ///
3694    /// `GDK_EVENT_STOP` to stop other handlers from being invoked for the
3695    ///  event. `GDK_EVENT_PROPAGATE` to propagate the event further.
3696    #[doc(alias = "extend-selection")]
3697    fn connect_extend_selection<
3698        F: Fn(&Self, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> glib::Propagation
3699            + 'static,
3700    >(
3701        &self,
3702        f: F,
3703    ) -> SignalHandlerId {
3704        unsafe extern "C" fn extend_selection_trampoline<
3705            P: IsA<TextView>,
3706            F: Fn(&P, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> glib::Propagation
3707                + 'static,
3708        >(
3709            this: *mut ffi::GtkTextView,
3710            granularity: ffi::GtkTextExtendSelection,
3711            location: *mut ffi::GtkTextIter,
3712            start: *mut ffi::GtkTextIter,
3713            end: *mut ffi::GtkTextIter,
3714            f: glib::ffi::gpointer,
3715        ) -> glib::ffi::gboolean {
3716            let f: &F = &*(f as *const F);
3717            f(
3718                TextView::from_glib_borrow(this).unsafe_cast_ref(),
3719                from_glib(granularity),
3720                &from_glib_borrow(location),
3721                &from_glib_borrow(start),
3722                &from_glib_borrow(end),
3723            )
3724            .into_glib()
3725        }
3726        unsafe {
3727            let f: Box_<F> = Box_::new(f);
3728            connect_raw(
3729                self.as_ptr() as *mut _,
3730                b"extend-selection\0".as_ptr() as *const _,
3731                Some(transmute::<_, unsafe extern "C" fn()>(
3732                    extend_selection_trampoline::<Self, F> as *const (),
3733                )),
3734                Box_::into_raw(f),
3735            )
3736        }
3737    }
3738
3739    /// The ::insert-at-cursor signal is a
3740    /// [keybinding signal][GtkBindingSignal]
3741    /// which gets emitted when the user initiates the insertion of a
3742    /// fixed string at the cursor.
3743    ///
3744    /// This signal has no default bindings.
3745    /// ## `string`
3746    /// the string to insert
3747    #[doc(alias = "insert-at-cursor")]
3748    fn connect_insert_at_cursor<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
3749        unsafe extern "C" fn insert_at_cursor_trampoline<
3750            P: IsA<TextView>,
3751            F: Fn(&P, &str) + 'static,
3752        >(
3753            this: *mut ffi::GtkTextView,
3754            string: *mut libc::c_char,
3755            f: glib::ffi::gpointer,
3756        ) {
3757            let f: &F = &*(f as *const F);
3758            f(
3759                TextView::from_glib_borrow(this).unsafe_cast_ref(),
3760                &glib::GString::from_glib_borrow(string),
3761            )
3762        }
3763        unsafe {
3764            let f: Box_<F> = Box_::new(f);
3765            connect_raw(
3766                self.as_ptr() as *mut _,
3767                b"insert-at-cursor\0".as_ptr() as *const _,
3768                Some(transmute::<_, unsafe extern "C" fn()>(
3769                    insert_at_cursor_trampoline::<Self, F> as *const (),
3770                )),
3771                Box_::into_raw(f),
3772            )
3773        }
3774    }
3775
3776    fn emit_insert_at_cursor(&self, string: &str) {
3777        self.emit_by_name::<()>("insert-at-cursor", &[&string]);
3778    }
3779
3780    /// The ::insert-emoji signal is a
3781    /// [keybinding signal][GtkBindingSignal]
3782    /// which gets emitted to present the Emoji chooser for the `text_view`.
3783    ///
3784    /// The default bindings for this signal are Ctrl-. and Ctrl-;
3785    #[doc(alias = "insert-emoji")]
3786    fn connect_insert_emoji<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3787        unsafe extern "C" fn insert_emoji_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
3788            this: *mut ffi::GtkTextView,
3789            f: glib::ffi::gpointer,
3790        ) {
3791            let f: &F = &*(f as *const F);
3792            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3793        }
3794        unsafe {
3795            let f: Box_<F> = Box_::new(f);
3796            connect_raw(
3797                self.as_ptr() as *mut _,
3798                b"insert-emoji\0".as_ptr() as *const _,
3799                Some(transmute::<_, unsafe extern "C" fn()>(
3800                    insert_emoji_trampoline::<Self, F> as *const (),
3801                )),
3802                Box_::into_raw(f),
3803            )
3804        }
3805    }
3806
3807    fn emit_insert_emoji(&self) {
3808        self.emit_by_name::<()>("insert-emoji", &[]);
3809    }
3810
3811    /// The ::move-cursor signal is a
3812    /// [keybinding signal][GtkBindingSignal]
3813    /// which gets emitted when the user initiates a cursor movement.
3814    /// If the cursor is not visible in `text_view`, this signal causes
3815    /// the viewport to be moved instead.
3816    ///
3817    /// Applications should not connect to it, but may emit it with
3818    /// `g_signal_emit_by_name()` if they need to control the cursor
3819    /// programmatically.
3820    ///
3821    /// The default bindings for this signal come in two variants,
3822    /// the variant with the Shift modifier extends the selection,
3823    /// the variant without the Shift modifer does not.
3824    /// There are too many key combinations to list them all here.
3825    /// - Arrow keys move by individual characters/lines
3826    /// - Ctrl-arrow key combinations move by words/paragraphs
3827    /// - Home/End keys move to the ends of the buffer
3828    /// - PageUp/PageDown keys move vertically by pages
3829    /// - Ctrl-PageUp/PageDown keys move horizontally by pages
3830    /// ## `step`
3831    /// the granularity of the move, as a [`MovementStep`][crate::MovementStep]
3832    /// ## `count`
3833    /// the number of `step` units to move
3834    /// ## `extend_selection`
3835    /// [`true`] if the move should extend the selection
3836    #[doc(alias = "move-cursor")]
3837    fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>(
3838        &self,
3839        f: F,
3840    ) -> SignalHandlerId {
3841        unsafe extern "C" fn move_cursor_trampoline<
3842            P: IsA<TextView>,
3843            F: Fn(&P, MovementStep, i32, bool) + 'static,
3844        >(
3845            this: *mut ffi::GtkTextView,
3846            step: ffi::GtkMovementStep,
3847            count: libc::c_int,
3848            extend_selection: glib::ffi::gboolean,
3849            f: glib::ffi::gpointer,
3850        ) {
3851            let f: &F = &*(f as *const F);
3852            f(
3853                TextView::from_glib_borrow(this).unsafe_cast_ref(),
3854                from_glib(step),
3855                count,
3856                from_glib(extend_selection),
3857            )
3858        }
3859        unsafe {
3860            let f: Box_<F> = Box_::new(f);
3861            connect_raw(
3862                self.as_ptr() as *mut _,
3863                b"move-cursor\0".as_ptr() as *const _,
3864                Some(transmute::<_, unsafe extern "C" fn()>(
3865                    move_cursor_trampoline::<Self, F> as *const (),
3866                )),
3867                Box_::into_raw(f),
3868            )
3869        }
3870    }
3871
3872    fn emit_move_cursor(&self, step: MovementStep, count: i32, extend_selection: bool) {
3873        self.emit_by_name::<()>("move-cursor", &[&step, &count, &extend_selection]);
3874    }
3875
3876    /// The ::move-viewport signal is a
3877    /// [keybinding signal][GtkBindingSignal]
3878    /// which can be bound to key combinations to allow the user
3879    /// to move the viewport, i.e. change what part of the text view
3880    /// is visible in a containing scrolled window.
3881    ///
3882    /// There are no default bindings for this signal.
3883    /// ## `step`
3884    /// the granularity of the movement, as a [`ScrollStep`][crate::ScrollStep]
3885    /// ## `count`
3886    /// the number of `step` units to move
3887    #[doc(alias = "move-viewport")]
3888    fn connect_move_viewport<F: Fn(&Self, ScrollStep, i32) + 'static>(
3889        &self,
3890        f: F,
3891    ) -> SignalHandlerId {
3892        unsafe extern "C" fn move_viewport_trampoline<
3893            P: IsA<TextView>,
3894            F: Fn(&P, ScrollStep, i32) + 'static,
3895        >(
3896            this: *mut ffi::GtkTextView,
3897            step: ffi::GtkScrollStep,
3898            count: libc::c_int,
3899            f: glib::ffi::gpointer,
3900        ) {
3901            let f: &F = &*(f as *const F);
3902            f(
3903                TextView::from_glib_borrow(this).unsafe_cast_ref(),
3904                from_glib(step),
3905                count,
3906            )
3907        }
3908        unsafe {
3909            let f: Box_<F> = Box_::new(f);
3910            connect_raw(
3911                self.as_ptr() as *mut _,
3912                b"move-viewport\0".as_ptr() as *const _,
3913                Some(transmute::<_, unsafe extern "C" fn()>(
3914                    move_viewport_trampoline::<Self, F> as *const (),
3915                )),
3916                Box_::into_raw(f),
3917            )
3918        }
3919    }
3920
3921    fn emit_move_viewport(&self, step: ScrollStep, count: i32) {
3922        self.emit_by_name::<()>("move-viewport", &[&step, &count]);
3923    }
3924
3925    /// The ::paste-clipboard signal is a
3926    /// [keybinding signal][GtkBindingSignal]
3927    /// which gets emitted to paste the contents of the clipboard
3928    /// into the text view.
3929    ///
3930    /// The default bindings for this signal are
3931    /// Ctrl-v and Shift-Insert.
3932    #[doc(alias = "paste-clipboard")]
3933    fn connect_paste_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3934        unsafe extern "C" fn paste_clipboard_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
3935            this: *mut ffi::GtkTextView,
3936            f: glib::ffi::gpointer,
3937        ) {
3938            let f: &F = &*(f as *const F);
3939            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
3940        }
3941        unsafe {
3942            let f: Box_<F> = Box_::new(f);
3943            connect_raw(
3944                self.as_ptr() as *mut _,
3945                b"paste-clipboard\0".as_ptr() as *const _,
3946                Some(transmute::<_, unsafe extern "C" fn()>(
3947                    paste_clipboard_trampoline::<Self, F> as *const (),
3948                )),
3949                Box_::into_raw(f),
3950            )
3951        }
3952    }
3953
3954    fn emit_paste_clipboard(&self) {
3955        self.emit_by_name::<()>("paste-clipboard", &[]);
3956    }
3957
3958    /// The ::populate-popup signal gets emitted before showing the
3959    /// context menu of the text view.
3960    ///
3961    /// If you need to add items to the context menu, connect
3962    /// to this signal and append your items to the `popup`, which
3963    /// will be a [`Menu`][crate::Menu] in this case.
3964    ///
3965    /// If [`populate-all`][struct@crate::TextView#populate-all] is [`true`], this signal will
3966    /// also be emitted to populate touch popups. In this case,
3967    /// `popup` will be a different container, e.g. a [`Toolbar`][crate::Toolbar].
3968    ///
3969    /// The signal handler should not make assumptions about the
3970    /// type of `widget`, but check whether `popup` is a [`Menu`][crate::Menu]
3971    /// or [`Toolbar`][crate::Toolbar] or another kind of container.
3972    /// ## `popup`
3973    /// the container that is being populated
3974    #[doc(alias = "populate-popup")]
3975    fn connect_populate_popup<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId {
3976        unsafe extern "C" fn populate_popup_trampoline<
3977            P: IsA<TextView>,
3978            F: Fn(&P, &Widget) + 'static,
3979        >(
3980            this: *mut ffi::GtkTextView,
3981            popup: *mut ffi::GtkWidget,
3982            f: glib::ffi::gpointer,
3983        ) {
3984            let f: &F = &*(f as *const F);
3985            f(
3986                TextView::from_glib_borrow(this).unsafe_cast_ref(),
3987                &from_glib_borrow(popup),
3988            )
3989        }
3990        unsafe {
3991            let f: Box_<F> = Box_::new(f);
3992            connect_raw(
3993                self.as_ptr() as *mut _,
3994                b"populate-popup\0".as_ptr() as *const _,
3995                Some(transmute::<_, unsafe extern "C" fn()>(
3996                    populate_popup_trampoline::<Self, F> as *const (),
3997                )),
3998                Box_::into_raw(f),
3999            )
4000        }
4001    }
4002
4003    /// If an input method is used, the typed text will not immediately
4004    /// be committed to the buffer. So if you are interested in the text,
4005    /// connect to this signal.
4006    ///
4007    /// This signal is only emitted if the text at the given position
4008    /// is actually editable.
4009    /// ## `preedit`
4010    /// the current preedit string
4011    #[doc(alias = "preedit-changed")]
4012    fn connect_preedit_changed<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
4013        unsafe extern "C" fn preedit_changed_trampoline<
4014            P: IsA<TextView>,
4015            F: Fn(&P, &str) + 'static,
4016        >(
4017            this: *mut ffi::GtkTextView,
4018            preedit: *mut libc::c_char,
4019            f: glib::ffi::gpointer,
4020        ) {
4021            let f: &F = &*(f as *const F);
4022            f(
4023                TextView::from_glib_borrow(this).unsafe_cast_ref(),
4024                &glib::GString::from_glib_borrow(preedit),
4025            )
4026        }
4027        unsafe {
4028            let f: Box_<F> = Box_::new(f);
4029            connect_raw(
4030                self.as_ptr() as *mut _,
4031                b"preedit-changed\0".as_ptr() as *const _,
4032                Some(transmute::<_, unsafe extern "C" fn()>(
4033                    preedit_changed_trampoline::<Self, F> as *const (),
4034                )),
4035                Box_::into_raw(f),
4036            )
4037        }
4038    }
4039
4040    fn emit_preedit_changed(&self, preedit: &str) {
4041        self.emit_by_name::<()>("preedit-changed", &[&preedit]);
4042    }
4043
4044    /// The ::select-all signal is a
4045    /// [keybinding signal][GtkBindingSignal]
4046    /// which gets emitted to select or unselect the complete
4047    /// contents of the text view.
4048    ///
4049    /// The default bindings for this signal are Ctrl-a and Ctrl-/
4050    /// for selecting and Shift-Ctrl-a and Ctrl-\ for unselecting.
4051    /// ## `select`
4052    /// [`true`] to select, [`false`] to unselect
4053    #[doc(alias = "select-all")]
4054    fn connect_select_all<F: Fn(&Self, bool) + 'static>(&self, f: F) -> SignalHandlerId {
4055        unsafe extern "C" fn select_all_trampoline<P: IsA<TextView>, F: Fn(&P, bool) + 'static>(
4056            this: *mut ffi::GtkTextView,
4057            select: glib::ffi::gboolean,
4058            f: glib::ffi::gpointer,
4059        ) {
4060            let f: &F = &*(f as *const F);
4061            f(
4062                TextView::from_glib_borrow(this).unsafe_cast_ref(),
4063                from_glib(select),
4064            )
4065        }
4066        unsafe {
4067            let f: Box_<F> = Box_::new(f);
4068            connect_raw(
4069                self.as_ptr() as *mut _,
4070                b"select-all\0".as_ptr() as *const _,
4071                Some(transmute::<_, unsafe extern "C" fn()>(
4072                    select_all_trampoline::<Self, F> as *const (),
4073                )),
4074                Box_::into_raw(f),
4075            )
4076        }
4077    }
4078
4079    fn emit_select_all(&self, select: bool) {
4080        self.emit_by_name::<()>("select-all", &[&select]);
4081    }
4082
4083    /// The ::set-anchor signal is a
4084    /// [keybinding signal][GtkBindingSignal]
4085    /// which gets emitted when the user initiates setting the "anchor"
4086    /// mark. The "anchor" mark gets placed at the same position as the
4087    /// "insert" mark.
4088    ///
4089    /// This signal has no default bindings.
4090    #[doc(alias = "set-anchor")]
4091    fn connect_set_anchor<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4092        unsafe extern "C" fn set_anchor_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
4093            this: *mut ffi::GtkTextView,
4094            f: glib::ffi::gpointer,
4095        ) {
4096            let f: &F = &*(f as *const F);
4097            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4098        }
4099        unsafe {
4100            let f: Box_<F> = Box_::new(f);
4101            connect_raw(
4102                self.as_ptr() as *mut _,
4103                b"set-anchor\0".as_ptr() as *const _,
4104                Some(transmute::<_, unsafe extern "C" fn()>(
4105                    set_anchor_trampoline::<Self, F> as *const (),
4106                )),
4107                Box_::into_raw(f),
4108            )
4109        }
4110    }
4111
4112    fn emit_set_anchor(&self) {
4113        self.emit_by_name::<()>("set-anchor", &[]);
4114    }
4115
4116    /// The ::toggle-cursor-visible signal is a
4117    /// [keybinding signal][GtkBindingSignal]
4118    /// which gets emitted to toggle the [`cursor-visible`][struct@crate::TextView#cursor-visible]
4119    /// property.
4120    ///
4121    /// The default binding for this signal is F7.
4122    #[doc(alias = "toggle-cursor-visible")]
4123    fn connect_toggle_cursor_visible<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4124        unsafe extern "C" fn toggle_cursor_visible_trampoline<
4125            P: IsA<TextView>,
4126            F: Fn(&P) + 'static,
4127        >(
4128            this: *mut ffi::GtkTextView,
4129            f: glib::ffi::gpointer,
4130        ) {
4131            let f: &F = &*(f as *const F);
4132            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4133        }
4134        unsafe {
4135            let f: Box_<F> = Box_::new(f);
4136            connect_raw(
4137                self.as_ptr() as *mut _,
4138                b"toggle-cursor-visible\0".as_ptr() as *const _,
4139                Some(transmute::<_, unsafe extern "C" fn()>(
4140                    toggle_cursor_visible_trampoline::<Self, F> as *const (),
4141                )),
4142                Box_::into_raw(f),
4143            )
4144        }
4145    }
4146
4147    fn emit_toggle_cursor_visible(&self) {
4148        self.emit_by_name::<()>("toggle-cursor-visible", &[]);
4149    }
4150
4151    /// The ::toggle-overwrite signal is a
4152    /// [keybinding signal][GtkBindingSignal]
4153    /// which gets emitted to toggle the overwrite mode of the text view.
4154    ///
4155    /// The default bindings for this signal is Insert.
4156    #[doc(alias = "toggle-overwrite")]
4157    fn connect_toggle_overwrite<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4158        unsafe extern "C" fn toggle_overwrite_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
4159            this: *mut ffi::GtkTextView,
4160            f: glib::ffi::gpointer,
4161        ) {
4162            let f: &F = &*(f as *const F);
4163            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4164        }
4165        unsafe {
4166            let f: Box_<F> = Box_::new(f);
4167            connect_raw(
4168                self.as_ptr() as *mut _,
4169                b"toggle-overwrite\0".as_ptr() as *const _,
4170                Some(transmute::<_, unsafe extern "C" fn()>(
4171                    toggle_overwrite_trampoline::<Self, F> as *const (),
4172                )),
4173                Box_::into_raw(f),
4174            )
4175        }
4176    }
4177
4178    fn emit_toggle_overwrite(&self) {
4179        self.emit_by_name::<()>("toggle-overwrite", &[]);
4180    }
4181
4182    #[doc(alias = "accepts-tab")]
4183    fn connect_accepts_tab_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4184        unsafe extern "C" fn notify_accepts_tab_trampoline<
4185            P: IsA<TextView>,
4186            F: Fn(&P) + 'static,
4187        >(
4188            this: *mut ffi::GtkTextView,
4189            _param_spec: glib::ffi::gpointer,
4190            f: glib::ffi::gpointer,
4191        ) {
4192            let f: &F = &*(f as *const F);
4193            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4194        }
4195        unsafe {
4196            let f: Box_<F> = Box_::new(f);
4197            connect_raw(
4198                self.as_ptr() as *mut _,
4199                b"notify::accepts-tab\0".as_ptr() as *const _,
4200                Some(transmute::<_, unsafe extern "C" fn()>(
4201                    notify_accepts_tab_trampoline::<Self, F> as *const (),
4202                )),
4203                Box_::into_raw(f),
4204            )
4205        }
4206    }
4207
4208    #[doc(alias = "bottom-margin")]
4209    fn connect_bottom_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4210        unsafe extern "C" fn notify_bottom_margin_trampoline<
4211            P: IsA<TextView>,
4212            F: Fn(&P) + 'static,
4213        >(
4214            this: *mut ffi::GtkTextView,
4215            _param_spec: glib::ffi::gpointer,
4216            f: glib::ffi::gpointer,
4217        ) {
4218            let f: &F = &*(f as *const F);
4219            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4220        }
4221        unsafe {
4222            let f: Box_<F> = Box_::new(f);
4223            connect_raw(
4224                self.as_ptr() as *mut _,
4225                b"notify::bottom-margin\0".as_ptr() as *const _,
4226                Some(transmute::<_, unsafe extern "C" fn()>(
4227                    notify_bottom_margin_trampoline::<Self, F> as *const (),
4228                )),
4229                Box_::into_raw(f),
4230            )
4231        }
4232    }
4233
4234    #[doc(alias = "buffer")]
4235    fn connect_buffer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4236        unsafe extern "C" fn notify_buffer_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
4237            this: *mut ffi::GtkTextView,
4238            _param_spec: glib::ffi::gpointer,
4239            f: glib::ffi::gpointer,
4240        ) {
4241            let f: &F = &*(f as *const F);
4242            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4243        }
4244        unsafe {
4245            let f: Box_<F> = Box_::new(f);
4246            connect_raw(
4247                self.as_ptr() as *mut _,
4248                b"notify::buffer\0".as_ptr() as *const _,
4249                Some(transmute::<_, unsafe extern "C" fn()>(
4250                    notify_buffer_trampoline::<Self, F> as *const (),
4251                )),
4252                Box_::into_raw(f),
4253            )
4254        }
4255    }
4256
4257    #[doc(alias = "cursor-visible")]
4258    fn connect_cursor_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4259        unsafe extern "C" fn notify_cursor_visible_trampoline<
4260            P: IsA<TextView>,
4261            F: Fn(&P) + 'static,
4262        >(
4263            this: *mut ffi::GtkTextView,
4264            _param_spec: glib::ffi::gpointer,
4265            f: glib::ffi::gpointer,
4266        ) {
4267            let f: &F = &*(f as *const F);
4268            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4269        }
4270        unsafe {
4271            let f: Box_<F> = Box_::new(f);
4272            connect_raw(
4273                self.as_ptr() as *mut _,
4274                b"notify::cursor-visible\0".as_ptr() as *const _,
4275                Some(transmute::<_, unsafe extern "C" fn()>(
4276                    notify_cursor_visible_trampoline::<Self, F> as *const (),
4277                )),
4278                Box_::into_raw(f),
4279            )
4280        }
4281    }
4282
4283    #[doc(alias = "editable")]
4284    fn connect_editable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4285        unsafe extern "C" fn notify_editable_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
4286            this: *mut ffi::GtkTextView,
4287            _param_spec: glib::ffi::gpointer,
4288            f: glib::ffi::gpointer,
4289        ) {
4290            let f: &F = &*(f as *const F);
4291            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4292        }
4293        unsafe {
4294            let f: Box_<F> = Box_::new(f);
4295            connect_raw(
4296                self.as_ptr() as *mut _,
4297                b"notify::editable\0".as_ptr() as *const _,
4298                Some(transmute::<_, unsafe extern "C" fn()>(
4299                    notify_editable_trampoline::<Self, F> as *const (),
4300                )),
4301                Box_::into_raw(f),
4302            )
4303        }
4304    }
4305
4306    #[doc(alias = "im-module")]
4307    fn connect_im_module_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4308        unsafe extern "C" fn notify_im_module_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
4309            this: *mut ffi::GtkTextView,
4310            _param_spec: glib::ffi::gpointer,
4311            f: glib::ffi::gpointer,
4312        ) {
4313            let f: &F = &*(f as *const F);
4314            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4315        }
4316        unsafe {
4317            let f: Box_<F> = Box_::new(f);
4318            connect_raw(
4319                self.as_ptr() as *mut _,
4320                b"notify::im-module\0".as_ptr() as *const _,
4321                Some(transmute::<_, unsafe extern "C" fn()>(
4322                    notify_im_module_trampoline::<Self, F> as *const (),
4323                )),
4324                Box_::into_raw(f),
4325            )
4326        }
4327    }
4328
4329    #[doc(alias = "indent")]
4330    fn connect_indent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4331        unsafe extern "C" fn notify_indent_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
4332            this: *mut ffi::GtkTextView,
4333            _param_spec: glib::ffi::gpointer,
4334            f: glib::ffi::gpointer,
4335        ) {
4336            let f: &F = &*(f as *const F);
4337            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4338        }
4339        unsafe {
4340            let f: Box_<F> = Box_::new(f);
4341            connect_raw(
4342                self.as_ptr() as *mut _,
4343                b"notify::indent\0".as_ptr() as *const _,
4344                Some(transmute::<_, unsafe extern "C" fn()>(
4345                    notify_indent_trampoline::<Self, F> as *const (),
4346                )),
4347                Box_::into_raw(f),
4348            )
4349        }
4350    }
4351
4352    #[doc(alias = "input-hints")]
4353    fn connect_input_hints_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4354        unsafe extern "C" fn notify_input_hints_trampoline<
4355            P: IsA<TextView>,
4356            F: Fn(&P) + 'static,
4357        >(
4358            this: *mut ffi::GtkTextView,
4359            _param_spec: glib::ffi::gpointer,
4360            f: glib::ffi::gpointer,
4361        ) {
4362            let f: &F = &*(f as *const F);
4363            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4364        }
4365        unsafe {
4366            let f: Box_<F> = Box_::new(f);
4367            connect_raw(
4368                self.as_ptr() as *mut _,
4369                b"notify::input-hints\0".as_ptr() as *const _,
4370                Some(transmute::<_, unsafe extern "C" fn()>(
4371                    notify_input_hints_trampoline::<Self, F> as *const (),
4372                )),
4373                Box_::into_raw(f),
4374            )
4375        }
4376    }
4377
4378    #[doc(alias = "input-purpose")]
4379    fn connect_input_purpose_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4380        unsafe extern "C" fn notify_input_purpose_trampoline<
4381            P: IsA<TextView>,
4382            F: Fn(&P) + 'static,
4383        >(
4384            this: *mut ffi::GtkTextView,
4385            _param_spec: glib::ffi::gpointer,
4386            f: glib::ffi::gpointer,
4387        ) {
4388            let f: &F = &*(f as *const F);
4389            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4390        }
4391        unsafe {
4392            let f: Box_<F> = Box_::new(f);
4393            connect_raw(
4394                self.as_ptr() as *mut _,
4395                b"notify::input-purpose\0".as_ptr() as *const _,
4396                Some(transmute::<_, unsafe extern "C" fn()>(
4397                    notify_input_purpose_trampoline::<Self, F> as *const (),
4398                )),
4399                Box_::into_raw(f),
4400            )
4401        }
4402    }
4403
4404    #[doc(alias = "justification")]
4405    fn connect_justification_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4406        unsafe extern "C" fn notify_justification_trampoline<
4407            P: IsA<TextView>,
4408            F: Fn(&P) + 'static,
4409        >(
4410            this: *mut ffi::GtkTextView,
4411            _param_spec: glib::ffi::gpointer,
4412            f: glib::ffi::gpointer,
4413        ) {
4414            let f: &F = &*(f as *const F);
4415            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4416        }
4417        unsafe {
4418            let f: Box_<F> = Box_::new(f);
4419            connect_raw(
4420                self.as_ptr() as *mut _,
4421                b"notify::justification\0".as_ptr() as *const _,
4422                Some(transmute::<_, unsafe extern "C" fn()>(
4423                    notify_justification_trampoline::<Self, F> as *const (),
4424                )),
4425                Box_::into_raw(f),
4426            )
4427        }
4428    }
4429
4430    #[doc(alias = "left-margin")]
4431    fn connect_left_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4432        unsafe extern "C" fn notify_left_margin_trampoline<
4433            P: IsA<TextView>,
4434            F: Fn(&P) + 'static,
4435        >(
4436            this: *mut ffi::GtkTextView,
4437            _param_spec: glib::ffi::gpointer,
4438            f: glib::ffi::gpointer,
4439        ) {
4440            let f: &F = &*(f as *const F);
4441            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4442        }
4443        unsafe {
4444            let f: Box_<F> = Box_::new(f);
4445            connect_raw(
4446                self.as_ptr() as *mut _,
4447                b"notify::left-margin\0".as_ptr() as *const _,
4448                Some(transmute::<_, unsafe extern "C" fn()>(
4449                    notify_left_margin_trampoline::<Self, F> as *const (),
4450                )),
4451                Box_::into_raw(f),
4452            )
4453        }
4454    }
4455
4456    #[doc(alias = "monospace")]
4457    fn connect_monospace_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4458        unsafe extern "C" fn notify_monospace_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
4459            this: *mut ffi::GtkTextView,
4460            _param_spec: glib::ffi::gpointer,
4461            f: glib::ffi::gpointer,
4462        ) {
4463            let f: &F = &*(f as *const F);
4464            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4465        }
4466        unsafe {
4467            let f: Box_<F> = Box_::new(f);
4468            connect_raw(
4469                self.as_ptr() as *mut _,
4470                b"notify::monospace\0".as_ptr() as *const _,
4471                Some(transmute::<_, unsafe extern "C" fn()>(
4472                    notify_monospace_trampoline::<Self, F> as *const (),
4473                )),
4474                Box_::into_raw(f),
4475            )
4476        }
4477    }
4478
4479    #[doc(alias = "overwrite")]
4480    fn connect_overwrite_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4481        unsafe extern "C" fn notify_overwrite_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
4482            this: *mut ffi::GtkTextView,
4483            _param_spec: glib::ffi::gpointer,
4484            f: glib::ffi::gpointer,
4485        ) {
4486            let f: &F = &*(f as *const F);
4487            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4488        }
4489        unsafe {
4490            let f: Box_<F> = Box_::new(f);
4491            connect_raw(
4492                self.as_ptr() as *mut _,
4493                b"notify::overwrite\0".as_ptr() as *const _,
4494                Some(transmute::<_, unsafe extern "C" fn()>(
4495                    notify_overwrite_trampoline::<Self, F> as *const (),
4496                )),
4497                Box_::into_raw(f),
4498            )
4499        }
4500    }
4501
4502    #[doc(alias = "pixels-above-lines")]
4503    fn connect_pixels_above_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4504        unsafe extern "C" fn notify_pixels_above_lines_trampoline<
4505            P: IsA<TextView>,
4506            F: Fn(&P) + 'static,
4507        >(
4508            this: *mut ffi::GtkTextView,
4509            _param_spec: glib::ffi::gpointer,
4510            f: glib::ffi::gpointer,
4511        ) {
4512            let f: &F = &*(f as *const F);
4513            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4514        }
4515        unsafe {
4516            let f: Box_<F> = Box_::new(f);
4517            connect_raw(
4518                self.as_ptr() as *mut _,
4519                b"notify::pixels-above-lines\0".as_ptr() as *const _,
4520                Some(transmute::<_, unsafe extern "C" fn()>(
4521                    notify_pixels_above_lines_trampoline::<Self, F> as *const (),
4522                )),
4523                Box_::into_raw(f),
4524            )
4525        }
4526    }
4527
4528    #[doc(alias = "pixels-below-lines")]
4529    fn connect_pixels_below_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4530        unsafe extern "C" fn notify_pixels_below_lines_trampoline<
4531            P: IsA<TextView>,
4532            F: Fn(&P) + 'static,
4533        >(
4534            this: *mut ffi::GtkTextView,
4535            _param_spec: glib::ffi::gpointer,
4536            f: glib::ffi::gpointer,
4537        ) {
4538            let f: &F = &*(f as *const F);
4539            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4540        }
4541        unsafe {
4542            let f: Box_<F> = Box_::new(f);
4543            connect_raw(
4544                self.as_ptr() as *mut _,
4545                b"notify::pixels-below-lines\0".as_ptr() as *const _,
4546                Some(transmute::<_, unsafe extern "C" fn()>(
4547                    notify_pixels_below_lines_trampoline::<Self, F> as *const (),
4548                )),
4549                Box_::into_raw(f),
4550            )
4551        }
4552    }
4553
4554    #[doc(alias = "pixels-inside-wrap")]
4555    fn connect_pixels_inside_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4556        unsafe extern "C" fn notify_pixels_inside_wrap_trampoline<
4557            P: IsA<TextView>,
4558            F: Fn(&P) + 'static,
4559        >(
4560            this: *mut ffi::GtkTextView,
4561            _param_spec: glib::ffi::gpointer,
4562            f: glib::ffi::gpointer,
4563        ) {
4564            let f: &F = &*(f as *const F);
4565            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4566        }
4567        unsafe {
4568            let f: Box_<F> = Box_::new(f);
4569            connect_raw(
4570                self.as_ptr() as *mut _,
4571                b"notify::pixels-inside-wrap\0".as_ptr() as *const _,
4572                Some(transmute::<_, unsafe extern "C" fn()>(
4573                    notify_pixels_inside_wrap_trampoline::<Self, F> as *const (),
4574                )),
4575                Box_::into_raw(f),
4576            )
4577        }
4578    }
4579
4580    #[doc(alias = "populate-all")]
4581    fn connect_populate_all_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4582        unsafe extern "C" fn notify_populate_all_trampoline<
4583            P: IsA<TextView>,
4584            F: Fn(&P) + 'static,
4585        >(
4586            this: *mut ffi::GtkTextView,
4587            _param_spec: glib::ffi::gpointer,
4588            f: glib::ffi::gpointer,
4589        ) {
4590            let f: &F = &*(f as *const F);
4591            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4592        }
4593        unsafe {
4594            let f: Box_<F> = Box_::new(f);
4595            connect_raw(
4596                self.as_ptr() as *mut _,
4597                b"notify::populate-all\0".as_ptr() as *const _,
4598                Some(transmute::<_, unsafe extern "C" fn()>(
4599                    notify_populate_all_trampoline::<Self, F> as *const (),
4600                )),
4601                Box_::into_raw(f),
4602            )
4603        }
4604    }
4605
4606    #[doc(alias = "right-margin")]
4607    fn connect_right_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4608        unsafe extern "C" fn notify_right_margin_trampoline<
4609            P: IsA<TextView>,
4610            F: Fn(&P) + 'static,
4611        >(
4612            this: *mut ffi::GtkTextView,
4613            _param_spec: glib::ffi::gpointer,
4614            f: glib::ffi::gpointer,
4615        ) {
4616            let f: &F = &*(f as *const F);
4617            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4618        }
4619        unsafe {
4620            let f: Box_<F> = Box_::new(f);
4621            connect_raw(
4622                self.as_ptr() as *mut _,
4623                b"notify::right-margin\0".as_ptr() as *const _,
4624                Some(transmute::<_, unsafe extern "C" fn()>(
4625                    notify_right_margin_trampoline::<Self, F> as *const (),
4626                )),
4627                Box_::into_raw(f),
4628            )
4629        }
4630    }
4631
4632    #[doc(alias = "tabs")]
4633    fn connect_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4634        unsafe extern "C" fn notify_tabs_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
4635            this: *mut ffi::GtkTextView,
4636            _param_spec: glib::ffi::gpointer,
4637            f: glib::ffi::gpointer,
4638        ) {
4639            let f: &F = &*(f as *const F);
4640            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4641        }
4642        unsafe {
4643            let f: Box_<F> = Box_::new(f);
4644            connect_raw(
4645                self.as_ptr() as *mut _,
4646                b"notify::tabs\0".as_ptr() as *const _,
4647                Some(transmute::<_, unsafe extern "C" fn()>(
4648                    notify_tabs_trampoline::<Self, F> as *const (),
4649                )),
4650                Box_::into_raw(f),
4651            )
4652        }
4653    }
4654
4655    #[doc(alias = "top-margin")]
4656    fn connect_top_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4657        unsafe extern "C" fn notify_top_margin_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
4658            this: *mut ffi::GtkTextView,
4659            _param_spec: glib::ffi::gpointer,
4660            f: glib::ffi::gpointer,
4661        ) {
4662            let f: &F = &*(f as *const F);
4663            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4664        }
4665        unsafe {
4666            let f: Box_<F> = Box_::new(f);
4667            connect_raw(
4668                self.as_ptr() as *mut _,
4669                b"notify::top-margin\0".as_ptr() as *const _,
4670                Some(transmute::<_, unsafe extern "C" fn()>(
4671                    notify_top_margin_trampoline::<Self, F> as *const (),
4672                )),
4673                Box_::into_raw(f),
4674            )
4675        }
4676    }
4677
4678    #[doc(alias = "wrap-mode")]
4679    fn connect_wrap_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4680        unsafe extern "C" fn notify_wrap_mode_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
4681            this: *mut ffi::GtkTextView,
4682            _param_spec: glib::ffi::gpointer,
4683            f: glib::ffi::gpointer,
4684        ) {
4685            let f: &F = &*(f as *const F);
4686            f(TextView::from_glib_borrow(this).unsafe_cast_ref())
4687        }
4688        unsafe {
4689            let f: Box_<F> = Box_::new(f);
4690            connect_raw(
4691                self.as_ptr() as *mut _,
4692                b"notify::wrap-mode\0".as_ptr() as *const _,
4693                Some(transmute::<_, unsafe extern "C" fn()>(
4694                    notify_wrap_mode_trampoline::<Self, F> as *const (),
4695                )),
4696                Box_::into_raw(f),
4697            )
4698        }
4699    }
4700}
4701
4702impl<O: IsA<TextView>> TextViewExt for O {}
4703
4704impl fmt::Display for TextView {
4705    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
4706        f.write_str("TextView")
4707    }
4708}