1 // This file was generated by gir (https://github.com/gtk-rs/gir)
2 // from gir-files (https://github.com/gtk-rs/gir-files)
3 // DO NOT EDIT
4 
5 use crate::Adjustment;
6 use crate::Align;
7 use crate::Buildable;
8 use crate::Container;
9 use crate::DeleteType;
10 use crate::InputHints;
11 use crate::InputPurpose;
12 use crate::Justification;
13 use crate::MovementStep;
14 use crate::ResizeMode;
15 use crate::ScrollStep;
16 use crate::Scrollable;
17 use crate::ScrollablePolicy;
18 use crate::TextAttributes;
19 use crate::TextBuffer;
20 use crate::TextChildAnchor;
21 use crate::TextExtendSelection;
22 use crate::TextIter;
23 use crate::TextMark;
24 use crate::TextWindowType;
25 use crate::Widget;
26 use crate::WrapMode;
27 use glib::object::Cast;
28 use glib::object::IsA;
29 use glib::object::ObjectExt;
30 use glib::signal::connect_raw;
31 use glib::signal::SignalHandlerId;
32 use glib::translate::*;
33 use glib::StaticType;
34 use glib::ToValue;
35 use std::boxed::Box as Box_;
36 use std::fmt;
37 use std::mem;
38 use std::mem::transmute;
39 
40 glib::wrapper! {
41     #[doc(alias = "GtkTextView")]
42     pub struct TextView(Object<ffi::GtkTextView, ffi::GtkTextViewClass>) @extends Container, Widget, @implements Buildable, Scrollable;
43 
44     match fn {
45         type_ => || ffi::gtk_text_view_get_type(),
46     }
47 }
48 
49 impl TextView {
50     #[doc(alias = "gtk_text_view_new")]
new() -> TextView51     pub fn new() -> TextView {
52         assert_initialized_main_thread!();
53         unsafe { Widget::from_glib_none(ffi::gtk_text_view_new()).unsafe_cast() }
54     }
55 
56     #[doc(alias = "gtk_text_view_new_with_buffer")]
57     #[doc(alias = "new_with_buffer")]
with_buffer<P: IsA<TextBuffer>>(buffer: &P) -> TextView58     pub fn with_buffer<P: IsA<TextBuffer>>(buffer: &P) -> TextView {
59         skip_assert_initialized!();
60         unsafe {
61             Widget::from_glib_none(ffi::gtk_text_view_new_with_buffer(
62                 buffer.as_ref().to_glib_none().0,
63             ))
64             .unsafe_cast()
65         }
66     }
67 
68     // rustdoc-stripper-ignore-next
69     /// Creates a new builder-pattern struct instance to construct [`TextView`] objects.
70     ///
71     /// This method returns an instance of [`TextViewBuilder`] which can be used to create [`TextView`] objects.
builder() -> TextViewBuilder72     pub fn builder() -> TextViewBuilder {
73         TextViewBuilder::default()
74     }
75 }
76 
77 impl Default for TextView {
default() -> Self78     fn default() -> Self {
79         Self::new()
80     }
81 }
82 
83 #[derive(Clone, Default)]
84 // rustdoc-stripper-ignore-next
85 /// A [builder-pattern] type to construct [`TextView`] objects.
86 ///
87 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
88 pub struct TextViewBuilder {
89     accepts_tab: Option<bool>,
90     bottom_margin: Option<i32>,
91     buffer: Option<TextBuffer>,
92     cursor_visible: Option<bool>,
93     editable: Option<bool>,
94     im_module: Option<String>,
95     indent: Option<i32>,
96     input_hints: Option<InputHints>,
97     input_purpose: Option<InputPurpose>,
98     justification: Option<Justification>,
99     left_margin: Option<i32>,
100     monospace: Option<bool>,
101     overwrite: Option<bool>,
102     pixels_above_lines: Option<i32>,
103     pixels_below_lines: Option<i32>,
104     pixels_inside_wrap: Option<i32>,
105     populate_all: Option<bool>,
106     right_margin: Option<i32>,
107     tabs: Option<pango::TabArray>,
108     top_margin: Option<i32>,
109     wrap_mode: Option<WrapMode>,
110     border_width: Option<u32>,
111     child: Option<Widget>,
112     resize_mode: Option<ResizeMode>,
113     app_paintable: Option<bool>,
114     can_default: Option<bool>,
115     can_focus: Option<bool>,
116     events: Option<gdk::EventMask>,
117     expand: Option<bool>,
118     #[cfg(any(feature = "v3_20", feature = "dox"))]
119     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
120     focus_on_click: Option<bool>,
121     halign: Option<Align>,
122     has_default: Option<bool>,
123     has_focus: Option<bool>,
124     has_tooltip: Option<bool>,
125     height_request: Option<i32>,
126     hexpand: Option<bool>,
127     hexpand_set: Option<bool>,
128     is_focus: Option<bool>,
129     margin: Option<i32>,
130     margin_bottom: Option<i32>,
131     margin_end: Option<i32>,
132     margin_start: Option<i32>,
133     margin_top: Option<i32>,
134     name: Option<String>,
135     no_show_all: Option<bool>,
136     opacity: Option<f64>,
137     parent: Option<Container>,
138     receives_default: Option<bool>,
139     sensitive: Option<bool>,
140     tooltip_markup: Option<String>,
141     tooltip_text: Option<String>,
142     valign: Option<Align>,
143     vexpand: Option<bool>,
144     vexpand_set: Option<bool>,
145     visible: Option<bool>,
146     width_request: Option<i32>,
147     hadjustment: Option<Adjustment>,
148     hscroll_policy: Option<ScrollablePolicy>,
149     vadjustment: Option<Adjustment>,
150     vscroll_policy: Option<ScrollablePolicy>,
151 }
152 
153 impl TextViewBuilder {
154     // rustdoc-stripper-ignore-next
155     /// Create a new [`TextViewBuilder`].
new() -> Self156     pub fn new() -> Self {
157         Self::default()
158     }
159 
160     // rustdoc-stripper-ignore-next
161     /// Build the [`TextView`].
build(self) -> TextView162     pub fn build(self) -> TextView {
163         let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
164         if let Some(ref accepts_tab) = self.accepts_tab {
165             properties.push(("accepts-tab", accepts_tab));
166         }
167         if let Some(ref bottom_margin) = self.bottom_margin {
168             properties.push(("bottom-margin", bottom_margin));
169         }
170         if let Some(ref buffer) = self.buffer {
171             properties.push(("buffer", buffer));
172         }
173         if let Some(ref cursor_visible) = self.cursor_visible {
174             properties.push(("cursor-visible", cursor_visible));
175         }
176         if let Some(ref editable) = self.editable {
177             properties.push(("editable", editable));
178         }
179         if let Some(ref im_module) = self.im_module {
180             properties.push(("im-module", im_module));
181         }
182         if let Some(ref indent) = self.indent {
183             properties.push(("indent", indent));
184         }
185         if let Some(ref input_hints) = self.input_hints {
186             properties.push(("input-hints", input_hints));
187         }
188         if let Some(ref input_purpose) = self.input_purpose {
189             properties.push(("input-purpose", input_purpose));
190         }
191         if let Some(ref justification) = self.justification {
192             properties.push(("justification", justification));
193         }
194         if let Some(ref left_margin) = self.left_margin {
195             properties.push(("left-margin", left_margin));
196         }
197         if let Some(ref monospace) = self.monospace {
198             properties.push(("monospace", monospace));
199         }
200         if let Some(ref overwrite) = self.overwrite {
201             properties.push(("overwrite", overwrite));
202         }
203         if let Some(ref pixels_above_lines) = self.pixels_above_lines {
204             properties.push(("pixels-above-lines", pixels_above_lines));
205         }
206         if let Some(ref pixels_below_lines) = self.pixels_below_lines {
207             properties.push(("pixels-below-lines", pixels_below_lines));
208         }
209         if let Some(ref pixels_inside_wrap) = self.pixels_inside_wrap {
210             properties.push(("pixels-inside-wrap", pixels_inside_wrap));
211         }
212         if let Some(ref populate_all) = self.populate_all {
213             properties.push(("populate-all", populate_all));
214         }
215         if let Some(ref right_margin) = self.right_margin {
216             properties.push(("right-margin", right_margin));
217         }
218         if let Some(ref tabs) = self.tabs {
219             properties.push(("tabs", tabs));
220         }
221         if let Some(ref top_margin) = self.top_margin {
222             properties.push(("top-margin", top_margin));
223         }
224         if let Some(ref wrap_mode) = self.wrap_mode {
225             properties.push(("wrap-mode", wrap_mode));
226         }
227         if let Some(ref border_width) = self.border_width {
228             properties.push(("border-width", border_width));
229         }
230         if let Some(ref child) = self.child {
231             properties.push(("child", child));
232         }
233         if let Some(ref resize_mode) = self.resize_mode {
234             properties.push(("resize-mode", resize_mode));
235         }
236         if let Some(ref app_paintable) = self.app_paintable {
237             properties.push(("app-paintable", app_paintable));
238         }
239         if let Some(ref can_default) = self.can_default {
240             properties.push(("can-default", can_default));
241         }
242         if let Some(ref can_focus) = self.can_focus {
243             properties.push(("can-focus", can_focus));
244         }
245         if let Some(ref events) = self.events {
246             properties.push(("events", events));
247         }
248         if let Some(ref expand) = self.expand {
249             properties.push(("expand", expand));
250         }
251         #[cfg(any(feature = "v3_20", feature = "dox"))]
252         if let Some(ref focus_on_click) = self.focus_on_click {
253             properties.push(("focus-on-click", focus_on_click));
254         }
255         if let Some(ref halign) = self.halign {
256             properties.push(("halign", halign));
257         }
258         if let Some(ref has_default) = self.has_default {
259             properties.push(("has-default", has_default));
260         }
261         if let Some(ref has_focus) = self.has_focus {
262             properties.push(("has-focus", has_focus));
263         }
264         if let Some(ref has_tooltip) = self.has_tooltip {
265             properties.push(("has-tooltip", has_tooltip));
266         }
267         if let Some(ref height_request) = self.height_request {
268             properties.push(("height-request", height_request));
269         }
270         if let Some(ref hexpand) = self.hexpand {
271             properties.push(("hexpand", hexpand));
272         }
273         if let Some(ref hexpand_set) = self.hexpand_set {
274             properties.push(("hexpand-set", hexpand_set));
275         }
276         if let Some(ref is_focus) = self.is_focus {
277             properties.push(("is-focus", is_focus));
278         }
279         if let Some(ref margin) = self.margin {
280             properties.push(("margin", margin));
281         }
282         if let Some(ref margin_bottom) = self.margin_bottom {
283             properties.push(("margin-bottom", margin_bottom));
284         }
285         if let Some(ref margin_end) = self.margin_end {
286             properties.push(("margin-end", margin_end));
287         }
288         if let Some(ref margin_start) = self.margin_start {
289             properties.push(("margin-start", margin_start));
290         }
291         if let Some(ref margin_top) = self.margin_top {
292             properties.push(("margin-top", margin_top));
293         }
294         if let Some(ref name) = self.name {
295             properties.push(("name", name));
296         }
297         if let Some(ref no_show_all) = self.no_show_all {
298             properties.push(("no-show-all", no_show_all));
299         }
300         if let Some(ref opacity) = self.opacity {
301             properties.push(("opacity", opacity));
302         }
303         if let Some(ref parent) = self.parent {
304             properties.push(("parent", parent));
305         }
306         if let Some(ref receives_default) = self.receives_default {
307             properties.push(("receives-default", receives_default));
308         }
309         if let Some(ref sensitive) = self.sensitive {
310             properties.push(("sensitive", sensitive));
311         }
312         if let Some(ref tooltip_markup) = self.tooltip_markup {
313             properties.push(("tooltip-markup", tooltip_markup));
314         }
315         if let Some(ref tooltip_text) = self.tooltip_text {
316             properties.push(("tooltip-text", tooltip_text));
317         }
318         if let Some(ref valign) = self.valign {
319             properties.push(("valign", valign));
320         }
321         if let Some(ref vexpand) = self.vexpand {
322             properties.push(("vexpand", vexpand));
323         }
324         if let Some(ref vexpand_set) = self.vexpand_set {
325             properties.push(("vexpand-set", vexpand_set));
326         }
327         if let Some(ref visible) = self.visible {
328             properties.push(("visible", visible));
329         }
330         if let Some(ref width_request) = self.width_request {
331             properties.push(("width-request", width_request));
332         }
333         if let Some(ref hadjustment) = self.hadjustment {
334             properties.push(("hadjustment", hadjustment));
335         }
336         if let Some(ref hscroll_policy) = self.hscroll_policy {
337             properties.push(("hscroll-policy", hscroll_policy));
338         }
339         if let Some(ref vadjustment) = self.vadjustment {
340             properties.push(("vadjustment", vadjustment));
341         }
342         if let Some(ref vscroll_policy) = self.vscroll_policy {
343             properties.push(("vscroll-policy", vscroll_policy));
344         }
345         glib::Object::new::<TextView>(&properties)
346             .expect("Failed to create an instance of TextView")
347     }
348 
accepts_tab(mut self, accepts_tab: bool) -> Self349     pub fn accepts_tab(mut self, accepts_tab: bool) -> Self {
350         self.accepts_tab = Some(accepts_tab);
351         self
352     }
353 
bottom_margin(mut self, bottom_margin: i32) -> Self354     pub fn bottom_margin(mut self, bottom_margin: i32) -> Self {
355         self.bottom_margin = Some(bottom_margin);
356         self
357     }
358 
buffer<P: IsA<TextBuffer>>(mut self, buffer: &P) -> Self359     pub fn buffer<P: IsA<TextBuffer>>(mut self, buffer: &P) -> Self {
360         self.buffer = Some(buffer.clone().upcast());
361         self
362     }
363 
cursor_visible(mut self, cursor_visible: bool) -> Self364     pub fn cursor_visible(mut self, cursor_visible: bool) -> Self {
365         self.cursor_visible = Some(cursor_visible);
366         self
367     }
368 
editable(mut self, editable: bool) -> Self369     pub fn editable(mut self, editable: bool) -> Self {
370         self.editable = Some(editable);
371         self
372     }
373 
im_module(mut self, im_module: &str) -> Self374     pub fn im_module(mut self, im_module: &str) -> Self {
375         self.im_module = Some(im_module.to_string());
376         self
377     }
378 
indent(mut self, indent: i32) -> Self379     pub fn indent(mut self, indent: i32) -> Self {
380         self.indent = Some(indent);
381         self
382     }
383 
input_hints(mut self, input_hints: InputHints) -> Self384     pub fn input_hints(mut self, input_hints: InputHints) -> Self {
385         self.input_hints = Some(input_hints);
386         self
387     }
388 
input_purpose(mut self, input_purpose: InputPurpose) -> Self389     pub fn input_purpose(mut self, input_purpose: InputPurpose) -> Self {
390         self.input_purpose = Some(input_purpose);
391         self
392     }
393 
justification(mut self, justification: Justification) -> Self394     pub fn justification(mut self, justification: Justification) -> Self {
395         self.justification = Some(justification);
396         self
397     }
398 
left_margin(mut self, left_margin: i32) -> Self399     pub fn left_margin(mut self, left_margin: i32) -> Self {
400         self.left_margin = Some(left_margin);
401         self
402     }
403 
monospace(mut self, monospace: bool) -> Self404     pub fn monospace(mut self, monospace: bool) -> Self {
405         self.monospace = Some(monospace);
406         self
407     }
408 
overwrite(mut self, overwrite: bool) -> Self409     pub fn overwrite(mut self, overwrite: bool) -> Self {
410         self.overwrite = Some(overwrite);
411         self
412     }
413 
pixels_above_lines(mut self, pixels_above_lines: i32) -> Self414     pub fn pixels_above_lines(mut self, pixels_above_lines: i32) -> Self {
415         self.pixels_above_lines = Some(pixels_above_lines);
416         self
417     }
418 
pixels_below_lines(mut self, pixels_below_lines: i32) -> Self419     pub fn pixels_below_lines(mut self, pixels_below_lines: i32) -> Self {
420         self.pixels_below_lines = Some(pixels_below_lines);
421         self
422     }
423 
pixels_inside_wrap(mut self, pixels_inside_wrap: i32) -> Self424     pub fn pixels_inside_wrap(mut self, pixels_inside_wrap: i32) -> Self {
425         self.pixels_inside_wrap = Some(pixels_inside_wrap);
426         self
427     }
428 
populate_all(mut self, populate_all: bool) -> Self429     pub fn populate_all(mut self, populate_all: bool) -> Self {
430         self.populate_all = Some(populate_all);
431         self
432     }
433 
right_margin(mut self, right_margin: i32) -> Self434     pub fn right_margin(mut self, right_margin: i32) -> Self {
435         self.right_margin = Some(right_margin);
436         self
437     }
438 
tabs(mut self, tabs: &pango::TabArray) -> Self439     pub fn tabs(mut self, tabs: &pango::TabArray) -> Self {
440         self.tabs = Some(tabs.clone());
441         self
442     }
443 
top_margin(mut self, top_margin: i32) -> Self444     pub fn top_margin(mut self, top_margin: i32) -> Self {
445         self.top_margin = Some(top_margin);
446         self
447     }
448 
wrap_mode(mut self, wrap_mode: WrapMode) -> Self449     pub fn wrap_mode(mut self, wrap_mode: WrapMode) -> Self {
450         self.wrap_mode = Some(wrap_mode);
451         self
452     }
453 
border_width(mut self, border_width: u32) -> Self454     pub fn border_width(mut self, border_width: u32) -> Self {
455         self.border_width = Some(border_width);
456         self
457     }
458 
child<P: IsA<Widget>>(mut self, child: &P) -> Self459     pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self {
460         self.child = Some(child.clone().upcast());
461         self
462     }
463 
resize_mode(mut self, resize_mode: ResizeMode) -> Self464     pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
465         self.resize_mode = Some(resize_mode);
466         self
467     }
468 
app_paintable(mut self, app_paintable: bool) -> Self469     pub fn app_paintable(mut self, app_paintable: bool) -> Self {
470         self.app_paintable = Some(app_paintable);
471         self
472     }
473 
can_default(mut self, can_default: bool) -> Self474     pub fn can_default(mut self, can_default: bool) -> Self {
475         self.can_default = Some(can_default);
476         self
477     }
478 
can_focus(mut self, can_focus: bool) -> Self479     pub fn can_focus(mut self, can_focus: bool) -> Self {
480         self.can_focus = Some(can_focus);
481         self
482     }
483 
events(mut self, events: gdk::EventMask) -> Self484     pub fn events(mut self, events: gdk::EventMask) -> Self {
485         self.events = Some(events);
486         self
487     }
488 
expand(mut self, expand: bool) -> Self489     pub fn expand(mut self, expand: bool) -> Self {
490         self.expand = Some(expand);
491         self
492     }
493 
494     #[cfg(any(feature = "v3_20", feature = "dox"))]
495     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
focus_on_click(mut self, focus_on_click: bool) -> Self496     pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
497         self.focus_on_click = Some(focus_on_click);
498         self
499     }
500 
halign(mut self, halign: Align) -> Self501     pub fn halign(mut self, halign: Align) -> Self {
502         self.halign = Some(halign);
503         self
504     }
505 
has_default(mut self, has_default: bool) -> Self506     pub fn has_default(mut self, has_default: bool) -> Self {
507         self.has_default = Some(has_default);
508         self
509     }
510 
has_focus(mut self, has_focus: bool) -> Self511     pub fn has_focus(mut self, has_focus: bool) -> Self {
512         self.has_focus = Some(has_focus);
513         self
514     }
515 
has_tooltip(mut self, has_tooltip: bool) -> Self516     pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
517         self.has_tooltip = Some(has_tooltip);
518         self
519     }
520 
height_request(mut self, height_request: i32) -> Self521     pub fn height_request(mut self, height_request: i32) -> Self {
522         self.height_request = Some(height_request);
523         self
524     }
525 
hexpand(mut self, hexpand: bool) -> Self526     pub fn hexpand(mut self, hexpand: bool) -> Self {
527         self.hexpand = Some(hexpand);
528         self
529     }
530 
hexpand_set(mut self, hexpand_set: bool) -> Self531     pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
532         self.hexpand_set = Some(hexpand_set);
533         self
534     }
535 
is_focus(mut self, is_focus: bool) -> Self536     pub fn is_focus(mut self, is_focus: bool) -> Self {
537         self.is_focus = Some(is_focus);
538         self
539     }
540 
margin(mut self, margin: i32) -> Self541     pub fn margin(mut self, margin: i32) -> Self {
542         self.margin = Some(margin);
543         self
544     }
545 
margin_bottom(mut self, margin_bottom: i32) -> Self546     pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
547         self.margin_bottom = Some(margin_bottom);
548         self
549     }
550 
margin_end(mut self, margin_end: i32) -> Self551     pub fn margin_end(mut self, margin_end: i32) -> Self {
552         self.margin_end = Some(margin_end);
553         self
554     }
555 
margin_start(mut self, margin_start: i32) -> Self556     pub fn margin_start(mut self, margin_start: i32) -> Self {
557         self.margin_start = Some(margin_start);
558         self
559     }
560 
margin_top(mut self, margin_top: i32) -> Self561     pub fn margin_top(mut self, margin_top: i32) -> Self {
562         self.margin_top = Some(margin_top);
563         self
564     }
565 
name(mut self, name: &str) -> Self566     pub fn name(mut self, name: &str) -> Self {
567         self.name = Some(name.to_string());
568         self
569     }
570 
no_show_all(mut self, no_show_all: bool) -> Self571     pub fn no_show_all(mut self, no_show_all: bool) -> Self {
572         self.no_show_all = Some(no_show_all);
573         self
574     }
575 
opacity(mut self, opacity: f64) -> Self576     pub fn opacity(mut self, opacity: f64) -> Self {
577         self.opacity = Some(opacity);
578         self
579     }
580 
parent<P: IsA<Container>>(mut self, parent: &P) -> Self581     pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self {
582         self.parent = Some(parent.clone().upcast());
583         self
584     }
585 
receives_default(mut self, receives_default: bool) -> Self586     pub fn receives_default(mut self, receives_default: bool) -> Self {
587         self.receives_default = Some(receives_default);
588         self
589     }
590 
sensitive(mut self, sensitive: bool) -> Self591     pub fn sensitive(mut self, sensitive: bool) -> Self {
592         self.sensitive = Some(sensitive);
593         self
594     }
595 
tooltip_markup(mut self, tooltip_markup: &str) -> Self596     pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
597         self.tooltip_markup = Some(tooltip_markup.to_string());
598         self
599     }
600 
tooltip_text(mut self, tooltip_text: &str) -> Self601     pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
602         self.tooltip_text = Some(tooltip_text.to_string());
603         self
604     }
605 
valign(mut self, valign: Align) -> Self606     pub fn valign(mut self, valign: Align) -> Self {
607         self.valign = Some(valign);
608         self
609     }
610 
vexpand(mut self, vexpand: bool) -> Self611     pub fn vexpand(mut self, vexpand: bool) -> Self {
612         self.vexpand = Some(vexpand);
613         self
614     }
615 
vexpand_set(mut self, vexpand_set: bool) -> Self616     pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
617         self.vexpand_set = Some(vexpand_set);
618         self
619     }
620 
visible(mut self, visible: bool) -> Self621     pub fn visible(mut self, visible: bool) -> Self {
622         self.visible = Some(visible);
623         self
624     }
625 
width_request(mut self, width_request: i32) -> Self626     pub fn width_request(mut self, width_request: i32) -> Self {
627         self.width_request = Some(width_request);
628         self
629     }
630 
hadjustment<P: IsA<Adjustment>>(mut self, hadjustment: &P) -> Self631     pub fn hadjustment<P: IsA<Adjustment>>(mut self, hadjustment: &P) -> Self {
632         self.hadjustment = Some(hadjustment.clone().upcast());
633         self
634     }
635 
hscroll_policy(mut self, hscroll_policy: ScrollablePolicy) -> Self636     pub fn hscroll_policy(mut self, hscroll_policy: ScrollablePolicy) -> Self {
637         self.hscroll_policy = Some(hscroll_policy);
638         self
639     }
640 
vadjustment<P: IsA<Adjustment>>(mut self, vadjustment: &P) -> Self641     pub fn vadjustment<P: IsA<Adjustment>>(mut self, vadjustment: &P) -> Self {
642         self.vadjustment = Some(vadjustment.clone().upcast());
643         self
644     }
645 
vscroll_policy(mut self, vscroll_policy: ScrollablePolicy) -> Self646     pub fn vscroll_policy(mut self, vscroll_policy: ScrollablePolicy) -> Self {
647         self.vscroll_policy = Some(vscroll_policy);
648         self
649     }
650 }
651 
652 pub const NONE_TEXT_VIEW: Option<&TextView> = None;
653 
654 pub trait TextViewExt: 'static {
655     #[doc(alias = "gtk_text_view_add_child_at_anchor")]
add_child_at_anchor<P: IsA<Widget>, Q: IsA<TextChildAnchor>>(&self, child: &P, anchor: &Q)656     fn add_child_at_anchor<P: IsA<Widget>, Q: IsA<TextChildAnchor>>(&self, child: &P, anchor: &Q);
657 
658     #[doc(alias = "gtk_text_view_add_child_in_window")]
add_child_in_window<P: IsA<Widget>>( &self, child: &P, which_window: TextWindowType, xpos: i32, ypos: i32, )659     fn add_child_in_window<P: IsA<Widget>>(
660         &self,
661         child: &P,
662         which_window: TextWindowType,
663         xpos: i32,
664         ypos: i32,
665     );
666 
667     #[doc(alias = "gtk_text_view_backward_display_line")]
backward_display_line(&self, iter: &mut TextIter) -> bool668     fn backward_display_line(&self, iter: &mut TextIter) -> bool;
669 
670     #[doc(alias = "gtk_text_view_backward_display_line_start")]
backward_display_line_start(&self, iter: &mut TextIter) -> bool671     fn backward_display_line_start(&self, iter: &mut TextIter) -> bool;
672 
673     #[doc(alias = "gtk_text_view_buffer_to_window_coords")]
buffer_to_window_coords( &self, win: TextWindowType, buffer_x: i32, buffer_y: i32, ) -> (i32, i32)674     fn buffer_to_window_coords(
675         &self,
676         win: TextWindowType,
677         buffer_x: i32,
678         buffer_y: i32,
679     ) -> (i32, i32);
680 
681     #[doc(alias = "gtk_text_view_forward_display_line")]
forward_display_line(&self, iter: &mut TextIter) -> bool682     fn forward_display_line(&self, iter: &mut TextIter) -> bool;
683 
684     #[doc(alias = "gtk_text_view_forward_display_line_end")]
forward_display_line_end(&self, iter: &mut TextIter) -> bool685     fn forward_display_line_end(&self, iter: &mut TextIter) -> bool;
686 
687     #[doc(alias = "gtk_text_view_get_accepts_tab")]
688     #[doc(alias = "get_accepts_tab")]
accepts_tab(&self) -> bool689     fn accepts_tab(&self) -> bool;
690 
691     #[doc(alias = "gtk_text_view_get_border_window_size")]
692     #[doc(alias = "get_border_window_size")]
border_window_size(&self, type_: TextWindowType) -> i32693     fn border_window_size(&self, type_: TextWindowType) -> i32;
694 
695     #[doc(alias = "gtk_text_view_get_bottom_margin")]
696     #[doc(alias = "get_bottom_margin")]
bottom_margin(&self) -> i32697     fn bottom_margin(&self) -> i32;
698 
699     #[doc(alias = "gtk_text_view_get_buffer")]
700     #[doc(alias = "get_buffer")]
buffer(&self) -> Option<TextBuffer>701     fn buffer(&self) -> Option<TextBuffer>;
702 
703     #[doc(alias = "gtk_text_view_get_cursor_locations")]
704     #[doc(alias = "get_cursor_locations")]
cursor_locations(&self, iter: Option<&TextIter>) -> (gdk::Rectangle, gdk::Rectangle)705     fn cursor_locations(&self, iter: Option<&TextIter>) -> (gdk::Rectangle, gdk::Rectangle);
706 
707     #[doc(alias = "gtk_text_view_get_cursor_visible")]
708     #[doc(alias = "get_cursor_visible")]
is_cursor_visible(&self) -> bool709     fn is_cursor_visible(&self) -> bool;
710 
711     #[doc(alias = "gtk_text_view_get_default_attributes")]
712     #[doc(alias = "get_default_attributes")]
default_attributes(&self) -> TextAttributes713     fn default_attributes(&self) -> TextAttributes;
714 
715     #[doc(alias = "gtk_text_view_get_editable")]
716     #[doc(alias = "get_editable")]
is_editable(&self) -> bool717     fn is_editable(&self) -> bool;
718 
719     #[doc(alias = "gtk_text_view_get_indent")]
720     #[doc(alias = "get_indent")]
indent(&self) -> i32721     fn indent(&self) -> i32;
722 
723     #[doc(alias = "gtk_text_view_get_input_hints")]
724     #[doc(alias = "get_input_hints")]
input_hints(&self) -> InputHints725     fn input_hints(&self) -> InputHints;
726 
727     #[doc(alias = "gtk_text_view_get_input_purpose")]
728     #[doc(alias = "get_input_purpose")]
input_purpose(&self) -> InputPurpose729     fn input_purpose(&self) -> InputPurpose;
730 
731     #[doc(alias = "gtk_text_view_get_iter_at_location")]
732     #[doc(alias = "get_iter_at_location")]
iter_at_location(&self, x: i32, y: i32) -> Option<TextIter>733     fn iter_at_location(&self, x: i32, y: i32) -> Option<TextIter>;
734 
735     #[doc(alias = "gtk_text_view_get_iter_at_position")]
736     #[doc(alias = "get_iter_at_position")]
iter_at_position(&self, x: i32, y: i32) -> Option<(TextIter, i32)>737     fn iter_at_position(&self, x: i32, y: i32) -> Option<(TextIter, i32)>;
738 
739     #[doc(alias = "gtk_text_view_get_iter_location")]
740     #[doc(alias = "get_iter_location")]
iter_location(&self, iter: &TextIter) -> gdk::Rectangle741     fn iter_location(&self, iter: &TextIter) -> gdk::Rectangle;
742 
743     #[doc(alias = "gtk_text_view_get_justification")]
744     #[doc(alias = "get_justification")]
justification(&self) -> Justification745     fn justification(&self) -> Justification;
746 
747     #[doc(alias = "gtk_text_view_get_left_margin")]
748     #[doc(alias = "get_left_margin")]
left_margin(&self) -> i32749     fn left_margin(&self) -> i32;
750 
751     #[doc(alias = "gtk_text_view_get_line_at_y")]
752     #[doc(alias = "get_line_at_y")]
line_at_y(&self, y: i32) -> (TextIter, i32)753     fn line_at_y(&self, y: i32) -> (TextIter, i32);
754 
755     #[doc(alias = "gtk_text_view_get_line_yrange")]
756     #[doc(alias = "get_line_yrange")]
line_yrange(&self, iter: &TextIter) -> (i32, i32)757     fn line_yrange(&self, iter: &TextIter) -> (i32, i32);
758 
759     #[doc(alias = "gtk_text_view_get_monospace")]
760     #[doc(alias = "get_monospace")]
is_monospace(&self) -> bool761     fn is_monospace(&self) -> bool;
762 
763     #[doc(alias = "gtk_text_view_get_overwrite")]
764     #[doc(alias = "get_overwrite")]
overwrites(&self) -> bool765     fn overwrites(&self) -> bool;
766 
767     #[doc(alias = "gtk_text_view_get_pixels_above_lines")]
768     #[doc(alias = "get_pixels_above_lines")]
pixels_above_lines(&self) -> i32769     fn pixels_above_lines(&self) -> i32;
770 
771     #[doc(alias = "gtk_text_view_get_pixels_below_lines")]
772     #[doc(alias = "get_pixels_below_lines")]
pixels_below_lines(&self) -> i32773     fn pixels_below_lines(&self) -> i32;
774 
775     #[doc(alias = "gtk_text_view_get_pixels_inside_wrap")]
776     #[doc(alias = "get_pixels_inside_wrap")]
pixels_inside_wrap(&self) -> i32777     fn pixels_inside_wrap(&self) -> i32;
778 
779     #[doc(alias = "gtk_text_view_get_right_margin")]
780     #[doc(alias = "get_right_margin")]
right_margin(&self) -> i32781     fn right_margin(&self) -> i32;
782 
783     #[doc(alias = "gtk_text_view_get_tabs")]
784     #[doc(alias = "get_tabs")]
tabs(&self) -> Option<pango::TabArray>785     fn tabs(&self) -> Option<pango::TabArray>;
786 
787     #[doc(alias = "gtk_text_view_get_top_margin")]
788     #[doc(alias = "get_top_margin")]
top_margin(&self) -> i32789     fn top_margin(&self) -> i32;
790 
791     #[doc(alias = "gtk_text_view_get_visible_rect")]
792     #[doc(alias = "get_visible_rect")]
visible_rect(&self) -> gdk::Rectangle793     fn visible_rect(&self) -> gdk::Rectangle;
794 
795     #[doc(alias = "gtk_text_view_get_window")]
796     #[doc(alias = "get_window")]
window(&self, win: TextWindowType) -> Option<gdk::Window>797     fn window(&self, win: TextWindowType) -> Option<gdk::Window>;
798 
799     #[doc(alias = "gtk_text_view_get_window_type")]
800     #[doc(alias = "get_window_type")]
window_type(&self, window: &gdk::Window) -> TextWindowType801     fn window_type(&self, window: &gdk::Window) -> TextWindowType;
802 
803     #[doc(alias = "gtk_text_view_get_wrap_mode")]
804     #[doc(alias = "get_wrap_mode")]
wrap_mode(&self) -> WrapMode805     fn wrap_mode(&self) -> WrapMode;
806 
807     #[doc(alias = "gtk_text_view_im_context_filter_keypress")]
im_context_filter_keypress(&self, event: &gdk::EventKey) -> bool808     fn im_context_filter_keypress(&self, event: &gdk::EventKey) -> bool;
809 
810     #[doc(alias = "gtk_text_view_move_child")]
move_child<P: IsA<Widget>>(&self, child: &P, xpos: i32, ypos: i32)811     fn move_child<P: IsA<Widget>>(&self, child: &P, xpos: i32, ypos: i32);
812 
813     #[doc(alias = "gtk_text_view_move_mark_onscreen")]
move_mark_onscreen<P: IsA<TextMark>>(&self, mark: &P) -> bool814     fn move_mark_onscreen<P: IsA<TextMark>>(&self, mark: &P) -> bool;
815 
816     #[doc(alias = "gtk_text_view_move_visually")]
move_visually(&self, iter: &mut TextIter, count: i32) -> bool817     fn move_visually(&self, iter: &mut TextIter, count: i32) -> bool;
818 
819     #[doc(alias = "gtk_text_view_place_cursor_onscreen")]
place_cursor_onscreen(&self) -> bool820     fn place_cursor_onscreen(&self) -> bool;
821 
822     #[cfg(any(feature = "v3_20", feature = "dox"))]
823     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
824     #[doc(alias = "gtk_text_view_reset_cursor_blink")]
reset_cursor_blink(&self)825     fn reset_cursor_blink(&self);
826 
827     #[doc(alias = "gtk_text_view_reset_im_context")]
reset_im_context(&self)828     fn reset_im_context(&self);
829 
830     #[doc(alias = "gtk_text_view_scroll_mark_onscreen")]
scroll_mark_onscreen<P: IsA<TextMark>>(&self, mark: &P)831     fn scroll_mark_onscreen<P: IsA<TextMark>>(&self, mark: &P);
832 
833     #[doc(alias = "gtk_text_view_scroll_to_iter")]
scroll_to_iter( &self, iter: &mut TextIter, within_margin: f64, use_align: bool, xalign: f64, yalign: f64, ) -> bool834     fn scroll_to_iter(
835         &self,
836         iter: &mut TextIter,
837         within_margin: f64,
838         use_align: bool,
839         xalign: f64,
840         yalign: f64,
841     ) -> bool;
842 
843     #[doc(alias = "gtk_text_view_scroll_to_mark")]
scroll_to_mark<P: IsA<TextMark>>( &self, mark: &P, within_margin: f64, use_align: bool, xalign: f64, yalign: f64, )844     fn scroll_to_mark<P: IsA<TextMark>>(
845         &self,
846         mark: &P,
847         within_margin: f64,
848         use_align: bool,
849         xalign: f64,
850         yalign: f64,
851     );
852 
853     #[doc(alias = "gtk_text_view_set_accepts_tab")]
set_accepts_tab(&self, accepts_tab: bool)854     fn set_accepts_tab(&self, accepts_tab: bool);
855 
856     #[doc(alias = "gtk_text_view_set_border_window_size")]
set_border_window_size(&self, type_: TextWindowType, size: i32)857     fn set_border_window_size(&self, type_: TextWindowType, size: i32);
858 
859     #[doc(alias = "gtk_text_view_set_bottom_margin")]
set_bottom_margin(&self, bottom_margin: i32)860     fn set_bottom_margin(&self, bottom_margin: i32);
861 
862     #[doc(alias = "gtk_text_view_set_buffer")]
set_buffer<P: IsA<TextBuffer>>(&self, buffer: Option<&P>)863     fn set_buffer<P: IsA<TextBuffer>>(&self, buffer: Option<&P>);
864 
865     #[doc(alias = "gtk_text_view_set_cursor_visible")]
set_cursor_visible(&self, setting: bool)866     fn set_cursor_visible(&self, setting: bool);
867 
868     #[doc(alias = "gtk_text_view_set_editable")]
set_editable(&self, setting: bool)869     fn set_editable(&self, setting: bool);
870 
871     #[doc(alias = "gtk_text_view_set_indent")]
set_indent(&self, indent: i32)872     fn set_indent(&self, indent: i32);
873 
874     #[doc(alias = "gtk_text_view_set_input_hints")]
set_input_hints(&self, hints: InputHints)875     fn set_input_hints(&self, hints: InputHints);
876 
877     #[doc(alias = "gtk_text_view_set_input_purpose")]
set_input_purpose(&self, purpose: InputPurpose)878     fn set_input_purpose(&self, purpose: InputPurpose);
879 
880     #[doc(alias = "gtk_text_view_set_justification")]
set_justification(&self, justification: Justification)881     fn set_justification(&self, justification: Justification);
882 
883     #[doc(alias = "gtk_text_view_set_left_margin")]
set_left_margin(&self, left_margin: i32)884     fn set_left_margin(&self, left_margin: i32);
885 
886     #[doc(alias = "gtk_text_view_set_monospace")]
set_monospace(&self, monospace: bool)887     fn set_monospace(&self, monospace: bool);
888 
889     #[doc(alias = "gtk_text_view_set_overwrite")]
set_overwrite(&self, overwrite: bool)890     fn set_overwrite(&self, overwrite: bool);
891 
892     #[doc(alias = "gtk_text_view_set_pixels_above_lines")]
set_pixels_above_lines(&self, pixels_above_lines: i32)893     fn set_pixels_above_lines(&self, pixels_above_lines: i32);
894 
895     #[doc(alias = "gtk_text_view_set_pixels_below_lines")]
set_pixels_below_lines(&self, pixels_below_lines: i32)896     fn set_pixels_below_lines(&self, pixels_below_lines: i32);
897 
898     #[doc(alias = "gtk_text_view_set_pixels_inside_wrap")]
set_pixels_inside_wrap(&self, pixels_inside_wrap: i32)899     fn set_pixels_inside_wrap(&self, pixels_inside_wrap: i32);
900 
901     #[doc(alias = "gtk_text_view_set_right_margin")]
set_right_margin(&self, right_margin: i32)902     fn set_right_margin(&self, right_margin: i32);
903 
904     #[doc(alias = "gtk_text_view_set_tabs")]
set_tabs(&self, tabs: &pango::TabArray)905     fn set_tabs(&self, tabs: &pango::TabArray);
906 
907     #[doc(alias = "gtk_text_view_set_top_margin")]
set_top_margin(&self, top_margin: i32)908     fn set_top_margin(&self, top_margin: i32);
909 
910     #[doc(alias = "gtk_text_view_set_wrap_mode")]
set_wrap_mode(&self, wrap_mode: WrapMode)911     fn set_wrap_mode(&self, wrap_mode: WrapMode);
912 
913     #[doc(alias = "gtk_text_view_starts_display_line")]
starts_display_line(&self, iter: &TextIter) -> bool914     fn starts_display_line(&self, iter: &TextIter) -> bool;
915 
916     #[doc(alias = "gtk_text_view_window_to_buffer_coords")]
window_to_buffer_coords( &self, win: TextWindowType, window_x: i32, window_y: i32, ) -> (i32, i32)917     fn window_to_buffer_coords(
918         &self,
919         win: TextWindowType,
920         window_x: i32,
921         window_y: i32,
922     ) -> (i32, i32);
923 
924     #[doc(alias = "im-module")]
im_module(&self) -> Option<glib::GString>925     fn im_module(&self) -> Option<glib::GString>;
926 
927     #[doc(alias = "im-module")]
set_im_module(&self, im_module: Option<&str>)928     fn set_im_module(&self, im_module: Option<&str>);
929 
930     #[doc(alias = "populate-all")]
populates_all(&self) -> bool931     fn populates_all(&self) -> bool;
932 
933     #[doc(alias = "populate-all")]
set_populate_all(&self, populate_all: bool)934     fn set_populate_all(&self, populate_all: bool);
935 
936     #[doc(alias = "backspace")]
connect_backspace<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId937     fn connect_backspace<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
938 
emit_backspace(&self)939     fn emit_backspace(&self);
940 
941     #[doc(alias = "copy-clipboard")]
connect_copy_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId942     fn connect_copy_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
943 
emit_copy_clipboard(&self)944     fn emit_copy_clipboard(&self);
945 
946     #[doc(alias = "cut-clipboard")]
connect_cut_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId947     fn connect_cut_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
948 
emit_cut_clipboard(&self)949     fn emit_cut_clipboard(&self);
950 
951     #[doc(alias = "delete-from-cursor")]
connect_delete_from_cursor<F: Fn(&Self, DeleteType, i32) + 'static>( &self, f: F, ) -> SignalHandlerId952     fn connect_delete_from_cursor<F: Fn(&Self, DeleteType, i32) + 'static>(
953         &self,
954         f: F,
955     ) -> SignalHandlerId;
956 
emit_delete_from_cursor(&self, type_: DeleteType, count: i32)957     fn emit_delete_from_cursor(&self, type_: DeleteType, count: i32);
958 
959     #[doc(alias = "extend-selection")]
connect_extend_selection< F: Fn(&Self, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> glib::signal::Inhibit + 'static, >( &self, f: F, ) -> SignalHandlerId960     fn connect_extend_selection<
961         F: Fn(&Self, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> glib::signal::Inhibit
962             + 'static,
963     >(
964         &self,
965         f: F,
966     ) -> SignalHandlerId;
967 
968     #[doc(alias = "insert-at-cursor")]
connect_insert_at_cursor<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId969     fn connect_insert_at_cursor<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId;
970 
emit_insert_at_cursor(&self, string: &str)971     fn emit_insert_at_cursor(&self, string: &str);
972 
973     #[cfg(any(feature = "v3_22_26", feature = "dox"))]
974     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22_26")))]
975     #[doc(alias = "insert-emoji")]
connect_insert_emoji<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId976     fn connect_insert_emoji<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
977 
978     #[cfg(any(feature = "v3_22_26", feature = "dox"))]
979     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22_26")))]
emit_insert_emoji(&self)980     fn emit_insert_emoji(&self);
981 
982     #[doc(alias = "move-cursor")]
connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>( &self, f: F, ) -> SignalHandlerId983     fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>(
984         &self,
985         f: F,
986     ) -> SignalHandlerId;
987 
emit_move_cursor(&self, step: MovementStep, count: i32, extend_selection: bool)988     fn emit_move_cursor(&self, step: MovementStep, count: i32, extend_selection: bool);
989 
990     #[doc(alias = "move-viewport")]
connect_move_viewport<F: Fn(&Self, ScrollStep, i32) + 'static>( &self, f: F, ) -> SignalHandlerId991     fn connect_move_viewport<F: Fn(&Self, ScrollStep, i32) + 'static>(
992         &self,
993         f: F,
994     ) -> SignalHandlerId;
995 
emit_move_viewport(&self, step: ScrollStep, count: i32)996     fn emit_move_viewport(&self, step: ScrollStep, count: i32);
997 
998     #[doc(alias = "paste-clipboard")]
connect_paste_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId999     fn connect_paste_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1000 
emit_paste_clipboard(&self)1001     fn emit_paste_clipboard(&self);
1002 
1003     #[doc(alias = "populate-popup")]
connect_populate_popup<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId1004     fn connect_populate_popup<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId;
1005 
1006     #[doc(alias = "preedit-changed")]
connect_preedit_changed<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId1007     fn connect_preedit_changed<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId;
1008 
emit_preedit_changed(&self, preedit: &str)1009     fn emit_preedit_changed(&self, preedit: &str);
1010 
1011     #[doc(alias = "select-all")]
connect_select_all<F: Fn(&Self, bool) + 'static>(&self, f: F) -> SignalHandlerId1012     fn connect_select_all<F: Fn(&Self, bool) + 'static>(&self, f: F) -> SignalHandlerId;
1013 
emit_select_all(&self, select: bool)1014     fn emit_select_all(&self, select: bool);
1015 
1016     #[doc(alias = "set-anchor")]
connect_set_anchor<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1017     fn connect_set_anchor<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1018 
emit_set_anchor(&self)1019     fn emit_set_anchor(&self);
1020 
1021     #[doc(alias = "toggle-cursor-visible")]
connect_toggle_cursor_visible<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1022     fn connect_toggle_cursor_visible<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1023 
emit_toggle_cursor_visible(&self)1024     fn emit_toggle_cursor_visible(&self);
1025 
1026     #[doc(alias = "toggle-overwrite")]
connect_toggle_overwrite<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1027     fn connect_toggle_overwrite<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1028 
emit_toggle_overwrite(&self)1029     fn emit_toggle_overwrite(&self);
1030 
1031     #[doc(alias = "accepts-tab")]
connect_accepts_tab_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1032     fn connect_accepts_tab_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1033 
1034     #[doc(alias = "bottom-margin")]
connect_bottom_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1035     fn connect_bottom_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1036 
1037     #[doc(alias = "buffer")]
connect_buffer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1038     fn connect_buffer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1039 
1040     #[doc(alias = "cursor-visible")]
connect_cursor_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1041     fn connect_cursor_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1042 
1043     #[doc(alias = "editable")]
connect_editable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1044     fn connect_editable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1045 
1046     #[doc(alias = "im-module")]
connect_im_module_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1047     fn connect_im_module_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1048 
1049     #[doc(alias = "indent")]
connect_indent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1050     fn connect_indent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1051 
1052     #[doc(alias = "input-hints")]
connect_input_hints_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1053     fn connect_input_hints_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1054 
1055     #[doc(alias = "input-purpose")]
connect_input_purpose_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1056     fn connect_input_purpose_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1057 
1058     #[doc(alias = "justification")]
connect_justification_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1059     fn connect_justification_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1060 
1061     #[doc(alias = "left-margin")]
connect_left_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1062     fn connect_left_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1063 
1064     #[doc(alias = "monospace")]
connect_monospace_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1065     fn connect_monospace_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1066 
1067     #[doc(alias = "overwrite")]
connect_overwrite_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1068     fn connect_overwrite_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1069 
1070     #[doc(alias = "pixels-above-lines")]
connect_pixels_above_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1071     fn connect_pixels_above_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1072 
1073     #[doc(alias = "pixels-below-lines")]
connect_pixels_below_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1074     fn connect_pixels_below_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1075 
1076     #[doc(alias = "pixels-inside-wrap")]
connect_pixels_inside_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1077     fn connect_pixels_inside_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1078 
1079     #[doc(alias = "populate-all")]
connect_populate_all_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1080     fn connect_populate_all_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1081 
1082     #[doc(alias = "right-margin")]
connect_right_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1083     fn connect_right_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1084 
1085     #[doc(alias = "tabs")]
connect_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1086     fn connect_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1087 
1088     #[doc(alias = "top-margin")]
connect_top_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1089     fn connect_top_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1090 
1091     #[doc(alias = "wrap-mode")]
connect_wrap_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1092     fn connect_wrap_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
1093 }
1094 
1095 impl<O: IsA<TextView>> TextViewExt for O {
add_child_at_anchor<P: IsA<Widget>, Q: IsA<TextChildAnchor>>(&self, child: &P, anchor: &Q)1096     fn add_child_at_anchor<P: IsA<Widget>, Q: IsA<TextChildAnchor>>(&self, child: &P, anchor: &Q) {
1097         unsafe {
1098             ffi::gtk_text_view_add_child_at_anchor(
1099                 self.as_ref().to_glib_none().0,
1100                 child.as_ref().to_glib_none().0,
1101                 anchor.as_ref().to_glib_none().0,
1102             );
1103         }
1104     }
1105 
add_child_in_window<P: IsA<Widget>>( &self, child: &P, which_window: TextWindowType, xpos: i32, ypos: i32, )1106     fn add_child_in_window<P: IsA<Widget>>(
1107         &self,
1108         child: &P,
1109         which_window: TextWindowType,
1110         xpos: i32,
1111         ypos: i32,
1112     ) {
1113         unsafe {
1114             ffi::gtk_text_view_add_child_in_window(
1115                 self.as_ref().to_glib_none().0,
1116                 child.as_ref().to_glib_none().0,
1117                 which_window.into_glib(),
1118                 xpos,
1119                 ypos,
1120             );
1121         }
1122     }
1123 
backward_display_line(&self, iter: &mut TextIter) -> bool1124     fn backward_display_line(&self, iter: &mut TextIter) -> bool {
1125         unsafe {
1126             from_glib(ffi::gtk_text_view_backward_display_line(
1127                 self.as_ref().to_glib_none().0,
1128                 iter.to_glib_none_mut().0,
1129             ))
1130         }
1131     }
1132 
backward_display_line_start(&self, iter: &mut TextIter) -> bool1133     fn backward_display_line_start(&self, iter: &mut TextIter) -> bool {
1134         unsafe {
1135             from_glib(ffi::gtk_text_view_backward_display_line_start(
1136                 self.as_ref().to_glib_none().0,
1137                 iter.to_glib_none_mut().0,
1138             ))
1139         }
1140     }
1141 
buffer_to_window_coords( &self, win: TextWindowType, buffer_x: i32, buffer_y: i32, ) -> (i32, i32)1142     fn buffer_to_window_coords(
1143         &self,
1144         win: TextWindowType,
1145         buffer_x: i32,
1146         buffer_y: i32,
1147     ) -> (i32, i32) {
1148         unsafe {
1149             let mut window_x = mem::MaybeUninit::uninit();
1150             let mut window_y = mem::MaybeUninit::uninit();
1151             ffi::gtk_text_view_buffer_to_window_coords(
1152                 self.as_ref().to_glib_none().0,
1153                 win.into_glib(),
1154                 buffer_x,
1155                 buffer_y,
1156                 window_x.as_mut_ptr(),
1157                 window_y.as_mut_ptr(),
1158             );
1159             let window_x = window_x.assume_init();
1160             let window_y = window_y.assume_init();
1161             (window_x, window_y)
1162         }
1163     }
1164 
forward_display_line(&self, iter: &mut TextIter) -> bool1165     fn forward_display_line(&self, iter: &mut TextIter) -> bool {
1166         unsafe {
1167             from_glib(ffi::gtk_text_view_forward_display_line(
1168                 self.as_ref().to_glib_none().0,
1169                 iter.to_glib_none_mut().0,
1170             ))
1171         }
1172     }
1173 
forward_display_line_end(&self, iter: &mut TextIter) -> bool1174     fn forward_display_line_end(&self, iter: &mut TextIter) -> bool {
1175         unsafe {
1176             from_glib(ffi::gtk_text_view_forward_display_line_end(
1177                 self.as_ref().to_glib_none().0,
1178                 iter.to_glib_none_mut().0,
1179             ))
1180         }
1181     }
1182 
accepts_tab(&self) -> bool1183     fn accepts_tab(&self) -> bool {
1184         unsafe {
1185             from_glib(ffi::gtk_text_view_get_accepts_tab(
1186                 self.as_ref().to_glib_none().0,
1187             ))
1188         }
1189     }
1190 
border_window_size(&self, type_: TextWindowType) -> i321191     fn border_window_size(&self, type_: TextWindowType) -> i32 {
1192         unsafe {
1193             ffi::gtk_text_view_get_border_window_size(
1194                 self.as_ref().to_glib_none().0,
1195                 type_.into_glib(),
1196             )
1197         }
1198     }
1199 
bottom_margin(&self) -> i321200     fn bottom_margin(&self) -> i32 {
1201         unsafe { ffi::gtk_text_view_get_bottom_margin(self.as_ref().to_glib_none().0) }
1202     }
1203 
buffer(&self) -> Option<TextBuffer>1204     fn buffer(&self) -> Option<TextBuffer> {
1205         unsafe {
1206             from_glib_none(ffi::gtk_text_view_get_buffer(
1207                 self.as_ref().to_glib_none().0,
1208             ))
1209         }
1210     }
1211 
cursor_locations(&self, iter: Option<&TextIter>) -> (gdk::Rectangle, gdk::Rectangle)1212     fn cursor_locations(&self, iter: Option<&TextIter>) -> (gdk::Rectangle, gdk::Rectangle) {
1213         unsafe {
1214             let mut strong = gdk::Rectangle::uninitialized();
1215             let mut weak = gdk::Rectangle::uninitialized();
1216             ffi::gtk_text_view_get_cursor_locations(
1217                 self.as_ref().to_glib_none().0,
1218                 iter.to_glib_none().0,
1219                 strong.to_glib_none_mut().0,
1220                 weak.to_glib_none_mut().0,
1221             );
1222             (strong, weak)
1223         }
1224     }
1225 
is_cursor_visible(&self) -> bool1226     fn is_cursor_visible(&self) -> bool {
1227         unsafe {
1228             from_glib(ffi::gtk_text_view_get_cursor_visible(
1229                 self.as_ref().to_glib_none().0,
1230             ))
1231         }
1232     }
1233 
default_attributes(&self) -> TextAttributes1234     fn default_attributes(&self) -> TextAttributes {
1235         unsafe {
1236             from_glib_full(ffi::gtk_text_view_get_default_attributes(
1237                 self.as_ref().to_glib_none().0,
1238             ))
1239         }
1240     }
1241 
is_editable(&self) -> bool1242     fn is_editable(&self) -> bool {
1243         unsafe {
1244             from_glib(ffi::gtk_text_view_get_editable(
1245                 self.as_ref().to_glib_none().0,
1246             ))
1247         }
1248     }
1249 
indent(&self) -> i321250     fn indent(&self) -> i32 {
1251         unsafe { ffi::gtk_text_view_get_indent(self.as_ref().to_glib_none().0) }
1252     }
1253 
input_hints(&self) -> InputHints1254     fn input_hints(&self) -> InputHints {
1255         unsafe {
1256             from_glib(ffi::gtk_text_view_get_input_hints(
1257                 self.as_ref().to_glib_none().0,
1258             ))
1259         }
1260     }
1261 
input_purpose(&self) -> InputPurpose1262     fn input_purpose(&self) -> InputPurpose {
1263         unsafe {
1264             from_glib(ffi::gtk_text_view_get_input_purpose(
1265                 self.as_ref().to_glib_none().0,
1266             ))
1267         }
1268     }
1269 
iter_at_location(&self, x: i32, y: i32) -> Option<TextIter>1270     fn iter_at_location(&self, x: i32, y: i32) -> Option<TextIter> {
1271         unsafe {
1272             let mut iter = TextIter::uninitialized();
1273             let ret = from_glib(ffi::gtk_text_view_get_iter_at_location(
1274                 self.as_ref().to_glib_none().0,
1275                 iter.to_glib_none_mut().0,
1276                 x,
1277                 y,
1278             ));
1279             if ret {
1280                 Some(iter)
1281             } else {
1282                 None
1283             }
1284         }
1285     }
1286 
iter_at_position(&self, x: i32, y: i32) -> Option<(TextIter, i32)>1287     fn iter_at_position(&self, x: i32, y: i32) -> Option<(TextIter, i32)> {
1288         unsafe {
1289             let mut iter = TextIter::uninitialized();
1290             let mut trailing = mem::MaybeUninit::uninit();
1291             let ret = from_glib(ffi::gtk_text_view_get_iter_at_position(
1292                 self.as_ref().to_glib_none().0,
1293                 iter.to_glib_none_mut().0,
1294                 trailing.as_mut_ptr(),
1295                 x,
1296                 y,
1297             ));
1298             let trailing = trailing.assume_init();
1299             if ret {
1300                 Some((iter, trailing))
1301             } else {
1302                 None
1303             }
1304         }
1305     }
1306 
iter_location(&self, iter: &TextIter) -> gdk::Rectangle1307     fn iter_location(&self, iter: &TextIter) -> gdk::Rectangle {
1308         unsafe {
1309             let mut location = gdk::Rectangle::uninitialized();
1310             ffi::gtk_text_view_get_iter_location(
1311                 self.as_ref().to_glib_none().0,
1312                 iter.to_glib_none().0,
1313                 location.to_glib_none_mut().0,
1314             );
1315             location
1316         }
1317     }
1318 
justification(&self) -> Justification1319     fn justification(&self) -> Justification {
1320         unsafe {
1321             from_glib(ffi::gtk_text_view_get_justification(
1322                 self.as_ref().to_glib_none().0,
1323             ))
1324         }
1325     }
1326 
left_margin(&self) -> i321327     fn left_margin(&self) -> i32 {
1328         unsafe { ffi::gtk_text_view_get_left_margin(self.as_ref().to_glib_none().0) }
1329     }
1330 
line_at_y(&self, y: i32) -> (TextIter, i32)1331     fn line_at_y(&self, y: i32) -> (TextIter, i32) {
1332         unsafe {
1333             let mut target_iter = TextIter::uninitialized();
1334             let mut line_top = mem::MaybeUninit::uninit();
1335             ffi::gtk_text_view_get_line_at_y(
1336                 self.as_ref().to_glib_none().0,
1337                 target_iter.to_glib_none_mut().0,
1338                 y,
1339                 line_top.as_mut_ptr(),
1340             );
1341             let line_top = line_top.assume_init();
1342             (target_iter, line_top)
1343         }
1344     }
1345 
line_yrange(&self, iter: &TextIter) -> (i32, i32)1346     fn line_yrange(&self, iter: &TextIter) -> (i32, i32) {
1347         unsafe {
1348             let mut y = mem::MaybeUninit::uninit();
1349             let mut height = mem::MaybeUninit::uninit();
1350             ffi::gtk_text_view_get_line_yrange(
1351                 self.as_ref().to_glib_none().0,
1352                 iter.to_glib_none().0,
1353                 y.as_mut_ptr(),
1354                 height.as_mut_ptr(),
1355             );
1356             let y = y.assume_init();
1357             let height = height.assume_init();
1358             (y, height)
1359         }
1360     }
1361 
is_monospace(&self) -> bool1362     fn is_monospace(&self) -> bool {
1363         unsafe {
1364             from_glib(ffi::gtk_text_view_get_monospace(
1365                 self.as_ref().to_glib_none().0,
1366             ))
1367         }
1368     }
1369 
overwrites(&self) -> bool1370     fn overwrites(&self) -> bool {
1371         unsafe {
1372             from_glib(ffi::gtk_text_view_get_overwrite(
1373                 self.as_ref().to_glib_none().0,
1374             ))
1375         }
1376     }
1377 
pixels_above_lines(&self) -> i321378     fn pixels_above_lines(&self) -> i32 {
1379         unsafe { ffi::gtk_text_view_get_pixels_above_lines(self.as_ref().to_glib_none().0) }
1380     }
1381 
pixels_below_lines(&self) -> i321382     fn pixels_below_lines(&self) -> i32 {
1383         unsafe { ffi::gtk_text_view_get_pixels_below_lines(self.as_ref().to_glib_none().0) }
1384     }
1385 
pixels_inside_wrap(&self) -> i321386     fn pixels_inside_wrap(&self) -> i32 {
1387         unsafe { ffi::gtk_text_view_get_pixels_inside_wrap(self.as_ref().to_glib_none().0) }
1388     }
1389 
right_margin(&self) -> i321390     fn right_margin(&self) -> i32 {
1391         unsafe { ffi::gtk_text_view_get_right_margin(self.as_ref().to_glib_none().0) }
1392     }
1393 
tabs(&self) -> Option<pango::TabArray>1394     fn tabs(&self) -> Option<pango::TabArray> {
1395         unsafe { from_glib_full(ffi::gtk_text_view_get_tabs(self.as_ref().to_glib_none().0)) }
1396     }
1397 
top_margin(&self) -> i321398     fn top_margin(&self) -> i32 {
1399         unsafe { ffi::gtk_text_view_get_top_margin(self.as_ref().to_glib_none().0) }
1400     }
1401 
visible_rect(&self) -> gdk::Rectangle1402     fn visible_rect(&self) -> gdk::Rectangle {
1403         unsafe {
1404             let mut visible_rect = gdk::Rectangle::uninitialized();
1405             ffi::gtk_text_view_get_visible_rect(
1406                 self.as_ref().to_glib_none().0,
1407                 visible_rect.to_glib_none_mut().0,
1408             );
1409             visible_rect
1410         }
1411     }
1412 
window(&self, win: TextWindowType) -> Option<gdk::Window>1413     fn window(&self, win: TextWindowType) -> Option<gdk::Window> {
1414         unsafe {
1415             from_glib_none(ffi::gtk_text_view_get_window(
1416                 self.as_ref().to_glib_none().0,
1417                 win.into_glib(),
1418             ))
1419         }
1420     }
1421 
window_type(&self, window: &gdk::Window) -> TextWindowType1422     fn window_type(&self, window: &gdk::Window) -> TextWindowType {
1423         unsafe {
1424             from_glib(ffi::gtk_text_view_get_window_type(
1425                 self.as_ref().to_glib_none().0,
1426                 window.to_glib_none().0,
1427             ))
1428         }
1429     }
1430 
wrap_mode(&self) -> WrapMode1431     fn wrap_mode(&self) -> WrapMode {
1432         unsafe {
1433             from_glib(ffi::gtk_text_view_get_wrap_mode(
1434                 self.as_ref().to_glib_none().0,
1435             ))
1436         }
1437     }
1438 
im_context_filter_keypress(&self, event: &gdk::EventKey) -> bool1439     fn im_context_filter_keypress(&self, event: &gdk::EventKey) -> bool {
1440         unsafe {
1441             from_glib(ffi::gtk_text_view_im_context_filter_keypress(
1442                 self.as_ref().to_glib_none().0,
1443                 mut_override(event.to_glib_none().0),
1444             ))
1445         }
1446     }
1447 
move_child<P: IsA<Widget>>(&self, child: &P, xpos: i32, ypos: i32)1448     fn move_child<P: IsA<Widget>>(&self, child: &P, xpos: i32, ypos: i32) {
1449         unsafe {
1450             ffi::gtk_text_view_move_child(
1451                 self.as_ref().to_glib_none().0,
1452                 child.as_ref().to_glib_none().0,
1453                 xpos,
1454                 ypos,
1455             );
1456         }
1457     }
1458 
move_mark_onscreen<P: IsA<TextMark>>(&self, mark: &P) -> bool1459     fn move_mark_onscreen<P: IsA<TextMark>>(&self, mark: &P) -> bool {
1460         unsafe {
1461             from_glib(ffi::gtk_text_view_move_mark_onscreen(
1462                 self.as_ref().to_glib_none().0,
1463                 mark.as_ref().to_glib_none().0,
1464             ))
1465         }
1466     }
1467 
move_visually(&self, iter: &mut TextIter, count: i32) -> bool1468     fn move_visually(&self, iter: &mut TextIter, count: i32) -> bool {
1469         unsafe {
1470             from_glib(ffi::gtk_text_view_move_visually(
1471                 self.as_ref().to_glib_none().0,
1472                 iter.to_glib_none_mut().0,
1473                 count,
1474             ))
1475         }
1476     }
1477 
place_cursor_onscreen(&self) -> bool1478     fn place_cursor_onscreen(&self) -> bool {
1479         unsafe {
1480             from_glib(ffi::gtk_text_view_place_cursor_onscreen(
1481                 self.as_ref().to_glib_none().0,
1482             ))
1483         }
1484     }
1485 
1486     #[cfg(any(feature = "v3_20", feature = "dox"))]
1487     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
reset_cursor_blink(&self)1488     fn reset_cursor_blink(&self) {
1489         unsafe {
1490             ffi::gtk_text_view_reset_cursor_blink(self.as_ref().to_glib_none().0);
1491         }
1492     }
1493 
reset_im_context(&self)1494     fn reset_im_context(&self) {
1495         unsafe {
1496             ffi::gtk_text_view_reset_im_context(self.as_ref().to_glib_none().0);
1497         }
1498     }
1499 
scroll_mark_onscreen<P: IsA<TextMark>>(&self, mark: &P)1500     fn scroll_mark_onscreen<P: IsA<TextMark>>(&self, mark: &P) {
1501         unsafe {
1502             ffi::gtk_text_view_scroll_mark_onscreen(
1503                 self.as_ref().to_glib_none().0,
1504                 mark.as_ref().to_glib_none().0,
1505             );
1506         }
1507     }
1508 
scroll_to_iter( &self, iter: &mut TextIter, within_margin: f64, use_align: bool, xalign: f64, yalign: f64, ) -> bool1509     fn scroll_to_iter(
1510         &self,
1511         iter: &mut TextIter,
1512         within_margin: f64,
1513         use_align: bool,
1514         xalign: f64,
1515         yalign: f64,
1516     ) -> bool {
1517         unsafe {
1518             from_glib(ffi::gtk_text_view_scroll_to_iter(
1519                 self.as_ref().to_glib_none().0,
1520                 iter.to_glib_none_mut().0,
1521                 within_margin,
1522                 use_align.into_glib(),
1523                 xalign,
1524                 yalign,
1525             ))
1526         }
1527     }
1528 
scroll_to_mark<P: IsA<TextMark>>( &self, mark: &P, within_margin: f64, use_align: bool, xalign: f64, yalign: f64, )1529     fn scroll_to_mark<P: IsA<TextMark>>(
1530         &self,
1531         mark: &P,
1532         within_margin: f64,
1533         use_align: bool,
1534         xalign: f64,
1535         yalign: f64,
1536     ) {
1537         unsafe {
1538             ffi::gtk_text_view_scroll_to_mark(
1539                 self.as_ref().to_glib_none().0,
1540                 mark.as_ref().to_glib_none().0,
1541                 within_margin,
1542                 use_align.into_glib(),
1543                 xalign,
1544                 yalign,
1545             );
1546         }
1547     }
1548 
set_accepts_tab(&self, accepts_tab: bool)1549     fn set_accepts_tab(&self, accepts_tab: bool) {
1550         unsafe {
1551             ffi::gtk_text_view_set_accepts_tab(
1552                 self.as_ref().to_glib_none().0,
1553                 accepts_tab.into_glib(),
1554             );
1555         }
1556     }
1557 
set_border_window_size(&self, type_: TextWindowType, size: i32)1558     fn set_border_window_size(&self, type_: TextWindowType, size: i32) {
1559         unsafe {
1560             ffi::gtk_text_view_set_border_window_size(
1561                 self.as_ref().to_glib_none().0,
1562                 type_.into_glib(),
1563                 size,
1564             );
1565         }
1566     }
1567 
set_bottom_margin(&self, bottom_margin: i32)1568     fn set_bottom_margin(&self, bottom_margin: i32) {
1569         unsafe {
1570             ffi::gtk_text_view_set_bottom_margin(self.as_ref().to_glib_none().0, bottom_margin);
1571         }
1572     }
1573 
set_buffer<P: IsA<TextBuffer>>(&self, buffer: Option<&P>)1574     fn set_buffer<P: IsA<TextBuffer>>(&self, buffer: Option<&P>) {
1575         unsafe {
1576             ffi::gtk_text_view_set_buffer(
1577                 self.as_ref().to_glib_none().0,
1578                 buffer.map(|p| p.as_ref()).to_glib_none().0,
1579             );
1580         }
1581     }
1582 
set_cursor_visible(&self, setting: bool)1583     fn set_cursor_visible(&self, setting: bool) {
1584         unsafe {
1585             ffi::gtk_text_view_set_cursor_visible(
1586                 self.as_ref().to_glib_none().0,
1587                 setting.into_glib(),
1588             );
1589         }
1590     }
1591 
set_editable(&self, setting: bool)1592     fn set_editable(&self, setting: bool) {
1593         unsafe {
1594             ffi::gtk_text_view_set_editable(self.as_ref().to_glib_none().0, setting.into_glib());
1595         }
1596     }
1597 
set_indent(&self, indent: i32)1598     fn set_indent(&self, indent: i32) {
1599         unsafe {
1600             ffi::gtk_text_view_set_indent(self.as_ref().to_glib_none().0, indent);
1601         }
1602     }
1603 
set_input_hints(&self, hints: InputHints)1604     fn set_input_hints(&self, hints: InputHints) {
1605         unsafe {
1606             ffi::gtk_text_view_set_input_hints(self.as_ref().to_glib_none().0, hints.into_glib());
1607         }
1608     }
1609 
set_input_purpose(&self, purpose: InputPurpose)1610     fn set_input_purpose(&self, purpose: InputPurpose) {
1611         unsafe {
1612             ffi::gtk_text_view_set_input_purpose(
1613                 self.as_ref().to_glib_none().0,
1614                 purpose.into_glib(),
1615             );
1616         }
1617     }
1618 
set_justification(&self, justification: Justification)1619     fn set_justification(&self, justification: Justification) {
1620         unsafe {
1621             ffi::gtk_text_view_set_justification(
1622                 self.as_ref().to_glib_none().0,
1623                 justification.into_glib(),
1624             );
1625         }
1626     }
1627 
set_left_margin(&self, left_margin: i32)1628     fn set_left_margin(&self, left_margin: i32) {
1629         unsafe {
1630             ffi::gtk_text_view_set_left_margin(self.as_ref().to_glib_none().0, left_margin);
1631         }
1632     }
1633 
set_monospace(&self, monospace: bool)1634     fn set_monospace(&self, monospace: bool) {
1635         unsafe {
1636             ffi::gtk_text_view_set_monospace(self.as_ref().to_glib_none().0, monospace.into_glib());
1637         }
1638     }
1639 
set_overwrite(&self, overwrite: bool)1640     fn set_overwrite(&self, overwrite: bool) {
1641         unsafe {
1642             ffi::gtk_text_view_set_overwrite(self.as_ref().to_glib_none().0, overwrite.into_glib());
1643         }
1644     }
1645 
set_pixels_above_lines(&self, pixels_above_lines: i32)1646     fn set_pixels_above_lines(&self, pixels_above_lines: i32) {
1647         unsafe {
1648             ffi::gtk_text_view_set_pixels_above_lines(
1649                 self.as_ref().to_glib_none().0,
1650                 pixels_above_lines,
1651             );
1652         }
1653     }
1654 
set_pixels_below_lines(&self, pixels_below_lines: i32)1655     fn set_pixels_below_lines(&self, pixels_below_lines: i32) {
1656         unsafe {
1657             ffi::gtk_text_view_set_pixels_below_lines(
1658                 self.as_ref().to_glib_none().0,
1659                 pixels_below_lines,
1660             );
1661         }
1662     }
1663 
set_pixels_inside_wrap(&self, pixels_inside_wrap: i32)1664     fn set_pixels_inside_wrap(&self, pixels_inside_wrap: i32) {
1665         unsafe {
1666             ffi::gtk_text_view_set_pixels_inside_wrap(
1667                 self.as_ref().to_glib_none().0,
1668                 pixels_inside_wrap,
1669             );
1670         }
1671     }
1672 
set_right_margin(&self, right_margin: i32)1673     fn set_right_margin(&self, right_margin: i32) {
1674         unsafe {
1675             ffi::gtk_text_view_set_right_margin(self.as_ref().to_glib_none().0, right_margin);
1676         }
1677     }
1678 
set_tabs(&self, tabs: &pango::TabArray)1679     fn set_tabs(&self, tabs: &pango::TabArray) {
1680         unsafe {
1681             ffi::gtk_text_view_set_tabs(
1682                 self.as_ref().to_glib_none().0,
1683                 mut_override(tabs.to_glib_none().0),
1684             );
1685         }
1686     }
1687 
set_top_margin(&self, top_margin: i32)1688     fn set_top_margin(&self, top_margin: i32) {
1689         unsafe {
1690             ffi::gtk_text_view_set_top_margin(self.as_ref().to_glib_none().0, top_margin);
1691         }
1692     }
1693 
set_wrap_mode(&self, wrap_mode: WrapMode)1694     fn set_wrap_mode(&self, wrap_mode: WrapMode) {
1695         unsafe {
1696             ffi::gtk_text_view_set_wrap_mode(self.as_ref().to_glib_none().0, wrap_mode.into_glib());
1697         }
1698     }
1699 
starts_display_line(&self, iter: &TextIter) -> bool1700     fn starts_display_line(&self, iter: &TextIter) -> bool {
1701         unsafe {
1702             from_glib(ffi::gtk_text_view_starts_display_line(
1703                 self.as_ref().to_glib_none().0,
1704                 iter.to_glib_none().0,
1705             ))
1706         }
1707     }
1708 
window_to_buffer_coords( &self, win: TextWindowType, window_x: i32, window_y: i32, ) -> (i32, i32)1709     fn window_to_buffer_coords(
1710         &self,
1711         win: TextWindowType,
1712         window_x: i32,
1713         window_y: i32,
1714     ) -> (i32, i32) {
1715         unsafe {
1716             let mut buffer_x = mem::MaybeUninit::uninit();
1717             let mut buffer_y = mem::MaybeUninit::uninit();
1718             ffi::gtk_text_view_window_to_buffer_coords(
1719                 self.as_ref().to_glib_none().0,
1720                 win.into_glib(),
1721                 window_x,
1722                 window_y,
1723                 buffer_x.as_mut_ptr(),
1724                 buffer_y.as_mut_ptr(),
1725             );
1726             let buffer_x = buffer_x.assume_init();
1727             let buffer_y = buffer_y.assume_init();
1728             (buffer_x, buffer_y)
1729         }
1730     }
1731 
im_module(&self) -> Option<glib::GString>1732     fn im_module(&self) -> Option<glib::GString> {
1733         unsafe {
1734             let mut value = glib::Value::from_type(<glib::GString as StaticType>::static_type());
1735             glib::gobject_ffi::g_object_get_property(
1736                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
1737                 b"im-module\0".as_ptr() as *const _,
1738                 value.to_glib_none_mut().0,
1739             );
1740             value
1741                 .get()
1742                 .expect("Return Value for property `im-module` getter")
1743         }
1744     }
1745 
set_im_module(&self, im_module: Option<&str>)1746     fn set_im_module(&self, im_module: Option<&str>) {
1747         unsafe {
1748             glib::gobject_ffi::g_object_set_property(
1749                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
1750                 b"im-module\0".as_ptr() as *const _,
1751                 im_module.to_value().to_glib_none().0,
1752             );
1753         }
1754     }
1755 
populates_all(&self) -> bool1756     fn populates_all(&self) -> bool {
1757         unsafe {
1758             let mut value = glib::Value::from_type(<bool as StaticType>::static_type());
1759             glib::gobject_ffi::g_object_get_property(
1760                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
1761                 b"populate-all\0".as_ptr() as *const _,
1762                 value.to_glib_none_mut().0,
1763             );
1764             value
1765                 .get()
1766                 .expect("Return Value for property `populate-all` getter")
1767         }
1768     }
1769 
set_populate_all(&self, populate_all: bool)1770     fn set_populate_all(&self, populate_all: bool) {
1771         unsafe {
1772             glib::gobject_ffi::g_object_set_property(
1773                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
1774                 b"populate-all\0".as_ptr() as *const _,
1775                 populate_all.to_value().to_glib_none().0,
1776             );
1777         }
1778     }
1779 
connect_backspace<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1780     fn connect_backspace<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1781         unsafe extern "C" fn backspace_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1782             this: *mut ffi::GtkTextView,
1783             f: glib::ffi::gpointer,
1784         ) {
1785             let f: &F = &*(f as *const F);
1786             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1787         }
1788         unsafe {
1789             let f: Box_<F> = Box_::new(f);
1790             connect_raw(
1791                 self.as_ptr() as *mut _,
1792                 b"backspace\0".as_ptr() as *const _,
1793                 Some(transmute::<_, unsafe extern "C" fn()>(
1794                     backspace_trampoline::<Self, F> as *const (),
1795                 )),
1796                 Box_::into_raw(f),
1797             )
1798         }
1799     }
1800 
emit_backspace(&self)1801     fn emit_backspace(&self) {
1802         let _ = unsafe {
1803             glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject)
1804                 .emit_by_name("backspace", &[])
1805                 .unwrap()
1806         };
1807     }
1808 
connect_copy_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1809     fn connect_copy_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1810         unsafe extern "C" fn copy_clipboard_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1811             this: *mut ffi::GtkTextView,
1812             f: glib::ffi::gpointer,
1813         ) {
1814             let f: &F = &*(f as *const F);
1815             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1816         }
1817         unsafe {
1818             let f: Box_<F> = Box_::new(f);
1819             connect_raw(
1820                 self.as_ptr() as *mut _,
1821                 b"copy-clipboard\0".as_ptr() as *const _,
1822                 Some(transmute::<_, unsafe extern "C" fn()>(
1823                     copy_clipboard_trampoline::<Self, F> as *const (),
1824                 )),
1825                 Box_::into_raw(f),
1826             )
1827         }
1828     }
1829 
emit_copy_clipboard(&self)1830     fn emit_copy_clipboard(&self) {
1831         let _ = unsafe {
1832             glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject)
1833                 .emit_by_name("copy-clipboard", &[])
1834                 .unwrap()
1835         };
1836     }
1837 
connect_cut_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1838     fn connect_cut_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1839         unsafe extern "C" fn cut_clipboard_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1840             this: *mut ffi::GtkTextView,
1841             f: glib::ffi::gpointer,
1842         ) {
1843             let f: &F = &*(f as *const F);
1844             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1845         }
1846         unsafe {
1847             let f: Box_<F> = Box_::new(f);
1848             connect_raw(
1849                 self.as_ptr() as *mut _,
1850                 b"cut-clipboard\0".as_ptr() as *const _,
1851                 Some(transmute::<_, unsafe extern "C" fn()>(
1852                     cut_clipboard_trampoline::<Self, F> as *const (),
1853                 )),
1854                 Box_::into_raw(f),
1855             )
1856         }
1857     }
1858 
emit_cut_clipboard(&self)1859     fn emit_cut_clipboard(&self) {
1860         let _ = unsafe {
1861             glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject)
1862                 .emit_by_name("cut-clipboard", &[])
1863                 .unwrap()
1864         };
1865     }
1866 
connect_delete_from_cursor<F: Fn(&Self, DeleteType, i32) + 'static>( &self, f: F, ) -> SignalHandlerId1867     fn connect_delete_from_cursor<F: Fn(&Self, DeleteType, i32) + 'static>(
1868         &self,
1869         f: F,
1870     ) -> SignalHandlerId {
1871         unsafe extern "C" fn delete_from_cursor_trampoline<
1872             P: IsA<TextView>,
1873             F: Fn(&P, DeleteType, i32) + 'static,
1874         >(
1875             this: *mut ffi::GtkTextView,
1876             type_: ffi::GtkDeleteType,
1877             count: libc::c_int,
1878             f: glib::ffi::gpointer,
1879         ) {
1880             let f: &F = &*(f as *const F);
1881             f(
1882                 TextView::from_glib_borrow(this).unsafe_cast_ref(),
1883                 from_glib(type_),
1884                 count,
1885             )
1886         }
1887         unsafe {
1888             let f: Box_<F> = Box_::new(f);
1889             connect_raw(
1890                 self.as_ptr() as *mut _,
1891                 b"delete-from-cursor\0".as_ptr() as *const _,
1892                 Some(transmute::<_, unsafe extern "C" fn()>(
1893                     delete_from_cursor_trampoline::<Self, F> as *const (),
1894                 )),
1895                 Box_::into_raw(f),
1896             )
1897         }
1898     }
1899 
emit_delete_from_cursor(&self, type_: DeleteType, count: i32)1900     fn emit_delete_from_cursor(&self, type_: DeleteType, count: i32) {
1901         let _ = unsafe {
1902             glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject)
1903                 .emit_by_name("delete-from-cursor", &[&type_, &count])
1904                 .unwrap()
1905         };
1906     }
1907 
connect_extend_selection< F: Fn(&Self, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> glib::signal::Inhibit + 'static, >( &self, f: F, ) -> SignalHandlerId1908     fn connect_extend_selection<
1909         F: Fn(&Self, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> glib::signal::Inhibit
1910             + 'static,
1911     >(
1912         &self,
1913         f: F,
1914     ) -> SignalHandlerId {
1915         unsafe extern "C" fn extend_selection_trampoline<
1916             P: IsA<TextView>,
1917             F: Fn(
1918                     &P,
1919                     TextExtendSelection,
1920                     &TextIter,
1921                     &TextIter,
1922                     &TextIter,
1923                 ) -> glib::signal::Inhibit
1924                 + 'static,
1925         >(
1926             this: *mut ffi::GtkTextView,
1927             granularity: ffi::GtkTextExtendSelection,
1928             location: *mut ffi::GtkTextIter,
1929             start: *mut ffi::GtkTextIter,
1930             end: *mut ffi::GtkTextIter,
1931             f: glib::ffi::gpointer,
1932         ) -> glib::ffi::gboolean {
1933             let f: &F = &*(f as *const F);
1934             f(
1935                 TextView::from_glib_borrow(this).unsafe_cast_ref(),
1936                 from_glib(granularity),
1937                 &from_glib_borrow(location),
1938                 &from_glib_borrow(start),
1939                 &from_glib_borrow(end),
1940             )
1941             .into_glib()
1942         }
1943         unsafe {
1944             let f: Box_<F> = Box_::new(f);
1945             connect_raw(
1946                 self.as_ptr() as *mut _,
1947                 b"extend-selection\0".as_ptr() as *const _,
1948                 Some(transmute::<_, unsafe extern "C" fn()>(
1949                     extend_selection_trampoline::<Self, F> as *const (),
1950                 )),
1951                 Box_::into_raw(f),
1952             )
1953         }
1954     }
1955 
connect_insert_at_cursor<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId1956     fn connect_insert_at_cursor<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
1957         unsafe extern "C" fn insert_at_cursor_trampoline<
1958             P: IsA<TextView>,
1959             F: Fn(&P, &str) + 'static,
1960         >(
1961             this: *mut ffi::GtkTextView,
1962             string: *mut libc::c_char,
1963             f: glib::ffi::gpointer,
1964         ) {
1965             let f: &F = &*(f as *const F);
1966             f(
1967                 TextView::from_glib_borrow(this).unsafe_cast_ref(),
1968                 &glib::GString::from_glib_borrow(string),
1969             )
1970         }
1971         unsafe {
1972             let f: Box_<F> = Box_::new(f);
1973             connect_raw(
1974                 self.as_ptr() as *mut _,
1975                 b"insert-at-cursor\0".as_ptr() as *const _,
1976                 Some(transmute::<_, unsafe extern "C" fn()>(
1977                     insert_at_cursor_trampoline::<Self, F> as *const (),
1978                 )),
1979                 Box_::into_raw(f),
1980             )
1981         }
1982     }
1983 
emit_insert_at_cursor(&self, string: &str)1984     fn emit_insert_at_cursor(&self, string: &str) {
1985         let _ = unsafe {
1986             glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject)
1987                 .emit_by_name("insert-at-cursor", &[&string])
1988                 .unwrap()
1989         };
1990     }
1991 
1992     #[cfg(any(feature = "v3_22_26", feature = "dox"))]
1993     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22_26")))]
connect_insert_emoji<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1994     fn connect_insert_emoji<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1995         unsafe extern "C" fn insert_emoji_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1996             this: *mut ffi::GtkTextView,
1997             f: glib::ffi::gpointer,
1998         ) {
1999             let f: &F = &*(f as *const F);
2000             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2001         }
2002         unsafe {
2003             let f: Box_<F> = Box_::new(f);
2004             connect_raw(
2005                 self.as_ptr() as *mut _,
2006                 b"insert-emoji\0".as_ptr() as *const _,
2007                 Some(transmute::<_, unsafe extern "C" fn()>(
2008                     insert_emoji_trampoline::<Self, F> as *const (),
2009                 )),
2010                 Box_::into_raw(f),
2011             )
2012         }
2013     }
2014 
2015     #[cfg(any(feature = "v3_22_26", feature = "dox"))]
2016     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22_26")))]
emit_insert_emoji(&self)2017     fn emit_insert_emoji(&self) {
2018         let _ = unsafe {
2019             glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject)
2020                 .emit_by_name("insert-emoji", &[])
2021                 .unwrap()
2022         };
2023     }
2024 
connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>( &self, f: F, ) -> SignalHandlerId2025     fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>(
2026         &self,
2027         f: F,
2028     ) -> SignalHandlerId {
2029         unsafe extern "C" fn move_cursor_trampoline<
2030             P: IsA<TextView>,
2031             F: Fn(&P, MovementStep, i32, bool) + 'static,
2032         >(
2033             this: *mut ffi::GtkTextView,
2034             step: ffi::GtkMovementStep,
2035             count: libc::c_int,
2036             extend_selection: glib::ffi::gboolean,
2037             f: glib::ffi::gpointer,
2038         ) {
2039             let f: &F = &*(f as *const F);
2040             f(
2041                 TextView::from_glib_borrow(this).unsafe_cast_ref(),
2042                 from_glib(step),
2043                 count,
2044                 from_glib(extend_selection),
2045             )
2046         }
2047         unsafe {
2048             let f: Box_<F> = Box_::new(f);
2049             connect_raw(
2050                 self.as_ptr() as *mut _,
2051                 b"move-cursor\0".as_ptr() as *const _,
2052                 Some(transmute::<_, unsafe extern "C" fn()>(
2053                     move_cursor_trampoline::<Self, F> as *const (),
2054                 )),
2055                 Box_::into_raw(f),
2056             )
2057         }
2058     }
2059 
emit_move_cursor(&self, step: MovementStep, count: i32, extend_selection: bool)2060     fn emit_move_cursor(&self, step: MovementStep, count: i32, extend_selection: bool) {
2061         let _ = unsafe {
2062             glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject)
2063                 .emit_by_name("move-cursor", &[&step, &count, &extend_selection])
2064                 .unwrap()
2065         };
2066     }
2067 
connect_move_viewport<F: Fn(&Self, ScrollStep, i32) + 'static>( &self, f: F, ) -> SignalHandlerId2068     fn connect_move_viewport<F: Fn(&Self, ScrollStep, i32) + 'static>(
2069         &self,
2070         f: F,
2071     ) -> SignalHandlerId {
2072         unsafe extern "C" fn move_viewport_trampoline<
2073             P: IsA<TextView>,
2074             F: Fn(&P, ScrollStep, i32) + 'static,
2075         >(
2076             this: *mut ffi::GtkTextView,
2077             step: ffi::GtkScrollStep,
2078             count: libc::c_int,
2079             f: glib::ffi::gpointer,
2080         ) {
2081             let f: &F = &*(f as *const F);
2082             f(
2083                 TextView::from_glib_borrow(this).unsafe_cast_ref(),
2084                 from_glib(step),
2085                 count,
2086             )
2087         }
2088         unsafe {
2089             let f: Box_<F> = Box_::new(f);
2090             connect_raw(
2091                 self.as_ptr() as *mut _,
2092                 b"move-viewport\0".as_ptr() as *const _,
2093                 Some(transmute::<_, unsafe extern "C" fn()>(
2094                     move_viewport_trampoline::<Self, F> as *const (),
2095                 )),
2096                 Box_::into_raw(f),
2097             )
2098         }
2099     }
2100 
emit_move_viewport(&self, step: ScrollStep, count: i32)2101     fn emit_move_viewport(&self, step: ScrollStep, count: i32) {
2102         let _ = unsafe {
2103             glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject)
2104                 .emit_by_name("move-viewport", &[&step, &count])
2105                 .unwrap()
2106         };
2107     }
2108 
connect_paste_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2109     fn connect_paste_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2110         unsafe extern "C" fn paste_clipboard_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2111             this: *mut ffi::GtkTextView,
2112             f: glib::ffi::gpointer,
2113         ) {
2114             let f: &F = &*(f as *const F);
2115             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2116         }
2117         unsafe {
2118             let f: Box_<F> = Box_::new(f);
2119             connect_raw(
2120                 self.as_ptr() as *mut _,
2121                 b"paste-clipboard\0".as_ptr() as *const _,
2122                 Some(transmute::<_, unsafe extern "C" fn()>(
2123                     paste_clipboard_trampoline::<Self, F> as *const (),
2124                 )),
2125                 Box_::into_raw(f),
2126             )
2127         }
2128     }
2129 
emit_paste_clipboard(&self)2130     fn emit_paste_clipboard(&self) {
2131         let _ = unsafe {
2132             glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject)
2133                 .emit_by_name("paste-clipboard", &[])
2134                 .unwrap()
2135         };
2136     }
2137 
connect_populate_popup<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId2138     fn connect_populate_popup<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId {
2139         unsafe extern "C" fn populate_popup_trampoline<
2140             P: IsA<TextView>,
2141             F: Fn(&P, &Widget) + 'static,
2142         >(
2143             this: *mut ffi::GtkTextView,
2144             popup: *mut ffi::GtkWidget,
2145             f: glib::ffi::gpointer,
2146         ) {
2147             let f: &F = &*(f as *const F);
2148             f(
2149                 TextView::from_glib_borrow(this).unsafe_cast_ref(),
2150                 &from_glib_borrow(popup),
2151             )
2152         }
2153         unsafe {
2154             let f: Box_<F> = Box_::new(f);
2155             connect_raw(
2156                 self.as_ptr() as *mut _,
2157                 b"populate-popup\0".as_ptr() as *const _,
2158                 Some(transmute::<_, unsafe extern "C" fn()>(
2159                     populate_popup_trampoline::<Self, F> as *const (),
2160                 )),
2161                 Box_::into_raw(f),
2162             )
2163         }
2164     }
2165 
connect_preedit_changed<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId2166     fn connect_preedit_changed<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
2167         unsafe extern "C" fn preedit_changed_trampoline<
2168             P: IsA<TextView>,
2169             F: Fn(&P, &str) + 'static,
2170         >(
2171             this: *mut ffi::GtkTextView,
2172             preedit: *mut libc::c_char,
2173             f: glib::ffi::gpointer,
2174         ) {
2175             let f: &F = &*(f as *const F);
2176             f(
2177                 TextView::from_glib_borrow(this).unsafe_cast_ref(),
2178                 &glib::GString::from_glib_borrow(preedit),
2179             )
2180         }
2181         unsafe {
2182             let f: Box_<F> = Box_::new(f);
2183             connect_raw(
2184                 self.as_ptr() as *mut _,
2185                 b"preedit-changed\0".as_ptr() as *const _,
2186                 Some(transmute::<_, unsafe extern "C" fn()>(
2187                     preedit_changed_trampoline::<Self, F> as *const (),
2188                 )),
2189                 Box_::into_raw(f),
2190             )
2191         }
2192     }
2193 
emit_preedit_changed(&self, preedit: &str)2194     fn emit_preedit_changed(&self, preedit: &str) {
2195         let _ = unsafe {
2196             glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject)
2197                 .emit_by_name("preedit-changed", &[&preedit])
2198                 .unwrap()
2199         };
2200     }
2201 
connect_select_all<F: Fn(&Self, bool) + 'static>(&self, f: F) -> SignalHandlerId2202     fn connect_select_all<F: Fn(&Self, bool) + 'static>(&self, f: F) -> SignalHandlerId {
2203         unsafe extern "C" fn select_all_trampoline<P: IsA<TextView>, F: Fn(&P, bool) + 'static>(
2204             this: *mut ffi::GtkTextView,
2205             select: glib::ffi::gboolean,
2206             f: glib::ffi::gpointer,
2207         ) {
2208             let f: &F = &*(f as *const F);
2209             f(
2210                 TextView::from_glib_borrow(this).unsafe_cast_ref(),
2211                 from_glib(select),
2212             )
2213         }
2214         unsafe {
2215             let f: Box_<F> = Box_::new(f);
2216             connect_raw(
2217                 self.as_ptr() as *mut _,
2218                 b"select-all\0".as_ptr() as *const _,
2219                 Some(transmute::<_, unsafe extern "C" fn()>(
2220                     select_all_trampoline::<Self, F> as *const (),
2221                 )),
2222                 Box_::into_raw(f),
2223             )
2224         }
2225     }
2226 
emit_select_all(&self, select: bool)2227     fn emit_select_all(&self, select: bool) {
2228         let _ = unsafe {
2229             glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject)
2230                 .emit_by_name("select-all", &[&select])
2231                 .unwrap()
2232         };
2233     }
2234 
connect_set_anchor<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2235     fn connect_set_anchor<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2236         unsafe extern "C" fn set_anchor_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2237             this: *mut ffi::GtkTextView,
2238             f: glib::ffi::gpointer,
2239         ) {
2240             let f: &F = &*(f as *const F);
2241             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2242         }
2243         unsafe {
2244             let f: Box_<F> = Box_::new(f);
2245             connect_raw(
2246                 self.as_ptr() as *mut _,
2247                 b"set-anchor\0".as_ptr() as *const _,
2248                 Some(transmute::<_, unsafe extern "C" fn()>(
2249                     set_anchor_trampoline::<Self, F> as *const (),
2250                 )),
2251                 Box_::into_raw(f),
2252             )
2253         }
2254     }
2255 
emit_set_anchor(&self)2256     fn emit_set_anchor(&self) {
2257         let _ = unsafe {
2258             glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject)
2259                 .emit_by_name("set-anchor", &[])
2260                 .unwrap()
2261         };
2262     }
2263 
connect_toggle_cursor_visible<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2264     fn connect_toggle_cursor_visible<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2265         unsafe extern "C" fn toggle_cursor_visible_trampoline<
2266             P: IsA<TextView>,
2267             F: Fn(&P) + 'static,
2268         >(
2269             this: *mut ffi::GtkTextView,
2270             f: glib::ffi::gpointer,
2271         ) {
2272             let f: &F = &*(f as *const F);
2273             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2274         }
2275         unsafe {
2276             let f: Box_<F> = Box_::new(f);
2277             connect_raw(
2278                 self.as_ptr() as *mut _,
2279                 b"toggle-cursor-visible\0".as_ptr() as *const _,
2280                 Some(transmute::<_, unsafe extern "C" fn()>(
2281                     toggle_cursor_visible_trampoline::<Self, F> as *const (),
2282                 )),
2283                 Box_::into_raw(f),
2284             )
2285         }
2286     }
2287 
emit_toggle_cursor_visible(&self)2288     fn emit_toggle_cursor_visible(&self) {
2289         let _ = unsafe {
2290             glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject)
2291                 .emit_by_name("toggle-cursor-visible", &[])
2292                 .unwrap()
2293         };
2294     }
2295 
connect_toggle_overwrite<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2296     fn connect_toggle_overwrite<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2297         unsafe extern "C" fn toggle_overwrite_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2298             this: *mut ffi::GtkTextView,
2299             f: glib::ffi::gpointer,
2300         ) {
2301             let f: &F = &*(f as *const F);
2302             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2303         }
2304         unsafe {
2305             let f: Box_<F> = Box_::new(f);
2306             connect_raw(
2307                 self.as_ptr() as *mut _,
2308                 b"toggle-overwrite\0".as_ptr() as *const _,
2309                 Some(transmute::<_, unsafe extern "C" fn()>(
2310                     toggle_overwrite_trampoline::<Self, F> as *const (),
2311                 )),
2312                 Box_::into_raw(f),
2313             )
2314         }
2315     }
2316 
emit_toggle_overwrite(&self)2317     fn emit_toggle_overwrite(&self) {
2318         let _ = unsafe {
2319             glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject)
2320                 .emit_by_name("toggle-overwrite", &[])
2321                 .unwrap()
2322         };
2323     }
2324 
connect_accepts_tab_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2325     fn connect_accepts_tab_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2326         unsafe extern "C" fn notify_accepts_tab_trampoline<
2327             P: IsA<TextView>,
2328             F: Fn(&P) + 'static,
2329         >(
2330             this: *mut ffi::GtkTextView,
2331             _param_spec: glib::ffi::gpointer,
2332             f: glib::ffi::gpointer,
2333         ) {
2334             let f: &F = &*(f as *const F);
2335             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2336         }
2337         unsafe {
2338             let f: Box_<F> = Box_::new(f);
2339             connect_raw(
2340                 self.as_ptr() as *mut _,
2341                 b"notify::accepts-tab\0".as_ptr() as *const _,
2342                 Some(transmute::<_, unsafe extern "C" fn()>(
2343                     notify_accepts_tab_trampoline::<Self, F> as *const (),
2344                 )),
2345                 Box_::into_raw(f),
2346             )
2347         }
2348     }
2349 
connect_bottom_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2350     fn connect_bottom_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2351         unsafe extern "C" fn notify_bottom_margin_trampoline<
2352             P: IsA<TextView>,
2353             F: Fn(&P) + 'static,
2354         >(
2355             this: *mut ffi::GtkTextView,
2356             _param_spec: glib::ffi::gpointer,
2357             f: glib::ffi::gpointer,
2358         ) {
2359             let f: &F = &*(f as *const F);
2360             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2361         }
2362         unsafe {
2363             let f: Box_<F> = Box_::new(f);
2364             connect_raw(
2365                 self.as_ptr() as *mut _,
2366                 b"notify::bottom-margin\0".as_ptr() as *const _,
2367                 Some(transmute::<_, unsafe extern "C" fn()>(
2368                     notify_bottom_margin_trampoline::<Self, F> as *const (),
2369                 )),
2370                 Box_::into_raw(f),
2371             )
2372         }
2373     }
2374 
connect_buffer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2375     fn connect_buffer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2376         unsafe extern "C" fn notify_buffer_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2377             this: *mut ffi::GtkTextView,
2378             _param_spec: glib::ffi::gpointer,
2379             f: glib::ffi::gpointer,
2380         ) {
2381             let f: &F = &*(f as *const F);
2382             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2383         }
2384         unsafe {
2385             let f: Box_<F> = Box_::new(f);
2386             connect_raw(
2387                 self.as_ptr() as *mut _,
2388                 b"notify::buffer\0".as_ptr() as *const _,
2389                 Some(transmute::<_, unsafe extern "C" fn()>(
2390                     notify_buffer_trampoline::<Self, F> as *const (),
2391                 )),
2392                 Box_::into_raw(f),
2393             )
2394         }
2395     }
2396 
connect_cursor_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2397     fn connect_cursor_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2398         unsafe extern "C" fn notify_cursor_visible_trampoline<
2399             P: IsA<TextView>,
2400             F: Fn(&P) + 'static,
2401         >(
2402             this: *mut ffi::GtkTextView,
2403             _param_spec: glib::ffi::gpointer,
2404             f: glib::ffi::gpointer,
2405         ) {
2406             let f: &F = &*(f as *const F);
2407             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2408         }
2409         unsafe {
2410             let f: Box_<F> = Box_::new(f);
2411             connect_raw(
2412                 self.as_ptr() as *mut _,
2413                 b"notify::cursor-visible\0".as_ptr() as *const _,
2414                 Some(transmute::<_, unsafe extern "C" fn()>(
2415                     notify_cursor_visible_trampoline::<Self, F> as *const (),
2416                 )),
2417                 Box_::into_raw(f),
2418             )
2419         }
2420     }
2421 
connect_editable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2422     fn connect_editable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2423         unsafe extern "C" fn notify_editable_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2424             this: *mut ffi::GtkTextView,
2425             _param_spec: glib::ffi::gpointer,
2426             f: glib::ffi::gpointer,
2427         ) {
2428             let f: &F = &*(f as *const F);
2429             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2430         }
2431         unsafe {
2432             let f: Box_<F> = Box_::new(f);
2433             connect_raw(
2434                 self.as_ptr() as *mut _,
2435                 b"notify::editable\0".as_ptr() as *const _,
2436                 Some(transmute::<_, unsafe extern "C" fn()>(
2437                     notify_editable_trampoline::<Self, F> as *const (),
2438                 )),
2439                 Box_::into_raw(f),
2440             )
2441         }
2442     }
2443 
connect_im_module_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2444     fn connect_im_module_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2445         unsafe extern "C" fn notify_im_module_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2446             this: *mut ffi::GtkTextView,
2447             _param_spec: glib::ffi::gpointer,
2448             f: glib::ffi::gpointer,
2449         ) {
2450             let f: &F = &*(f as *const F);
2451             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2452         }
2453         unsafe {
2454             let f: Box_<F> = Box_::new(f);
2455             connect_raw(
2456                 self.as_ptr() as *mut _,
2457                 b"notify::im-module\0".as_ptr() as *const _,
2458                 Some(transmute::<_, unsafe extern "C" fn()>(
2459                     notify_im_module_trampoline::<Self, F> as *const (),
2460                 )),
2461                 Box_::into_raw(f),
2462             )
2463         }
2464     }
2465 
connect_indent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2466     fn connect_indent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2467         unsafe extern "C" fn notify_indent_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2468             this: *mut ffi::GtkTextView,
2469             _param_spec: glib::ffi::gpointer,
2470             f: glib::ffi::gpointer,
2471         ) {
2472             let f: &F = &*(f as *const F);
2473             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2474         }
2475         unsafe {
2476             let f: Box_<F> = Box_::new(f);
2477             connect_raw(
2478                 self.as_ptr() as *mut _,
2479                 b"notify::indent\0".as_ptr() as *const _,
2480                 Some(transmute::<_, unsafe extern "C" fn()>(
2481                     notify_indent_trampoline::<Self, F> as *const (),
2482                 )),
2483                 Box_::into_raw(f),
2484             )
2485         }
2486     }
2487 
connect_input_hints_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2488     fn connect_input_hints_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2489         unsafe extern "C" fn notify_input_hints_trampoline<
2490             P: IsA<TextView>,
2491             F: Fn(&P) + 'static,
2492         >(
2493             this: *mut ffi::GtkTextView,
2494             _param_spec: glib::ffi::gpointer,
2495             f: glib::ffi::gpointer,
2496         ) {
2497             let f: &F = &*(f as *const F);
2498             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2499         }
2500         unsafe {
2501             let f: Box_<F> = Box_::new(f);
2502             connect_raw(
2503                 self.as_ptr() as *mut _,
2504                 b"notify::input-hints\0".as_ptr() as *const _,
2505                 Some(transmute::<_, unsafe extern "C" fn()>(
2506                     notify_input_hints_trampoline::<Self, F> as *const (),
2507                 )),
2508                 Box_::into_raw(f),
2509             )
2510         }
2511     }
2512 
connect_input_purpose_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2513     fn connect_input_purpose_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2514         unsafe extern "C" fn notify_input_purpose_trampoline<
2515             P: IsA<TextView>,
2516             F: Fn(&P) + 'static,
2517         >(
2518             this: *mut ffi::GtkTextView,
2519             _param_spec: glib::ffi::gpointer,
2520             f: glib::ffi::gpointer,
2521         ) {
2522             let f: &F = &*(f as *const F);
2523             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2524         }
2525         unsafe {
2526             let f: Box_<F> = Box_::new(f);
2527             connect_raw(
2528                 self.as_ptr() as *mut _,
2529                 b"notify::input-purpose\0".as_ptr() as *const _,
2530                 Some(transmute::<_, unsafe extern "C" fn()>(
2531                     notify_input_purpose_trampoline::<Self, F> as *const (),
2532                 )),
2533                 Box_::into_raw(f),
2534             )
2535         }
2536     }
2537 
connect_justification_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2538     fn connect_justification_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2539         unsafe extern "C" fn notify_justification_trampoline<
2540             P: IsA<TextView>,
2541             F: Fn(&P) + 'static,
2542         >(
2543             this: *mut ffi::GtkTextView,
2544             _param_spec: glib::ffi::gpointer,
2545             f: glib::ffi::gpointer,
2546         ) {
2547             let f: &F = &*(f as *const F);
2548             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2549         }
2550         unsafe {
2551             let f: Box_<F> = Box_::new(f);
2552             connect_raw(
2553                 self.as_ptr() as *mut _,
2554                 b"notify::justification\0".as_ptr() as *const _,
2555                 Some(transmute::<_, unsafe extern "C" fn()>(
2556                     notify_justification_trampoline::<Self, F> as *const (),
2557                 )),
2558                 Box_::into_raw(f),
2559             )
2560         }
2561     }
2562 
connect_left_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2563     fn connect_left_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2564         unsafe extern "C" fn notify_left_margin_trampoline<
2565             P: IsA<TextView>,
2566             F: Fn(&P) + 'static,
2567         >(
2568             this: *mut ffi::GtkTextView,
2569             _param_spec: glib::ffi::gpointer,
2570             f: glib::ffi::gpointer,
2571         ) {
2572             let f: &F = &*(f as *const F);
2573             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2574         }
2575         unsafe {
2576             let f: Box_<F> = Box_::new(f);
2577             connect_raw(
2578                 self.as_ptr() as *mut _,
2579                 b"notify::left-margin\0".as_ptr() as *const _,
2580                 Some(transmute::<_, unsafe extern "C" fn()>(
2581                     notify_left_margin_trampoline::<Self, F> as *const (),
2582                 )),
2583                 Box_::into_raw(f),
2584             )
2585         }
2586     }
2587 
connect_monospace_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2588     fn connect_monospace_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2589         unsafe extern "C" fn notify_monospace_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2590             this: *mut ffi::GtkTextView,
2591             _param_spec: glib::ffi::gpointer,
2592             f: glib::ffi::gpointer,
2593         ) {
2594             let f: &F = &*(f as *const F);
2595             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2596         }
2597         unsafe {
2598             let f: Box_<F> = Box_::new(f);
2599             connect_raw(
2600                 self.as_ptr() as *mut _,
2601                 b"notify::monospace\0".as_ptr() as *const _,
2602                 Some(transmute::<_, unsafe extern "C" fn()>(
2603                     notify_monospace_trampoline::<Self, F> as *const (),
2604                 )),
2605                 Box_::into_raw(f),
2606             )
2607         }
2608     }
2609 
connect_overwrite_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2610     fn connect_overwrite_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2611         unsafe extern "C" fn notify_overwrite_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2612             this: *mut ffi::GtkTextView,
2613             _param_spec: glib::ffi::gpointer,
2614             f: glib::ffi::gpointer,
2615         ) {
2616             let f: &F = &*(f as *const F);
2617             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2618         }
2619         unsafe {
2620             let f: Box_<F> = Box_::new(f);
2621             connect_raw(
2622                 self.as_ptr() as *mut _,
2623                 b"notify::overwrite\0".as_ptr() as *const _,
2624                 Some(transmute::<_, unsafe extern "C" fn()>(
2625                     notify_overwrite_trampoline::<Self, F> as *const (),
2626                 )),
2627                 Box_::into_raw(f),
2628             )
2629         }
2630     }
2631 
connect_pixels_above_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2632     fn connect_pixels_above_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2633         unsafe extern "C" fn notify_pixels_above_lines_trampoline<
2634             P: IsA<TextView>,
2635             F: Fn(&P) + 'static,
2636         >(
2637             this: *mut ffi::GtkTextView,
2638             _param_spec: glib::ffi::gpointer,
2639             f: glib::ffi::gpointer,
2640         ) {
2641             let f: &F = &*(f as *const F);
2642             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2643         }
2644         unsafe {
2645             let f: Box_<F> = Box_::new(f);
2646             connect_raw(
2647                 self.as_ptr() as *mut _,
2648                 b"notify::pixels-above-lines\0".as_ptr() as *const _,
2649                 Some(transmute::<_, unsafe extern "C" fn()>(
2650                     notify_pixels_above_lines_trampoline::<Self, F> as *const (),
2651                 )),
2652                 Box_::into_raw(f),
2653             )
2654         }
2655     }
2656 
connect_pixels_below_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2657     fn connect_pixels_below_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2658         unsafe extern "C" fn notify_pixels_below_lines_trampoline<
2659             P: IsA<TextView>,
2660             F: Fn(&P) + 'static,
2661         >(
2662             this: *mut ffi::GtkTextView,
2663             _param_spec: glib::ffi::gpointer,
2664             f: glib::ffi::gpointer,
2665         ) {
2666             let f: &F = &*(f as *const F);
2667             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2668         }
2669         unsafe {
2670             let f: Box_<F> = Box_::new(f);
2671             connect_raw(
2672                 self.as_ptr() as *mut _,
2673                 b"notify::pixels-below-lines\0".as_ptr() as *const _,
2674                 Some(transmute::<_, unsafe extern "C" fn()>(
2675                     notify_pixels_below_lines_trampoline::<Self, F> as *const (),
2676                 )),
2677                 Box_::into_raw(f),
2678             )
2679         }
2680     }
2681 
connect_pixels_inside_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2682     fn connect_pixels_inside_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2683         unsafe extern "C" fn notify_pixels_inside_wrap_trampoline<
2684             P: IsA<TextView>,
2685             F: Fn(&P) + 'static,
2686         >(
2687             this: *mut ffi::GtkTextView,
2688             _param_spec: glib::ffi::gpointer,
2689             f: glib::ffi::gpointer,
2690         ) {
2691             let f: &F = &*(f as *const F);
2692             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2693         }
2694         unsafe {
2695             let f: Box_<F> = Box_::new(f);
2696             connect_raw(
2697                 self.as_ptr() as *mut _,
2698                 b"notify::pixels-inside-wrap\0".as_ptr() as *const _,
2699                 Some(transmute::<_, unsafe extern "C" fn()>(
2700                     notify_pixels_inside_wrap_trampoline::<Self, F> as *const (),
2701                 )),
2702                 Box_::into_raw(f),
2703             )
2704         }
2705     }
2706 
connect_populate_all_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2707     fn connect_populate_all_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2708         unsafe extern "C" fn notify_populate_all_trampoline<
2709             P: IsA<TextView>,
2710             F: Fn(&P) + 'static,
2711         >(
2712             this: *mut ffi::GtkTextView,
2713             _param_spec: glib::ffi::gpointer,
2714             f: glib::ffi::gpointer,
2715         ) {
2716             let f: &F = &*(f as *const F);
2717             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2718         }
2719         unsafe {
2720             let f: Box_<F> = Box_::new(f);
2721             connect_raw(
2722                 self.as_ptr() as *mut _,
2723                 b"notify::populate-all\0".as_ptr() as *const _,
2724                 Some(transmute::<_, unsafe extern "C" fn()>(
2725                     notify_populate_all_trampoline::<Self, F> as *const (),
2726                 )),
2727                 Box_::into_raw(f),
2728             )
2729         }
2730     }
2731 
connect_right_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2732     fn connect_right_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2733         unsafe extern "C" fn notify_right_margin_trampoline<
2734             P: IsA<TextView>,
2735             F: Fn(&P) + 'static,
2736         >(
2737             this: *mut ffi::GtkTextView,
2738             _param_spec: glib::ffi::gpointer,
2739             f: glib::ffi::gpointer,
2740         ) {
2741             let f: &F = &*(f as *const F);
2742             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2743         }
2744         unsafe {
2745             let f: Box_<F> = Box_::new(f);
2746             connect_raw(
2747                 self.as_ptr() as *mut _,
2748                 b"notify::right-margin\0".as_ptr() as *const _,
2749                 Some(transmute::<_, unsafe extern "C" fn()>(
2750                     notify_right_margin_trampoline::<Self, F> as *const (),
2751                 )),
2752                 Box_::into_raw(f),
2753             )
2754         }
2755     }
2756 
connect_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2757     fn connect_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2758         unsafe extern "C" fn notify_tabs_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2759             this: *mut ffi::GtkTextView,
2760             _param_spec: glib::ffi::gpointer,
2761             f: glib::ffi::gpointer,
2762         ) {
2763             let f: &F = &*(f as *const F);
2764             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2765         }
2766         unsafe {
2767             let f: Box_<F> = Box_::new(f);
2768             connect_raw(
2769                 self.as_ptr() as *mut _,
2770                 b"notify::tabs\0".as_ptr() as *const _,
2771                 Some(transmute::<_, unsafe extern "C" fn()>(
2772                     notify_tabs_trampoline::<Self, F> as *const (),
2773                 )),
2774                 Box_::into_raw(f),
2775             )
2776         }
2777     }
2778 
connect_top_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2779     fn connect_top_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2780         unsafe extern "C" fn notify_top_margin_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2781             this: *mut ffi::GtkTextView,
2782             _param_spec: glib::ffi::gpointer,
2783             f: glib::ffi::gpointer,
2784         ) {
2785             let f: &F = &*(f as *const F);
2786             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2787         }
2788         unsafe {
2789             let f: Box_<F> = Box_::new(f);
2790             connect_raw(
2791                 self.as_ptr() as *mut _,
2792                 b"notify::top-margin\0".as_ptr() as *const _,
2793                 Some(transmute::<_, unsafe extern "C" fn()>(
2794                     notify_top_margin_trampoline::<Self, F> as *const (),
2795                 )),
2796                 Box_::into_raw(f),
2797             )
2798         }
2799     }
2800 
connect_wrap_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2801     fn connect_wrap_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2802         unsafe extern "C" fn notify_wrap_mode_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2803             this: *mut ffi::GtkTextView,
2804             _param_spec: glib::ffi::gpointer,
2805             f: glib::ffi::gpointer,
2806         ) {
2807             let f: &F = &*(f as *const F);
2808             f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2809         }
2810         unsafe {
2811             let f: Box_<F> = Box_::new(f);
2812             connect_raw(
2813                 self.as_ptr() as *mut _,
2814                 b"notify::wrap-mode\0".as_ptr() as *const _,
2815                 Some(transmute::<_, unsafe extern "C" fn()>(
2816                     notify_wrap_mode_trampoline::<Self, F> as *const (),
2817                 )),
2818                 Box_::into_raw(f),
2819             )
2820         }
2821     }
2822 }
2823 
2824 impl fmt::Display for TextView {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result2825     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2826         f.write_str("TextView")
2827     }
2828 }
2829