1#[cfg(feature = "v4_14")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
7use crate::AccessibleText;
8use crate::{
9 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, ffi,
13};
14use glib::{
15 object::ObjectType as _,
16 prelude::*,
17 signal::{SignalHandlerId, connect_raw},
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(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) -> Option<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 { Some(iter) } else { None }
672 }
673 }
674
675 #[doc(alias = "gtk_text_view_get_iter_at_position")]
676 #[doc(alias = "get_iter_at_position")]
677 fn iter_at_position(&self, x: i32, y: i32) -> Option<(TextIter, i32)> {
678 unsafe {
679 let mut iter = TextIter::uninitialized();
680 let mut trailing = std::mem::MaybeUninit::uninit();
681 let ret = from_glib(ffi::gtk_text_view_get_iter_at_position(
682 self.as_ref().to_glib_none().0,
683 iter.to_glib_none_mut().0,
684 trailing.as_mut_ptr(),
685 x,
686 y,
687 ));
688 if ret {
689 Some((iter, trailing.assume_init()))
690 } else {
691 None
692 }
693 }
694 }
695
696 #[doc(alias = "gtk_text_view_get_iter_location")]
697 #[doc(alias = "get_iter_location")]
698 fn iter_location(&self, iter: &TextIter) -> gdk::Rectangle {
699 unsafe {
700 let mut location = gdk::Rectangle::uninitialized();
701 ffi::gtk_text_view_get_iter_location(
702 self.as_ref().to_glib_none().0,
703 iter.to_glib_none().0,
704 location.to_glib_none_mut().0,
705 );
706 location
707 }
708 }
709
710 #[doc(alias = "gtk_text_view_get_justification")]
711 #[doc(alias = "get_justification")]
712 fn justification(&self) -> Justification {
713 unsafe {
714 from_glib(ffi::gtk_text_view_get_justification(
715 self.as_ref().to_glib_none().0,
716 ))
717 }
718 }
719
720 #[doc(alias = "gtk_text_view_get_left_margin")]
721 #[doc(alias = "get_left_margin")]
722 #[doc(alias = "left-margin")]
723 fn left_margin(&self) -> i32 {
724 unsafe { ffi::gtk_text_view_get_left_margin(self.as_ref().to_glib_none().0) }
725 }
726
727 #[doc(alias = "gtk_text_view_get_line_at_y")]
728 #[doc(alias = "get_line_at_y")]
729 fn line_at_y(&self, y: i32) -> (TextIter, i32) {
730 unsafe {
731 let mut target_iter = TextIter::uninitialized();
732 let mut line_top = std::mem::MaybeUninit::uninit();
733 ffi::gtk_text_view_get_line_at_y(
734 self.as_ref().to_glib_none().0,
735 target_iter.to_glib_none_mut().0,
736 y,
737 line_top.as_mut_ptr(),
738 );
739 (target_iter, line_top.assume_init())
740 }
741 }
742
743 #[doc(alias = "gtk_text_view_get_line_yrange")]
744 #[doc(alias = "get_line_yrange")]
745 fn line_yrange(&self, iter: &TextIter) -> (i32, i32) {
746 unsafe {
747 let mut y = std::mem::MaybeUninit::uninit();
748 let mut height = std::mem::MaybeUninit::uninit();
749 ffi::gtk_text_view_get_line_yrange(
750 self.as_ref().to_glib_none().0,
751 iter.to_glib_none().0,
752 y.as_mut_ptr(),
753 height.as_mut_ptr(),
754 );
755 (y.assume_init(), height.assume_init())
756 }
757 }
758
759 #[cfg(feature = "v4_4")]
760 #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
761 #[doc(alias = "gtk_text_view_get_ltr_context")]
762 #[doc(alias = "get_ltr_context")]
763 fn ltr_context(&self) -> pango::Context {
764 unsafe {
765 from_glib_none(ffi::gtk_text_view_get_ltr_context(
766 self.as_ref().to_glib_none().0,
767 ))
768 }
769 }
770
771 #[doc(alias = "gtk_text_view_get_monospace")]
772 #[doc(alias = "get_monospace")]
773 #[doc(alias = "monospace")]
774 fn is_monospace(&self) -> bool {
775 unsafe {
776 from_glib(ffi::gtk_text_view_get_monospace(
777 self.as_ref().to_glib_none().0,
778 ))
779 }
780 }
781
782 #[doc(alias = "gtk_text_view_get_overwrite")]
783 #[doc(alias = "get_overwrite")]
784 #[doc(alias = "overwrite")]
785 fn overwrites(&self) -> bool {
786 unsafe {
787 from_glib(ffi::gtk_text_view_get_overwrite(
788 self.as_ref().to_glib_none().0,
789 ))
790 }
791 }
792
793 #[doc(alias = "gtk_text_view_get_pixels_above_lines")]
794 #[doc(alias = "get_pixels_above_lines")]
795 #[doc(alias = "pixels-above-lines")]
796 fn pixels_above_lines(&self) -> i32 {
797 unsafe { ffi::gtk_text_view_get_pixels_above_lines(self.as_ref().to_glib_none().0) }
798 }
799
800 #[doc(alias = "gtk_text_view_get_pixels_below_lines")]
801 #[doc(alias = "get_pixels_below_lines")]
802 #[doc(alias = "pixels-below-lines")]
803 fn pixels_below_lines(&self) -> i32 {
804 unsafe { ffi::gtk_text_view_get_pixels_below_lines(self.as_ref().to_glib_none().0) }
805 }
806
807 #[doc(alias = "gtk_text_view_get_pixels_inside_wrap")]
808 #[doc(alias = "get_pixels_inside_wrap")]
809 #[doc(alias = "pixels-inside-wrap")]
810 fn pixels_inside_wrap(&self) -> i32 {
811 unsafe { ffi::gtk_text_view_get_pixels_inside_wrap(self.as_ref().to_glib_none().0) }
812 }
813
814 #[doc(alias = "gtk_text_view_get_right_margin")]
815 #[doc(alias = "get_right_margin")]
816 #[doc(alias = "right-margin")]
817 fn right_margin(&self) -> i32 {
818 unsafe { ffi::gtk_text_view_get_right_margin(self.as_ref().to_glib_none().0) }
819 }
820
821 #[cfg(feature = "v4_4")]
822 #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
823 #[doc(alias = "gtk_text_view_get_rtl_context")]
824 #[doc(alias = "get_rtl_context")]
825 fn rtl_context(&self) -> pango::Context {
826 unsafe {
827 from_glib_none(ffi::gtk_text_view_get_rtl_context(
828 self.as_ref().to_glib_none().0,
829 ))
830 }
831 }
832
833 #[doc(alias = "gtk_text_view_get_tabs")]
834 #[doc(alias = "get_tabs")]
835 fn tabs(&self) -> Option<pango::TabArray> {
836 unsafe { from_glib_full(ffi::gtk_text_view_get_tabs(self.as_ref().to_glib_none().0)) }
837 }
838
839 #[doc(alias = "gtk_text_view_get_top_margin")]
840 #[doc(alias = "get_top_margin")]
841 #[doc(alias = "top-margin")]
842 fn top_margin(&self) -> i32 {
843 unsafe { ffi::gtk_text_view_get_top_margin(self.as_ref().to_glib_none().0) }
844 }
845
846 #[cfg(feature = "v4_18")]
847 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
848 #[doc(alias = "gtk_text_view_get_visible_offset")]
849 #[doc(alias = "get_visible_offset")]
850 fn visible_offset(&self) -> (f64, f64) {
851 unsafe {
852 let mut x_offset = std::mem::MaybeUninit::uninit();
853 let mut y_offset = std::mem::MaybeUninit::uninit();
854 ffi::gtk_text_view_get_visible_offset(
855 self.as_ref().to_glib_none().0,
856 x_offset.as_mut_ptr(),
857 y_offset.as_mut_ptr(),
858 );
859 (x_offset.assume_init(), y_offset.assume_init())
860 }
861 }
862
863 #[doc(alias = "gtk_text_view_get_visible_rect")]
864 #[doc(alias = "get_visible_rect")]
865 fn visible_rect(&self) -> gdk::Rectangle {
866 unsafe {
867 let mut visible_rect = gdk::Rectangle::uninitialized();
868 ffi::gtk_text_view_get_visible_rect(
869 self.as_ref().to_glib_none().0,
870 visible_rect.to_glib_none_mut().0,
871 );
872 visible_rect
873 }
874 }
875
876 #[doc(alias = "gtk_text_view_get_wrap_mode")]
877 #[doc(alias = "get_wrap_mode")]
878 #[doc(alias = "wrap-mode")]
879 fn wrap_mode(&self) -> WrapMode {
880 unsafe {
881 from_glib(ffi::gtk_text_view_get_wrap_mode(
882 self.as_ref().to_glib_none().0,
883 ))
884 }
885 }
886
887 #[doc(alias = "gtk_text_view_im_context_filter_keypress")]
888 fn im_context_filter_keypress(&self, event: impl AsRef<gdk::Event>) -> bool {
889 unsafe {
890 from_glib(ffi::gtk_text_view_im_context_filter_keypress(
891 self.as_ref().to_glib_none().0,
892 event.as_ref().to_glib_none().0,
893 ))
894 }
895 }
896
897 #[doc(alias = "gtk_text_view_move_mark_onscreen")]
898 fn move_mark_onscreen(&self, mark: &impl IsA<TextMark>) -> bool {
899 unsafe {
900 from_glib(ffi::gtk_text_view_move_mark_onscreen(
901 self.as_ref().to_glib_none().0,
902 mark.as_ref().to_glib_none().0,
903 ))
904 }
905 }
906
907 #[doc(alias = "gtk_text_view_move_overlay")]
908 fn move_overlay(&self, child: &impl IsA<Widget>, xpos: i32, ypos: i32) {
909 unsafe {
910 ffi::gtk_text_view_move_overlay(
911 self.as_ref().to_glib_none().0,
912 child.as_ref().to_glib_none().0,
913 xpos,
914 ypos,
915 );
916 }
917 }
918
919 #[doc(alias = "gtk_text_view_move_visually")]
920 fn move_visually(&self, iter: &mut TextIter, count: i32) -> bool {
921 unsafe {
922 from_glib(ffi::gtk_text_view_move_visually(
923 self.as_ref().to_glib_none().0,
924 iter.to_glib_none_mut().0,
925 count,
926 ))
927 }
928 }
929
930 #[doc(alias = "gtk_text_view_place_cursor_onscreen")]
931 fn place_cursor_onscreen(&self) -> bool {
932 unsafe {
933 from_glib(ffi::gtk_text_view_place_cursor_onscreen(
934 self.as_ref().to_glib_none().0,
935 ))
936 }
937 }
938
939 #[doc(alias = "gtk_text_view_remove")]
940 fn remove(&self, child: &impl IsA<Widget>) {
941 unsafe {
942 ffi::gtk_text_view_remove(
943 self.as_ref().to_glib_none().0,
944 child.as_ref().to_glib_none().0,
945 );
946 }
947 }
948
949 #[doc(alias = "gtk_text_view_reset_cursor_blink")]
950 fn reset_cursor_blink(&self) {
951 unsafe {
952 ffi::gtk_text_view_reset_cursor_blink(self.as_ref().to_glib_none().0);
953 }
954 }
955
956 #[doc(alias = "gtk_text_view_reset_im_context")]
957 fn reset_im_context(&self) {
958 unsafe {
959 ffi::gtk_text_view_reset_im_context(self.as_ref().to_glib_none().0);
960 }
961 }
962
963 #[doc(alias = "gtk_text_view_scroll_mark_onscreen")]
964 fn scroll_mark_onscreen(&self, mark: &impl IsA<TextMark>) {
965 unsafe {
966 ffi::gtk_text_view_scroll_mark_onscreen(
967 self.as_ref().to_glib_none().0,
968 mark.as_ref().to_glib_none().0,
969 );
970 }
971 }
972
973 #[doc(alias = "gtk_text_view_scroll_to_iter")]
974 fn scroll_to_iter(
975 &self,
976 iter: &mut TextIter,
977 within_margin: f64,
978 use_align: bool,
979 xalign: f64,
980 yalign: f64,
981 ) -> bool {
982 unsafe {
983 from_glib(ffi::gtk_text_view_scroll_to_iter(
984 self.as_ref().to_glib_none().0,
985 iter.to_glib_none_mut().0,
986 within_margin,
987 use_align.into_glib(),
988 xalign,
989 yalign,
990 ))
991 }
992 }
993
994 #[doc(alias = "gtk_text_view_scroll_to_mark")]
995 fn scroll_to_mark(
996 &self,
997 mark: &impl IsA<TextMark>,
998 within_margin: f64,
999 use_align: bool,
1000 xalign: f64,
1001 yalign: f64,
1002 ) {
1003 unsafe {
1004 ffi::gtk_text_view_scroll_to_mark(
1005 self.as_ref().to_glib_none().0,
1006 mark.as_ref().to_glib_none().0,
1007 within_margin,
1008 use_align.into_glib(),
1009 xalign,
1010 yalign,
1011 );
1012 }
1013 }
1014
1015 #[doc(alias = "gtk_text_view_set_accepts_tab")]
1016 #[doc(alias = "accepts-tab")]
1017 fn set_accepts_tab(&self, accepts_tab: bool) {
1018 unsafe {
1019 ffi::gtk_text_view_set_accepts_tab(
1020 self.as_ref().to_glib_none().0,
1021 accepts_tab.into_glib(),
1022 );
1023 }
1024 }
1025
1026 #[doc(alias = "gtk_text_view_set_bottom_margin")]
1027 #[doc(alias = "bottom-margin")]
1028 fn set_bottom_margin(&self, bottom_margin: i32) {
1029 unsafe {
1030 ffi::gtk_text_view_set_bottom_margin(self.as_ref().to_glib_none().0, bottom_margin);
1031 }
1032 }
1033
1034 #[doc(alias = "gtk_text_view_set_buffer")]
1035 #[doc(alias = "buffer")]
1036 fn set_buffer(&self, buffer: Option<&impl IsA<TextBuffer>>) {
1037 unsafe {
1038 ffi::gtk_text_view_set_buffer(
1039 self.as_ref().to_glib_none().0,
1040 buffer.map(|p| p.as_ref()).to_glib_none().0,
1041 );
1042 }
1043 }
1044
1045 #[doc(alias = "gtk_text_view_set_cursor_visible")]
1046 #[doc(alias = "cursor-visible")]
1047 fn set_cursor_visible(&self, setting: bool) {
1048 unsafe {
1049 ffi::gtk_text_view_set_cursor_visible(
1050 self.as_ref().to_glib_none().0,
1051 setting.into_glib(),
1052 );
1053 }
1054 }
1055
1056 #[doc(alias = "gtk_text_view_set_editable")]
1057 #[doc(alias = "editable")]
1058 fn set_editable(&self, setting: bool) {
1059 unsafe {
1060 ffi::gtk_text_view_set_editable(self.as_ref().to_glib_none().0, setting.into_glib());
1061 }
1062 }
1063
1064 #[doc(alias = "gtk_text_view_set_extra_menu")]
1065 #[doc(alias = "extra-menu")]
1066 fn set_extra_menu(&self, model: Option<&impl IsA<gio::MenuModel>>) {
1067 unsafe {
1068 ffi::gtk_text_view_set_extra_menu(
1069 self.as_ref().to_glib_none().0,
1070 model.map(|p| p.as_ref()).to_glib_none().0,
1071 );
1072 }
1073 }
1074
1075 #[doc(alias = "gtk_text_view_set_gutter")]
1076 fn set_gutter(&self, win: TextWindowType, widget: Option<&impl IsA<Widget>>) {
1077 unsafe {
1078 ffi::gtk_text_view_set_gutter(
1079 self.as_ref().to_glib_none().0,
1080 win.into_glib(),
1081 widget.map(|p| p.as_ref()).to_glib_none().0,
1082 );
1083 }
1084 }
1085
1086 #[doc(alias = "gtk_text_view_set_indent")]
1087 #[doc(alias = "indent")]
1088 fn set_indent(&self, indent: i32) {
1089 unsafe {
1090 ffi::gtk_text_view_set_indent(self.as_ref().to_glib_none().0, indent);
1091 }
1092 }
1093
1094 #[doc(alias = "gtk_text_view_set_input_hints")]
1095 #[doc(alias = "input-hints")]
1096 fn set_input_hints(&self, hints: InputHints) {
1097 unsafe {
1098 ffi::gtk_text_view_set_input_hints(self.as_ref().to_glib_none().0, hints.into_glib());
1099 }
1100 }
1101
1102 #[doc(alias = "gtk_text_view_set_input_purpose")]
1103 #[doc(alias = "input-purpose")]
1104 fn set_input_purpose(&self, purpose: InputPurpose) {
1105 unsafe {
1106 ffi::gtk_text_view_set_input_purpose(
1107 self.as_ref().to_glib_none().0,
1108 purpose.into_glib(),
1109 );
1110 }
1111 }
1112
1113 #[doc(alias = "gtk_text_view_set_justification")]
1114 #[doc(alias = "justification")]
1115 fn set_justification(&self, justification: Justification) {
1116 unsafe {
1117 ffi::gtk_text_view_set_justification(
1118 self.as_ref().to_glib_none().0,
1119 justification.into_glib(),
1120 );
1121 }
1122 }
1123
1124 #[doc(alias = "gtk_text_view_set_left_margin")]
1125 #[doc(alias = "left-margin")]
1126 fn set_left_margin(&self, left_margin: i32) {
1127 unsafe {
1128 ffi::gtk_text_view_set_left_margin(self.as_ref().to_glib_none().0, left_margin);
1129 }
1130 }
1131
1132 #[doc(alias = "gtk_text_view_set_monospace")]
1133 #[doc(alias = "monospace")]
1134 fn set_monospace(&self, monospace: bool) {
1135 unsafe {
1136 ffi::gtk_text_view_set_monospace(self.as_ref().to_glib_none().0, monospace.into_glib());
1137 }
1138 }
1139
1140 #[doc(alias = "gtk_text_view_set_overwrite")]
1141 #[doc(alias = "overwrite")]
1142 fn set_overwrite(&self, overwrite: bool) {
1143 unsafe {
1144 ffi::gtk_text_view_set_overwrite(self.as_ref().to_glib_none().0, overwrite.into_glib());
1145 }
1146 }
1147
1148 #[doc(alias = "gtk_text_view_set_pixels_above_lines")]
1149 #[doc(alias = "pixels-above-lines")]
1150 fn set_pixels_above_lines(&self, pixels_above_lines: i32) {
1151 unsafe {
1152 ffi::gtk_text_view_set_pixels_above_lines(
1153 self.as_ref().to_glib_none().0,
1154 pixels_above_lines,
1155 );
1156 }
1157 }
1158
1159 #[doc(alias = "gtk_text_view_set_pixels_below_lines")]
1160 #[doc(alias = "pixels-below-lines")]
1161 fn set_pixels_below_lines(&self, pixels_below_lines: i32) {
1162 unsafe {
1163 ffi::gtk_text_view_set_pixels_below_lines(
1164 self.as_ref().to_glib_none().0,
1165 pixels_below_lines,
1166 );
1167 }
1168 }
1169
1170 #[doc(alias = "gtk_text_view_set_pixels_inside_wrap")]
1171 #[doc(alias = "pixels-inside-wrap")]
1172 fn set_pixels_inside_wrap(&self, pixels_inside_wrap: i32) {
1173 unsafe {
1174 ffi::gtk_text_view_set_pixels_inside_wrap(
1175 self.as_ref().to_glib_none().0,
1176 pixels_inside_wrap,
1177 );
1178 }
1179 }
1180
1181 #[doc(alias = "gtk_text_view_set_right_margin")]
1182 #[doc(alias = "right-margin")]
1183 fn set_right_margin(&self, right_margin: i32) {
1184 unsafe {
1185 ffi::gtk_text_view_set_right_margin(self.as_ref().to_glib_none().0, right_margin);
1186 }
1187 }
1188
1189 #[doc(alias = "gtk_text_view_set_tabs")]
1190 #[doc(alias = "tabs")]
1191 fn set_tabs(&self, tabs: &pango::TabArray) {
1192 unsafe {
1193 ffi::gtk_text_view_set_tabs(
1194 self.as_ref().to_glib_none().0,
1195 mut_override(tabs.to_glib_none().0),
1196 );
1197 }
1198 }
1199
1200 #[doc(alias = "gtk_text_view_set_top_margin")]
1201 #[doc(alias = "top-margin")]
1202 fn set_top_margin(&self, top_margin: i32) {
1203 unsafe {
1204 ffi::gtk_text_view_set_top_margin(self.as_ref().to_glib_none().0, top_margin);
1205 }
1206 }
1207
1208 #[doc(alias = "gtk_text_view_set_wrap_mode")]
1209 #[doc(alias = "wrap-mode")]
1210 fn set_wrap_mode(&self, wrap_mode: WrapMode) {
1211 unsafe {
1212 ffi::gtk_text_view_set_wrap_mode(self.as_ref().to_glib_none().0, wrap_mode.into_glib());
1213 }
1214 }
1215
1216 #[doc(alias = "gtk_text_view_starts_display_line")]
1217 fn starts_display_line(&self, iter: &TextIter) -> bool {
1218 unsafe {
1219 from_glib(ffi::gtk_text_view_starts_display_line(
1220 self.as_ref().to_glib_none().0,
1221 iter.to_glib_none().0,
1222 ))
1223 }
1224 }
1225
1226 #[doc(alias = "gtk_text_view_window_to_buffer_coords")]
1227 fn window_to_buffer_coords(
1228 &self,
1229 win: TextWindowType,
1230 window_x: i32,
1231 window_y: i32,
1232 ) -> (i32, i32) {
1233 unsafe {
1234 let mut buffer_x = std::mem::MaybeUninit::uninit();
1235 let mut buffer_y = std::mem::MaybeUninit::uninit();
1236 ffi::gtk_text_view_window_to_buffer_coords(
1237 self.as_ref().to_glib_none().0,
1238 win.into_glib(),
1239 window_x,
1240 window_y,
1241 buffer_x.as_mut_ptr(),
1242 buffer_y.as_mut_ptr(),
1243 );
1244 (buffer_x.assume_init(), buffer_y.assume_init())
1245 }
1246 }
1247
1248 #[doc(alias = "im-module")]
1249 fn im_module(&self) -> Option<glib::GString> {
1250 ObjectExt::property(self.as_ref(), "im-module")
1251 }
1252
1253 #[doc(alias = "im-module")]
1254 fn set_im_module(&self, im_module: Option<&str>) {
1255 ObjectExt::set_property(self.as_ref(), "im-module", im_module)
1256 }
1257
1258 #[doc(alias = "backspace")]
1259 fn connect_backspace<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1260 unsafe extern "C" fn backspace_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1261 this: *mut ffi::GtkTextView,
1262 f: glib::ffi::gpointer,
1263 ) {
1264 unsafe {
1265 let f: &F = &*(f as *const F);
1266 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1267 }
1268 }
1269 unsafe {
1270 let f: Box_<F> = Box_::new(f);
1271 connect_raw(
1272 self.as_ptr() as *mut _,
1273 c"backspace".as_ptr(),
1274 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1275 backspace_trampoline::<Self, F> as *const (),
1276 )),
1277 Box_::into_raw(f),
1278 )
1279 }
1280 }
1281
1282 fn emit_backspace(&self) {
1283 self.emit_by_name::<()>("backspace", &[]);
1284 }
1285
1286 #[doc(alias = "copy-clipboard")]
1287 fn connect_copy_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1288 unsafe extern "C" fn copy_clipboard_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1289 this: *mut ffi::GtkTextView,
1290 f: glib::ffi::gpointer,
1291 ) {
1292 unsafe {
1293 let f: &F = &*(f as *const F);
1294 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1295 }
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(),
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 unsafe {
1321 let f: &F = &*(f as *const F);
1322 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1323 }
1324 }
1325 unsafe {
1326 let f: Box_<F> = Box_::new(f);
1327 connect_raw(
1328 self.as_ptr() as *mut _,
1329 c"cut-clipboard".as_ptr(),
1330 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1331 cut_clipboard_trampoline::<Self, F> as *const (),
1332 )),
1333 Box_::into_raw(f),
1334 )
1335 }
1336 }
1337
1338 fn emit_cut_clipboard(&self) {
1339 self.emit_by_name::<()>("cut-clipboard", &[]);
1340 }
1341
1342 #[doc(alias = "delete-from-cursor")]
1343 fn connect_delete_from_cursor<F: Fn(&Self, DeleteType, i32) + 'static>(
1344 &self,
1345 f: F,
1346 ) -> SignalHandlerId {
1347 unsafe extern "C" fn delete_from_cursor_trampoline<
1348 P: IsA<TextView>,
1349 F: Fn(&P, DeleteType, i32) + 'static,
1350 >(
1351 this: *mut ffi::GtkTextView,
1352 type_: ffi::GtkDeleteType,
1353 count: std::ffi::c_int,
1354 f: glib::ffi::gpointer,
1355 ) {
1356 unsafe {
1357 let f: &F = &*(f as *const F);
1358 f(
1359 TextView::from_glib_borrow(this).unsafe_cast_ref(),
1360 from_glib(type_),
1361 count,
1362 )
1363 }
1364 }
1365 unsafe {
1366 let f: Box_<F> = Box_::new(f);
1367 connect_raw(
1368 self.as_ptr() as *mut _,
1369 c"delete-from-cursor".as_ptr(),
1370 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1371 delete_from_cursor_trampoline::<Self, F> as *const (),
1372 )),
1373 Box_::into_raw(f),
1374 )
1375 }
1376 }
1377
1378 fn emit_delete_from_cursor(&self, type_: DeleteType, count: i32) {
1379 self.emit_by_name::<()>("delete-from-cursor", &[&type_, &count]);
1380 }
1381
1382 #[doc(alias = "extend-selection")]
1383 fn connect_extend_selection<
1384 F: Fn(&Self, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> glib::Propagation
1385 + 'static,
1386 >(
1387 &self,
1388 f: F,
1389 ) -> SignalHandlerId {
1390 unsafe extern "C" fn extend_selection_trampoline<
1391 P: IsA<TextView>,
1392 F: Fn(&P, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> glib::Propagation
1393 + 'static,
1394 >(
1395 this: *mut ffi::GtkTextView,
1396 granularity: ffi::GtkTextExtendSelection,
1397 location: *mut ffi::GtkTextIter,
1398 start: *mut ffi::GtkTextIter,
1399 end: *mut ffi::GtkTextIter,
1400 f: glib::ffi::gpointer,
1401 ) -> glib::ffi::gboolean {
1402 unsafe {
1403 let f: &F = &*(f as *const F);
1404 f(
1405 TextView::from_glib_borrow(this).unsafe_cast_ref(),
1406 from_glib(granularity),
1407 &from_glib_borrow(location),
1408 &from_glib_borrow(start),
1409 &from_glib_borrow(end),
1410 )
1411 .into_glib()
1412 }
1413 }
1414 unsafe {
1415 let f: Box_<F> = Box_::new(f);
1416 connect_raw(
1417 self.as_ptr() as *mut _,
1418 c"extend-selection".as_ptr(),
1419 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1420 extend_selection_trampoline::<Self, F> as *const (),
1421 )),
1422 Box_::into_raw(f),
1423 )
1424 }
1425 }
1426
1427 #[doc(alias = "insert-at-cursor")]
1428 fn connect_insert_at_cursor<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
1429 unsafe extern "C" fn insert_at_cursor_trampoline<
1430 P: IsA<TextView>,
1431 F: Fn(&P, &str) + 'static,
1432 >(
1433 this: *mut ffi::GtkTextView,
1434 string: *mut std::ffi::c_char,
1435 f: glib::ffi::gpointer,
1436 ) {
1437 unsafe {
1438 let f: &F = &*(f as *const F);
1439 f(
1440 TextView::from_glib_borrow(this).unsafe_cast_ref(),
1441 &glib::GString::from_glib_borrow(string),
1442 )
1443 }
1444 }
1445 unsafe {
1446 let f: Box_<F> = Box_::new(f);
1447 connect_raw(
1448 self.as_ptr() as *mut _,
1449 c"insert-at-cursor".as_ptr(),
1450 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1451 insert_at_cursor_trampoline::<Self, F> as *const (),
1452 )),
1453 Box_::into_raw(f),
1454 )
1455 }
1456 }
1457
1458 fn emit_insert_at_cursor(&self, string: &str) {
1459 self.emit_by_name::<()>("insert-at-cursor", &[&string]);
1460 }
1461
1462 #[doc(alias = "insert-emoji")]
1463 fn connect_insert_emoji<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1464 unsafe extern "C" fn insert_emoji_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1465 this: *mut ffi::GtkTextView,
1466 f: glib::ffi::gpointer,
1467 ) {
1468 unsafe {
1469 let f: &F = &*(f as *const F);
1470 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1471 }
1472 }
1473 unsafe {
1474 let f: Box_<F> = Box_::new(f);
1475 connect_raw(
1476 self.as_ptr() as *mut _,
1477 c"insert-emoji".as_ptr(),
1478 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1479 insert_emoji_trampoline::<Self, F> as *const (),
1480 )),
1481 Box_::into_raw(f),
1482 )
1483 }
1484 }
1485
1486 fn emit_insert_emoji(&self) {
1487 self.emit_by_name::<()>("insert-emoji", &[]);
1488 }
1489
1490 #[doc(alias = "move-cursor")]
1491 fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>(
1492 &self,
1493 f: F,
1494 ) -> SignalHandlerId {
1495 unsafe extern "C" fn move_cursor_trampoline<
1496 P: IsA<TextView>,
1497 F: Fn(&P, MovementStep, i32, bool) + 'static,
1498 >(
1499 this: *mut ffi::GtkTextView,
1500 step: ffi::GtkMovementStep,
1501 count: std::ffi::c_int,
1502 extend_selection: glib::ffi::gboolean,
1503 f: glib::ffi::gpointer,
1504 ) {
1505 unsafe {
1506 let f: &F = &*(f as *const F);
1507 f(
1508 TextView::from_glib_borrow(this).unsafe_cast_ref(),
1509 from_glib(step),
1510 count,
1511 from_glib(extend_selection),
1512 )
1513 }
1514 }
1515 unsafe {
1516 let f: Box_<F> = Box_::new(f);
1517 connect_raw(
1518 self.as_ptr() as *mut _,
1519 c"move-cursor".as_ptr(),
1520 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1521 move_cursor_trampoline::<Self, F> as *const (),
1522 )),
1523 Box_::into_raw(f),
1524 )
1525 }
1526 }
1527
1528 fn emit_move_cursor(&self, step: MovementStep, count: i32, extend_selection: bool) {
1529 self.emit_by_name::<()>("move-cursor", &[&step, &count, &extend_selection]);
1530 }
1531
1532 #[doc(alias = "move-viewport")]
1533 fn connect_move_viewport<F: Fn(&Self, ScrollStep, i32) + 'static>(
1534 &self,
1535 f: F,
1536 ) -> SignalHandlerId {
1537 unsafe extern "C" fn move_viewport_trampoline<
1538 P: IsA<TextView>,
1539 F: Fn(&P, ScrollStep, i32) + 'static,
1540 >(
1541 this: *mut ffi::GtkTextView,
1542 step: ffi::GtkScrollStep,
1543 count: std::ffi::c_int,
1544 f: glib::ffi::gpointer,
1545 ) {
1546 unsafe {
1547 let f: &F = &*(f as *const F);
1548 f(
1549 TextView::from_glib_borrow(this).unsafe_cast_ref(),
1550 from_glib(step),
1551 count,
1552 )
1553 }
1554 }
1555 unsafe {
1556 let f: Box_<F> = Box_::new(f);
1557 connect_raw(
1558 self.as_ptr() as *mut _,
1559 c"move-viewport".as_ptr(),
1560 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1561 move_viewport_trampoline::<Self, F> as *const (),
1562 )),
1563 Box_::into_raw(f),
1564 )
1565 }
1566 }
1567
1568 fn emit_move_viewport(&self, step: ScrollStep, count: i32) {
1569 self.emit_by_name::<()>("move-viewport", &[&step, &count]);
1570 }
1571
1572 #[doc(alias = "paste-clipboard")]
1573 fn connect_paste_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1574 unsafe extern "C" fn paste_clipboard_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1575 this: *mut ffi::GtkTextView,
1576 f: glib::ffi::gpointer,
1577 ) {
1578 unsafe {
1579 let f: &F = &*(f as *const F);
1580 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1581 }
1582 }
1583 unsafe {
1584 let f: Box_<F> = Box_::new(f);
1585 connect_raw(
1586 self.as_ptr() as *mut _,
1587 c"paste-clipboard".as_ptr(),
1588 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1589 paste_clipboard_trampoline::<Self, F> as *const (),
1590 )),
1591 Box_::into_raw(f),
1592 )
1593 }
1594 }
1595
1596 fn emit_paste_clipboard(&self) {
1597 self.emit_by_name::<()>("paste-clipboard", &[]);
1598 }
1599
1600 #[doc(alias = "preedit-changed")]
1601 fn connect_preedit_changed<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
1602 unsafe extern "C" fn preedit_changed_trampoline<
1603 P: IsA<TextView>,
1604 F: Fn(&P, &str) + 'static,
1605 >(
1606 this: *mut ffi::GtkTextView,
1607 preedit: *mut std::ffi::c_char,
1608 f: glib::ffi::gpointer,
1609 ) {
1610 unsafe {
1611 let f: &F = &*(f as *const F);
1612 f(
1613 TextView::from_glib_borrow(this).unsafe_cast_ref(),
1614 &glib::GString::from_glib_borrow(preedit),
1615 )
1616 }
1617 }
1618 unsafe {
1619 let f: Box_<F> = Box_::new(f);
1620 connect_raw(
1621 self.as_ptr() as *mut _,
1622 c"preedit-changed".as_ptr(),
1623 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1624 preedit_changed_trampoline::<Self, F> as *const (),
1625 )),
1626 Box_::into_raw(f),
1627 )
1628 }
1629 }
1630
1631 fn emit_preedit_changed(&self, preedit: &str) {
1632 self.emit_by_name::<()>("preedit-changed", &[&preedit]);
1633 }
1634
1635 #[doc(alias = "select-all")]
1636 fn connect_select_all<F: Fn(&Self, bool) + 'static>(&self, f: F) -> SignalHandlerId {
1637 unsafe extern "C" fn select_all_trampoline<P: IsA<TextView>, F: Fn(&P, bool) + 'static>(
1638 this: *mut ffi::GtkTextView,
1639 select: glib::ffi::gboolean,
1640 f: glib::ffi::gpointer,
1641 ) {
1642 unsafe {
1643 let f: &F = &*(f as *const F);
1644 f(
1645 TextView::from_glib_borrow(this).unsafe_cast_ref(),
1646 from_glib(select),
1647 )
1648 }
1649 }
1650 unsafe {
1651 let f: Box_<F> = Box_::new(f);
1652 connect_raw(
1653 self.as_ptr() as *mut _,
1654 c"select-all".as_ptr(),
1655 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1656 select_all_trampoline::<Self, F> as *const (),
1657 )),
1658 Box_::into_raw(f),
1659 )
1660 }
1661 }
1662
1663 fn emit_select_all(&self, select: bool) {
1664 self.emit_by_name::<()>("select-all", &[&select]);
1665 }
1666
1667 #[doc(alias = "set-anchor")]
1668 fn connect_set_anchor<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1669 unsafe extern "C" fn set_anchor_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1670 this: *mut ffi::GtkTextView,
1671 f: glib::ffi::gpointer,
1672 ) {
1673 unsafe {
1674 let f: &F = &*(f as *const F);
1675 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1676 }
1677 }
1678 unsafe {
1679 let f: Box_<F> = Box_::new(f);
1680 connect_raw(
1681 self.as_ptr() as *mut _,
1682 c"set-anchor".as_ptr(),
1683 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1684 set_anchor_trampoline::<Self, F> as *const (),
1685 )),
1686 Box_::into_raw(f),
1687 )
1688 }
1689 }
1690
1691 fn emit_set_anchor(&self) {
1692 self.emit_by_name::<()>("set-anchor", &[]);
1693 }
1694
1695 #[doc(alias = "toggle-cursor-visible")]
1696 fn connect_toggle_cursor_visible<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1697 unsafe extern "C" fn toggle_cursor_visible_trampoline<
1698 P: IsA<TextView>,
1699 F: Fn(&P) + 'static,
1700 >(
1701 this: *mut ffi::GtkTextView,
1702 f: glib::ffi::gpointer,
1703 ) {
1704 unsafe {
1705 let f: &F = &*(f as *const F);
1706 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1707 }
1708 }
1709 unsafe {
1710 let f: Box_<F> = Box_::new(f);
1711 connect_raw(
1712 self.as_ptr() as *mut _,
1713 c"toggle-cursor-visible".as_ptr(),
1714 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1715 toggle_cursor_visible_trampoline::<Self, F> as *const (),
1716 )),
1717 Box_::into_raw(f),
1718 )
1719 }
1720 }
1721
1722 fn emit_toggle_cursor_visible(&self) {
1723 self.emit_by_name::<()>("toggle-cursor-visible", &[]);
1724 }
1725
1726 #[doc(alias = "toggle-overwrite")]
1727 fn connect_toggle_overwrite<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1728 unsafe extern "C" fn toggle_overwrite_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1729 this: *mut ffi::GtkTextView,
1730 f: glib::ffi::gpointer,
1731 ) {
1732 unsafe {
1733 let f: &F = &*(f as *const F);
1734 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1735 }
1736 }
1737 unsafe {
1738 let f: Box_<F> = Box_::new(f);
1739 connect_raw(
1740 self.as_ptr() as *mut _,
1741 c"toggle-overwrite".as_ptr(),
1742 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1743 toggle_overwrite_trampoline::<Self, F> as *const (),
1744 )),
1745 Box_::into_raw(f),
1746 )
1747 }
1748 }
1749
1750 fn emit_toggle_overwrite(&self) {
1751 self.emit_by_name::<()>("toggle-overwrite", &[]);
1752 }
1753
1754 #[doc(alias = "accepts-tab")]
1755 fn connect_accepts_tab_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1756 unsafe extern "C" fn notify_accepts_tab_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 unsafe {
1765 let f: &F = &*(f as *const F);
1766 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1767 }
1768 }
1769 unsafe {
1770 let f: Box_<F> = Box_::new(f);
1771 connect_raw(
1772 self.as_ptr() as *mut _,
1773 c"notify::accepts-tab".as_ptr(),
1774 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1775 notify_accepts_tab_trampoline::<Self, F> as *const (),
1776 )),
1777 Box_::into_raw(f),
1778 )
1779 }
1780 }
1781
1782 #[doc(alias = "bottom-margin")]
1783 fn connect_bottom_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1784 unsafe extern "C" fn notify_bottom_margin_trampoline<
1785 P: IsA<TextView>,
1786 F: Fn(&P) + 'static,
1787 >(
1788 this: *mut ffi::GtkTextView,
1789 _param_spec: glib::ffi::gpointer,
1790 f: glib::ffi::gpointer,
1791 ) {
1792 unsafe {
1793 let f: &F = &*(f as *const F);
1794 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1795 }
1796 }
1797 unsafe {
1798 let f: Box_<F> = Box_::new(f);
1799 connect_raw(
1800 self.as_ptr() as *mut _,
1801 c"notify::bottom-margin".as_ptr(),
1802 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1803 notify_bottom_margin_trampoline::<Self, F> as *const (),
1804 )),
1805 Box_::into_raw(f),
1806 )
1807 }
1808 }
1809
1810 #[doc(alias = "buffer")]
1811 fn connect_buffer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1812 unsafe extern "C" fn notify_buffer_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1813 this: *mut ffi::GtkTextView,
1814 _param_spec: glib::ffi::gpointer,
1815 f: glib::ffi::gpointer,
1816 ) {
1817 unsafe {
1818 let f: &F = &*(f as *const F);
1819 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1820 }
1821 }
1822 unsafe {
1823 let f: Box_<F> = Box_::new(f);
1824 connect_raw(
1825 self.as_ptr() as *mut _,
1826 c"notify::buffer".as_ptr(),
1827 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1828 notify_buffer_trampoline::<Self, F> as *const (),
1829 )),
1830 Box_::into_raw(f),
1831 )
1832 }
1833 }
1834
1835 #[doc(alias = "cursor-visible")]
1836 fn connect_cursor_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1837 unsafe extern "C" fn notify_cursor_visible_trampoline<
1838 P: IsA<TextView>,
1839 F: Fn(&P) + 'static,
1840 >(
1841 this: *mut ffi::GtkTextView,
1842 _param_spec: glib::ffi::gpointer,
1843 f: glib::ffi::gpointer,
1844 ) {
1845 unsafe {
1846 let f: &F = &*(f as *const F);
1847 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1848 }
1849 }
1850 unsafe {
1851 let f: Box_<F> = Box_::new(f);
1852 connect_raw(
1853 self.as_ptr() as *mut _,
1854 c"notify::cursor-visible".as_ptr(),
1855 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1856 notify_cursor_visible_trampoline::<Self, F> as *const (),
1857 )),
1858 Box_::into_raw(f),
1859 )
1860 }
1861 }
1862
1863 #[doc(alias = "editable")]
1864 fn connect_editable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1865 unsafe extern "C" fn notify_editable_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1866 this: *mut ffi::GtkTextView,
1867 _param_spec: glib::ffi::gpointer,
1868 f: glib::ffi::gpointer,
1869 ) {
1870 unsafe {
1871 let f: &F = &*(f as *const F);
1872 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1873 }
1874 }
1875 unsafe {
1876 let f: Box_<F> = Box_::new(f);
1877 connect_raw(
1878 self.as_ptr() as *mut _,
1879 c"notify::editable".as_ptr(),
1880 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1881 notify_editable_trampoline::<Self, F> as *const (),
1882 )),
1883 Box_::into_raw(f),
1884 )
1885 }
1886 }
1887
1888 #[doc(alias = "extra-menu")]
1889 fn connect_extra_menu_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1890 unsafe extern "C" fn notify_extra_menu_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1891 this: *mut ffi::GtkTextView,
1892 _param_spec: glib::ffi::gpointer,
1893 f: glib::ffi::gpointer,
1894 ) {
1895 unsafe {
1896 let f: &F = &*(f as *const F);
1897 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1898 }
1899 }
1900 unsafe {
1901 let f: Box_<F> = Box_::new(f);
1902 connect_raw(
1903 self.as_ptr() as *mut _,
1904 c"notify::extra-menu".as_ptr(),
1905 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1906 notify_extra_menu_trampoline::<Self, F> as *const (),
1907 )),
1908 Box_::into_raw(f),
1909 )
1910 }
1911 }
1912
1913 #[doc(alias = "im-module")]
1914 fn connect_im_module_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1915 unsafe extern "C" fn notify_im_module_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1916 this: *mut ffi::GtkTextView,
1917 _param_spec: glib::ffi::gpointer,
1918 f: glib::ffi::gpointer,
1919 ) {
1920 unsafe {
1921 let f: &F = &*(f as *const F);
1922 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1923 }
1924 }
1925 unsafe {
1926 let f: Box_<F> = Box_::new(f);
1927 connect_raw(
1928 self.as_ptr() as *mut _,
1929 c"notify::im-module".as_ptr(),
1930 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1931 notify_im_module_trampoline::<Self, F> as *const (),
1932 )),
1933 Box_::into_raw(f),
1934 )
1935 }
1936 }
1937
1938 #[doc(alias = "indent")]
1939 fn connect_indent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1940 unsafe extern "C" fn notify_indent_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
1941 this: *mut ffi::GtkTextView,
1942 _param_spec: glib::ffi::gpointer,
1943 f: glib::ffi::gpointer,
1944 ) {
1945 unsafe {
1946 let f: &F = &*(f as *const F);
1947 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1948 }
1949 }
1950 unsafe {
1951 let f: Box_<F> = Box_::new(f);
1952 connect_raw(
1953 self.as_ptr() as *mut _,
1954 c"notify::indent".as_ptr(),
1955 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1956 notify_indent_trampoline::<Self, F> as *const (),
1957 )),
1958 Box_::into_raw(f),
1959 )
1960 }
1961 }
1962
1963 #[doc(alias = "input-hints")]
1964 fn connect_input_hints_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1965 unsafe extern "C" fn notify_input_hints_trampoline<
1966 P: IsA<TextView>,
1967 F: Fn(&P) + 'static,
1968 >(
1969 this: *mut ffi::GtkTextView,
1970 _param_spec: glib::ffi::gpointer,
1971 f: glib::ffi::gpointer,
1972 ) {
1973 unsafe {
1974 let f: &F = &*(f as *const F);
1975 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
1976 }
1977 }
1978 unsafe {
1979 let f: Box_<F> = Box_::new(f);
1980 connect_raw(
1981 self.as_ptr() as *mut _,
1982 c"notify::input-hints".as_ptr(),
1983 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1984 notify_input_hints_trampoline::<Self, F> as *const (),
1985 )),
1986 Box_::into_raw(f),
1987 )
1988 }
1989 }
1990
1991 #[doc(alias = "input-purpose")]
1992 fn connect_input_purpose_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1993 unsafe extern "C" fn notify_input_purpose_trampoline<
1994 P: IsA<TextView>,
1995 F: Fn(&P) + 'static,
1996 >(
1997 this: *mut ffi::GtkTextView,
1998 _param_spec: glib::ffi::gpointer,
1999 f: glib::ffi::gpointer,
2000 ) {
2001 unsafe {
2002 let f: &F = &*(f as *const F);
2003 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2004 }
2005 }
2006 unsafe {
2007 let f: Box_<F> = Box_::new(f);
2008 connect_raw(
2009 self.as_ptr() as *mut _,
2010 c"notify::input-purpose".as_ptr(),
2011 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2012 notify_input_purpose_trampoline::<Self, F> as *const (),
2013 )),
2014 Box_::into_raw(f),
2015 )
2016 }
2017 }
2018
2019 #[doc(alias = "justification")]
2020 fn connect_justification_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2021 unsafe extern "C" fn notify_justification_trampoline<
2022 P: IsA<TextView>,
2023 F: Fn(&P) + 'static,
2024 >(
2025 this: *mut ffi::GtkTextView,
2026 _param_spec: glib::ffi::gpointer,
2027 f: glib::ffi::gpointer,
2028 ) {
2029 unsafe {
2030 let f: &F = &*(f as *const F);
2031 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2032 }
2033 }
2034 unsafe {
2035 let f: Box_<F> = Box_::new(f);
2036 connect_raw(
2037 self.as_ptr() as *mut _,
2038 c"notify::justification".as_ptr(),
2039 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2040 notify_justification_trampoline::<Self, F> as *const (),
2041 )),
2042 Box_::into_raw(f),
2043 )
2044 }
2045 }
2046
2047 #[doc(alias = "left-margin")]
2048 fn connect_left_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2049 unsafe extern "C" fn notify_left_margin_trampoline<
2050 P: IsA<TextView>,
2051 F: Fn(&P) + 'static,
2052 >(
2053 this: *mut ffi::GtkTextView,
2054 _param_spec: glib::ffi::gpointer,
2055 f: glib::ffi::gpointer,
2056 ) {
2057 unsafe {
2058 let f: &F = &*(f as *const F);
2059 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2060 }
2061 }
2062 unsafe {
2063 let f: Box_<F> = Box_::new(f);
2064 connect_raw(
2065 self.as_ptr() as *mut _,
2066 c"notify::left-margin".as_ptr(),
2067 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2068 notify_left_margin_trampoline::<Self, F> as *const (),
2069 )),
2070 Box_::into_raw(f),
2071 )
2072 }
2073 }
2074
2075 #[doc(alias = "monospace")]
2076 fn connect_monospace_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2077 unsafe extern "C" fn notify_monospace_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2078 this: *mut ffi::GtkTextView,
2079 _param_spec: glib::ffi::gpointer,
2080 f: glib::ffi::gpointer,
2081 ) {
2082 unsafe {
2083 let f: &F = &*(f as *const F);
2084 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2085 }
2086 }
2087 unsafe {
2088 let f: Box_<F> = Box_::new(f);
2089 connect_raw(
2090 self.as_ptr() as *mut _,
2091 c"notify::monospace".as_ptr(),
2092 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2093 notify_monospace_trampoline::<Self, F> as *const (),
2094 )),
2095 Box_::into_raw(f),
2096 )
2097 }
2098 }
2099
2100 #[doc(alias = "overwrite")]
2101 fn connect_overwrite_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2102 unsafe extern "C" fn notify_overwrite_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2103 this: *mut ffi::GtkTextView,
2104 _param_spec: glib::ffi::gpointer,
2105 f: glib::ffi::gpointer,
2106 ) {
2107 unsafe {
2108 let f: &F = &*(f as *const F);
2109 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2110 }
2111 }
2112 unsafe {
2113 let f: Box_<F> = Box_::new(f);
2114 connect_raw(
2115 self.as_ptr() as *mut _,
2116 c"notify::overwrite".as_ptr(),
2117 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2118 notify_overwrite_trampoline::<Self, F> as *const (),
2119 )),
2120 Box_::into_raw(f),
2121 )
2122 }
2123 }
2124
2125 #[doc(alias = "pixels-above-lines")]
2126 fn connect_pixels_above_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2127 unsafe extern "C" fn notify_pixels_above_lines_trampoline<
2128 P: IsA<TextView>,
2129 F: Fn(&P) + 'static,
2130 >(
2131 this: *mut ffi::GtkTextView,
2132 _param_spec: glib::ffi::gpointer,
2133 f: glib::ffi::gpointer,
2134 ) {
2135 unsafe {
2136 let f: &F = &*(f as *const F);
2137 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2138 }
2139 }
2140 unsafe {
2141 let f: Box_<F> = Box_::new(f);
2142 connect_raw(
2143 self.as_ptr() as *mut _,
2144 c"notify::pixels-above-lines".as_ptr(),
2145 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2146 notify_pixels_above_lines_trampoline::<Self, F> as *const (),
2147 )),
2148 Box_::into_raw(f),
2149 )
2150 }
2151 }
2152
2153 #[doc(alias = "pixels-below-lines")]
2154 fn connect_pixels_below_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2155 unsafe extern "C" fn notify_pixels_below_lines_trampoline<
2156 P: IsA<TextView>,
2157 F: Fn(&P) + 'static,
2158 >(
2159 this: *mut ffi::GtkTextView,
2160 _param_spec: glib::ffi::gpointer,
2161 f: glib::ffi::gpointer,
2162 ) {
2163 unsafe {
2164 let f: &F = &*(f as *const F);
2165 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2166 }
2167 }
2168 unsafe {
2169 let f: Box_<F> = Box_::new(f);
2170 connect_raw(
2171 self.as_ptr() as *mut _,
2172 c"notify::pixels-below-lines".as_ptr(),
2173 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2174 notify_pixels_below_lines_trampoline::<Self, F> as *const (),
2175 )),
2176 Box_::into_raw(f),
2177 )
2178 }
2179 }
2180
2181 #[doc(alias = "pixels-inside-wrap")]
2182 fn connect_pixels_inside_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2183 unsafe extern "C" fn notify_pixels_inside_wrap_trampoline<
2184 P: IsA<TextView>,
2185 F: Fn(&P) + 'static,
2186 >(
2187 this: *mut ffi::GtkTextView,
2188 _param_spec: glib::ffi::gpointer,
2189 f: glib::ffi::gpointer,
2190 ) {
2191 unsafe {
2192 let f: &F = &*(f as *const F);
2193 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2194 }
2195 }
2196 unsafe {
2197 let f: Box_<F> = Box_::new(f);
2198 connect_raw(
2199 self.as_ptr() as *mut _,
2200 c"notify::pixels-inside-wrap".as_ptr(),
2201 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2202 notify_pixels_inside_wrap_trampoline::<Self, F> as *const (),
2203 )),
2204 Box_::into_raw(f),
2205 )
2206 }
2207 }
2208
2209 #[doc(alias = "right-margin")]
2210 fn connect_right_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2211 unsafe extern "C" fn notify_right_margin_trampoline<
2212 P: IsA<TextView>,
2213 F: Fn(&P) + 'static,
2214 >(
2215 this: *mut ffi::GtkTextView,
2216 _param_spec: glib::ffi::gpointer,
2217 f: glib::ffi::gpointer,
2218 ) {
2219 unsafe {
2220 let f: &F = &*(f as *const F);
2221 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2222 }
2223 }
2224 unsafe {
2225 let f: Box_<F> = Box_::new(f);
2226 connect_raw(
2227 self.as_ptr() as *mut _,
2228 c"notify::right-margin".as_ptr(),
2229 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2230 notify_right_margin_trampoline::<Self, F> as *const (),
2231 )),
2232 Box_::into_raw(f),
2233 )
2234 }
2235 }
2236
2237 #[doc(alias = "tabs")]
2238 fn connect_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2239 unsafe extern "C" fn notify_tabs_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2240 this: *mut ffi::GtkTextView,
2241 _param_spec: glib::ffi::gpointer,
2242 f: glib::ffi::gpointer,
2243 ) {
2244 unsafe {
2245 let f: &F = &*(f as *const F);
2246 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2247 }
2248 }
2249 unsafe {
2250 let f: Box_<F> = Box_::new(f);
2251 connect_raw(
2252 self.as_ptr() as *mut _,
2253 c"notify::tabs".as_ptr(),
2254 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2255 notify_tabs_trampoline::<Self, F> as *const (),
2256 )),
2257 Box_::into_raw(f),
2258 )
2259 }
2260 }
2261
2262 #[doc(alias = "top-margin")]
2263 fn connect_top_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2264 unsafe extern "C" fn notify_top_margin_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2265 this: *mut ffi::GtkTextView,
2266 _param_spec: glib::ffi::gpointer,
2267 f: glib::ffi::gpointer,
2268 ) {
2269 unsafe {
2270 let f: &F = &*(f as *const F);
2271 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2272 }
2273 }
2274 unsafe {
2275 let f: Box_<F> = Box_::new(f);
2276 connect_raw(
2277 self.as_ptr() as *mut _,
2278 c"notify::top-margin".as_ptr(),
2279 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2280 notify_top_margin_trampoline::<Self, F> as *const (),
2281 )),
2282 Box_::into_raw(f),
2283 )
2284 }
2285 }
2286
2287 #[doc(alias = "wrap-mode")]
2288 fn connect_wrap_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2289 unsafe extern "C" fn notify_wrap_mode_trampoline<P: IsA<TextView>, F: Fn(&P) + 'static>(
2290 this: *mut ffi::GtkTextView,
2291 _param_spec: glib::ffi::gpointer,
2292 f: glib::ffi::gpointer,
2293 ) {
2294 unsafe {
2295 let f: &F = &*(f as *const F);
2296 f(TextView::from_glib_borrow(this).unsafe_cast_ref())
2297 }
2298 }
2299 unsafe {
2300 let f: Box_<F> = Box_::new(f);
2301 connect_raw(
2302 self.as_ptr() as *mut _,
2303 c"notify::wrap-mode".as_ptr(),
2304 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2305 notify_wrap_mode_trampoline::<Self, F> as *const (),
2306 )),
2307 Box_::into_raw(f),
2308 )
2309 }
2310 }
2311}
2312
2313impl<O: IsA<TextView>> TextViewExt for O {}