1#[cfg(feature = "v4_14")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
7use crate::AccessibleText;
8use crate::{
9 ffi, Accessible, AccessibleRole, Adjustment, Align, Buildable, ConstraintTarget, DeleteType,
10 InputHints, InputPurpose, Justification, LayoutManager, MovementStep, Overflow, ScrollStep,
11 Scrollable, ScrollablePolicy, TextBuffer, TextChildAnchor, TextExtendSelection, TextIter,
12 TextMark, TextWindowType, Widget, WrapMode,
13};
14use glib::{
15 object::ObjectType as _,
16 prelude::*,
17 signal::{connect_raw, SignalHandlerId},
18 translate::*,
19};
20use std::boxed::Box as Box_;
21
22#[cfg(feature = "v4_14")]
23#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
24glib::wrapper! {
25 #[doc(alias = "GtkTextView")]
26 pub struct TextView(Object<ffi::GtkTextView, ffi::GtkTextViewClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, AccessibleText, Scrollable;
27
28 match fn {
29 type_ => || ffi::gtk_text_view_get_type(),
30 }
31}
32
33#[cfg(not(any(feature = "v4_14")))]
34glib::wrapper! {
35 #[doc(alias = "GtkTextView")]
36 pub struct TextView(Object<ffi::GtkTextView, ffi::GtkTextViewClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, Scrollable;
37
38 match fn {
39 type_ => || ffi::gtk_text_view_get_type(),
40 }
41}
42
43impl TextView {
44 pub const NONE: Option<&'static TextView> = None;
45
46 #[doc(alias = "gtk_text_view_new")]
47 pub fn new() -> TextView {
48 assert_initialized_main_thread!();
49 unsafe { Widget::from_glib_none(ffi::gtk_text_view_new()).unsafe_cast() }
50 }
51
52 #[doc(alias = "gtk_text_view_new_with_buffer")]
53 #[doc(alias = "new_with_buffer")]
54 pub fn with_buffer(buffer: &impl IsA<TextBuffer>) -> TextView {
55 skip_assert_initialized!();
56 unsafe {
57 Widget::from_glib_none(ffi::gtk_text_view_new_with_buffer(
58 buffer.as_ref().to_glib_none().0,
59 ))
60 .unsafe_cast()
61 }
62 }
63
64 pub fn builder() -> TextViewBuilder {
69 TextViewBuilder::new()
70 }
71}
72
73impl Default for TextView {
74 fn default() -> Self {
75 Self::new()
76 }
77}
78
79#[must_use = "The builder must be built to be used"]
84pub struct TextViewBuilder {
85 builder: glib::object::ObjectBuilder<'static, TextView>,
86}
87
88impl TextViewBuilder {
89 fn new() -> Self {
90 Self {
91 builder: glib::object::Object::builder(),
92 }
93 }
94
95 pub fn accepts_tab(self, accepts_tab: bool) -> Self {
96 Self {
97 builder: self.builder.property("accepts-tab", accepts_tab),
98 }
99 }
100
101 pub fn bottom_margin(self, bottom_margin: i32) -> Self {
102 Self {
103 builder: self.builder.property("bottom-margin", bottom_margin),
104 }
105 }
106
107 pub fn buffer(self, buffer: &impl IsA<TextBuffer>) -> Self {
108 Self {
109 builder: self.builder.property("buffer", buffer.clone().upcast()),
110 }
111 }
112
113 pub fn cursor_visible(self, cursor_visible: bool) -> Self {
114 Self {
115 builder: self.builder.property("cursor-visible", cursor_visible),
116 }
117 }
118
119 pub fn editable(self, editable: bool) -> Self {
120 Self {
121 builder: self.builder.property("editable", editable),
122 }
123 }
124
125 pub fn extra_menu(self, extra_menu: &impl IsA<gio::MenuModel>) -> Self {
126 Self {
127 builder: self
128 .builder
129 .property("extra-menu", extra_menu.clone().upcast()),
130 }
131 }
132
133 pub fn im_module(self, im_module: impl Into<glib::GString>) -> Self {
134 Self {
135 builder: self.builder.property("im-module", im_module.into()),
136 }
137 }
138
139 pub fn indent(self, indent: i32) -> Self {
140 Self {
141 builder: self.builder.property("indent", indent),
142 }
143 }
144
145 pub fn input_hints(self, input_hints: InputHints) -> Self {
146 Self {
147 builder: self.builder.property("input-hints", input_hints),
148 }
149 }
150
151 pub fn input_purpose(self, input_purpose: InputPurpose) -> Self {
152 Self {
153 builder: self.builder.property("input-purpose", input_purpose),
154 }
155 }
156
157 pub fn justification(self, justification: Justification) -> Self {
158 Self {
159 builder: self.builder.property("justification", justification),
160 }
161 }
162
163 pub fn left_margin(self, left_margin: i32) -> Self {
164 Self {
165 builder: self.builder.property("left-margin", left_margin),
166 }
167 }
168
169 pub fn monospace(self, monospace: bool) -> Self {
170 Self {
171 builder: self.builder.property("monospace", monospace),
172 }
173 }
174
175 pub fn overwrite(self, overwrite: bool) -> Self {
176 Self {
177 builder: self.builder.property("overwrite", overwrite),
178 }
179 }
180
181 pub fn pixels_above_lines(self, pixels_above_lines: i32) -> Self {
182 Self {
183 builder: self
184 .builder
185 .property("pixels-above-lines", pixels_above_lines),
186 }
187 }
188
189 pub fn pixels_below_lines(self, pixels_below_lines: i32) -> Self {
190 Self {
191 builder: self
192 .builder
193 .property("pixels-below-lines", pixels_below_lines),
194 }
195 }
196
197 pub fn pixels_inside_wrap(self, pixels_inside_wrap: i32) -> Self {
198 Self {
199 builder: self
200 .builder
201 .property("pixels-inside-wrap", pixels_inside_wrap),
202 }
203 }
204
205 pub fn right_margin(self, right_margin: i32) -> Self {
206 Self {
207 builder: self.builder.property("right-margin", right_margin),
208 }
209 }
210
211 pub fn tabs(self, tabs: &pango::TabArray) -> Self {
212 Self {
213 builder: self.builder.property("tabs", tabs),
214 }
215 }
216
217 pub fn top_margin(self, top_margin: i32) -> Self {
218 Self {
219 builder: self.builder.property("top-margin", top_margin),
220 }
221 }
222
223 pub fn wrap_mode(self, wrap_mode: WrapMode) -> Self {
224 Self {
225 builder: self.builder.property("wrap-mode", wrap_mode),
226 }
227 }
228
229 pub fn can_focus(self, can_focus: bool) -> Self {
230 Self {
231 builder: self.builder.property("can-focus", can_focus),
232 }
233 }
234
235 pub fn can_target(self, can_target: bool) -> Self {
236 Self {
237 builder: self.builder.property("can-target", can_target),
238 }
239 }
240
241 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
242 Self {
243 builder: self.builder.property("css-classes", css_classes.into()),
244 }
245 }
246
247 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
248 Self {
249 builder: self.builder.property("css-name", css_name.into()),
250 }
251 }
252
253 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
254 Self {
255 builder: self.builder.property("cursor", cursor.clone()),
256 }
257 }
258
259 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
260 Self {
261 builder: self.builder.property("focus-on-click", focus_on_click),
262 }
263 }
264
265 pub fn focusable(self, focusable: bool) -> Self {
266 Self {
267 builder: self.builder.property("focusable", focusable),
268 }
269 }
270
271 pub fn halign(self, halign: Align) -> Self {
272 Self {
273 builder: self.builder.property("halign", halign),
274 }
275 }
276
277 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
278 Self {
279 builder: self.builder.property("has-tooltip", has_tooltip),
280 }
281 }
282
283 pub fn height_request(self, height_request: i32) -> Self {
284 Self {
285 builder: self.builder.property("height-request", height_request),
286 }
287 }
288
289 pub fn hexpand(self, hexpand: bool) -> Self {
290 Self {
291 builder: self.builder.property("hexpand", hexpand),
292 }
293 }
294
295 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
296 Self {
297 builder: self.builder.property("hexpand-set", hexpand_set),
298 }
299 }
300
301 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
302 Self {
303 builder: self
304 .builder
305 .property("layout-manager", layout_manager.clone().upcast()),
306 }
307 }
308
309 #[cfg(feature = "v4_18")]
310 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
311 pub fn limit_events(self, limit_events: bool) -> Self {
312 Self {
313 builder: self.builder.property("limit-events", limit_events),
314 }
315 }
316
317 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
318 Self {
319 builder: self.builder.property("margin-bottom", margin_bottom),
320 }
321 }
322
323 pub fn margin_end(self, margin_end: i32) -> Self {
324 Self {
325 builder: self.builder.property("margin-end", margin_end),
326 }
327 }
328
329 pub fn margin_start(self, margin_start: i32) -> Self {
330 Self {
331 builder: self.builder.property("margin-start", margin_start),
332 }
333 }
334
335 pub fn margin_top(self, margin_top: i32) -> Self {
336 Self {
337 builder: self.builder.property("margin-top", margin_top),
338 }
339 }
340
341 pub fn name(self, name: impl Into<glib::GString>) -> Self {
342 Self {
343 builder: self.builder.property("name", name.into()),
344 }
345 }
346
347 pub fn opacity(self, opacity: f64) -> Self {
348 Self {
349 builder: self.builder.property("opacity", opacity),
350 }
351 }
352
353 pub fn overflow(self, overflow: Overflow) -> Self {
354 Self {
355 builder: self.builder.property("overflow", overflow),
356 }
357 }
358
359 pub fn receives_default(self, receives_default: bool) -> Self {
360 Self {
361 builder: self.builder.property("receives-default", receives_default),
362 }
363 }
364
365 pub fn sensitive(self, sensitive: bool) -> Self {
366 Self {
367 builder: self.builder.property("sensitive", sensitive),
368 }
369 }
370
371 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
372 Self {
373 builder: self
374 .builder
375 .property("tooltip-markup", tooltip_markup.into()),
376 }
377 }
378
379 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
380 Self {
381 builder: self.builder.property("tooltip-text", tooltip_text.into()),
382 }
383 }
384
385 pub fn valign(self, valign: Align) -> Self {
386 Self {
387 builder: self.builder.property("valign", valign),
388 }
389 }
390
391 pub fn vexpand(self, vexpand: bool) -> Self {
392 Self {
393 builder: self.builder.property("vexpand", vexpand),
394 }
395 }
396
397 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
398 Self {
399 builder: self.builder.property("vexpand-set", vexpand_set),
400 }
401 }
402
403 pub fn visible(self, visible: bool) -> Self {
404 Self {
405 builder: self.builder.property("visible", visible),
406 }
407 }
408
409 pub fn width_request(self, width_request: i32) -> Self {
410 Self {
411 builder: self.builder.property("width-request", width_request),
412 }
413 }
414
415 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
416 Self {
417 builder: self.builder.property("accessible-role", accessible_role),
418 }
419 }
420
421 pub fn hadjustment(self, hadjustment: &impl IsA<Adjustment>) -> Self {
422 Self {
423 builder: self
424 .builder
425 .property("hadjustment", hadjustment.clone().upcast()),
426 }
427 }
428
429 pub fn hscroll_policy(self, hscroll_policy: ScrollablePolicy) -> Self {
430 Self {
431 builder: self.builder.property("hscroll-policy", hscroll_policy),
432 }
433 }
434
435 pub fn vadjustment(self, vadjustment: &impl IsA<Adjustment>) -> Self {
436 Self {
437 builder: self
438 .builder
439 .property("vadjustment", vadjustment.clone().upcast()),
440 }
441 }
442
443 pub fn vscroll_policy(self, vscroll_policy: ScrollablePolicy) -> Self {
444 Self {
445 builder: self.builder.property("vscroll-policy", vscroll_policy),
446 }
447 }
448
449 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
452 pub fn build(self) -> TextView {
453 assert_initialized_main_thread!();
454 self.builder.build()
455 }
456}
457
458pub trait TextViewExt: IsA<TextView> + 'static {
459 #[doc(alias = "gtk_text_view_add_child_at_anchor")]
460 fn add_child_at_anchor(&self, child: &impl IsA<Widget>, anchor: &impl IsA<TextChildAnchor>) {
461 unsafe {
462 ffi::gtk_text_view_add_child_at_anchor(
463 self.as_ref().to_glib_none().0,
464 child.as_ref().to_glib_none().0,
465 anchor.as_ref().to_glib_none().0,
466 );
467 }
468 }
469
470 #[doc(alias = "gtk_text_view_add_overlay")]
471 fn add_overlay(&self, child: &impl IsA<Widget>, xpos: i32, ypos: i32) {
472 unsafe {
473 ffi::gtk_text_view_add_overlay(
474 self.as_ref().to_glib_none().0,
475 child.as_ref().to_glib_none().0,
476 xpos,
477 ypos,
478 );
479 }
480 }
481
482 #[doc(alias = "gtk_text_view_backward_display_line")]
483 fn backward_display_line(&self, iter: &mut TextIter) -> bool {
484 unsafe {
485 from_glib(ffi::gtk_text_view_backward_display_line(
486 self.as_ref().to_glib_none().0,
487 iter.to_glib_none_mut().0,
488 ))
489 }
490 }
491
492 #[doc(alias = "gtk_text_view_backward_display_line_start")]
493 fn backward_display_line_start(&self, iter: &mut TextIter) -> bool {
494 unsafe {
495 from_glib(ffi::gtk_text_view_backward_display_line_start(
496 self.as_ref().to_glib_none().0,
497 iter.to_glib_none_mut().0,
498 ))
499 }
500 }
501
502 #[doc(alias = "gtk_text_view_buffer_to_window_coords")]
503 fn buffer_to_window_coords(
504 &self,
505 win: TextWindowType,
506 buffer_x: i32,
507 buffer_y: i32,
508 ) -> (i32, i32) {
509 unsafe {
510 let mut window_x = std::mem::MaybeUninit::uninit();
511 let mut window_y = std::mem::MaybeUninit::uninit();
512 ffi::gtk_text_view_buffer_to_window_coords(
513 self.as_ref().to_glib_none().0,
514 win.into_glib(),
515 buffer_x,
516 buffer_y,
517 window_x.as_mut_ptr(),
518 window_y.as_mut_ptr(),
519 );
520 (window_x.assume_init(), window_y.assume_init())
521 }
522 }
523
524 #[doc(alias = "gtk_text_view_forward_display_line")]
525 fn forward_display_line(&self, iter: &mut TextIter) -> bool {
526 unsafe {
527 from_glib(ffi::gtk_text_view_forward_display_line(
528 self.as_ref().to_glib_none().0,
529 iter.to_glib_none_mut().0,
530 ))
531 }
532 }
533
534 #[doc(alias = "gtk_text_view_forward_display_line_end")]
535 fn forward_display_line_end(&self, iter: &mut TextIter) -> bool {
536 unsafe {
537 from_glib(ffi::gtk_text_view_forward_display_line_end(
538 self.as_ref().to_glib_none().0,
539 iter.to_glib_none_mut().0,
540 ))
541 }
542 }
543
544 #[doc(alias = "gtk_text_view_get_accepts_tab")]
545 #[doc(alias = "get_accepts_tab")]
546 #[doc(alias = "accepts-tab")]
547 fn accepts_tab(&self) -> bool {
548 unsafe {
549 from_glib(ffi::gtk_text_view_get_accepts_tab(
550 self.as_ref().to_glib_none().0,
551 ))
552 }
553 }
554
555 #[doc(alias = "gtk_text_view_get_bottom_margin")]
556 #[doc(alias = "get_bottom_margin")]
557 #[doc(alias = "bottom-margin")]
558 fn bottom_margin(&self) -> i32 {
559 unsafe { ffi::gtk_text_view_get_bottom_margin(self.as_ref().to_glib_none().0) }
560 }
561
562 #[doc(alias = "gtk_text_view_get_buffer")]
563 #[doc(alias = "get_buffer")]
564 fn buffer(&self) -> TextBuffer {
565 unsafe {
566 from_glib_none(ffi::gtk_text_view_get_buffer(
567 self.as_ref().to_glib_none().0,
568 ))
569 }
570 }
571
572 #[doc(alias = "gtk_text_view_get_cursor_locations")]
573 #[doc(alias = "get_cursor_locations")]
574 fn cursor_locations(&self, iter: Option<&TextIter>) -> (gdk::Rectangle, gdk::Rectangle) {
575 unsafe {
576 let mut strong = gdk::Rectangle::uninitialized();
577 let mut weak = gdk::Rectangle::uninitialized();
578 ffi::gtk_text_view_get_cursor_locations(
579 self.as_ref().to_glib_none().0,
580 iter.to_glib_none().0,
581 strong.to_glib_none_mut().0,
582 weak.to_glib_none_mut().0,
583 );
584 (strong, weak)
585 }
586 }
587
588 #[doc(alias = "gtk_text_view_get_cursor_visible")]
589 #[doc(alias = "get_cursor_visible")]
590 #[doc(alias = "cursor-visible")]
591 fn is_cursor_visible(&self) -> bool {
592 unsafe {
593 from_glib(ffi::gtk_text_view_get_cursor_visible(
594 self.as_ref().to_glib_none().0,
595 ))
596 }
597 }
598
599 #[doc(alias = "gtk_text_view_get_editable")]
600 #[doc(alias = "get_editable")]
601 #[doc(alias = "editable")]
602 fn is_editable(&self) -> bool {
603 unsafe {
604 from_glib(ffi::gtk_text_view_get_editable(
605 self.as_ref().to_glib_none().0,
606 ))
607 }
608 }
609
610 #[doc(alias = "gtk_text_view_get_extra_menu")]
611 #[doc(alias = "get_extra_menu")]
612 #[doc(alias = "extra-menu")]
613 fn extra_menu(&self) -> gio::MenuModel {
614 unsafe {
615 from_glib_none(ffi::gtk_text_view_get_extra_menu(
616 self.as_ref().to_glib_none().0,
617 ))
618 }
619 }
620
621 #[doc(alias = "gtk_text_view_get_gutter")]
622 #[doc(alias = "get_gutter")]
623 fn gutter(&self, win: TextWindowType) -> Option<Widget> {
624 unsafe {
625 from_glib_none(ffi::gtk_text_view_get_gutter(
626 self.as_ref().to_glib_none().0,
627 win.into_glib(),
628 ))
629 }
630 }
631
632 #[doc(alias = "gtk_text_view_get_indent")]
633 #[doc(alias = "get_indent")]
634 fn indent(&self) -> i32 {
635 unsafe { ffi::gtk_text_view_get_indent(self.as_ref().to_glib_none().0) }
636 }
637
638 #[doc(alias = "gtk_text_view_get_input_hints")]
639 #[doc(alias = "get_input_hints")]
640 #[doc(alias = "input-hints")]
641 fn input_hints(&self) -> InputHints {
642 unsafe {
643 from_glib(ffi::gtk_text_view_get_input_hints(
644 self.as_ref().to_glib_none().0,
645 ))
646 }
647 }
648
649 #[doc(alias = "gtk_text_view_get_input_purpose")]
650 #[doc(alias = "get_input_purpose")]
651 #[doc(alias = "input-purpose")]
652 fn input_purpose(&self) -> InputPurpose {
653 unsafe {
654 from_glib(ffi::gtk_text_view_get_input_purpose(
655 self.as_ref().to_glib_none().0,
656 ))
657 }
658 }
659
660 #[doc(alias = "gtk_text_view_get_iter_at_location")]
661 #[doc(alias = "get_iter_at_location")]
662 fn iter_at_location(&self, x: i32, y: i32) -> Option<TextIter> {
663 unsafe {
664 let mut iter = TextIter::uninitialized();
665 let ret = from_glib(ffi::gtk_text_view_get_iter_at_location(
666 self.as_ref().to_glib_none().0,
667 iter.to_glib_none_mut().0,
668 x,
669 y,
670 ));
671 if ret {
672 Some(iter)
673 } else {
674 None
675 }
676 }
677 }
678
679 #[doc(alias = "gtk_text_view_get_iter_at_position")]
680 #[doc(alias = "get_iter_at_position")]
681 fn iter_at_position(&self, x: i32, y: i32) -> Option<(TextIter, i32)> {
682 unsafe {
683 let mut iter = TextIter::uninitialized();
684 let mut trailing = std::mem::MaybeUninit::uninit();
685 let ret = from_glib(ffi::gtk_text_view_get_iter_at_position(
686 self.as_ref().to_glib_none().0,
687 iter.to_glib_none_mut().0,
688 trailing.as_mut_ptr(),
689 x,
690 y,
691 ));
692 if ret {
693 Some((iter, trailing.assume_init()))
694 } else {
695 None
696 }
697 }
698 }
699
700 #[doc(alias = "gtk_text_view_get_iter_location")]
701 #[doc(alias = "get_iter_location")]
702 fn iter_location(&self, iter: &TextIter) -> gdk::Rectangle {
703 unsafe {
704 let mut location = gdk::Rectangle::uninitialized();
705 ffi::gtk_text_view_get_iter_location(
706 self.as_ref().to_glib_none().0,
707 iter.to_glib_none().0,
708 location.to_glib_none_mut().0,
709 );
710 location
711 }
712 }
713
714 #[doc(alias = "gtk_text_view_get_justification")]
715 #[doc(alias = "get_justification")]
716 fn justification(&self) -> Justification {
717 unsafe {
718 from_glib(ffi::gtk_text_view_get_justification(
719 self.as_ref().to_glib_none().0,
720 ))
721 }
722 }
723
724 #[doc(alias = "gtk_text_view_get_left_margin")]
725 #[doc(alias = "get_left_margin")]
726 #[doc(alias = "left-margin")]
727 fn left_margin(&self) -> i32 {
728 unsafe { ffi::gtk_text_view_get_left_margin(self.as_ref().to_glib_none().0) }
729 }
730
731 #[doc(alias = "gtk_text_view_get_line_at_y")]
732 #[doc(alias = "get_line_at_y")]
733 fn line_at_y(&self, y: i32) -> (TextIter, i32) {
734 unsafe {
735 let mut target_iter = TextIter::uninitialized();
736 let mut line_top = std::mem::MaybeUninit::uninit();
737 ffi::gtk_text_view_get_line_at_y(
738 self.as_ref().to_glib_none().0,
739 target_iter.to_glib_none_mut().0,
740 y,
741 line_top.as_mut_ptr(),
742 );
743 (target_iter, line_top.assume_init())
744 }
745 }
746
747 #[doc(alias = "gtk_text_view_get_line_yrange")]
748 #[doc(alias = "get_line_yrange")]
749 fn line_yrange(&self, iter: &TextIter) -> (i32, i32) {
750 unsafe {
751 let mut y = std::mem::MaybeUninit::uninit();
752 let mut height = std::mem::MaybeUninit::uninit();
753 ffi::gtk_text_view_get_line_yrange(
754 self.as_ref().to_glib_none().0,
755 iter.to_glib_none().0,
756 y.as_mut_ptr(),
757 height.as_mut_ptr(),
758 );
759 (y.assume_init(), height.assume_init())
760 }
761 }
762
763 #[cfg(feature = "v4_4")]
764 #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
765 #[doc(alias = "gtk_text_view_get_ltr_context")]
766 #[doc(alias = "get_ltr_context")]
767 fn ltr_context(&self) -> pango::Context {
768 unsafe {
769 from_glib_none(ffi::gtk_text_view_get_ltr_context(
770 self.as_ref().to_glib_none().0,
771 ))
772 }
773 }
774
775 #[doc(alias = "gtk_text_view_get_monospace")]
776 #[doc(alias = "get_monospace")]
777 #[doc(alias = "monospace")]
778 fn is_monospace(&self) -> bool {
779 unsafe {
780 from_glib(ffi::gtk_text_view_get_monospace(
781 self.as_ref().to_glib_none().0,
782 ))
783 }
784 }
785
786 #[doc(alias = "gtk_text_view_get_overwrite")]
787 #[doc(alias = "get_overwrite")]
788 #[doc(alias = "overwrite")]
789 fn overwrites(&self) -> bool {
790 unsafe {
791 from_glib(ffi::gtk_text_view_get_overwrite(
792 self.as_ref().to_glib_none().0,
793 ))
794 }
795 }
796
797 #[doc(alias = "gtk_text_view_get_pixels_above_lines")]
798 #[doc(alias = "get_pixels_above_lines")]
799 #[doc(alias = "pixels-above-lines")]
800 fn pixels_above_lines(&self) -> i32 {
801 unsafe { ffi::gtk_text_view_get_pixels_above_lines(self.as_ref().to_glib_none().0) }
802 }
803
804 #[doc(alias = "gtk_text_view_get_pixels_below_lines")]
805 #[doc(alias = "get_pixels_below_lines")]
806 #[doc(alias = "pixels-below-lines")]
807 fn pixels_below_lines(&self) -> i32 {
808 unsafe { ffi::gtk_text_view_get_pixels_below_lines(self.as_ref().to_glib_none().0) }
809 }
810
811 #[doc(alias = "gtk_text_view_get_pixels_inside_wrap")]
812 #[doc(alias = "get_pixels_inside_wrap")]
813 #[doc(alias = "pixels-inside-wrap")]
814 fn pixels_inside_wrap(&self) -> i32 {
815 unsafe { ffi::gtk_text_view_get_pixels_inside_wrap(self.as_ref().to_glib_none().0) }
816 }
817
818 #[doc(alias = "gtk_text_view_get_right_margin")]
819 #[doc(alias = "get_right_margin")]
820 #[doc(alias = "right-margin")]
821 fn right_margin(&self) -> i32 {
822 unsafe { ffi::gtk_text_view_get_right_margin(self.as_ref().to_glib_none().0) }
823 }
824
825 #[cfg(feature = "v4_4")]
826 #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
827 #[doc(alias = "gtk_text_view_get_rtl_context")]
828 #[doc(alias = "get_rtl_context")]
829 fn rtl_context(&self) -> pango::Context {
830 unsafe {
831 from_glib_none(ffi::gtk_text_view_get_rtl_context(
832 self.as_ref().to_glib_none().0,
833 ))
834 }
835 }
836
837 #[doc(alias = "gtk_text_view_get_tabs")]
838 #[doc(alias = "get_tabs")]
839 fn tabs(&self) -> Option<pango::TabArray> {
840 unsafe { from_glib_full(ffi::gtk_text_view_get_tabs(self.as_ref().to_glib_none().0)) }
841 }
842
843 #[doc(alias = "gtk_text_view_get_top_margin")]
844 #[doc(alias = "get_top_margin")]
845 #[doc(alias = "top-margin")]
846 fn top_margin(&self) -> i32 {
847 unsafe { ffi::gtk_text_view_get_top_margin(self.as_ref().to_glib_none().0) }
848 }
849
850 #[cfg(feature = "v4_18")]
851 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
852 #[doc(alias = "gtk_text_view_get_visible_offset")]
853 #[doc(alias = "get_visible_offset")]
854 fn visible_offset(&self) -> (f64, f64) {
855 unsafe {
856 let mut x_offset = std::mem::MaybeUninit::uninit();
857 let mut y_offset = std::mem::MaybeUninit::uninit();
858 ffi::gtk_text_view_get_visible_offset(
859 self.as_ref().to_glib_none().0,
860 x_offset.as_mut_ptr(),
861 y_offset.as_mut_ptr(),
862 );
863 (x_offset.assume_init(), y_offset.assume_init())
864 }
865 }
866
867 #[doc(alias = "gtk_text_view_get_visible_rect")]
868 #[doc(alias = "get_visible_rect")]
869 fn visible_rect(&self) -> gdk::Rectangle {
870 unsafe {
871 let mut visible_rect = gdk::Rectangle::uninitialized();
872 ffi::gtk_text_view_get_visible_rect(
873 self.as_ref().to_glib_none().0,
874 visible_rect.to_glib_none_mut().0,
875 );
876 visible_rect
877 }
878 }
879
880 #[doc(alias = "gtk_text_view_get_wrap_mode")]
881 #[doc(alias = "get_wrap_mode")]
882 #[doc(alias = "wrap-mode")]
883 fn wrap_mode(&self) -> WrapMode {
884 unsafe {
885 from_glib(ffi::gtk_text_view_get_wrap_mode(
886 self.as_ref().to_glib_none().0,
887 ))
888 }
889 }
890
891 #[doc(alias = "gtk_text_view_im_context_filter_keypress")]
892 fn im_context_filter_keypress(&self, event: impl AsRef<gdk::Event>) -> bool {
893 unsafe {
894 from_glib(ffi::gtk_text_view_im_context_filter_keypress(
895 self.as_ref().to_glib_none().0,
896 event.as_ref().to_glib_none().0,
897 ))
898 }
899 }
900
901 #[doc(alias = "gtk_text_view_move_mark_onscreen")]
902 fn move_mark_onscreen(&self, mark: &impl IsA<TextMark>) -> bool {
903 unsafe {
904 from_glib(ffi::gtk_text_view_move_mark_onscreen(
905 self.as_ref().to_glib_none().0,
906 mark.as_ref().to_glib_none().0,
907 ))
908 }
909 }
910
911 #[doc(alias = "gtk_text_view_move_overlay")]
912 fn move_overlay(&self, child: &impl IsA<Widget>, xpos: i32, ypos: i32) {
913 unsafe {
914 ffi::gtk_text_view_move_overlay(
915 self.as_ref().to_glib_none().0,
916 child.as_ref().to_glib_none().0,
917 xpos,
918 ypos,
919 );
920 }
921 }
922
923 #[doc(alias = "gtk_text_view_move_visually")]
924 fn move_visually(&self, iter: &mut TextIter, count: i32) -> bool {
925 unsafe {
926 from_glib(ffi::gtk_text_view_move_visually(
927 self.as_ref().to_glib_none().0,
928 iter.to_glib_none_mut().0,
929 count,
930 ))
931 }
932 }
933
934 #[doc(alias = "gtk_text_view_place_cursor_onscreen")]
935 fn place_cursor_onscreen(&self) -> bool {
936 unsafe {
937 from_glib(ffi::gtk_text_view_place_cursor_onscreen(
938 self.as_ref().to_glib_none().0,
939 ))
940 }
941 }
942
943 #[doc(alias = "gtk_text_view_remove")]
944 fn remove(&self, child: &impl IsA<Widget>) {
945 unsafe {
946 ffi::gtk_text_view_remove(
947 self.as_ref().to_glib_none().0,
948 child.as_ref().to_glib_none().0,
949 );
950 }
951 }
952
953 #[doc(alias = "gtk_text_view_reset_cursor_blink")]
954 fn reset_cursor_blink(&self) {
955 unsafe {
956 ffi::gtk_text_view_reset_cursor_blink(self.as_ref().to_glib_none().0);
957 }
958 }
959
960 #[doc(alias = "gtk_text_view_reset_im_context")]
961 fn reset_im_context(&self) {
962 unsafe {
963 ffi::gtk_text_view_reset_im_context(self.as_ref().to_glib_none().0);
964 }
965 }
966
967 #[doc(alias = "gtk_text_view_scroll_mark_onscreen")]
968 fn scroll_mark_onscreen(&self, mark: &impl IsA<TextMark>) {
969 unsafe {
970 ffi::gtk_text_view_scroll_mark_onscreen(
971 self.as_ref().to_glib_none().0,
972 mark.as_ref().to_glib_none().0,
973 );
974 }
975 }
976
977 #[doc(alias = "gtk_text_view_scroll_to_iter")]
978 fn scroll_to_iter(
979 &self,
980 iter: &mut TextIter,
981 within_margin: f64,
982 use_align: bool,
983 xalign: f64,
984 yalign: f64,
985 ) -> bool {
986 unsafe {
987 from_glib(ffi::gtk_text_view_scroll_to_iter(
988 self.as_ref().to_glib_none().0,
989 iter.to_glib_none_mut().0,
990 within_margin,
991 use_align.into_glib(),
992 xalign,
993 yalign,
994 ))
995 }
996 }
997
998 #[doc(alias = "gtk_text_view_scroll_to_mark")]
999 fn scroll_to_mark(
1000 &self,
1001 mark: &impl IsA<TextMark>,
1002 within_margin: f64,
1003 use_align: bool,
1004 xalign: f64,
1005 yalign: f64,
1006 ) {
1007 unsafe {
1008 ffi::gtk_text_view_scroll_to_mark(
1009 self.as_ref().to_glib_none().0,
1010 mark.as_ref().to_glib_none().0,
1011 within_margin,
1012 use_align.into_glib(),
1013 xalign,
1014 yalign,
1015 );
1016 }
1017 }
1018
1019 #[doc(alias = "gtk_text_view_set_accepts_tab")]
1020 #[doc(alias = "accepts-tab")]
1021 fn set_accepts_tab(&self, accepts_tab: bool) {
1022 unsafe {
1023 ffi::gtk_text_view_set_accepts_tab(
1024 self.as_ref().to_glib_none().0,
1025 accepts_tab.into_glib(),
1026 );
1027 }
1028 }
1029
1030 #[doc(alias = "gtk_text_view_set_bottom_margin")]
1031 #[doc(alias = "bottom-margin")]
1032 fn set_bottom_margin(&self, bottom_margin: i32) {
1033 unsafe {
1034 ffi::gtk_text_view_set_bottom_margin(self.as_ref().to_glib_none().0, bottom_margin);
1035 }
1036 }
1037
1038 #[doc(alias = "gtk_text_view_set_buffer")]
1039 #[doc(alias = "buffer")]
1040 fn set_buffer(&self, buffer: Option<&impl IsA<TextBuffer>>) {
1041 unsafe {
1042 ffi::gtk_text_view_set_buffer(
1043 self.as_ref().to_glib_none().0,
1044 buffer.map(|p| p.as_ref()).to_glib_none().0,
1045 );
1046 }
1047 }
1048
1049 #[doc(alias = "gtk_text_view_set_cursor_visible")]
1050 #[doc(alias = "cursor-visible")]
1051 fn set_cursor_visible(&self, setting: bool) {
1052 unsafe {
1053 ffi::gtk_text_view_set_cursor_visible(
1054 self.as_ref().to_glib_none().0,
1055 setting.into_glib(),
1056 );
1057 }
1058 }
1059
1060 #[doc(alias = "gtk_text_view_set_editable")]
1061 #[doc(alias = "editable")]
1062 fn set_editable(&self, setting: bool) {
1063 unsafe {
1064 ffi::gtk_text_view_set_editable(self.as_ref().to_glib_none().0, setting.into_glib());
1065 }
1066 }
1067
1068 #[doc(alias = "gtk_text_view_set_extra_menu")]
1069 #[doc(alias = "extra-menu")]
1070 fn set_extra_menu(&self, model: Option<&impl IsA<gio::MenuModel>>) {
1071 unsafe {
1072 ffi::gtk_text_view_set_extra_menu(
1073 self.as_ref().to_glib_none().0,
1074 model.map(|p| p.as_ref()).to_glib_none().0,
1075 );
1076 }
1077 }
1078
1079 #[doc(alias = "gtk_text_view_set_gutter")]
1080 fn set_gutter(&self, win: TextWindowType, widget: Option<&impl IsA<Widget>>) {
1081 unsafe {
1082 ffi::gtk_text_view_set_gutter(
1083 self.as_ref().to_glib_none().0,
1084 win.into_glib(),
1085 widget.map(|p| p.as_ref()).to_glib_none().0,
1086 );
1087 }
1088 }
1089
1090 #[doc(alias = "gtk_text_view_set_indent")]
1091 #[doc(alias = "indent")]
1092 fn set_indent(&self, indent: i32) {
1093 unsafe {
1094 ffi::gtk_text_view_set_indent(self.as_ref().to_glib_none().0, indent);
1095 }
1096 }
1097
1098 #[doc(alias = "gtk_text_view_set_input_hints")]
1099 #[doc(alias = "input-hints")]
1100 fn set_input_hints(&self, hints: InputHints) {
1101 unsafe {
1102 ffi::gtk_text_view_set_input_hints(self.as_ref().to_glib_none().0, hints.into_glib());
1103 }
1104 }
1105
1106 #[doc(alias = "gtk_text_view_set_input_purpose")]
1107 #[doc(alias = "input-purpose")]
1108 fn set_input_purpose(&self, purpose: InputPurpose) {
1109 unsafe {
1110 ffi::gtk_text_view_set_input_purpose(
1111 self.as_ref().to_glib_none().0,
1112 purpose.into_glib(),
1113 );
1114 }
1115 }
1116
1117 #[doc(alias = "gtk_text_view_set_justification")]
1118 #[doc(alias = "justification")]
1119 fn set_justification(&self, justification: Justification) {
1120 unsafe {
1121 ffi::gtk_text_view_set_justification(
1122 self.as_ref().to_glib_none().0,
1123 justification.into_glib(),
1124 );
1125 }
1126 }
1127
1128 #[doc(alias = "gtk_text_view_set_left_margin")]
1129 #[doc(alias = "left-margin")]
1130 fn set_left_margin(&self, left_margin: i32) {
1131 unsafe {
1132 ffi::gtk_text_view_set_left_margin(self.as_ref().to_glib_none().0, left_margin);
1133 }
1134 }
1135
1136 #[doc(alias = "gtk_text_view_set_monospace")]
1137 #[doc(alias = "monospace")]
1138 fn set_monospace(&self, monospace: bool) {
1139 unsafe {
1140 ffi::gtk_text_view_set_monospace(self.as_ref().to_glib_none().0, monospace.into_glib());
1141 }
1142 }
1143
1144 #[doc(alias = "gtk_text_view_set_overwrite")]
1145 #[doc(alias = "overwrite")]
1146 fn set_overwrite(&self, overwrite: bool) {
1147 unsafe {
1148 ffi::gtk_text_view_set_overwrite(self.as_ref().to_glib_none().0, overwrite.into_glib());
1149 }
1150 }
1151
1152 #[doc(alias = "gtk_text_view_set_pixels_above_lines")]
1153 #[doc(alias = "pixels-above-lines")]
1154 fn set_pixels_above_lines(&self, pixels_above_lines: i32) {
1155 unsafe {
1156 ffi::gtk_text_view_set_pixels_above_lines(
1157 self.as_ref().to_glib_none().0,
1158 pixels_above_lines,
1159 );
1160 }
1161 }
1162
1163 #[doc(alias = "gtk_text_view_set_pixels_below_lines")]
1164 #[doc(alias = "pixels-below-lines")]
1165 fn set_pixels_below_lines(&self, pixels_below_lines: i32) {
1166 unsafe {
1167 ffi::gtk_text_view_set_pixels_below_lines(
1168 self.as_ref().to_glib_none().0,
1169 pixels_below_lines,
1170 );
1171 }
1172 }
1173
1174 #[doc(alias = "gtk_text_view_set_pixels_inside_wrap")]
1175 #[doc(alias = "pixels-inside-wrap")]
1176 fn set_pixels_inside_wrap(&self, pixels_inside_wrap: i32) {
1177 unsafe {
1178 ffi::gtk_text_view_set_pixels_inside_wrap(
1179 self.as_ref().to_glib_none().0,
1180 pixels_inside_wrap,
1181 );
1182 }
1183 }
1184
1185 #[doc(alias = "gtk_text_view_set_right_margin")]
1186 #[doc(alias = "right-margin")]
1187 fn set_right_margin(&self, right_margin: i32) {
1188 unsafe {
1189 ffi::gtk_text_view_set_right_margin(self.as_ref().to_glib_none().0, right_margin);
1190 }
1191 }
1192
1193 #[doc(alias = "gtk_text_view_set_tabs")]
1194 #[doc(alias = "tabs")]
1195 fn set_tabs(&self, tabs: &pango::TabArray) {
1196 unsafe {
1197 ffi::gtk_text_view_set_tabs(
1198 self.as_ref().to_glib_none().0,
1199 mut_override(tabs.to_glib_none().0),
1200 );
1201 }
1202 }
1203
1204 #[doc(alias = "gtk_text_view_set_top_margin")]
1205 #[doc(alias = "top-margin")]
1206 fn set_top_margin(&self, top_margin: i32) {
1207 unsafe {
1208 ffi::gtk_text_view_set_top_margin(self.as_ref().to_glib_none().0, top_margin);
1209 }
1210 }
1211
1212 #[doc(alias = "gtk_text_view_set_wrap_mode")]
1213 #[doc(alias = "wrap-mode")]
1214 fn set_wrap_mode(&self, wrap_mode: WrapMode) {
1215 unsafe {
1216 ffi::gtk_text_view_set_wrap_mode(self.as_ref().to_glib_none().0, wrap_mode.into_glib());
1217 }
1218 }
1219
1220 #[doc(alias = "gtk_text_view_starts_display_line")]
1221 fn starts_display_line(&self, iter: &TextIter) -> bool {
1222 unsafe {
1223 from_glib(ffi::gtk_text_view_starts_display_line(
1224 self.as_ref().to_glib_none().0,
1225 iter.to_glib_none().0,
1226 ))
1227 }
1228 }
1229
1230 #[doc(alias = "gtk_text_view_window_to_buffer_coords")]
1231 fn window_to_buffer_coords(
1232 &self,
1233 win: TextWindowType,
1234 window_x: i32,
1235 window_y: i32,
1236 ) -> (i32, i32) {
1237 unsafe {
1238 let mut buffer_x = std::mem::MaybeUninit::uninit();
1239 let mut buffer_y = std::mem::MaybeUninit::uninit();
1240 ffi::gtk_text_view_window_to_buffer_coords(
1241 self.as_ref().to_glib_none().0,
1242 win.into_glib(),
1243 window_x,
1244 window_y,
1245 buffer_x.as_mut_ptr(),
1246 buffer_y.as_mut_ptr(),
1247 );
1248 (buffer_x.assume_init(), buffer_y.assume_init())
1249 }
1250 }
1251
1252 #[doc(alias = "im-module")]
1253 fn im_module(&self) -> Option<glib::GString> {
1254 ObjectExt::property(self.as_ref(), "im-module")
1255 }
1256
1257 #[doc(alias = "im-module")]
1258 fn set_im_module(&self, im_module: Option<&str>) {
1259 ObjectExt::set_property(self.as_ref(), "im-module", im_module)
1260 }
1261
1262 #[doc(alias = "backspace")]
1263 fn connect_backspace<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1264 unsafe extern "C" fn backspace_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1265 this: *mut ffi::GtkTextView,
1266 f: glib::ffi::gpointer,
1267 ) {
1268 let f: &F = &*(f as *const F);
1269 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1270 }
1271 unsafe {
1272 let f: Box_<F> = Box_::new(f);
1273 connect_raw(
1274 self.as_ptr() as *mut _,
1275 c"backspace".as_ptr() as *const _,
1276 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1277 backspace_trampoline::<Self, F> as *const (),
1278 )),
1279 Box_::into_raw(f),
1280 )
1281 }
1282 }
1283
1284 fn emit_backspace(&self) {
1285 self.emit_by_name::<()>("backspace", &[]);
1286 }
1287
1288 #[doc(alias = "copy-clipboard")]
1289 fn connect_copy_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1290 unsafe extern "C" fn copy_clipboard_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1291 this: *mut ffi::GtkTextView,
1292 f: glib::ffi::gpointer,
1293 ) {
1294 let f: &F = &*(f as *const F);
1295 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1296 }
1297 unsafe {
1298 let f: Box_<F> = Box_::new(f);
1299 connect_raw(
1300 self.as_ptr() as *mut _,
1301 c"copy-clipboard".as_ptr() as *const _,
1302 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1303 copy_clipboard_trampoline::<Self, F> as *const (),
1304 )),
1305 Box_::into_raw(f),
1306 )
1307 }
1308 }
1309
1310 fn emit_copy_clipboard(&self) {
1311 self.emit_by_name::<()>("copy-clipboard", &[]);
1312 }
1313
1314 #[doc(alias = "cut-clipboard")]
1315 fn connect_cut_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1316 unsafe extern "C" fn cut_clipboard_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1317 this: *mut ffi::GtkTextView,
1318 f: glib::ffi::gpointer,
1319 ) {
1320 let f: &F = &*(f as *const F);
1321 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1322 }
1323 unsafe {
1324 let f: Box_<F> = Box_::new(f);
1325 connect_raw(
1326 self.as_ptr() as *mut _,
1327 c"cut-clipboard".as_ptr() as *const _,
1328 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1329 cut_clipboard_trampoline::<Self, F> as *const (),
1330 )),
1331 Box_::into_raw(f),
1332 )
1333 }
1334 }
1335
1336 fn emit_cut_clipboard(&self) {
1337 self.emit_by_name::<()>("cut-clipboard", &[]);
1338 }
1339
1340 #[doc(alias = "delete-from-cursor")]
1341 fn connect_delete_from_cursor<F: Fn(&Self, DeleteType, i32) + 'static>(
1342 &self,
1343 f: F,
1344 ) -> SignalHandlerId {
1345 unsafe extern "C" fn delete_from_cursor_trampoline<
1346 P: IsA<TextView>,
1347 F: Fn(&P, DeleteType, i32) + 'static,
1348 >(
1349 this: *mut ffi::GtkTextView,
1350 type_: ffi::GtkDeleteType,
1351 count: std::ffi::c_int,
1352 f: glib::ffi::gpointer,
1353 ) {
1354 let f: &F = &*(f as *const F);
1355 f(
1356 TextView::from_glib_borrow(this).unsafe_cast_ref(),
1357 from_glib(type_),
1358 count,
1359 )
1360 }
1361 unsafe {
1362 let f: Box_<F> = Box_::new(f);
1363 connect_raw(
1364 self.as_ptr() as *mut _,
1365 c"delete-from-cursor".as_ptr() as *const _,
1366 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1367 delete_from_cursor_trampoline::<Self, F> as *const (),
1368 )),
1369 Box_::into_raw(f),
1370 )
1371 }
1372 }
1373
1374 fn emit_delete_from_cursor(&self, type_: DeleteType, count: i32) {
1375 self.emit_by_name::<()>("delete-from-cursor", &[&type_, &count]);
1376 }
1377
1378 #[doc(alias = "extend-selection")]
1379 fn connect_extend_selection<
1380 F: Fn(&Self, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> glib::Propagation
1381 + 'static,
1382 >(
1383 &self,
1384 f: F,
1385 ) -> SignalHandlerId {
1386 unsafe extern "C" fn extend_selection_trampoline<
1387 P: IsA<TextView>,
1388 F: Fn(&P, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> glib::Propagation
1389 + 'static,
1390 >(
1391 this: *mut ffi::GtkTextView,
1392 granularity: ffi::GtkTextExtendSelection,
1393 location: *mut ffi::GtkTextIter,
1394 start: *mut ffi::GtkTextIter,
1395 end: *mut ffi::GtkTextIter,
1396 f: glib::ffi::gpointer,
1397 ) -> glib::ffi::gboolean {
1398 let f: &F = &*(f as *const F);
1399 f(
1400 TextView::from_glib_borrow(this).unsafe_cast_ref(),
1401 from_glib(granularity),
1402 &from_glib_borrow(location),
1403 &from_glib_borrow(start),
1404 &from_glib_borrow(end),
1405 )
1406 .into_glib()
1407 }
1408 unsafe {
1409 let f: Box_<F> = Box_::new(f);
1410 connect_raw(
1411 self.as_ptr() as *mut _,
1412 c"extend-selection".as_ptr() as *const _,
1413 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1414 extend_selection_trampoline::<Self, F> as *const (),
1415 )),
1416 Box_::into_raw(f),
1417 )
1418 }
1419 }
1420
1421 #[doc(alias = "insert-at-cursor")]
1422 fn connect_insert_at_cursor<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
1423 unsafe extern "C" fn insert_at_cursor_trampoline<
1424 P: IsA<TextView>,
1425 F: Fn(&P, &str) + 'static,
1426 >(
1427 this: *mut ffi::GtkTextView,
1428 string: *mut std::ffi::c_char,
1429 f: glib::ffi::gpointer,
1430 ) {
1431 let f: &F = &*(f as *const F);
1432 f(
1433 TextView::from_glib_borrow(this).unsafe_cast_ref(),
1434 &glib::GString::from_glib_borrow(string),
1435 )
1436 }
1437 unsafe {
1438 let f: Box_<F> = Box_::new(f);
1439 connect_raw(
1440 self.as_ptr() as *mut _,
1441 c"insert-at-cursor".as_ptr() as *const _,
1442 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1443 insert_at_cursor_trampoline::<Self, F> as *const (),
1444 )),
1445 Box_::into_raw(f),
1446 )
1447 }
1448 }
1449
1450 fn emit_insert_at_cursor(&self, string: &str) {
1451 self.emit_by_name::<()>("insert-at-cursor", &[&string]);
1452 }
1453
1454 #[doc(alias = "insert-emoji")]
1455 fn connect_insert_emoji<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1456 unsafe extern "C" fn insert_emoji_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1457 this: *mut ffi::GtkTextView,
1458 f: glib::ffi::gpointer,
1459 ) {
1460 let f: &F = &*(f as *const F);
1461 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1462 }
1463 unsafe {
1464 let f: Box_<F> = Box_::new(f);
1465 connect_raw(
1466 self.as_ptr() as *mut _,
1467 c"insert-emoji".as_ptr() as *const _,
1468 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1469 insert_emoji_trampoline::<Self, F> as *const (),
1470 )),
1471 Box_::into_raw(f),
1472 )
1473 }
1474 }
1475
1476 fn emit_insert_emoji(&self) {
1477 self.emit_by_name::<()>("insert-emoji", &[]);
1478 }
1479
1480 #[doc(alias = "move-cursor")]
1481 fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>(
1482 &self,
1483 f: F,
1484 ) -> SignalHandlerId {
1485 unsafe extern "C" fn move_cursor_trampoline<
1486 P: IsA<TextView>,
1487 F: Fn(&P, MovementStep, i32, bool) + 'static,
1488 >(
1489 this: *mut ffi::GtkTextView,
1490 step: ffi::GtkMovementStep,
1491 count: std::ffi::c_int,
1492 extend_selection: glib::ffi::gboolean,
1493 f: glib::ffi::gpointer,
1494 ) {
1495 let f: &F = &*(f as *const F);
1496 f(
1497 TextView::from_glib_borrow(this).unsafe_cast_ref(),
1498 from_glib(step),
1499 count,
1500 from_glib(extend_selection),
1501 )
1502 }
1503 unsafe {
1504 let f: Box_<F> = Box_::new(f);
1505 connect_raw(
1506 self.as_ptr() as *mut _,
1507 c"move-cursor".as_ptr() as *const _,
1508 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1509 move_cursor_trampoline::<Self, F> as *const (),
1510 )),
1511 Box_::into_raw(f),
1512 )
1513 }
1514 }
1515
1516 fn emit_move_cursor(&self, step: MovementStep, count: i32, extend_selection: bool) {
1517 self.emit_by_name::<()>("move-cursor", &[&step, &count, &extend_selection]);
1518 }
1519
1520 #[doc(alias = "move-viewport")]
1521 fn connect_move_viewport<F: Fn(&Self, ScrollStep, i32) + 'static>(
1522 &self,
1523 f: F,
1524 ) -> SignalHandlerId {
1525 unsafe extern "C" fn move_viewport_trampoline<
1526 P: IsA<TextView>,
1527 F: Fn(&P, ScrollStep, i32) + 'static,
1528 >(
1529 this: *mut ffi::GtkTextView,
1530 step: ffi::GtkScrollStep,
1531 count: std::ffi::c_int,
1532 f: glib::ffi::gpointer,
1533 ) {
1534 let f: &F = &*(f as *const F);
1535 f(
1536 TextView::from_glib_borrow(this).unsafe_cast_ref(),
1537 from_glib(step),
1538 count,
1539 )
1540 }
1541 unsafe {
1542 let f: Box_<F> = Box_::new(f);
1543 connect_raw(
1544 self.as_ptr() as *mut _,
1545 c"move-viewport".as_ptr() as *const _,
1546 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1547 move_viewport_trampoline::<Self, F> as *const (),
1548 )),
1549 Box_::into_raw(f),
1550 )
1551 }
1552 }
1553
1554 fn emit_move_viewport(&self, step: ScrollStep, count: i32) {
1555 self.emit_by_name::<()>("move-viewport", &[&step, &count]);
1556 }
1557
1558 #[doc(alias = "paste-clipboard")]
1559 fn connect_paste_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1560 unsafe extern "C" fn paste_clipboard_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1561 this: *mut ffi::GtkTextView,
1562 f: glib::ffi::gpointer,
1563 ) {
1564 let f: &F = &*(f as *const F);
1565 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1566 }
1567 unsafe {
1568 let f: Box_<F> = Box_::new(f);
1569 connect_raw(
1570 self.as_ptr() as *mut _,
1571 c"paste-clipboard".as_ptr() as *const _,
1572 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1573 paste_clipboard_trampoline::<Self, F> as *const (),
1574 )),
1575 Box_::into_raw(f),
1576 )
1577 }
1578 }
1579
1580 fn emit_paste_clipboard(&self) {
1581 self.emit_by_name::<()>("paste-clipboard", &[]);
1582 }
1583
1584 #[doc(alias = "preedit-changed")]
1585 fn connect_preedit_changed<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
1586 unsafe extern "C" fn preedit_changed_trampoline<
1587 P: IsA<TextView>,
1588 F: Fn(&P, &str) + 'static,
1589 >(
1590 this: *mut ffi::GtkTextView,
1591 preedit: *mut std::ffi::c_char,
1592 f: glib::ffi::gpointer,
1593 ) {
1594 let f: &F = &*(f as *const F);
1595 f(
1596 TextView::from_glib_borrow(this).unsafe_cast_ref(),
1597 &glib::GString::from_glib_borrow(preedit),
1598 )
1599 }
1600 unsafe {
1601 let f: Box_<F> = Box_::new(f);
1602 connect_raw(
1603 self.as_ptr() as *mut _,
1604 c"preedit-changed".as_ptr() as *const _,
1605 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1606 preedit_changed_trampoline::<Self, F> as *const (),
1607 )),
1608 Box_::into_raw(f),
1609 )
1610 }
1611 }
1612
1613 fn emit_preedit_changed(&self, preedit: &str) {
1614 self.emit_by_name::<()>("preedit-changed", &[&preedit]);
1615 }
1616
1617 #[doc(alias = "select-all")]
1618 fn connect_select_all<F: Fn(&Self, bool) + 'static>(&self, f: F) -> SignalHandlerId {
1619 unsafe extern "C" fn select_all_trampoline<P: IsA<TextView>, F: Fn(&P, bool) + 'static>(
1620 this: *mut ffi::GtkTextView,
1621 select: glib::ffi::gboolean,
1622 f: glib::ffi::gpointer,
1623 ) {
1624 let f: &F = &*(f as *const F);
1625 f(
1626 TextView::from_glib_borrow(this).unsafe_cast_ref(),
1627 from_glib(select),
1628 )
1629 }
1630 unsafe {
1631 let f: Box_<F> = Box_::new(f);
1632 connect_raw(
1633 self.as_ptr() as *mut _,
1634 c"select-all".as_ptr() as *const _,
1635 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1636 select_all_trampoline::<Self, F> as *const (),
1637 )),
1638 Box_::into_raw(f),
1639 )
1640 }
1641 }
1642
1643 fn emit_select_all(&self, select: bool) {
1644 self.emit_by_name::<()>("select-all", &[&select]);
1645 }
1646
1647 #[doc(alias = "set-anchor")]
1648 fn connect_set_anchor<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1649 unsafe extern "C" fn set_anchor_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1650 this: *mut ffi::GtkTextView,
1651 f: glib::ffi::gpointer,
1652 ) {
1653 let f: &F = &*(f as *const F);
1654 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1655 }
1656 unsafe {
1657 let f: Box_<F> = Box_::new(f);
1658 connect_raw(
1659 self.as_ptr() as *mut _,
1660 c"set-anchor".as_ptr() as *const _,
1661 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1662 set_anchor_trampoline::<Self, F> as *const (),
1663 )),
1664 Box_::into_raw(f),
1665 )
1666 }
1667 }
1668
1669 fn emit_set_anchor(&self) {
1670 self.emit_by_name::<()>("set-anchor", &[]);
1671 }
1672
1673 #[doc(alias = "toggle-cursor-visible")]
1674 fn connect_toggle_cursor_visible<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1675 unsafe extern "C" fn toggle_cursor_visible_trampoline<
1676 P: IsA<TextView>,
1677 F: Fn(&P) + 'static,
1678 >(
1679 this: *mut ffi::GtkTextView,
1680 f: glib::ffi::gpointer,
1681 ) {
1682 let f: &F = &*(f as *const F);
1683 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1684 }
1685 unsafe {
1686 let f: Box_<F> = Box_::new(f);
1687 connect_raw(
1688 self.as_ptr() as *mut _,
1689 c"toggle-cursor-visible".as_ptr() as *const _,
1690 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1691 toggle_cursor_visible_trampoline::<Self, F> as *const (),
1692 )),
1693 Box_::into_raw(f),
1694 )
1695 }
1696 }
1697
1698 fn emit_toggle_cursor_visible(&self) {
1699 self.emit_by_name::<()>("toggle-cursor-visible", &[]);
1700 }
1701
1702 #[doc(alias = "toggle-overwrite")]
1703 fn connect_toggle_overwrite<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1704 unsafe extern "C" fn toggle_overwrite_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1705 this: *mut ffi::GtkTextView,
1706 f: glib::ffi::gpointer,
1707 ) {
1708 let f: &F = &*(f as *const F);
1709 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1710 }
1711 unsafe {
1712 let f: Box_<F> = Box_::new(f);
1713 connect_raw(
1714 self.as_ptr() as *mut _,
1715 c"toggle-overwrite".as_ptr() as *const _,
1716 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1717 toggle_overwrite_trampoline::<Self, F> as *const (),
1718 )),
1719 Box_::into_raw(f),
1720 )
1721 }
1722 }
1723
1724 fn emit_toggle_overwrite(&self) {
1725 self.emit_by_name::<()>("toggle-overwrite", &[]);
1726 }
1727
1728 #[doc(alias = "accepts-tab")]
1729 fn connect_accepts_tab_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1730 unsafe extern "C" fn notify_accepts_tab_trampoline<
1731 P: IsA<TextView>,
1732 F: Fn(&P) + 'static,
1733 >(
1734 this: *mut ffi::GtkTextView,
1735 _param_spec: glib::ffi::gpointer,
1736 f: glib::ffi::gpointer,
1737 ) {
1738 let f: &F = &*(f as *const F);
1739 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1740 }
1741 unsafe {
1742 let f: Box_<F> = Box_::new(f);
1743 connect_raw(
1744 self.as_ptr() as *mut _,
1745 c"notify::accepts-tab".as_ptr() as *const _,
1746 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1747 notify_accepts_tab_trampoline::<Self, F> as *const (),
1748 )),
1749 Box_::into_raw(f),
1750 )
1751 }
1752 }
1753
1754 #[doc(alias = "bottom-margin")]
1755 fn connect_bottom_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1756 unsafe extern "C" fn notify_bottom_margin_trampoline<
1757 P: IsA<TextView>,
1758 F: Fn(&P) + 'static,
1759 >(
1760 this: *mut ffi::GtkTextView,
1761 _param_spec: glib::ffi::gpointer,
1762 f: glib::ffi::gpointer,
1763 ) {
1764 let f: &F = &*(f as *const F);
1765 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1766 }
1767 unsafe {
1768 let f: Box_<F> = Box_::new(f);
1769 connect_raw(
1770 self.as_ptr() as *mut _,
1771 c"notify::bottom-margin".as_ptr() as *const _,
1772 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1773 notify_bottom_margin_trampoline::<Self, F> as *const (),
1774 )),
1775 Box_::into_raw(f),
1776 )
1777 }
1778 }
1779
1780 #[doc(alias = "buffer")]
1781 fn connect_buffer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1782 unsafe extern "C" fn notify_buffer_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1783 this: *mut ffi::GtkTextView,
1784 _param_spec: glib::ffi::gpointer,
1785 f: glib::ffi::gpointer,
1786 ) {
1787 let f: &F = &*(f as *const F);
1788 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1789 }
1790 unsafe {
1791 let f: Box_<F> = Box_::new(f);
1792 connect_raw(
1793 self.as_ptr() as *mut _,
1794 c"notify::buffer".as_ptr() as *const _,
1795 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1796 notify_buffer_trampoline::<Self, F> as *const (),
1797 )),
1798 Box_::into_raw(f),
1799 )
1800 }
1801 }
1802
1803 #[doc(alias = "cursor-visible")]
1804 fn connect_cursor_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1805 unsafe extern "C" fn notify_cursor_visible_trampoline<
1806 P: IsA<TextView>,
1807 F: Fn(&P) + 'static,
1808 >(
1809 this: *mut ffi::GtkTextView,
1810 _param_spec: glib::ffi::gpointer,
1811 f: glib::ffi::gpointer,
1812 ) {
1813 let f: &F = &*(f as *const F);
1814 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1815 }
1816 unsafe {
1817 let f: Box_<F> = Box_::new(f);
1818 connect_raw(
1819 self.as_ptr() as *mut _,
1820 c"notify::cursor-visible".as_ptr() as *const _,
1821 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1822 notify_cursor_visible_trampoline::<Self, F> as *const (),
1823 )),
1824 Box_::into_raw(f),
1825 )
1826 }
1827 }
1828
1829 #[doc(alias = "editable")]
1830 fn connect_editable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1831 unsafe extern "C" fn notify_editable_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1832 this: *mut ffi::GtkTextView,
1833 _param_spec: glib::ffi::gpointer,
1834 f: glib::ffi::gpointer,
1835 ) {
1836 let f: &F = &*(f as *const F);
1837 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1838 }
1839 unsafe {
1840 let f: Box_<F> = Box_::new(f);
1841 connect_raw(
1842 self.as_ptr() as *mut _,
1843 c"notify::editable".as_ptr() as *const _,
1844 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1845 notify_editable_trampoline::<Self, F> as *const (),
1846 )),
1847 Box_::into_raw(f),
1848 )
1849 }
1850 }
1851
1852 #[doc(alias = "extra-menu")]
1853 fn connect_extra_menu_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1854 unsafe extern "C" fn notify_extra_menu_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1855 this: *mut ffi::GtkTextView,
1856 _param_spec: glib::ffi::gpointer,
1857 f: glib::ffi::gpointer,
1858 ) {
1859 let f: &F = &*(f as *const F);
1860 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1861 }
1862 unsafe {
1863 let f: Box_<F> = Box_::new(f);
1864 connect_raw(
1865 self.as_ptr() as *mut _,
1866 c"notify::extra-menu".as_ptr() as *const _,
1867 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1868 notify_extra_menu_trampoline::<Self, F> as *const (),
1869 )),
1870 Box_::into_raw(f),
1871 )
1872 }
1873 }
1874
1875 #[doc(alias = "im-module")]
1876 fn connect_im_module_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1877 unsafe extern "C" fn notify_im_module_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1878 this: *mut ffi::GtkTextView,
1879 _param_spec: glib::ffi::gpointer,
1880 f: glib::ffi::gpointer,
1881 ) {
1882 let f: &F = &*(f as *const F);
1883 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1884 }
1885 unsafe {
1886 let f: Box_<F> = Box_::new(f);
1887 connect_raw(
1888 self.as_ptr() as *mut _,
1889 c"notify::im-module".as_ptr() as *const _,
1890 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1891 notify_im_module_trampoline::<Self, F> as *const (),
1892 )),
1893 Box_::into_raw(f),
1894 )
1895 }
1896 }
1897
1898 #[doc(alias = "indent")]
1899 fn connect_indent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1900 unsafe extern "C" fn notify_indent_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1901 this: *mut ffi::GtkTextView,
1902 _param_spec: glib::ffi::gpointer,
1903 f: glib::ffi::gpointer,
1904 ) {
1905 let f: &F = &*(f as *const F);
1906 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1907 }
1908 unsafe {
1909 let f: Box_<F> = Box_::new(f);
1910 connect_raw(
1911 self.as_ptr() as *mut _,
1912 c"notify::indent".as_ptr() as *const _,
1913 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1914 notify_indent_trampoline::<Self, F> as *const (),
1915 )),
1916 Box_::into_raw(f),
1917 )
1918 }
1919 }
1920
1921 #[doc(alias = "input-hints")]
1922 fn connect_input_hints_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1923 unsafe extern "C" fn notify_input_hints_trampoline<
1924 P: IsA<TextView>,
1925 F: Fn(&P) + 'static,
1926 >(
1927 this: *mut ffi::GtkTextView,
1928 _param_spec: glib::ffi::gpointer,
1929 f: glib::ffi::gpointer,
1930 ) {
1931 let f: &F = &*(f as *const F);
1932 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1933 }
1934 unsafe {
1935 let f: Box_<F> = Box_::new(f);
1936 connect_raw(
1937 self.as_ptr() as *mut _,
1938 c"notify::input-hints".as_ptr() as *const _,
1939 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1940 notify_input_hints_trampoline::<Self, F> as *const (),
1941 )),
1942 Box_::into_raw(f),
1943 )
1944 }
1945 }
1946
1947 #[doc(alias = "input-purpose")]
1948 fn connect_input_purpose_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1949 unsafe extern "C" fn notify_input_purpose_trampoline<
1950 P: IsA<TextView>,
1951 F: Fn(&P) + 'static,
1952 >(
1953 this: *mut ffi::GtkTextView,
1954 _param_spec: glib::ffi::gpointer,
1955 f: glib::ffi::gpointer,
1956 ) {
1957 let f: &F = &*(f as *const F);
1958 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1959 }
1960 unsafe {
1961 let f: Box_<F> = Box_::new(f);
1962 connect_raw(
1963 self.as_ptr() as *mut _,
1964 c"notify::input-purpose".as_ptr() as *const _,
1965 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1966 notify_input_purpose_trampoline::<Self, F> as *const (),
1967 )),
1968 Box_::into_raw(f),
1969 )
1970 }
1971 }
1972
1973 #[doc(alias = "justification")]
1974 fn connect_justification_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1975 unsafe extern "C" fn notify_justification_trampoline<
1976 P: IsA<TextView>,
1977 F: Fn(&P) + 'static,
1978 >(
1979 this: *mut ffi::GtkTextView,
1980 _param_spec: glib::ffi::gpointer,
1981 f: glib::ffi::gpointer,
1982 ) {
1983 let f: &F = &*(f as *const F);
1984 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1985 }
1986 unsafe {
1987 let f: Box_<F> = Box_::new(f);
1988 connect_raw(
1989 self.as_ptr() as *mut _,
1990 c"notify::justification".as_ptr() as *const _,
1991 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1992 notify_justification_trampoline::<Self, F> as *const (),
1993 )),
1994 Box_::into_raw(f),
1995 )
1996 }
1997 }
1998
1999 #[doc(alias = "left-margin")]
2000 fn connect_left_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2001 unsafe extern "C" fn notify_left_margin_trampoline<
2002 P: IsA<TextView>,
2003 F: Fn(&P) + 'static,
2004 >(
2005 this: *mut ffi::GtkTextView,
2006 _param_spec: glib::ffi::gpointer,
2007 f: glib::ffi::gpointer,
2008 ) {
2009 let f: &F = &*(f as *const F);
2010 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2011 }
2012 unsafe {
2013 let f: Box_<F> = Box_::new(f);
2014 connect_raw(
2015 self.as_ptr() as *mut _,
2016 c"notify::left-margin".as_ptr() as *const _,
2017 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2018 notify_left_margin_trampoline::<Self, F> as *const (),
2019 )),
2020 Box_::into_raw(f),
2021 )
2022 }
2023 }
2024
2025 #[doc(alias = "monospace")]
2026 fn connect_monospace_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2027 unsafe extern "C" fn notify_monospace_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2028 this: *mut ffi::GtkTextView,
2029 _param_spec: glib::ffi::gpointer,
2030 f: glib::ffi::gpointer,
2031 ) {
2032 let f: &F = &*(f as *const F);
2033 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2034 }
2035 unsafe {
2036 let f: Box_<F> = Box_::new(f);
2037 connect_raw(
2038 self.as_ptr() as *mut _,
2039 c"notify::monospace".as_ptr() as *const _,
2040 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2041 notify_monospace_trampoline::<Self, F> as *const (),
2042 )),
2043 Box_::into_raw(f),
2044 )
2045 }
2046 }
2047
2048 #[doc(alias = "overwrite")]
2049 fn connect_overwrite_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2050 unsafe extern "C" fn notify_overwrite_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2051 this: *mut ffi::GtkTextView,
2052 _param_spec: glib::ffi::gpointer,
2053 f: glib::ffi::gpointer,
2054 ) {
2055 let f: &F = &*(f as *const F);
2056 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2057 }
2058 unsafe {
2059 let f: Box_<F> = Box_::new(f);
2060 connect_raw(
2061 self.as_ptr() as *mut _,
2062 c"notify::overwrite".as_ptr() as *const _,
2063 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2064 notify_overwrite_trampoline::<Self, F> as *const (),
2065 )),
2066 Box_::into_raw(f),
2067 )
2068 }
2069 }
2070
2071 #[doc(alias = "pixels-above-lines")]
2072 fn connect_pixels_above_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2073 unsafe extern "C" fn notify_pixels_above_lines_trampoline<
2074 P: IsA<TextView>,
2075 F: Fn(&P) + 'static,
2076 >(
2077 this: *mut ffi::GtkTextView,
2078 _param_spec: glib::ffi::gpointer,
2079 f: glib::ffi::gpointer,
2080 ) {
2081 let f: &F = &*(f as *const F);
2082 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2083 }
2084 unsafe {
2085 let f: Box_<F> = Box_::new(f);
2086 connect_raw(
2087 self.as_ptr() as *mut _,
2088 c"notify::pixels-above-lines".as_ptr() as *const _,
2089 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2090 notify_pixels_above_lines_trampoline::<Self, F> as *const (),
2091 )),
2092 Box_::into_raw(f),
2093 )
2094 }
2095 }
2096
2097 #[doc(alias = "pixels-below-lines")]
2098 fn connect_pixels_below_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2099 unsafe extern "C" fn notify_pixels_below_lines_trampoline<
2100 P: IsA<TextView>,
2101 F: Fn(&P) + 'static,
2102 >(
2103 this: *mut ffi::GtkTextView,
2104 _param_spec: glib::ffi::gpointer,
2105 f: glib::ffi::gpointer,
2106 ) {
2107 let f: &F = &*(f as *const F);
2108 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2109 }
2110 unsafe {
2111 let f: Box_<F> = Box_::new(f);
2112 connect_raw(
2113 self.as_ptr() as *mut _,
2114 c"notify::pixels-below-lines".as_ptr() as *const _,
2115 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2116 notify_pixels_below_lines_trampoline::<Self, F> as *const (),
2117 )),
2118 Box_::into_raw(f),
2119 )
2120 }
2121 }
2122
2123 #[doc(alias = "pixels-inside-wrap")]
2124 fn connect_pixels_inside_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2125 unsafe extern "C" fn notify_pixels_inside_wrap_trampoline<
2126 P: IsA<TextView>,
2127 F: Fn(&P) + 'static,
2128 >(
2129 this: *mut ffi::GtkTextView,
2130 _param_spec: glib::ffi::gpointer,
2131 f: glib::ffi::gpointer,
2132 ) {
2133 let f: &F = &*(f as *const F);
2134 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2135 }
2136 unsafe {
2137 let f: Box_<F> = Box_::new(f);
2138 connect_raw(
2139 self.as_ptr() as *mut _,
2140 c"notify::pixels-inside-wrap".as_ptr() as *const _,
2141 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2142 notify_pixels_inside_wrap_trampoline::<Self, F> as *const (),
2143 )),
2144 Box_::into_raw(f),
2145 )
2146 }
2147 }
2148
2149 #[doc(alias = "right-margin")]
2150 fn connect_right_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2151 unsafe extern "C" fn notify_right_margin_trampoline<
2152 P: IsA<TextView>,
2153 F: Fn(&P) + 'static,
2154 >(
2155 this: *mut ffi::GtkTextView,
2156 _param_spec: glib::ffi::gpointer,
2157 f: glib::ffi::gpointer,
2158 ) {
2159 let f: &F = &*(f as *const F);
2160 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2161 }
2162 unsafe {
2163 let f: Box_<F> = Box_::new(f);
2164 connect_raw(
2165 self.as_ptr() as *mut _,
2166 c"notify::right-margin".as_ptr() as *const _,
2167 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2168 notify_right_margin_trampoline::<Self, F> as *const (),
2169 )),
2170 Box_::into_raw(f),
2171 )
2172 }
2173 }
2174
2175 #[doc(alias = "tabs")]
2176 fn connect_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2177 unsafe extern "C" fn notify_tabs_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2178 this: *mut ffi::GtkTextView,
2179 _param_spec: glib::ffi::gpointer,
2180 f: glib::ffi::gpointer,
2181 ) {
2182 let f: &F = &*(f as *const F);
2183 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2184 }
2185 unsafe {
2186 let f: Box_<F> = Box_::new(f);
2187 connect_raw(
2188 self.as_ptr() as *mut _,
2189 c"notify::tabs".as_ptr() as *const _,
2190 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2191 notify_tabs_trampoline::<Self, F> as *const (),
2192 )),
2193 Box_::into_raw(f),
2194 )
2195 }
2196 }
2197
2198 #[doc(alias = "top-margin")]
2199 fn connect_top_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2200 unsafe extern "C" fn notify_top_margin_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2201 this: *mut ffi::GtkTextView,
2202 _param_spec: glib::ffi::gpointer,
2203 f: glib::ffi::gpointer,
2204 ) {
2205 let f: &F = &*(f as *const F);
2206 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2207 }
2208 unsafe {
2209 let f: Box_<F> = Box_::new(f);
2210 connect_raw(
2211 self.as_ptr() as *mut _,
2212 c"notify::top-margin".as_ptr() as *const _,
2213 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2214 notify_top_margin_trampoline::<Self, F> as *const (),
2215 )),
2216 Box_::into_raw(f),
2217 )
2218 }
2219 }
2220
2221 #[doc(alias = "wrap-mode")]
2222 fn connect_wrap_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2223 unsafe extern "C" fn notify_wrap_mode_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2224 this: *mut ffi::GtkTextView,
2225 _param_spec: glib::ffi::gpointer,
2226 f: glib::ffi::gpointer,
2227 ) {
2228 let f: &F = &*(f as *const F);
2229 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2230 }
2231 unsafe {
2232 let f: Box_<F> = Box_::new(f);
2233 connect_raw(
2234 self.as_ptr() as *mut _,
2235 c"notify::wrap-mode".as_ptr() as *const _,
2236 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2237 notify_wrap_mode_trampoline::<Self, F> as *const (),
2238 )),
2239 Box_::into_raw(f),
2240 )
2241 }
2242 }
2243}
2244
2245impl<O: IsA<TextView>> TextViewExt for O {}