gtk4/auto/
text_buffer.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{ffi, TextChildAnchor, TextIter, TextMark, TextTag, TextTagTable};
6use glib::{
7    object::ObjectType as _,
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    #[doc(alias = "GtkTextBuffer")]
16    pub struct TextBuffer(Object<ffi::GtkTextBuffer, ffi::GtkTextBufferClass>);
17
18    match fn {
19        type_ => || ffi::gtk_text_buffer_get_type(),
20    }
21}
22
23impl TextBuffer {
24    pub const NONE: Option<&'static TextBuffer> = None;
25
26    #[doc(alias = "gtk_text_buffer_new")]
27    pub fn new(table: Option<&TextTagTable>) -> TextBuffer {
28        assert_initialized_main_thread!();
29        unsafe { from_glib_full(ffi::gtk_text_buffer_new(table.to_glib_none().0)) }
30    }
31
32    // rustdoc-stripper-ignore-next
33    /// Creates a new builder-pattern struct instance to construct [`TextBuffer`] objects.
34    ///
35    /// This method returns an instance of [`TextBufferBuilder`](crate::builders::TextBufferBuilder) which can be used to create [`TextBuffer`] objects.
36    pub fn builder() -> TextBufferBuilder {
37        TextBufferBuilder::new()
38    }
39}
40
41impl Default for TextBuffer {
42    fn default() -> Self {
43        glib::object::Object::new::<Self>()
44    }
45}
46
47// rustdoc-stripper-ignore-next
48/// A [builder-pattern] type to construct [`TextBuffer`] objects.
49///
50/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
51#[must_use = "The builder must be built to be used"]
52pub struct TextBufferBuilder {
53    builder: glib::object::ObjectBuilder<'static, TextBuffer>,
54}
55
56impl TextBufferBuilder {
57    fn new() -> Self {
58        Self {
59            builder: glib::object::Object::builder(),
60        }
61    }
62
63    pub fn enable_undo(self, enable_undo: bool) -> Self {
64        Self {
65            builder: self.builder.property("enable-undo", enable_undo),
66        }
67    }
68
69    pub fn tag_table(self, tag_table: &TextTagTable) -> Self {
70        Self {
71            builder: self.builder.property("tag-table", tag_table.clone()),
72        }
73    }
74
75    pub fn text(self, text: impl Into<glib::GString>) -> Self {
76        Self {
77            builder: self.builder.property("text", text.into()),
78        }
79    }
80
81    // rustdoc-stripper-ignore-next
82    /// Build the [`TextBuffer`].
83    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
84    pub fn build(self) -> TextBuffer {
85        assert_initialized_main_thread!();
86        self.builder.build()
87    }
88}
89
90pub trait TextBufferExt: IsA<TextBuffer> + 'static {
91    #[doc(alias = "gtk_text_buffer_add_mark")]
92    fn add_mark(&self, mark: &impl IsA<TextMark>, where_: &TextIter) {
93        unsafe {
94            ffi::gtk_text_buffer_add_mark(
95                self.as_ref().to_glib_none().0,
96                mark.as_ref().to_glib_none().0,
97                where_.to_glib_none().0,
98            );
99        }
100    }
101
102    #[doc(alias = "gtk_text_buffer_add_selection_clipboard")]
103    fn add_selection_clipboard(&self, clipboard: &gdk::Clipboard) {
104        unsafe {
105            ffi::gtk_text_buffer_add_selection_clipboard(
106                self.as_ref().to_glib_none().0,
107                clipboard.to_glib_none().0,
108            );
109        }
110    }
111
112    #[doc(alias = "gtk_text_buffer_apply_tag")]
113    fn apply_tag(&self, tag: &impl IsA<TextTag>, start: &TextIter, end: &TextIter) {
114        unsafe {
115            ffi::gtk_text_buffer_apply_tag(
116                self.as_ref().to_glib_none().0,
117                tag.as_ref().to_glib_none().0,
118                start.to_glib_none().0,
119                end.to_glib_none().0,
120            );
121        }
122    }
123
124    #[doc(alias = "gtk_text_buffer_apply_tag_by_name")]
125    fn apply_tag_by_name(&self, name: &str, start: &TextIter, end: &TextIter) {
126        unsafe {
127            ffi::gtk_text_buffer_apply_tag_by_name(
128                self.as_ref().to_glib_none().0,
129                name.to_glib_none().0,
130                start.to_glib_none().0,
131                end.to_glib_none().0,
132            );
133        }
134    }
135
136    #[doc(alias = "gtk_text_buffer_backspace")]
137    fn backspace(&self, iter: &mut TextIter, interactive: bool, default_editable: bool) -> bool {
138        unsafe {
139            from_glib(ffi::gtk_text_buffer_backspace(
140                self.as_ref().to_glib_none().0,
141                iter.to_glib_none_mut().0,
142                interactive.into_glib(),
143                default_editable.into_glib(),
144            ))
145        }
146    }
147
148    #[doc(alias = "gtk_text_buffer_begin_irreversible_action")]
149    fn begin_irreversible_action(&self) {
150        unsafe {
151            ffi::gtk_text_buffer_begin_irreversible_action(self.as_ref().to_glib_none().0);
152        }
153    }
154
155    #[doc(alias = "gtk_text_buffer_begin_user_action")]
156    fn begin_user_action(&self) {
157        unsafe {
158            ffi::gtk_text_buffer_begin_user_action(self.as_ref().to_glib_none().0);
159        }
160    }
161
162    #[doc(alias = "gtk_text_buffer_copy_clipboard")]
163    fn copy_clipboard(&self, clipboard: &gdk::Clipboard) {
164        unsafe {
165            ffi::gtk_text_buffer_copy_clipboard(
166                self.as_ref().to_glib_none().0,
167                clipboard.to_glib_none().0,
168            );
169        }
170    }
171
172    #[doc(alias = "gtk_text_buffer_create_child_anchor")]
173    fn create_child_anchor(&self, iter: &mut TextIter) -> TextChildAnchor {
174        unsafe {
175            from_glib_none(ffi::gtk_text_buffer_create_child_anchor(
176                self.as_ref().to_glib_none().0,
177                iter.to_glib_none_mut().0,
178            ))
179        }
180    }
181
182    #[doc(alias = "gtk_text_buffer_create_mark")]
183    fn create_mark(
184        &self,
185        mark_name: Option<&str>,
186        where_: &TextIter,
187        left_gravity: bool,
188    ) -> TextMark {
189        unsafe {
190            from_glib_none(ffi::gtk_text_buffer_create_mark(
191                self.as_ref().to_glib_none().0,
192                mark_name.to_glib_none().0,
193                where_.to_glib_none().0,
194                left_gravity.into_glib(),
195            ))
196        }
197    }
198
199    #[doc(alias = "gtk_text_buffer_cut_clipboard")]
200    fn cut_clipboard(&self, clipboard: &gdk::Clipboard, default_editable: bool) {
201        unsafe {
202            ffi::gtk_text_buffer_cut_clipboard(
203                self.as_ref().to_glib_none().0,
204                clipboard.to_glib_none().0,
205                default_editable.into_glib(),
206            );
207        }
208    }
209
210    #[doc(alias = "gtk_text_buffer_delete")]
211    fn delete(&self, start: &mut TextIter, end: &mut TextIter) {
212        unsafe {
213            ffi::gtk_text_buffer_delete(
214                self.as_ref().to_glib_none().0,
215                start.to_glib_none_mut().0,
216                end.to_glib_none_mut().0,
217            );
218        }
219    }
220
221    #[doc(alias = "gtk_text_buffer_delete_interactive")]
222    fn delete_interactive(
223        &self,
224        start_iter: &mut TextIter,
225        end_iter: &mut TextIter,
226        default_editable: bool,
227    ) -> bool {
228        unsafe {
229            from_glib(ffi::gtk_text_buffer_delete_interactive(
230                self.as_ref().to_glib_none().0,
231                start_iter.to_glib_none_mut().0,
232                end_iter.to_glib_none_mut().0,
233                default_editable.into_glib(),
234            ))
235        }
236    }
237
238    #[doc(alias = "gtk_text_buffer_delete_mark")]
239    fn delete_mark(&self, mark: &impl IsA<TextMark>) {
240        unsafe {
241            ffi::gtk_text_buffer_delete_mark(
242                self.as_ref().to_glib_none().0,
243                mark.as_ref().to_glib_none().0,
244            );
245        }
246    }
247
248    #[doc(alias = "gtk_text_buffer_delete_mark_by_name")]
249    fn delete_mark_by_name(&self, name: &str) {
250        unsafe {
251            ffi::gtk_text_buffer_delete_mark_by_name(
252                self.as_ref().to_glib_none().0,
253                name.to_glib_none().0,
254            );
255        }
256    }
257
258    #[doc(alias = "gtk_text_buffer_delete_selection")]
259    fn delete_selection(&self, interactive: bool, default_editable: bool) -> bool {
260        unsafe {
261            from_glib(ffi::gtk_text_buffer_delete_selection(
262                self.as_ref().to_glib_none().0,
263                interactive.into_glib(),
264                default_editable.into_glib(),
265            ))
266        }
267    }
268
269    #[doc(alias = "gtk_text_buffer_end_irreversible_action")]
270    fn end_irreversible_action(&self) {
271        unsafe {
272            ffi::gtk_text_buffer_end_irreversible_action(self.as_ref().to_glib_none().0);
273        }
274    }
275
276    #[doc(alias = "gtk_text_buffer_end_user_action")]
277    fn end_user_action(&self) {
278        unsafe {
279            ffi::gtk_text_buffer_end_user_action(self.as_ref().to_glib_none().0);
280        }
281    }
282
283    #[doc(alias = "gtk_text_buffer_get_bounds")]
284    #[doc(alias = "get_bounds")]
285    fn bounds(&self) -> (TextIter, TextIter) {
286        unsafe {
287            let mut start = TextIter::uninitialized();
288            let mut end = TextIter::uninitialized();
289            ffi::gtk_text_buffer_get_bounds(
290                self.as_ref().to_glib_none().0,
291                start.to_glib_none_mut().0,
292                end.to_glib_none_mut().0,
293            );
294            (start, end)
295        }
296    }
297
298    #[doc(alias = "gtk_text_buffer_get_can_redo")]
299    #[doc(alias = "get_can_redo")]
300    #[doc(alias = "can-redo")]
301    fn can_redo(&self) -> bool {
302        unsafe {
303            from_glib(ffi::gtk_text_buffer_get_can_redo(
304                self.as_ref().to_glib_none().0,
305            ))
306        }
307    }
308
309    #[doc(alias = "gtk_text_buffer_get_can_undo")]
310    #[doc(alias = "get_can_undo")]
311    #[doc(alias = "can-undo")]
312    fn can_undo(&self) -> bool {
313        unsafe {
314            from_glib(ffi::gtk_text_buffer_get_can_undo(
315                self.as_ref().to_glib_none().0,
316            ))
317        }
318    }
319
320    #[doc(alias = "gtk_text_buffer_get_char_count")]
321    #[doc(alias = "get_char_count")]
322    fn char_count(&self) -> i32 {
323        unsafe { ffi::gtk_text_buffer_get_char_count(self.as_ref().to_glib_none().0) }
324    }
325
326    #[doc(alias = "gtk_text_buffer_get_enable_undo")]
327    #[doc(alias = "get_enable_undo")]
328    #[doc(alias = "enable-undo")]
329    fn enables_undo(&self) -> bool {
330        unsafe {
331            from_glib(ffi::gtk_text_buffer_get_enable_undo(
332                self.as_ref().to_glib_none().0,
333            ))
334        }
335    }
336
337    #[doc(alias = "gtk_text_buffer_get_end_iter")]
338    #[doc(alias = "get_end_iter")]
339    fn end_iter(&self) -> TextIter {
340        unsafe {
341            let mut iter = TextIter::uninitialized();
342            ffi::gtk_text_buffer_get_end_iter(
343                self.as_ref().to_glib_none().0,
344                iter.to_glib_none_mut().0,
345            );
346            iter
347        }
348    }
349
350    #[doc(alias = "gtk_text_buffer_get_has_selection")]
351    #[doc(alias = "get_has_selection")]
352    #[doc(alias = "has-selection")]
353    fn has_selection(&self) -> bool {
354        unsafe {
355            from_glib(ffi::gtk_text_buffer_get_has_selection(
356                self.as_ref().to_glib_none().0,
357            ))
358        }
359    }
360
361    #[doc(alias = "gtk_text_buffer_get_insert")]
362    fn get_insert(&self) -> TextMark {
363        unsafe {
364            from_glib_none(ffi::gtk_text_buffer_get_insert(
365                self.as_ref().to_glib_none().0,
366            ))
367        }
368    }
369
370    #[doc(alias = "gtk_text_buffer_get_iter_at_child_anchor")]
371    #[doc(alias = "get_iter_at_child_anchor")]
372    fn iter_at_child_anchor(&self, anchor: &impl IsA<TextChildAnchor>) -> TextIter {
373        unsafe {
374            let mut iter = TextIter::uninitialized();
375            ffi::gtk_text_buffer_get_iter_at_child_anchor(
376                self.as_ref().to_glib_none().0,
377                iter.to_glib_none_mut().0,
378                anchor.as_ref().to_glib_none().0,
379            );
380            iter
381        }
382    }
383
384    #[doc(alias = "gtk_text_buffer_get_iter_at_line")]
385    #[doc(alias = "get_iter_at_line")]
386    fn iter_at_line(&self, line_number: i32) -> Option<TextIter> {
387        unsafe {
388            let mut iter = TextIter::uninitialized();
389            let ret = from_glib(ffi::gtk_text_buffer_get_iter_at_line(
390                self.as_ref().to_glib_none().0,
391                iter.to_glib_none_mut().0,
392                line_number,
393            ));
394            if ret {
395                Some(iter)
396            } else {
397                None
398            }
399        }
400    }
401
402    #[doc(alias = "gtk_text_buffer_get_iter_at_line_index")]
403    #[doc(alias = "get_iter_at_line_index")]
404    fn iter_at_line_index(&self, line_number: i32, byte_index: i32) -> Option<TextIter> {
405        unsafe {
406            let mut iter = TextIter::uninitialized();
407            let ret = from_glib(ffi::gtk_text_buffer_get_iter_at_line_index(
408                self.as_ref().to_glib_none().0,
409                iter.to_glib_none_mut().0,
410                line_number,
411                byte_index,
412            ));
413            if ret {
414                Some(iter)
415            } else {
416                None
417            }
418        }
419    }
420
421    #[doc(alias = "gtk_text_buffer_get_iter_at_line_offset")]
422    #[doc(alias = "get_iter_at_line_offset")]
423    fn iter_at_line_offset(&self, line_number: i32, char_offset: i32) -> Option<TextIter> {
424        unsafe {
425            let mut iter = TextIter::uninitialized();
426            let ret = from_glib(ffi::gtk_text_buffer_get_iter_at_line_offset(
427                self.as_ref().to_glib_none().0,
428                iter.to_glib_none_mut().0,
429                line_number,
430                char_offset,
431            ));
432            if ret {
433                Some(iter)
434            } else {
435                None
436            }
437        }
438    }
439
440    #[doc(alias = "gtk_text_buffer_get_iter_at_mark")]
441    #[doc(alias = "get_iter_at_mark")]
442    fn iter_at_mark(&self, mark: &impl IsA<TextMark>) -> TextIter {
443        unsafe {
444            let mut iter = TextIter::uninitialized();
445            ffi::gtk_text_buffer_get_iter_at_mark(
446                self.as_ref().to_glib_none().0,
447                iter.to_glib_none_mut().0,
448                mark.as_ref().to_glib_none().0,
449            );
450            iter
451        }
452    }
453
454    #[doc(alias = "gtk_text_buffer_get_iter_at_offset")]
455    #[doc(alias = "get_iter_at_offset")]
456    fn iter_at_offset(&self, char_offset: i32) -> TextIter {
457        unsafe {
458            let mut iter = TextIter::uninitialized();
459            ffi::gtk_text_buffer_get_iter_at_offset(
460                self.as_ref().to_glib_none().0,
461                iter.to_glib_none_mut().0,
462                char_offset,
463            );
464            iter
465        }
466    }
467
468    #[doc(alias = "gtk_text_buffer_get_line_count")]
469    #[doc(alias = "get_line_count")]
470    fn line_count(&self) -> i32 {
471        unsafe { ffi::gtk_text_buffer_get_line_count(self.as_ref().to_glib_none().0) }
472    }
473
474    #[doc(alias = "gtk_text_buffer_get_mark")]
475    #[doc(alias = "get_mark")]
476    fn mark(&self, name: &str) -> Option<TextMark> {
477        unsafe {
478            from_glib_none(ffi::gtk_text_buffer_get_mark(
479                self.as_ref().to_glib_none().0,
480                name.to_glib_none().0,
481            ))
482        }
483    }
484
485    #[doc(alias = "gtk_text_buffer_get_max_undo_levels")]
486    #[doc(alias = "get_max_undo_levels")]
487    fn max_undo_levels(&self) -> u32 {
488        unsafe { ffi::gtk_text_buffer_get_max_undo_levels(self.as_ref().to_glib_none().0) }
489    }
490
491    #[doc(alias = "gtk_text_buffer_get_modified")]
492    #[doc(alias = "get_modified")]
493    fn is_modified(&self) -> bool {
494        unsafe {
495            from_glib(ffi::gtk_text_buffer_get_modified(
496                self.as_ref().to_glib_none().0,
497            ))
498        }
499    }
500
501    #[doc(alias = "gtk_text_buffer_get_selection_bound")]
502    #[doc(alias = "get_selection_bound")]
503    fn selection_bound(&self) -> TextMark {
504        unsafe {
505            from_glib_none(ffi::gtk_text_buffer_get_selection_bound(
506                self.as_ref().to_glib_none().0,
507            ))
508        }
509    }
510
511    #[doc(alias = "gtk_text_buffer_get_selection_bounds")]
512    #[doc(alias = "get_selection_bounds")]
513    fn selection_bounds(&self) -> Option<(TextIter, TextIter)> {
514        unsafe {
515            let mut start = TextIter::uninitialized();
516            let mut end = TextIter::uninitialized();
517            let ret = from_glib(ffi::gtk_text_buffer_get_selection_bounds(
518                self.as_ref().to_glib_none().0,
519                start.to_glib_none_mut().0,
520                end.to_glib_none_mut().0,
521            ));
522            if ret {
523                Some((start, end))
524            } else {
525                None
526            }
527        }
528    }
529
530    #[doc(alias = "gtk_text_buffer_get_selection_content")]
531    #[doc(alias = "get_selection_content")]
532    fn selection_content(&self) -> gdk::ContentProvider {
533        unsafe {
534            from_glib_full(ffi::gtk_text_buffer_get_selection_content(
535                self.as_ref().to_glib_none().0,
536            ))
537        }
538    }
539
540    #[doc(alias = "gtk_text_buffer_get_slice")]
541    #[doc(alias = "get_slice")]
542    fn slice(&self, start: &TextIter, end: &TextIter, include_hidden_chars: bool) -> glib::GString {
543        unsafe {
544            from_glib_full(ffi::gtk_text_buffer_get_slice(
545                self.as_ref().to_glib_none().0,
546                start.to_glib_none().0,
547                end.to_glib_none().0,
548                include_hidden_chars.into_glib(),
549            ))
550        }
551    }
552
553    #[doc(alias = "gtk_text_buffer_get_start_iter")]
554    #[doc(alias = "get_start_iter")]
555    fn start_iter(&self) -> TextIter {
556        unsafe {
557            let mut iter = TextIter::uninitialized();
558            ffi::gtk_text_buffer_get_start_iter(
559                self.as_ref().to_glib_none().0,
560                iter.to_glib_none_mut().0,
561            );
562            iter
563        }
564    }
565
566    #[doc(alias = "gtk_text_buffer_get_tag_table")]
567    #[doc(alias = "get_tag_table")]
568    #[doc(alias = "tag-table")]
569    fn tag_table(&self) -> TextTagTable {
570        unsafe {
571            from_glib_none(ffi::gtk_text_buffer_get_tag_table(
572                self.as_ref().to_glib_none().0,
573            ))
574        }
575    }
576
577    #[doc(alias = "gtk_text_buffer_get_text")]
578    #[doc(alias = "get_text")]
579    fn text(&self, start: &TextIter, end: &TextIter, include_hidden_chars: bool) -> glib::GString {
580        unsafe {
581            from_glib_full(ffi::gtk_text_buffer_get_text(
582                self.as_ref().to_glib_none().0,
583                start.to_glib_none().0,
584                end.to_glib_none().0,
585                include_hidden_chars.into_glib(),
586            ))
587        }
588    }
589
590    #[doc(alias = "gtk_text_buffer_insert")]
591    fn insert(&self, iter: &mut TextIter, text: &str) {
592        let len = text.len() as _;
593        unsafe {
594            ffi::gtk_text_buffer_insert(
595                self.as_ref().to_glib_none().0,
596                iter.to_glib_none_mut().0,
597                text.to_glib_none().0,
598                len,
599            );
600        }
601    }
602
603    #[doc(alias = "gtk_text_buffer_insert_at_cursor")]
604    fn insert_at_cursor(&self, text: &str) {
605        let len = text.len() as _;
606        unsafe {
607            ffi::gtk_text_buffer_insert_at_cursor(
608                self.as_ref().to_glib_none().0,
609                text.to_glib_none().0,
610                len,
611            );
612        }
613    }
614
615    #[doc(alias = "gtk_text_buffer_insert_child_anchor")]
616    fn insert_child_anchor(&self, iter: &mut TextIter, anchor: &impl IsA<TextChildAnchor>) {
617        unsafe {
618            ffi::gtk_text_buffer_insert_child_anchor(
619                self.as_ref().to_glib_none().0,
620                iter.to_glib_none_mut().0,
621                anchor.as_ref().to_glib_none().0,
622            );
623        }
624    }
625
626    #[doc(alias = "gtk_text_buffer_insert_interactive")]
627    fn insert_interactive(&self, iter: &mut TextIter, text: &str, default_editable: bool) -> bool {
628        let len = text.len() as _;
629        unsafe {
630            from_glib(ffi::gtk_text_buffer_insert_interactive(
631                self.as_ref().to_glib_none().0,
632                iter.to_glib_none_mut().0,
633                text.to_glib_none().0,
634                len,
635                default_editable.into_glib(),
636            ))
637        }
638    }
639
640    #[doc(alias = "gtk_text_buffer_insert_interactive_at_cursor")]
641    fn insert_interactive_at_cursor(&self, text: &str, default_editable: bool) -> bool {
642        let len = text.len() as _;
643        unsafe {
644            from_glib(ffi::gtk_text_buffer_insert_interactive_at_cursor(
645                self.as_ref().to_glib_none().0,
646                text.to_glib_none().0,
647                len,
648                default_editable.into_glib(),
649            ))
650        }
651    }
652
653    #[doc(alias = "gtk_text_buffer_insert_markup")]
654    fn insert_markup(&self, iter: &mut TextIter, markup: &str) {
655        let len = markup.len() as _;
656        unsafe {
657            ffi::gtk_text_buffer_insert_markup(
658                self.as_ref().to_glib_none().0,
659                iter.to_glib_none_mut().0,
660                markup.to_glib_none().0,
661                len,
662            );
663        }
664    }
665
666    #[doc(alias = "gtk_text_buffer_insert_paintable")]
667    fn insert_paintable(&self, iter: &mut TextIter, paintable: &impl IsA<gdk::Paintable>) {
668        unsafe {
669            ffi::gtk_text_buffer_insert_paintable(
670                self.as_ref().to_glib_none().0,
671                iter.to_glib_none_mut().0,
672                paintable.as_ref().to_glib_none().0,
673            );
674        }
675    }
676
677    #[doc(alias = "gtk_text_buffer_insert_range")]
678    fn insert_range(&self, iter: &mut TextIter, start: &TextIter, end: &TextIter) {
679        unsafe {
680            ffi::gtk_text_buffer_insert_range(
681                self.as_ref().to_glib_none().0,
682                iter.to_glib_none_mut().0,
683                start.to_glib_none().0,
684                end.to_glib_none().0,
685            );
686        }
687    }
688
689    #[doc(alias = "gtk_text_buffer_insert_range_interactive")]
690    fn insert_range_interactive(
691        &self,
692        iter: &mut TextIter,
693        start: &TextIter,
694        end: &TextIter,
695        default_editable: bool,
696    ) -> bool {
697        unsafe {
698            from_glib(ffi::gtk_text_buffer_insert_range_interactive(
699                self.as_ref().to_glib_none().0,
700                iter.to_glib_none_mut().0,
701                start.to_glib_none().0,
702                end.to_glib_none().0,
703                default_editable.into_glib(),
704            ))
705        }
706    }
707
708    #[doc(alias = "gtk_text_buffer_move_mark")]
709    fn move_mark(&self, mark: &impl IsA<TextMark>, where_: &TextIter) {
710        unsafe {
711            ffi::gtk_text_buffer_move_mark(
712                self.as_ref().to_glib_none().0,
713                mark.as_ref().to_glib_none().0,
714                where_.to_glib_none().0,
715            );
716        }
717    }
718
719    #[doc(alias = "gtk_text_buffer_move_mark_by_name")]
720    fn move_mark_by_name(&self, name: &str, where_: &TextIter) {
721        unsafe {
722            ffi::gtk_text_buffer_move_mark_by_name(
723                self.as_ref().to_glib_none().0,
724                name.to_glib_none().0,
725                where_.to_glib_none().0,
726            );
727        }
728    }
729
730    #[doc(alias = "gtk_text_buffer_paste_clipboard")]
731    fn paste_clipboard(
732        &self,
733        clipboard: &gdk::Clipboard,
734        override_location: Option<&TextIter>,
735        default_editable: bool,
736    ) {
737        unsafe {
738            ffi::gtk_text_buffer_paste_clipboard(
739                self.as_ref().to_glib_none().0,
740                clipboard.to_glib_none().0,
741                mut_override(override_location.to_glib_none().0),
742                default_editable.into_glib(),
743            );
744        }
745    }
746
747    #[doc(alias = "gtk_text_buffer_place_cursor")]
748    fn place_cursor(&self, where_: &TextIter) {
749        unsafe {
750            ffi::gtk_text_buffer_place_cursor(
751                self.as_ref().to_glib_none().0,
752                where_.to_glib_none().0,
753            );
754        }
755    }
756
757    #[doc(alias = "gtk_text_buffer_redo")]
758    fn redo(&self) {
759        unsafe {
760            ffi::gtk_text_buffer_redo(self.as_ref().to_glib_none().0);
761        }
762    }
763
764    #[doc(alias = "gtk_text_buffer_remove_all_tags")]
765    fn remove_all_tags(&self, start: &TextIter, end: &TextIter) {
766        unsafe {
767            ffi::gtk_text_buffer_remove_all_tags(
768                self.as_ref().to_glib_none().0,
769                start.to_glib_none().0,
770                end.to_glib_none().0,
771            );
772        }
773    }
774
775    #[cfg(feature = "v4_16")]
776    #[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
777    #[doc(alias = "gtk_text_buffer_remove_commit_notify")]
778    fn remove_commit_notify(&self, commit_notify_handler: u32) {
779        unsafe {
780            ffi::gtk_text_buffer_remove_commit_notify(
781                self.as_ref().to_glib_none().0,
782                commit_notify_handler,
783            );
784        }
785    }
786
787    #[doc(alias = "gtk_text_buffer_remove_selection_clipboard")]
788    fn remove_selection_clipboard(&self, clipboard: &gdk::Clipboard) {
789        unsafe {
790            ffi::gtk_text_buffer_remove_selection_clipboard(
791                self.as_ref().to_glib_none().0,
792                clipboard.to_glib_none().0,
793            );
794        }
795    }
796
797    #[doc(alias = "gtk_text_buffer_remove_tag")]
798    fn remove_tag(&self, tag: &impl IsA<TextTag>, start: &TextIter, end: &TextIter) {
799        unsafe {
800            ffi::gtk_text_buffer_remove_tag(
801                self.as_ref().to_glib_none().0,
802                tag.as_ref().to_glib_none().0,
803                start.to_glib_none().0,
804                end.to_glib_none().0,
805            );
806        }
807    }
808
809    #[doc(alias = "gtk_text_buffer_remove_tag_by_name")]
810    fn remove_tag_by_name(&self, name: &str, start: &TextIter, end: &TextIter) {
811        unsafe {
812            ffi::gtk_text_buffer_remove_tag_by_name(
813                self.as_ref().to_glib_none().0,
814                name.to_glib_none().0,
815                start.to_glib_none().0,
816                end.to_glib_none().0,
817            );
818        }
819    }
820
821    #[doc(alias = "gtk_text_buffer_select_range")]
822    fn select_range(&self, ins: &TextIter, bound: &TextIter) {
823        unsafe {
824            ffi::gtk_text_buffer_select_range(
825                self.as_ref().to_glib_none().0,
826                ins.to_glib_none().0,
827                bound.to_glib_none().0,
828            );
829        }
830    }
831
832    #[doc(alias = "gtk_text_buffer_set_enable_undo")]
833    #[doc(alias = "enable-undo")]
834    fn set_enable_undo(&self, enable_undo: bool) {
835        unsafe {
836            ffi::gtk_text_buffer_set_enable_undo(
837                self.as_ref().to_glib_none().0,
838                enable_undo.into_glib(),
839            );
840        }
841    }
842
843    #[doc(alias = "gtk_text_buffer_set_max_undo_levels")]
844    fn set_max_undo_levels(&self, max_undo_levels: u32) {
845        unsafe {
846            ffi::gtk_text_buffer_set_max_undo_levels(
847                self.as_ref().to_glib_none().0,
848                max_undo_levels,
849            );
850        }
851    }
852
853    #[doc(alias = "gtk_text_buffer_set_modified")]
854    fn set_modified(&self, setting: bool) {
855        unsafe {
856            ffi::gtk_text_buffer_set_modified(self.as_ref().to_glib_none().0, setting.into_glib());
857        }
858    }
859
860    #[doc(alias = "gtk_text_buffer_set_text")]
861    #[doc(alias = "text")]
862    fn set_text(&self, text: &str) {
863        let len = text.len() as _;
864        unsafe {
865            ffi::gtk_text_buffer_set_text(
866                self.as_ref().to_glib_none().0,
867                text.to_glib_none().0,
868                len,
869            );
870        }
871    }
872
873    #[doc(alias = "gtk_text_buffer_undo")]
874    fn undo(&self) {
875        unsafe {
876            ffi::gtk_text_buffer_undo(self.as_ref().to_glib_none().0);
877        }
878    }
879
880    #[doc(alias = "cursor-position")]
881    fn cursor_position(&self) -> i32 {
882        ObjectExt::property(self.as_ref(), "cursor-position")
883    }
884
885    #[doc(alias = "apply-tag")]
886    fn connect_apply_tag<F: Fn(&Self, &TextTag, &TextIter, &TextIter) + 'static>(
887        &self,
888        f: F,
889    ) -> SignalHandlerId {
890        unsafe extern "C" fn apply_tag_trampoline<
891            P: IsA<TextBuffer>,
892            F: Fn(&P, &TextTag, &TextIter, &TextIter) + 'static,
893        >(
894            this: *mut ffi::GtkTextBuffer,
895            tag: *mut ffi::GtkTextTag,
896            start: *mut ffi::GtkTextIter,
897            end: *mut ffi::GtkTextIter,
898            f: glib::ffi::gpointer,
899        ) {
900            let f: &F = &*(f as *const F);
901            f(
902                TextBuffer::from_glib_borrow(this).unsafe_cast_ref(),
903                &from_glib_borrow(tag),
904                &from_glib_borrow(start),
905                &from_glib_borrow(end),
906            )
907        }
908        unsafe {
909            let f: Box_<F> = Box_::new(f);
910            connect_raw(
911                self.as_ptr() as *mut _,
912                c"apply-tag".as_ptr() as *const _,
913                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
914                    apply_tag_trampoline::<Self, F> as *const (),
915                )),
916                Box_::into_raw(f),
917            )
918        }
919    }
920
921    #[doc(alias = "begin-user-action")]
922    fn connect_begin_user_action<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
923        unsafe extern "C" fn begin_user_action_trampoline<
924            P: IsA<TextBuffer>,
925            F: Fn(&P) + 'static,
926        >(
927            this: *mut ffi::GtkTextBuffer,
928            f: glib::ffi::gpointer,
929        ) {
930            let f: &F = &*(f as *const F);
931            f(TextBuffer::from_glib_borrow(this).unsafe_cast_ref())
932        }
933        unsafe {
934            let f: Box_<F> = Box_::new(f);
935            connect_raw(
936                self.as_ptr() as *mut _,
937                c"begin-user-action".as_ptr() as *const _,
938                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
939                    begin_user_action_trampoline::<Self, F> as *const (),
940                )),
941                Box_::into_raw(f),
942            )
943        }
944    }
945
946    #[doc(alias = "changed")]
947    fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
948        unsafe extern "C" fn changed_trampoline<P: IsA<TextBuffer>, F: Fn(&P) + 'static>(
949            this: *mut ffi::GtkTextBuffer,
950            f: glib::ffi::gpointer,
951        ) {
952            let f: &F = &*(f as *const F);
953            f(TextBuffer::from_glib_borrow(this).unsafe_cast_ref())
954        }
955        unsafe {
956            let f: Box_<F> = Box_::new(f);
957            connect_raw(
958                self.as_ptr() as *mut _,
959                c"changed".as_ptr() as *const _,
960                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
961                    changed_trampoline::<Self, F> as *const (),
962                )),
963                Box_::into_raw(f),
964            )
965        }
966    }
967
968    #[doc(alias = "delete-range")]
969    fn connect_delete_range<F: Fn(&Self, &TextIter, &TextIter) + 'static>(
970        &self,
971        f: F,
972    ) -> SignalHandlerId {
973        unsafe extern "C" fn delete_range_trampoline<
974            P: IsA<TextBuffer>,
975            F: Fn(&P, &TextIter, &TextIter) + 'static,
976        >(
977            this: *mut ffi::GtkTextBuffer,
978            start: *mut ffi::GtkTextIter,
979            end: *mut ffi::GtkTextIter,
980            f: glib::ffi::gpointer,
981        ) {
982            let f: &F = &*(f as *const F);
983            f(
984                TextBuffer::from_glib_borrow(this).unsafe_cast_ref(),
985                &from_glib_borrow(start),
986                &from_glib_borrow(end),
987            )
988        }
989        unsafe {
990            let f: Box_<F> = Box_::new(f);
991            connect_raw(
992                self.as_ptr() as *mut _,
993                c"delete-range".as_ptr() as *const _,
994                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
995                    delete_range_trampoline::<Self, F> as *const (),
996                )),
997                Box_::into_raw(f),
998            )
999        }
1000    }
1001
1002    #[doc(alias = "end-user-action")]
1003    fn connect_end_user_action<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1004        unsafe extern "C" fn end_user_action_trampoline<P: IsA<TextBuffer>, F: Fn(&P) + 'static>(
1005            this: *mut ffi::GtkTextBuffer,
1006            f: glib::ffi::gpointer,
1007        ) {
1008            let f: &F = &*(f as *const F);
1009            f(TextBuffer::from_glib_borrow(this).unsafe_cast_ref())
1010        }
1011        unsafe {
1012            let f: Box_<F> = Box_::new(f);
1013            connect_raw(
1014                self.as_ptr() as *mut _,
1015                c"end-user-action".as_ptr() as *const _,
1016                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1017                    end_user_action_trampoline::<Self, F> as *const (),
1018                )),
1019                Box_::into_raw(f),
1020            )
1021        }
1022    }
1023
1024    #[doc(alias = "insert-child-anchor")]
1025    fn connect_insert_child_anchor<F: Fn(&Self, &TextIter, &TextChildAnchor) + 'static>(
1026        &self,
1027        f: F,
1028    ) -> SignalHandlerId {
1029        unsafe extern "C" fn insert_child_anchor_trampoline<
1030            P: IsA<TextBuffer>,
1031            F: Fn(&P, &TextIter, &TextChildAnchor) + 'static,
1032        >(
1033            this: *mut ffi::GtkTextBuffer,
1034            location: *mut ffi::GtkTextIter,
1035            anchor: *mut ffi::GtkTextChildAnchor,
1036            f: glib::ffi::gpointer,
1037        ) {
1038            let f: &F = &*(f as *const F);
1039            f(
1040                TextBuffer::from_glib_borrow(this).unsafe_cast_ref(),
1041                &from_glib_borrow(location),
1042                &from_glib_borrow(anchor),
1043            )
1044        }
1045        unsafe {
1046            let f: Box_<F> = Box_::new(f);
1047            connect_raw(
1048                self.as_ptr() as *mut _,
1049                c"insert-child-anchor".as_ptr() as *const _,
1050                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1051                    insert_child_anchor_trampoline::<Self, F> as *const (),
1052                )),
1053                Box_::into_raw(f),
1054            )
1055        }
1056    }
1057
1058    #[doc(alias = "insert-paintable")]
1059    fn connect_insert_paintable<F: Fn(&Self, &TextIter, &gdk::Paintable) + 'static>(
1060        &self,
1061        f: F,
1062    ) -> SignalHandlerId {
1063        unsafe extern "C" fn insert_paintable_trampoline<
1064            P: IsA<TextBuffer>,
1065            F: Fn(&P, &TextIter, &gdk::Paintable) + 'static,
1066        >(
1067            this: *mut ffi::GtkTextBuffer,
1068            location: *mut ffi::GtkTextIter,
1069            paintable: *mut gdk::ffi::GdkPaintable,
1070            f: glib::ffi::gpointer,
1071        ) {
1072            let f: &F = &*(f as *const F);
1073            f(
1074                TextBuffer::from_glib_borrow(this).unsafe_cast_ref(),
1075                &from_glib_borrow(location),
1076                &from_glib_borrow(paintable),
1077            )
1078        }
1079        unsafe {
1080            let f: Box_<F> = Box_::new(f);
1081            connect_raw(
1082                self.as_ptr() as *mut _,
1083                c"insert-paintable".as_ptr() as *const _,
1084                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1085                    insert_paintable_trampoline::<Self, F> as *const (),
1086                )),
1087                Box_::into_raw(f),
1088            )
1089        }
1090    }
1091
1092    #[doc(alias = "mark-deleted")]
1093    fn connect_mark_deleted<F: Fn(&Self, &TextMark) + 'static>(&self, f: F) -> SignalHandlerId {
1094        unsafe extern "C" fn mark_deleted_trampoline<
1095            P: IsA<TextBuffer>,
1096            F: Fn(&P, &TextMark) + 'static,
1097        >(
1098            this: *mut ffi::GtkTextBuffer,
1099            mark: *mut ffi::GtkTextMark,
1100            f: glib::ffi::gpointer,
1101        ) {
1102            let f: &F = &*(f as *const F);
1103            f(
1104                TextBuffer::from_glib_borrow(this).unsafe_cast_ref(),
1105                &from_glib_borrow(mark),
1106            )
1107        }
1108        unsafe {
1109            let f: Box_<F> = Box_::new(f);
1110            connect_raw(
1111                self.as_ptr() as *mut _,
1112                c"mark-deleted".as_ptr() as *const _,
1113                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1114                    mark_deleted_trampoline::<Self, F> as *const (),
1115                )),
1116                Box_::into_raw(f),
1117            )
1118        }
1119    }
1120
1121    #[doc(alias = "mark-set")]
1122    fn connect_mark_set<F: Fn(&Self, &TextIter, &TextMark) + 'static>(
1123        &self,
1124        f: F,
1125    ) -> SignalHandlerId {
1126        unsafe extern "C" fn mark_set_trampoline<
1127            P: IsA<TextBuffer>,
1128            F: Fn(&P, &TextIter, &TextMark) + 'static,
1129        >(
1130            this: *mut ffi::GtkTextBuffer,
1131            location: *mut ffi::GtkTextIter,
1132            mark: *mut ffi::GtkTextMark,
1133            f: glib::ffi::gpointer,
1134        ) {
1135            let f: &F = &*(f as *const F);
1136            f(
1137                TextBuffer::from_glib_borrow(this).unsafe_cast_ref(),
1138                &from_glib_borrow(location),
1139                &from_glib_borrow(mark),
1140            )
1141        }
1142        unsafe {
1143            let f: Box_<F> = Box_::new(f);
1144            connect_raw(
1145                self.as_ptr() as *mut _,
1146                c"mark-set".as_ptr() as *const _,
1147                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1148                    mark_set_trampoline::<Self, F> as *const (),
1149                )),
1150                Box_::into_raw(f),
1151            )
1152        }
1153    }
1154
1155    #[doc(alias = "modified-changed")]
1156    fn connect_modified_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1157        unsafe extern "C" fn modified_changed_trampoline<
1158            P: IsA<TextBuffer>,
1159            F: Fn(&P) + 'static,
1160        >(
1161            this: *mut ffi::GtkTextBuffer,
1162            f: glib::ffi::gpointer,
1163        ) {
1164            let f: &F = &*(f as *const F);
1165            f(TextBuffer::from_glib_borrow(this).unsafe_cast_ref())
1166        }
1167        unsafe {
1168            let f: Box_<F> = Box_::new(f);
1169            connect_raw(
1170                self.as_ptr() as *mut _,
1171                c"modified-changed".as_ptr() as *const _,
1172                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1173                    modified_changed_trampoline::<Self, F> as *const (),
1174                )),
1175                Box_::into_raw(f),
1176            )
1177        }
1178    }
1179
1180    #[doc(alias = "paste-done")]
1181    fn connect_paste_done<F: Fn(&Self, &gdk::Clipboard) + 'static>(&self, f: F) -> SignalHandlerId {
1182        unsafe extern "C" fn paste_done_trampoline<
1183            P: IsA<TextBuffer>,
1184            F: Fn(&P, &gdk::Clipboard) + 'static,
1185        >(
1186            this: *mut ffi::GtkTextBuffer,
1187            clipboard: *mut gdk::ffi::GdkClipboard,
1188            f: glib::ffi::gpointer,
1189        ) {
1190            let f: &F = &*(f as *const F);
1191            f(
1192                TextBuffer::from_glib_borrow(this).unsafe_cast_ref(),
1193                &from_glib_borrow(clipboard),
1194            )
1195        }
1196        unsafe {
1197            let f: Box_<F> = Box_::new(f);
1198            connect_raw(
1199                self.as_ptr() as *mut _,
1200                c"paste-done".as_ptr() as *const _,
1201                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1202                    paste_done_trampoline::<Self, F> as *const (),
1203                )),
1204                Box_::into_raw(f),
1205            )
1206        }
1207    }
1208
1209    #[doc(alias = "redo")]
1210    fn connect_redo<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1211        unsafe extern "C" fn redo_trampoline<P: IsA<TextBuffer>, F: Fn(&P) + 'static>(
1212            this: *mut ffi::GtkTextBuffer,
1213            f: glib::ffi::gpointer,
1214        ) {
1215            let f: &F = &*(f as *const F);
1216            f(TextBuffer::from_glib_borrow(this).unsafe_cast_ref())
1217        }
1218        unsafe {
1219            let f: Box_<F> = Box_::new(f);
1220            connect_raw(
1221                self.as_ptr() as *mut _,
1222                c"redo".as_ptr() as *const _,
1223                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1224                    redo_trampoline::<Self, F> as *const (),
1225                )),
1226                Box_::into_raw(f),
1227            )
1228        }
1229    }
1230
1231    #[doc(alias = "remove-tag")]
1232    fn connect_remove_tag<F: Fn(&Self, &TextTag, &TextIter, &TextIter) + 'static>(
1233        &self,
1234        f: F,
1235    ) -> SignalHandlerId {
1236        unsafe extern "C" fn remove_tag_trampoline<
1237            P: IsA<TextBuffer>,
1238            F: Fn(&P, &TextTag, &TextIter, &TextIter) + 'static,
1239        >(
1240            this: *mut ffi::GtkTextBuffer,
1241            tag: *mut ffi::GtkTextTag,
1242            start: *mut ffi::GtkTextIter,
1243            end: *mut ffi::GtkTextIter,
1244            f: glib::ffi::gpointer,
1245        ) {
1246            let f: &F = &*(f as *const F);
1247            f(
1248                TextBuffer::from_glib_borrow(this).unsafe_cast_ref(),
1249                &from_glib_borrow(tag),
1250                &from_glib_borrow(start),
1251                &from_glib_borrow(end),
1252            )
1253        }
1254        unsafe {
1255            let f: Box_<F> = Box_::new(f);
1256            connect_raw(
1257                self.as_ptr() as *mut _,
1258                c"remove-tag".as_ptr() as *const _,
1259                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1260                    remove_tag_trampoline::<Self, F> as *const (),
1261                )),
1262                Box_::into_raw(f),
1263            )
1264        }
1265    }
1266
1267    #[doc(alias = "undo")]
1268    fn connect_undo<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1269        unsafe extern "C" fn undo_trampoline<P: IsA<TextBuffer>, F: Fn(&P) + 'static>(
1270            this: *mut ffi::GtkTextBuffer,
1271            f: glib::ffi::gpointer,
1272        ) {
1273            let f: &F = &*(f as *const F);
1274            f(TextBuffer::from_glib_borrow(this).unsafe_cast_ref())
1275        }
1276        unsafe {
1277            let f: Box_<F> = Box_::new(f);
1278            connect_raw(
1279                self.as_ptr() as *mut _,
1280                c"undo".as_ptr() as *const _,
1281                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1282                    undo_trampoline::<Self, F> as *const (),
1283                )),
1284                Box_::into_raw(f),
1285            )
1286        }
1287    }
1288
1289    #[doc(alias = "can-redo")]
1290    fn connect_can_redo_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1291        unsafe extern "C" fn notify_can_redo_trampoline<P: IsA<TextBuffer>, F: Fn(&P) + 'static>(
1292            this: *mut ffi::GtkTextBuffer,
1293            _param_spec: glib::ffi::gpointer,
1294            f: glib::ffi::gpointer,
1295        ) {
1296            let f: &F = &*(f as *const F);
1297            f(TextBuffer::from_glib_borrow(this).unsafe_cast_ref())
1298        }
1299        unsafe {
1300            let f: Box_<F> = Box_::new(f);
1301            connect_raw(
1302                self.as_ptr() as *mut _,
1303                c"notify::can-redo".as_ptr() as *const _,
1304                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1305                    notify_can_redo_trampoline::<Self, F> as *const (),
1306                )),
1307                Box_::into_raw(f),
1308            )
1309        }
1310    }
1311
1312    #[doc(alias = "can-undo")]
1313    fn connect_can_undo_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1314        unsafe extern "C" fn notify_can_undo_trampoline<P: IsA<TextBuffer>, F: Fn(&P) + 'static>(
1315            this: *mut ffi::GtkTextBuffer,
1316            _param_spec: glib::ffi::gpointer,
1317            f: glib::ffi::gpointer,
1318        ) {
1319            let f: &F = &*(f as *const F);
1320            f(TextBuffer::from_glib_borrow(this).unsafe_cast_ref())
1321        }
1322        unsafe {
1323            let f: Box_<F> = Box_::new(f);
1324            connect_raw(
1325                self.as_ptr() as *mut _,
1326                c"notify::can-undo".as_ptr() as *const _,
1327                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1328                    notify_can_undo_trampoline::<Self, F> as *const (),
1329                )),
1330                Box_::into_raw(f),
1331            )
1332        }
1333    }
1334
1335    #[doc(alias = "cursor-position")]
1336    fn connect_cursor_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1337        unsafe extern "C" fn notify_cursor_position_trampoline<
1338            P: IsA<TextBuffer>,
1339            F: Fn(&P) + 'static,
1340        >(
1341            this: *mut ffi::GtkTextBuffer,
1342            _param_spec: glib::ffi::gpointer,
1343            f: glib::ffi::gpointer,
1344        ) {
1345            let f: &F = &*(f as *const F);
1346            f(TextBuffer::from_glib_borrow(this).unsafe_cast_ref())
1347        }
1348        unsafe {
1349            let f: Box_<F> = Box_::new(f);
1350            connect_raw(
1351                self.as_ptr() as *mut _,
1352                c"notify::cursor-position".as_ptr() as *const _,
1353                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1354                    notify_cursor_position_trampoline::<Self, F> as *const (),
1355                )),
1356                Box_::into_raw(f),
1357            )
1358        }
1359    }
1360
1361    #[doc(alias = "enable-undo")]
1362    fn connect_enable_undo_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1363        unsafe extern "C" fn notify_enable_undo_trampoline<
1364            P: IsA<TextBuffer>,
1365            F: Fn(&P) + 'static,
1366        >(
1367            this: *mut ffi::GtkTextBuffer,
1368            _param_spec: glib::ffi::gpointer,
1369            f: glib::ffi::gpointer,
1370        ) {
1371            let f: &F = &*(f as *const F);
1372            f(TextBuffer::from_glib_borrow(this).unsafe_cast_ref())
1373        }
1374        unsafe {
1375            let f: Box_<F> = Box_::new(f);
1376            connect_raw(
1377                self.as_ptr() as *mut _,
1378                c"notify::enable-undo".as_ptr() as *const _,
1379                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1380                    notify_enable_undo_trampoline::<Self, F> as *const (),
1381                )),
1382                Box_::into_raw(f),
1383            )
1384        }
1385    }
1386
1387    #[doc(alias = "has-selection")]
1388    fn connect_has_selection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1389        unsafe extern "C" fn notify_has_selection_trampoline<
1390            P: IsA<TextBuffer>,
1391            F: Fn(&P) + 'static,
1392        >(
1393            this: *mut ffi::GtkTextBuffer,
1394            _param_spec: glib::ffi::gpointer,
1395            f: glib::ffi::gpointer,
1396        ) {
1397            let f: &F = &*(f as *const F);
1398            f(TextBuffer::from_glib_borrow(this).unsafe_cast_ref())
1399        }
1400        unsafe {
1401            let f: Box_<F> = Box_::new(f);
1402            connect_raw(
1403                self.as_ptr() as *mut _,
1404                c"notify::has-selection".as_ptr() as *const _,
1405                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1406                    notify_has_selection_trampoline::<Self, F> as *const (),
1407                )),
1408                Box_::into_raw(f),
1409            )
1410        }
1411    }
1412
1413    #[doc(alias = "text")]
1414    fn connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1415        unsafe extern "C" fn notify_text_trampoline<P: IsA<TextBuffer>, F: Fn(&P) + 'static>(
1416            this: *mut ffi::GtkTextBuffer,
1417            _param_spec: glib::ffi::gpointer,
1418            f: glib::ffi::gpointer,
1419        ) {
1420            let f: &F = &*(f as *const F);
1421            f(TextBuffer::from_glib_borrow(this).unsafe_cast_ref())
1422        }
1423        unsafe {
1424            let f: Box_<F> = Box_::new(f);
1425            connect_raw(
1426                self.as_ptr() as *mut _,
1427                c"notify::text".as_ptr() as *const _,
1428                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1429                    notify_text_trampoline::<Self, F> as *const (),
1430                )),
1431                Box_::into_raw(f),
1432            )
1433        }
1434    }
1435}
1436
1437impl<O: IsA<TextBuffer>> TextBufferExt for O {}