1 // This file was generated by gir (https://github.com/gtk-rs/gir) 2 // from gir-files (https://github.com/gtk-rs/gir-files) 3 // DO NOT EDIT 4 5 use gdk; 6 use glib; 7 use glib::object::Cast; 8 use glib::object::IsA; 9 use glib::object::ObjectExt; 10 use glib::signal::connect_raw; 11 use glib::signal::SignalHandlerId; 12 use glib::translate::*; 13 use glib::GString; 14 use glib::StaticType; 15 use glib::ToValue; 16 use glib::Value; 17 use glib_sys; 18 use gobject_sys; 19 use gtk_sys; 20 use libc; 21 use pango; 22 #[cfg(any(feature = "v3_16", feature = "dox"))] 23 use signal::Inhibit; 24 use std::boxed::Box as Box_; 25 use std::fmt; 26 use std::mem; 27 use std::mem::transmute; 28 use Align; 29 use Buildable; 30 use Container; 31 use DeleteType; 32 use InputHints; 33 use InputPurpose; 34 use Justification; 35 use MovementStep; 36 use ResizeMode; 37 use ScrollStep; 38 use Scrollable; 39 use TextAttributes; 40 use TextBuffer; 41 use TextChildAnchor; 42 #[cfg(any(feature = "v3_16", feature = "dox"))] 43 use TextExtendSelection; 44 use TextIter; 45 use TextMark; 46 use TextWindowType; 47 use Widget; 48 use WrapMode; 49 50 glib_wrapper! { 51 pub struct TextView(Object<gtk_sys::GtkTextView, gtk_sys::GtkTextViewClass, TextViewClass>) @extends Container, Widget, @implements Buildable, Scrollable; 52 53 match fn { 54 get_type => || gtk_sys::gtk_text_view_get_type(), 55 } 56 } 57 58 impl TextView { new() -> TextView59 pub fn new() -> TextView { 60 assert_initialized_main_thread!(); 61 unsafe { Widget::from_glib_none(gtk_sys::gtk_text_view_new()).unsafe_cast() } 62 } 63 new_with_buffer<P: IsA<TextBuffer>>(buffer: &P) -> TextView64 pub fn new_with_buffer<P: IsA<TextBuffer>>(buffer: &P) -> TextView { 65 skip_assert_initialized!(); 66 unsafe { 67 Widget::from_glib_none(gtk_sys::gtk_text_view_new_with_buffer( 68 buffer.as_ref().to_glib_none().0, 69 )) 70 .unsafe_cast() 71 } 72 } 73 } 74 75 impl Default for TextView { default() -> Self76 fn default() -> Self { 77 Self::new() 78 } 79 } 80 81 pub struct TextViewBuilder { 82 accepts_tab: Option<bool>, 83 #[cfg(any(feature = "v3_18", feature = "dox"))] 84 bottom_margin: Option<i32>, 85 buffer: Option<TextBuffer>, 86 cursor_visible: Option<bool>, 87 editable: Option<bool>, 88 im_module: Option<String>, 89 indent: Option<i32>, 90 input_hints: Option<InputHints>, 91 input_purpose: Option<InputPurpose>, 92 justification: Option<Justification>, 93 left_margin: Option<i32>, 94 monospace: Option<bool>, 95 overwrite: Option<bool>, 96 pixels_above_lines: Option<i32>, 97 pixels_below_lines: Option<i32>, 98 pixels_inside_wrap: Option<i32>, 99 populate_all: Option<bool>, 100 right_margin: Option<i32>, 101 tabs: Option<pango::TabArray>, 102 #[cfg(any(feature = "v3_18", feature = "dox"))] 103 top_margin: Option<i32>, 104 wrap_mode: Option<WrapMode>, 105 border_width: Option<u32>, 106 child: Option<Widget>, 107 resize_mode: Option<ResizeMode>, 108 app_paintable: Option<bool>, 109 can_default: Option<bool>, 110 can_focus: Option<bool>, 111 events: Option<gdk::EventMask>, 112 expand: Option<bool>, 113 #[cfg(any(feature = "v3_20", feature = "dox"))] 114 focus_on_click: Option<bool>, 115 halign: Option<Align>, 116 has_default: Option<bool>, 117 has_focus: Option<bool>, 118 has_tooltip: Option<bool>, 119 height_request: Option<i32>, 120 hexpand: Option<bool>, 121 hexpand_set: Option<bool>, 122 is_focus: Option<bool>, 123 margin: Option<i32>, 124 margin_bottom: Option<i32>, 125 margin_end: Option<i32>, 126 margin_start: Option<i32>, 127 margin_top: Option<i32>, 128 name: Option<String>, 129 no_show_all: Option<bool>, 130 opacity: Option<f64>, 131 parent: Option<Container>, 132 receives_default: Option<bool>, 133 sensitive: Option<bool>, 134 //style: /*Unknown type*/, 135 tooltip_markup: Option<String>, 136 tooltip_text: Option<String>, 137 valign: Option<Align>, 138 vexpand: Option<bool>, 139 vexpand_set: Option<bool>, 140 visible: Option<bool>, 141 width_request: Option<i32>, 142 } 143 144 impl TextViewBuilder { new() -> Self145 pub fn new() -> Self { 146 Self { 147 accepts_tab: None, 148 #[cfg(any(feature = "v3_18", feature = "dox"))] 149 bottom_margin: None, 150 buffer: None, 151 cursor_visible: None, 152 editable: None, 153 im_module: None, 154 indent: None, 155 input_hints: None, 156 input_purpose: None, 157 justification: None, 158 left_margin: None, 159 monospace: None, 160 overwrite: None, 161 pixels_above_lines: None, 162 pixels_below_lines: None, 163 pixels_inside_wrap: None, 164 populate_all: None, 165 right_margin: None, 166 tabs: None, 167 #[cfg(any(feature = "v3_18", feature = "dox"))] 168 top_margin: None, 169 wrap_mode: None, 170 border_width: None, 171 child: None, 172 resize_mode: None, 173 app_paintable: None, 174 can_default: None, 175 can_focus: None, 176 events: None, 177 expand: None, 178 #[cfg(any(feature = "v3_20", feature = "dox"))] 179 focus_on_click: None, 180 halign: None, 181 has_default: None, 182 has_focus: None, 183 has_tooltip: None, 184 height_request: None, 185 hexpand: None, 186 hexpand_set: None, 187 is_focus: None, 188 margin: None, 189 margin_bottom: None, 190 margin_end: None, 191 margin_start: None, 192 margin_top: None, 193 name: None, 194 no_show_all: None, 195 opacity: None, 196 parent: None, 197 receives_default: None, 198 sensitive: None, 199 tooltip_markup: None, 200 tooltip_text: None, 201 valign: None, 202 vexpand: None, 203 vexpand_set: None, 204 visible: None, 205 width_request: None, 206 } 207 } 208 build(self) -> TextView209 pub fn build(self) -> TextView { 210 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 211 if let Some(ref accepts_tab) = self.accepts_tab { 212 properties.push(("accepts-tab", accepts_tab)); 213 } 214 #[cfg(any(feature = "v3_18", feature = "dox"))] 215 { 216 if let Some(ref bottom_margin) = self.bottom_margin { 217 properties.push(("bottom-margin", bottom_margin)); 218 } 219 } 220 if let Some(ref buffer) = self.buffer { 221 properties.push(("buffer", buffer)); 222 } 223 if let Some(ref cursor_visible) = self.cursor_visible { 224 properties.push(("cursor-visible", cursor_visible)); 225 } 226 if let Some(ref editable) = self.editable { 227 properties.push(("editable", editable)); 228 } 229 if let Some(ref im_module) = self.im_module { 230 properties.push(("im-module", im_module)); 231 } 232 if let Some(ref indent) = self.indent { 233 properties.push(("indent", indent)); 234 } 235 if let Some(ref input_hints) = self.input_hints { 236 properties.push(("input-hints", input_hints)); 237 } 238 if let Some(ref input_purpose) = self.input_purpose { 239 properties.push(("input-purpose", input_purpose)); 240 } 241 if let Some(ref justification) = self.justification { 242 properties.push(("justification", justification)); 243 } 244 if let Some(ref left_margin) = self.left_margin { 245 properties.push(("left-margin", left_margin)); 246 } 247 if let Some(ref monospace) = self.monospace { 248 properties.push(("monospace", monospace)); 249 } 250 if let Some(ref overwrite) = self.overwrite { 251 properties.push(("overwrite", overwrite)); 252 } 253 if let Some(ref pixels_above_lines) = self.pixels_above_lines { 254 properties.push(("pixels-above-lines", pixels_above_lines)); 255 } 256 if let Some(ref pixels_below_lines) = self.pixels_below_lines { 257 properties.push(("pixels-below-lines", pixels_below_lines)); 258 } 259 if let Some(ref pixels_inside_wrap) = self.pixels_inside_wrap { 260 properties.push(("pixels-inside-wrap", pixels_inside_wrap)); 261 } 262 if let Some(ref populate_all) = self.populate_all { 263 properties.push(("populate-all", populate_all)); 264 } 265 if let Some(ref right_margin) = self.right_margin { 266 properties.push(("right-margin", right_margin)); 267 } 268 if let Some(ref tabs) = self.tabs { 269 properties.push(("tabs", tabs)); 270 } 271 #[cfg(any(feature = "v3_18", feature = "dox"))] 272 { 273 if let Some(ref top_margin) = self.top_margin { 274 properties.push(("top-margin", top_margin)); 275 } 276 } 277 if let Some(ref wrap_mode) = self.wrap_mode { 278 properties.push(("wrap-mode", wrap_mode)); 279 } 280 if let Some(ref border_width) = self.border_width { 281 properties.push(("border-width", border_width)); 282 } 283 if let Some(ref child) = self.child { 284 properties.push(("child", child)); 285 } 286 if let Some(ref resize_mode) = self.resize_mode { 287 properties.push(("resize-mode", resize_mode)); 288 } 289 if let Some(ref app_paintable) = self.app_paintable { 290 properties.push(("app-paintable", app_paintable)); 291 } 292 if let Some(ref can_default) = self.can_default { 293 properties.push(("can-default", can_default)); 294 } 295 if let Some(ref can_focus) = self.can_focus { 296 properties.push(("can-focus", can_focus)); 297 } 298 if let Some(ref events) = self.events { 299 properties.push(("events", events)); 300 } 301 if let Some(ref expand) = self.expand { 302 properties.push(("expand", expand)); 303 } 304 #[cfg(any(feature = "v3_20", feature = "dox"))] 305 { 306 if let Some(ref focus_on_click) = self.focus_on_click { 307 properties.push(("focus-on-click", focus_on_click)); 308 } 309 } 310 if let Some(ref halign) = self.halign { 311 properties.push(("halign", halign)); 312 } 313 if let Some(ref has_default) = self.has_default { 314 properties.push(("has-default", has_default)); 315 } 316 if let Some(ref has_focus) = self.has_focus { 317 properties.push(("has-focus", has_focus)); 318 } 319 if let Some(ref has_tooltip) = self.has_tooltip { 320 properties.push(("has-tooltip", has_tooltip)); 321 } 322 if let Some(ref height_request) = self.height_request { 323 properties.push(("height-request", height_request)); 324 } 325 if let Some(ref hexpand) = self.hexpand { 326 properties.push(("hexpand", hexpand)); 327 } 328 if let Some(ref hexpand_set) = self.hexpand_set { 329 properties.push(("hexpand-set", hexpand_set)); 330 } 331 if let Some(ref is_focus) = self.is_focus { 332 properties.push(("is-focus", is_focus)); 333 } 334 if let Some(ref margin) = self.margin { 335 properties.push(("margin", margin)); 336 } 337 if let Some(ref margin_bottom) = self.margin_bottom { 338 properties.push(("margin-bottom", margin_bottom)); 339 } 340 if let Some(ref margin_end) = self.margin_end { 341 properties.push(("margin-end", margin_end)); 342 } 343 if let Some(ref margin_start) = self.margin_start { 344 properties.push(("margin-start", margin_start)); 345 } 346 if let Some(ref margin_top) = self.margin_top { 347 properties.push(("margin-top", margin_top)); 348 } 349 if let Some(ref name) = self.name { 350 properties.push(("name", name)); 351 } 352 if let Some(ref no_show_all) = self.no_show_all { 353 properties.push(("no-show-all", no_show_all)); 354 } 355 if let Some(ref opacity) = self.opacity { 356 properties.push(("opacity", opacity)); 357 } 358 if let Some(ref parent) = self.parent { 359 properties.push(("parent", parent)); 360 } 361 if let Some(ref receives_default) = self.receives_default { 362 properties.push(("receives-default", receives_default)); 363 } 364 if let Some(ref sensitive) = self.sensitive { 365 properties.push(("sensitive", sensitive)); 366 } 367 if let Some(ref tooltip_markup) = self.tooltip_markup { 368 properties.push(("tooltip-markup", tooltip_markup)); 369 } 370 if let Some(ref tooltip_text) = self.tooltip_text { 371 properties.push(("tooltip-text", tooltip_text)); 372 } 373 if let Some(ref valign) = self.valign { 374 properties.push(("valign", valign)); 375 } 376 if let Some(ref vexpand) = self.vexpand { 377 properties.push(("vexpand", vexpand)); 378 } 379 if let Some(ref vexpand_set) = self.vexpand_set { 380 properties.push(("vexpand-set", vexpand_set)); 381 } 382 if let Some(ref visible) = self.visible { 383 properties.push(("visible", visible)); 384 } 385 if let Some(ref width_request) = self.width_request { 386 properties.push(("width-request", width_request)); 387 } 388 glib::Object::new(TextView::static_type(), &properties) 389 .expect("object new") 390 .downcast() 391 .expect("downcast") 392 } 393 accepts_tab(mut self, accepts_tab: bool) -> Self394 pub fn accepts_tab(mut self, accepts_tab: bool) -> Self { 395 self.accepts_tab = Some(accepts_tab); 396 self 397 } 398 399 #[cfg(any(feature = "v3_18", feature = "dox"))] bottom_margin(mut self, bottom_margin: i32) -> Self400 pub fn bottom_margin(mut self, bottom_margin: i32) -> Self { 401 self.bottom_margin = Some(bottom_margin); 402 self 403 } 404 buffer(mut self, buffer: &TextBuffer) -> Self405 pub fn buffer(mut self, buffer: &TextBuffer) -> Self { 406 self.buffer = Some(buffer.clone()); 407 self 408 } 409 cursor_visible(mut self, cursor_visible: bool) -> Self410 pub fn cursor_visible(mut self, cursor_visible: bool) -> Self { 411 self.cursor_visible = Some(cursor_visible); 412 self 413 } 414 editable(mut self, editable: bool) -> Self415 pub fn editable(mut self, editable: bool) -> Self { 416 self.editable = Some(editable); 417 self 418 } 419 im_module(mut self, im_module: &str) -> Self420 pub fn im_module(mut self, im_module: &str) -> Self { 421 self.im_module = Some(im_module.to_string()); 422 self 423 } 424 indent(mut self, indent: i32) -> Self425 pub fn indent(mut self, indent: i32) -> Self { 426 self.indent = Some(indent); 427 self 428 } 429 input_hints(mut self, input_hints: InputHints) -> Self430 pub fn input_hints(mut self, input_hints: InputHints) -> Self { 431 self.input_hints = Some(input_hints); 432 self 433 } 434 input_purpose(mut self, input_purpose: InputPurpose) -> Self435 pub fn input_purpose(mut self, input_purpose: InputPurpose) -> Self { 436 self.input_purpose = Some(input_purpose); 437 self 438 } 439 justification(mut self, justification: Justification) -> Self440 pub fn justification(mut self, justification: Justification) -> Self { 441 self.justification = Some(justification); 442 self 443 } 444 left_margin(mut self, left_margin: i32) -> Self445 pub fn left_margin(mut self, left_margin: i32) -> Self { 446 self.left_margin = Some(left_margin); 447 self 448 } 449 monospace(mut self, monospace: bool) -> Self450 pub fn monospace(mut self, monospace: bool) -> Self { 451 self.monospace = Some(monospace); 452 self 453 } 454 overwrite(mut self, overwrite: bool) -> Self455 pub fn overwrite(mut self, overwrite: bool) -> Self { 456 self.overwrite = Some(overwrite); 457 self 458 } 459 pixels_above_lines(mut self, pixels_above_lines: i32) -> Self460 pub fn pixels_above_lines(mut self, pixels_above_lines: i32) -> Self { 461 self.pixels_above_lines = Some(pixels_above_lines); 462 self 463 } 464 pixels_below_lines(mut self, pixels_below_lines: i32) -> Self465 pub fn pixels_below_lines(mut self, pixels_below_lines: i32) -> Self { 466 self.pixels_below_lines = Some(pixels_below_lines); 467 self 468 } 469 pixels_inside_wrap(mut self, pixels_inside_wrap: i32) -> Self470 pub fn pixels_inside_wrap(mut self, pixels_inside_wrap: i32) -> Self { 471 self.pixels_inside_wrap = Some(pixels_inside_wrap); 472 self 473 } 474 populate_all(mut self, populate_all: bool) -> Self475 pub fn populate_all(mut self, populate_all: bool) -> Self { 476 self.populate_all = Some(populate_all); 477 self 478 } 479 right_margin(mut self, right_margin: i32) -> Self480 pub fn right_margin(mut self, right_margin: i32) -> Self { 481 self.right_margin = Some(right_margin); 482 self 483 } 484 tabs(mut self, tabs: &pango::TabArray) -> Self485 pub fn tabs(mut self, tabs: &pango::TabArray) -> Self { 486 self.tabs = Some(tabs.clone()); 487 self 488 } 489 490 #[cfg(any(feature = "v3_18", feature = "dox"))] top_margin(mut self, top_margin: i32) -> Self491 pub fn top_margin(mut self, top_margin: i32) -> Self { 492 self.top_margin = Some(top_margin); 493 self 494 } 495 wrap_mode(mut self, wrap_mode: WrapMode) -> Self496 pub fn wrap_mode(mut self, wrap_mode: WrapMode) -> Self { 497 self.wrap_mode = Some(wrap_mode); 498 self 499 } 500 border_width(mut self, border_width: u32) -> Self501 pub fn border_width(mut self, border_width: u32) -> Self { 502 self.border_width = Some(border_width); 503 self 504 } 505 child(mut self, child: &Widget) -> Self506 pub fn child(mut self, child: &Widget) -> Self { 507 self.child = Some(child.clone()); 508 self 509 } 510 resize_mode(mut self, resize_mode: ResizeMode) -> Self511 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 512 self.resize_mode = Some(resize_mode); 513 self 514 } 515 app_paintable(mut self, app_paintable: bool) -> Self516 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 517 self.app_paintable = Some(app_paintable); 518 self 519 } 520 can_default(mut self, can_default: bool) -> Self521 pub fn can_default(mut self, can_default: bool) -> Self { 522 self.can_default = Some(can_default); 523 self 524 } 525 can_focus(mut self, can_focus: bool) -> Self526 pub fn can_focus(mut self, can_focus: bool) -> Self { 527 self.can_focus = Some(can_focus); 528 self 529 } 530 events(mut self, events: gdk::EventMask) -> Self531 pub fn events(mut self, events: gdk::EventMask) -> Self { 532 self.events = Some(events); 533 self 534 } 535 expand(mut self, expand: bool) -> Self536 pub fn expand(mut self, expand: bool) -> Self { 537 self.expand = Some(expand); 538 self 539 } 540 541 #[cfg(any(feature = "v3_20", feature = "dox"))] focus_on_click(mut self, focus_on_click: bool) -> Self542 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 543 self.focus_on_click = Some(focus_on_click); 544 self 545 } 546 halign(mut self, halign: Align) -> Self547 pub fn halign(mut self, halign: Align) -> Self { 548 self.halign = Some(halign); 549 self 550 } 551 has_default(mut self, has_default: bool) -> Self552 pub fn has_default(mut self, has_default: bool) -> Self { 553 self.has_default = Some(has_default); 554 self 555 } 556 has_focus(mut self, has_focus: bool) -> Self557 pub fn has_focus(mut self, has_focus: bool) -> Self { 558 self.has_focus = Some(has_focus); 559 self 560 } 561 has_tooltip(mut self, has_tooltip: bool) -> Self562 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 563 self.has_tooltip = Some(has_tooltip); 564 self 565 } 566 height_request(mut self, height_request: i32) -> Self567 pub fn height_request(mut self, height_request: i32) -> Self { 568 self.height_request = Some(height_request); 569 self 570 } 571 hexpand(mut self, hexpand: bool) -> Self572 pub fn hexpand(mut self, hexpand: bool) -> Self { 573 self.hexpand = Some(hexpand); 574 self 575 } 576 hexpand_set(mut self, hexpand_set: bool) -> Self577 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 578 self.hexpand_set = Some(hexpand_set); 579 self 580 } 581 is_focus(mut self, is_focus: bool) -> Self582 pub fn is_focus(mut self, is_focus: bool) -> Self { 583 self.is_focus = Some(is_focus); 584 self 585 } 586 margin(mut self, margin: i32) -> Self587 pub fn margin(mut self, margin: i32) -> Self { 588 self.margin = Some(margin); 589 self 590 } 591 margin_bottom(mut self, margin_bottom: i32) -> Self592 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 593 self.margin_bottom = Some(margin_bottom); 594 self 595 } 596 margin_end(mut self, margin_end: i32) -> Self597 pub fn margin_end(mut self, margin_end: i32) -> Self { 598 self.margin_end = Some(margin_end); 599 self 600 } 601 margin_start(mut self, margin_start: i32) -> Self602 pub fn margin_start(mut self, margin_start: i32) -> Self { 603 self.margin_start = Some(margin_start); 604 self 605 } 606 margin_top(mut self, margin_top: i32) -> Self607 pub fn margin_top(mut self, margin_top: i32) -> Self { 608 self.margin_top = Some(margin_top); 609 self 610 } 611 name(mut self, name: &str) -> Self612 pub fn name(mut self, name: &str) -> Self { 613 self.name = Some(name.to_string()); 614 self 615 } 616 no_show_all(mut self, no_show_all: bool) -> Self617 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 618 self.no_show_all = Some(no_show_all); 619 self 620 } 621 opacity(mut self, opacity: f64) -> Self622 pub fn opacity(mut self, opacity: f64) -> Self { 623 self.opacity = Some(opacity); 624 self 625 } 626 parent(mut self, parent: &Container) -> Self627 pub fn parent(mut self, parent: &Container) -> Self { 628 self.parent = Some(parent.clone()); 629 self 630 } 631 receives_default(mut self, receives_default: bool) -> Self632 pub fn receives_default(mut self, receives_default: bool) -> Self { 633 self.receives_default = Some(receives_default); 634 self 635 } 636 sensitive(mut self, sensitive: bool) -> Self637 pub fn sensitive(mut self, sensitive: bool) -> Self { 638 self.sensitive = Some(sensitive); 639 self 640 } 641 tooltip_markup(mut self, tooltip_markup: &str) -> Self642 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 643 self.tooltip_markup = Some(tooltip_markup.to_string()); 644 self 645 } 646 tooltip_text(mut self, tooltip_text: &str) -> Self647 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 648 self.tooltip_text = Some(tooltip_text.to_string()); 649 self 650 } 651 valign(mut self, valign: Align) -> Self652 pub fn valign(mut self, valign: Align) -> Self { 653 self.valign = Some(valign); 654 self 655 } 656 vexpand(mut self, vexpand: bool) -> Self657 pub fn vexpand(mut self, vexpand: bool) -> Self { 658 self.vexpand = Some(vexpand); 659 self 660 } 661 vexpand_set(mut self, vexpand_set: bool) -> Self662 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 663 self.vexpand_set = Some(vexpand_set); 664 self 665 } 666 visible(mut self, visible: bool) -> Self667 pub fn visible(mut self, visible: bool) -> Self { 668 self.visible = Some(visible); 669 self 670 } 671 width_request(mut self, width_request: i32) -> Self672 pub fn width_request(mut self, width_request: i32) -> Self { 673 self.width_request = Some(width_request); 674 self 675 } 676 } 677 678 pub const NONE_TEXT_VIEW: Option<&TextView> = None; 679 680 pub trait TextViewExt: 'static { add_child_at_anchor<P: IsA<Widget>, Q: IsA<TextChildAnchor>>(&self, child: &P, anchor: &Q)681 fn add_child_at_anchor<P: IsA<Widget>, Q: IsA<TextChildAnchor>>(&self, child: &P, anchor: &Q); 682 add_child_in_window<P: IsA<Widget>>( &self, child: &P, which_window: TextWindowType, xpos: i32, ypos: i32, )683 fn add_child_in_window<P: IsA<Widget>>( 684 &self, 685 child: &P, 686 which_window: TextWindowType, 687 xpos: i32, 688 ypos: i32, 689 ); 690 backward_display_line(&self, iter: &mut TextIter) -> bool691 fn backward_display_line(&self, iter: &mut TextIter) -> bool; 692 backward_display_line_start(&self, iter: &mut TextIter) -> bool693 fn backward_display_line_start(&self, iter: &mut TextIter) -> bool; 694 buffer_to_window_coords( &self, win: TextWindowType, buffer_x: i32, buffer_y: i32, ) -> (i32, i32)695 fn buffer_to_window_coords( 696 &self, 697 win: TextWindowType, 698 buffer_x: i32, 699 buffer_y: i32, 700 ) -> (i32, i32); 701 forward_display_line(&self, iter: &mut TextIter) -> bool702 fn forward_display_line(&self, iter: &mut TextIter) -> bool; 703 forward_display_line_end(&self, iter: &mut TextIter) -> bool704 fn forward_display_line_end(&self, iter: &mut TextIter) -> bool; 705 get_accepts_tab(&self) -> bool706 fn get_accepts_tab(&self) -> bool; 707 get_border_window_size(&self, type_: TextWindowType) -> i32708 fn get_border_window_size(&self, type_: TextWindowType) -> i32; 709 710 #[cfg(any(feature = "v3_18", feature = "dox"))] get_bottom_margin(&self) -> i32711 fn get_bottom_margin(&self) -> i32; 712 get_buffer(&self) -> Option<TextBuffer>713 fn get_buffer(&self) -> Option<TextBuffer>; 714 get_cursor_locations(&self, iter: Option<&TextIter>) -> (gdk::Rectangle, gdk::Rectangle)715 fn get_cursor_locations(&self, iter: Option<&TextIter>) -> (gdk::Rectangle, gdk::Rectangle); 716 get_cursor_visible(&self) -> bool717 fn get_cursor_visible(&self) -> bool; 718 get_default_attributes(&self) -> TextAttributes719 fn get_default_attributes(&self) -> TextAttributes; 720 get_editable(&self) -> bool721 fn get_editable(&self) -> bool; 722 get_indent(&self) -> i32723 fn get_indent(&self) -> i32; 724 get_input_hints(&self) -> InputHints725 fn get_input_hints(&self) -> InputHints; 726 get_input_purpose(&self) -> InputPurpose727 fn get_input_purpose(&self) -> InputPurpose; 728 get_iter_at_location(&self, x: i32, y: i32) -> Option<TextIter>729 fn get_iter_at_location(&self, x: i32, y: i32) -> Option<TextIter>; 730 get_iter_at_position(&self, x: i32, y: i32) -> Option<(TextIter, i32)>731 fn get_iter_at_position(&self, x: i32, y: i32) -> Option<(TextIter, i32)>; 732 get_iter_location(&self, iter: &TextIter) -> gdk::Rectangle733 fn get_iter_location(&self, iter: &TextIter) -> gdk::Rectangle; 734 get_justification(&self) -> Justification735 fn get_justification(&self) -> Justification; 736 get_left_margin(&self) -> i32737 fn get_left_margin(&self) -> i32; 738 get_line_at_y(&self, y: i32) -> (TextIter, i32)739 fn get_line_at_y(&self, y: i32) -> (TextIter, i32); 740 get_line_yrange(&self, iter: &TextIter) -> (i32, i32)741 fn get_line_yrange(&self, iter: &TextIter) -> (i32, i32); 742 743 #[cfg(any(feature = "v3_16", feature = "dox"))] get_monospace(&self) -> bool744 fn get_monospace(&self) -> bool; 745 get_overwrite(&self) -> bool746 fn get_overwrite(&self) -> bool; 747 get_pixels_above_lines(&self) -> i32748 fn get_pixels_above_lines(&self) -> i32; 749 get_pixels_below_lines(&self) -> i32750 fn get_pixels_below_lines(&self) -> i32; 751 get_pixels_inside_wrap(&self) -> i32752 fn get_pixels_inside_wrap(&self) -> i32; 753 get_right_margin(&self) -> i32754 fn get_right_margin(&self) -> i32; 755 get_tabs(&self) -> Option<pango::TabArray>756 fn get_tabs(&self) -> Option<pango::TabArray>; 757 758 #[cfg(any(feature = "v3_18", feature = "dox"))] get_top_margin(&self) -> i32759 fn get_top_margin(&self) -> i32; 760 get_visible_rect(&self) -> gdk::Rectangle761 fn get_visible_rect(&self) -> gdk::Rectangle; 762 get_window(&self, win: TextWindowType) -> Option<gdk::Window>763 fn get_window(&self, win: TextWindowType) -> Option<gdk::Window>; 764 get_window_type<P: IsA<gdk::Window>>(&self, window: &P) -> TextWindowType765 fn get_window_type<P: IsA<gdk::Window>>(&self, window: &P) -> TextWindowType; 766 get_wrap_mode(&self) -> WrapMode767 fn get_wrap_mode(&self) -> WrapMode; 768 im_context_filter_keypress(&self, event: &gdk::EventKey) -> bool769 fn im_context_filter_keypress(&self, event: &gdk::EventKey) -> bool; 770 move_child<P: IsA<Widget>>(&self, child: &P, xpos: i32, ypos: i32)771 fn move_child<P: IsA<Widget>>(&self, child: &P, xpos: i32, ypos: i32); 772 move_mark_onscreen<P: IsA<TextMark>>(&self, mark: &P) -> bool773 fn move_mark_onscreen<P: IsA<TextMark>>(&self, mark: &P) -> bool; 774 move_visually(&self, iter: &mut TextIter, count: i32) -> bool775 fn move_visually(&self, iter: &mut TextIter, count: i32) -> bool; 776 place_cursor_onscreen(&self) -> bool777 fn place_cursor_onscreen(&self) -> bool; 778 779 #[cfg(any(feature = "v3_20", feature = "dox"))] reset_cursor_blink(&self)780 fn reset_cursor_blink(&self); 781 reset_im_context(&self)782 fn reset_im_context(&self); 783 scroll_mark_onscreen<P: IsA<TextMark>>(&self, mark: &P)784 fn scroll_mark_onscreen<P: IsA<TextMark>>(&self, mark: &P); 785 scroll_to_iter( &self, iter: &mut TextIter, within_margin: f64, use_align: bool, xalign: f64, yalign: f64, ) -> bool786 fn scroll_to_iter( 787 &self, 788 iter: &mut TextIter, 789 within_margin: f64, 790 use_align: bool, 791 xalign: f64, 792 yalign: f64, 793 ) -> bool; 794 scroll_to_mark<P: IsA<TextMark>>( &self, mark: &P, within_margin: f64, use_align: bool, xalign: f64, yalign: f64, )795 fn scroll_to_mark<P: IsA<TextMark>>( 796 &self, 797 mark: &P, 798 within_margin: f64, 799 use_align: bool, 800 xalign: f64, 801 yalign: f64, 802 ); 803 set_accepts_tab(&self, accepts_tab: bool)804 fn set_accepts_tab(&self, accepts_tab: bool); 805 set_border_window_size(&self, type_: TextWindowType, size: i32)806 fn set_border_window_size(&self, type_: TextWindowType, size: i32); 807 808 #[cfg(any(feature = "v3_18", feature = "dox"))] set_bottom_margin(&self, bottom_margin: i32)809 fn set_bottom_margin(&self, bottom_margin: i32); 810 set_buffer<P: IsA<TextBuffer>>(&self, buffer: Option<&P>)811 fn set_buffer<P: IsA<TextBuffer>>(&self, buffer: Option<&P>); 812 set_cursor_visible(&self, setting: bool)813 fn set_cursor_visible(&self, setting: bool); 814 set_editable(&self, setting: bool)815 fn set_editable(&self, setting: bool); 816 set_indent(&self, indent: i32)817 fn set_indent(&self, indent: i32); 818 set_input_hints(&self, hints: InputHints)819 fn set_input_hints(&self, hints: InputHints); 820 set_input_purpose(&self, purpose: InputPurpose)821 fn set_input_purpose(&self, purpose: InputPurpose); 822 set_justification(&self, justification: Justification)823 fn set_justification(&self, justification: Justification); 824 set_left_margin(&self, left_margin: i32)825 fn set_left_margin(&self, left_margin: i32); 826 827 #[cfg(any(feature = "v3_16", feature = "dox"))] set_monospace(&self, monospace: bool)828 fn set_monospace(&self, monospace: bool); 829 set_overwrite(&self, overwrite: bool)830 fn set_overwrite(&self, overwrite: bool); 831 set_pixels_above_lines(&self, pixels_above_lines: i32)832 fn set_pixels_above_lines(&self, pixels_above_lines: i32); 833 set_pixels_below_lines(&self, pixels_below_lines: i32)834 fn set_pixels_below_lines(&self, pixels_below_lines: i32); 835 set_pixels_inside_wrap(&self, pixels_inside_wrap: i32)836 fn set_pixels_inside_wrap(&self, pixels_inside_wrap: i32); 837 set_right_margin(&self, right_margin: i32)838 fn set_right_margin(&self, right_margin: i32); 839 set_tabs(&self, tabs: &pango::TabArray)840 fn set_tabs(&self, tabs: &pango::TabArray); 841 842 #[cfg(any(feature = "v3_18", feature = "dox"))] set_top_margin(&self, top_margin: i32)843 fn set_top_margin(&self, top_margin: i32); 844 set_wrap_mode(&self, wrap_mode: WrapMode)845 fn set_wrap_mode(&self, wrap_mode: WrapMode); 846 starts_display_line(&self, iter: &TextIter) -> bool847 fn starts_display_line(&self, iter: &TextIter) -> bool; 848 window_to_buffer_coords( &self, win: TextWindowType, window_x: i32, window_y: i32, ) -> (i32, i32)849 fn window_to_buffer_coords( 850 &self, 851 win: TextWindowType, 852 window_x: i32, 853 window_y: i32, 854 ) -> (i32, i32); 855 get_property_im_module(&self) -> Option<GString>856 fn get_property_im_module(&self) -> Option<GString>; 857 set_property_im_module(&self, im_module: Option<&str>)858 fn set_property_im_module(&self, im_module: Option<&str>); 859 get_property_monospace(&self) -> bool860 fn get_property_monospace(&self) -> bool; 861 set_property_monospace(&self, monospace: bool)862 fn set_property_monospace(&self, monospace: bool); 863 get_property_populate_all(&self) -> bool864 fn get_property_populate_all(&self) -> bool; 865 set_property_populate_all(&self, populate_all: bool)866 fn set_property_populate_all(&self, populate_all: bool); 867 connect_backspace<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId868 fn connect_backspace<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 869 emit_backspace(&self)870 fn emit_backspace(&self); 871 connect_copy_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId872 fn connect_copy_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 873 emit_copy_clipboard(&self)874 fn emit_copy_clipboard(&self); 875 connect_cut_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId876 fn connect_cut_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 877 emit_cut_clipboard(&self)878 fn emit_cut_clipboard(&self); 879 connect_delete_from_cursor<F: Fn(&Self, DeleteType, i32) + 'static>( &self, f: F, ) -> SignalHandlerId880 fn connect_delete_from_cursor<F: Fn(&Self, DeleteType, i32) + 'static>( 881 &self, 882 f: F, 883 ) -> SignalHandlerId; 884 emit_delete_from_cursor(&self, type_: DeleteType, count: i32)885 fn emit_delete_from_cursor(&self, type_: DeleteType, count: i32); 886 887 #[cfg(any(feature = "v3_16", feature = "dox"))] connect_extend_selection< F: Fn(&Self, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> Inhibit + 'static, >( &self, f: F, ) -> SignalHandlerId888 fn connect_extend_selection< 889 F: Fn(&Self, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> Inhibit + 'static, 890 >( 891 &self, 892 f: F, 893 ) -> SignalHandlerId; 894 connect_insert_at_cursor<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId895 fn connect_insert_at_cursor<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId; 896 emit_insert_at_cursor(&self, string: &str)897 fn emit_insert_at_cursor(&self, string: &str); 898 899 #[cfg(any(feature = "v3_22_26", feature = "dox"))] connect_insert_emoji<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId900 fn connect_insert_emoji<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 901 902 #[cfg(any(feature = "v3_22_26", feature = "dox"))] emit_insert_emoji(&self)903 fn emit_insert_emoji(&self); 904 connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>( &self, f: F, ) -> SignalHandlerId905 fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>( 906 &self, 907 f: F, 908 ) -> SignalHandlerId; 909 emit_move_cursor(&self, step: MovementStep, count: i32, extend_selection: bool)910 fn emit_move_cursor(&self, step: MovementStep, count: i32, extend_selection: bool); 911 connect_move_viewport<F: Fn(&Self, ScrollStep, i32) + 'static>( &self, f: F, ) -> SignalHandlerId912 fn connect_move_viewport<F: Fn(&Self, ScrollStep, i32) + 'static>( 913 &self, 914 f: F, 915 ) -> SignalHandlerId; 916 emit_move_viewport(&self, step: ScrollStep, count: i32)917 fn emit_move_viewport(&self, step: ScrollStep, count: i32); 918 connect_paste_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId919 fn connect_paste_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 920 emit_paste_clipboard(&self)921 fn emit_paste_clipboard(&self); 922 connect_populate_popup<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId923 fn connect_populate_popup<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId; 924 connect_preedit_changed<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId925 fn connect_preedit_changed<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId; 926 emit_preedit_changed(&self, preedit: &str)927 fn emit_preedit_changed(&self, preedit: &str); 928 connect_select_all<F: Fn(&Self, bool) + 'static>(&self, f: F) -> SignalHandlerId929 fn connect_select_all<F: Fn(&Self, bool) + 'static>(&self, f: F) -> SignalHandlerId; 930 emit_select_all(&self, select: bool)931 fn emit_select_all(&self, select: bool); 932 connect_set_anchor<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId933 fn connect_set_anchor<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 934 emit_set_anchor(&self)935 fn emit_set_anchor(&self); 936 connect_toggle_cursor_visible<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId937 fn connect_toggle_cursor_visible<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 938 emit_toggle_cursor_visible(&self)939 fn emit_toggle_cursor_visible(&self); 940 connect_toggle_overwrite<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId941 fn connect_toggle_overwrite<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 942 emit_toggle_overwrite(&self)943 fn emit_toggle_overwrite(&self); 944 connect_property_accepts_tab_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId945 fn connect_property_accepts_tab_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 946 947 #[cfg(any(feature = "v3_18", feature = "dox"))] connect_property_bottom_margin_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId948 fn connect_property_bottom_margin_notify<F: Fn(&Self) + 'static>( 949 &self, 950 f: F, 951 ) -> SignalHandlerId; 952 connect_property_buffer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId953 fn connect_property_buffer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 954 connect_property_cursor_visible_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId955 fn connect_property_cursor_visible_notify<F: Fn(&Self) + 'static>( 956 &self, 957 f: F, 958 ) -> SignalHandlerId; 959 connect_property_editable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId960 fn connect_property_editable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 961 connect_property_im_module_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId962 fn connect_property_im_module_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 963 connect_property_indent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId964 fn connect_property_indent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 965 connect_property_input_hints_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId966 fn connect_property_input_hints_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 967 connect_property_input_purpose_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId968 fn connect_property_input_purpose_notify<F: Fn(&Self) + 'static>( 969 &self, 970 f: F, 971 ) -> SignalHandlerId; 972 connect_property_justification_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId973 fn connect_property_justification_notify<F: Fn(&Self) + 'static>( 974 &self, 975 f: F, 976 ) -> SignalHandlerId; 977 connect_property_left_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId978 fn connect_property_left_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 979 connect_property_monospace_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId980 fn connect_property_monospace_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 981 connect_property_overwrite_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId982 fn connect_property_overwrite_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 983 connect_property_pixels_above_lines_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId984 fn connect_property_pixels_above_lines_notify<F: Fn(&Self) + 'static>( 985 &self, 986 f: F, 987 ) -> SignalHandlerId; 988 connect_property_pixels_below_lines_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId989 fn connect_property_pixels_below_lines_notify<F: Fn(&Self) + 'static>( 990 &self, 991 f: F, 992 ) -> SignalHandlerId; 993 connect_property_pixels_inside_wrap_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId994 fn connect_property_pixels_inside_wrap_notify<F: Fn(&Self) + 'static>( 995 &self, 996 f: F, 997 ) -> SignalHandlerId; 998 connect_property_populate_all_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId999 fn connect_property_populate_all_notify<F: Fn(&Self) + 'static>(&self, f: F) 1000 -> SignalHandlerId; 1001 connect_property_right_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1002 fn connect_property_right_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) 1003 -> SignalHandlerId; 1004 connect_property_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1005 fn connect_property_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 1006 1007 #[cfg(any(feature = "v3_18", feature = "dox"))] connect_property_top_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1008 fn connect_property_top_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 1009 connect_property_wrap_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1010 fn connect_property_wrap_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 1011 } 1012 1013 impl<O: IsA<TextView>> TextViewExt for O { add_child_at_anchor<P: IsA<Widget>, Q: IsA<TextChildAnchor>>(&self, child: &P, anchor: &Q)1014 fn add_child_at_anchor<P: IsA<Widget>, Q: IsA<TextChildAnchor>>(&self, child: &P, anchor: &Q) { 1015 unsafe { 1016 gtk_sys::gtk_text_view_add_child_at_anchor( 1017 self.as_ref().to_glib_none().0, 1018 child.as_ref().to_glib_none().0, 1019 anchor.as_ref().to_glib_none().0, 1020 ); 1021 } 1022 } 1023 add_child_in_window<P: IsA<Widget>>( &self, child: &P, which_window: TextWindowType, xpos: i32, ypos: i32, )1024 fn add_child_in_window<P: IsA<Widget>>( 1025 &self, 1026 child: &P, 1027 which_window: TextWindowType, 1028 xpos: i32, 1029 ypos: i32, 1030 ) { 1031 unsafe { 1032 gtk_sys::gtk_text_view_add_child_in_window( 1033 self.as_ref().to_glib_none().0, 1034 child.as_ref().to_glib_none().0, 1035 which_window.to_glib(), 1036 xpos, 1037 ypos, 1038 ); 1039 } 1040 } 1041 backward_display_line(&self, iter: &mut TextIter) -> bool1042 fn backward_display_line(&self, iter: &mut TextIter) -> bool { 1043 unsafe { 1044 from_glib(gtk_sys::gtk_text_view_backward_display_line( 1045 self.as_ref().to_glib_none().0, 1046 iter.to_glib_none_mut().0, 1047 )) 1048 } 1049 } 1050 backward_display_line_start(&self, iter: &mut TextIter) -> bool1051 fn backward_display_line_start(&self, iter: &mut TextIter) -> bool { 1052 unsafe { 1053 from_glib(gtk_sys::gtk_text_view_backward_display_line_start( 1054 self.as_ref().to_glib_none().0, 1055 iter.to_glib_none_mut().0, 1056 )) 1057 } 1058 } 1059 buffer_to_window_coords( &self, win: TextWindowType, buffer_x: i32, buffer_y: i32, ) -> (i32, i32)1060 fn buffer_to_window_coords( 1061 &self, 1062 win: TextWindowType, 1063 buffer_x: i32, 1064 buffer_y: i32, 1065 ) -> (i32, i32) { 1066 unsafe { 1067 let mut window_x = mem::uninitialized(); 1068 let mut window_y = mem::uninitialized(); 1069 gtk_sys::gtk_text_view_buffer_to_window_coords( 1070 self.as_ref().to_glib_none().0, 1071 win.to_glib(), 1072 buffer_x, 1073 buffer_y, 1074 &mut window_x, 1075 &mut window_y, 1076 ); 1077 (window_x, window_y) 1078 } 1079 } 1080 forward_display_line(&self, iter: &mut TextIter) -> bool1081 fn forward_display_line(&self, iter: &mut TextIter) -> bool { 1082 unsafe { 1083 from_glib(gtk_sys::gtk_text_view_forward_display_line( 1084 self.as_ref().to_glib_none().0, 1085 iter.to_glib_none_mut().0, 1086 )) 1087 } 1088 } 1089 forward_display_line_end(&self, iter: &mut TextIter) -> bool1090 fn forward_display_line_end(&self, iter: &mut TextIter) -> bool { 1091 unsafe { 1092 from_glib(gtk_sys::gtk_text_view_forward_display_line_end( 1093 self.as_ref().to_glib_none().0, 1094 iter.to_glib_none_mut().0, 1095 )) 1096 } 1097 } 1098 get_accepts_tab(&self) -> bool1099 fn get_accepts_tab(&self) -> bool { 1100 unsafe { 1101 from_glib(gtk_sys::gtk_text_view_get_accepts_tab( 1102 self.as_ref().to_glib_none().0, 1103 )) 1104 } 1105 } 1106 get_border_window_size(&self, type_: TextWindowType) -> i321107 fn get_border_window_size(&self, type_: TextWindowType) -> i32 { 1108 unsafe { 1109 gtk_sys::gtk_text_view_get_border_window_size( 1110 self.as_ref().to_glib_none().0, 1111 type_.to_glib(), 1112 ) 1113 } 1114 } 1115 1116 #[cfg(any(feature = "v3_18", feature = "dox"))] get_bottom_margin(&self) -> i321117 fn get_bottom_margin(&self) -> i32 { 1118 unsafe { gtk_sys::gtk_text_view_get_bottom_margin(self.as_ref().to_glib_none().0) } 1119 } 1120 get_buffer(&self) -> Option<TextBuffer>1121 fn get_buffer(&self) -> Option<TextBuffer> { 1122 unsafe { 1123 from_glib_none(gtk_sys::gtk_text_view_get_buffer( 1124 self.as_ref().to_glib_none().0, 1125 )) 1126 } 1127 } 1128 get_cursor_locations(&self, iter: Option<&TextIter>) -> (gdk::Rectangle, gdk::Rectangle)1129 fn get_cursor_locations(&self, iter: Option<&TextIter>) -> (gdk::Rectangle, gdk::Rectangle) { 1130 unsafe { 1131 let mut strong = gdk::Rectangle::uninitialized(); 1132 let mut weak = gdk::Rectangle::uninitialized(); 1133 gtk_sys::gtk_text_view_get_cursor_locations( 1134 self.as_ref().to_glib_none().0, 1135 iter.to_glib_none().0, 1136 strong.to_glib_none_mut().0, 1137 weak.to_glib_none_mut().0, 1138 ); 1139 (strong, weak) 1140 } 1141 } 1142 get_cursor_visible(&self) -> bool1143 fn get_cursor_visible(&self) -> bool { 1144 unsafe { 1145 from_glib(gtk_sys::gtk_text_view_get_cursor_visible( 1146 self.as_ref().to_glib_none().0, 1147 )) 1148 } 1149 } 1150 get_default_attributes(&self) -> TextAttributes1151 fn get_default_attributes(&self) -> TextAttributes { 1152 unsafe { 1153 from_glib_full(gtk_sys::gtk_text_view_get_default_attributes( 1154 self.as_ref().to_glib_none().0, 1155 )) 1156 } 1157 } 1158 get_editable(&self) -> bool1159 fn get_editable(&self) -> bool { 1160 unsafe { 1161 from_glib(gtk_sys::gtk_text_view_get_editable( 1162 self.as_ref().to_glib_none().0, 1163 )) 1164 } 1165 } 1166 get_indent(&self) -> i321167 fn get_indent(&self) -> i32 { 1168 unsafe { gtk_sys::gtk_text_view_get_indent(self.as_ref().to_glib_none().0) } 1169 } 1170 get_input_hints(&self) -> InputHints1171 fn get_input_hints(&self) -> InputHints { 1172 unsafe { 1173 from_glib(gtk_sys::gtk_text_view_get_input_hints( 1174 self.as_ref().to_glib_none().0, 1175 )) 1176 } 1177 } 1178 get_input_purpose(&self) -> InputPurpose1179 fn get_input_purpose(&self) -> InputPurpose { 1180 unsafe { 1181 from_glib(gtk_sys::gtk_text_view_get_input_purpose( 1182 self.as_ref().to_glib_none().0, 1183 )) 1184 } 1185 } 1186 get_iter_at_location(&self, x: i32, y: i32) -> Option<TextIter>1187 fn get_iter_at_location(&self, x: i32, y: i32) -> Option<TextIter> { 1188 unsafe { 1189 let mut iter = TextIter::uninitialized(); 1190 let ret = from_glib(gtk_sys::gtk_text_view_get_iter_at_location( 1191 self.as_ref().to_glib_none().0, 1192 iter.to_glib_none_mut().0, 1193 x, 1194 y, 1195 )); 1196 if ret { 1197 Some(iter) 1198 } else { 1199 None 1200 } 1201 } 1202 } 1203 get_iter_at_position(&self, x: i32, y: i32) -> Option<(TextIter, i32)>1204 fn get_iter_at_position(&self, x: i32, y: i32) -> Option<(TextIter, i32)> { 1205 unsafe { 1206 let mut iter = TextIter::uninitialized(); 1207 let mut trailing = mem::uninitialized(); 1208 let ret = from_glib(gtk_sys::gtk_text_view_get_iter_at_position( 1209 self.as_ref().to_glib_none().0, 1210 iter.to_glib_none_mut().0, 1211 &mut trailing, 1212 x, 1213 y, 1214 )); 1215 if ret { 1216 Some((iter, trailing)) 1217 } else { 1218 None 1219 } 1220 } 1221 } 1222 get_iter_location(&self, iter: &TextIter) -> gdk::Rectangle1223 fn get_iter_location(&self, iter: &TextIter) -> gdk::Rectangle { 1224 unsafe { 1225 let mut location = gdk::Rectangle::uninitialized(); 1226 gtk_sys::gtk_text_view_get_iter_location( 1227 self.as_ref().to_glib_none().0, 1228 iter.to_glib_none().0, 1229 location.to_glib_none_mut().0, 1230 ); 1231 location 1232 } 1233 } 1234 get_justification(&self) -> Justification1235 fn get_justification(&self) -> Justification { 1236 unsafe { 1237 from_glib(gtk_sys::gtk_text_view_get_justification( 1238 self.as_ref().to_glib_none().0, 1239 )) 1240 } 1241 } 1242 get_left_margin(&self) -> i321243 fn get_left_margin(&self) -> i32 { 1244 unsafe { gtk_sys::gtk_text_view_get_left_margin(self.as_ref().to_glib_none().0) } 1245 } 1246 get_line_at_y(&self, y: i32) -> (TextIter, i32)1247 fn get_line_at_y(&self, y: i32) -> (TextIter, i32) { 1248 unsafe { 1249 let mut target_iter = TextIter::uninitialized(); 1250 let mut line_top = mem::uninitialized(); 1251 gtk_sys::gtk_text_view_get_line_at_y( 1252 self.as_ref().to_glib_none().0, 1253 target_iter.to_glib_none_mut().0, 1254 y, 1255 &mut line_top, 1256 ); 1257 (target_iter, line_top) 1258 } 1259 } 1260 get_line_yrange(&self, iter: &TextIter) -> (i32, i32)1261 fn get_line_yrange(&self, iter: &TextIter) -> (i32, i32) { 1262 unsafe { 1263 let mut y = mem::uninitialized(); 1264 let mut height = mem::uninitialized(); 1265 gtk_sys::gtk_text_view_get_line_yrange( 1266 self.as_ref().to_glib_none().0, 1267 iter.to_glib_none().0, 1268 &mut y, 1269 &mut height, 1270 ); 1271 (y, height) 1272 } 1273 } 1274 1275 #[cfg(any(feature = "v3_16", feature = "dox"))] get_monospace(&self) -> bool1276 fn get_monospace(&self) -> bool { 1277 unsafe { 1278 from_glib(gtk_sys::gtk_text_view_get_monospace( 1279 self.as_ref().to_glib_none().0, 1280 )) 1281 } 1282 } 1283 get_overwrite(&self) -> bool1284 fn get_overwrite(&self) -> bool { 1285 unsafe { 1286 from_glib(gtk_sys::gtk_text_view_get_overwrite( 1287 self.as_ref().to_glib_none().0, 1288 )) 1289 } 1290 } 1291 get_pixels_above_lines(&self) -> i321292 fn get_pixels_above_lines(&self) -> i32 { 1293 unsafe { gtk_sys::gtk_text_view_get_pixels_above_lines(self.as_ref().to_glib_none().0) } 1294 } 1295 get_pixels_below_lines(&self) -> i321296 fn get_pixels_below_lines(&self) -> i32 { 1297 unsafe { gtk_sys::gtk_text_view_get_pixels_below_lines(self.as_ref().to_glib_none().0) } 1298 } 1299 get_pixels_inside_wrap(&self) -> i321300 fn get_pixels_inside_wrap(&self) -> i32 { 1301 unsafe { gtk_sys::gtk_text_view_get_pixels_inside_wrap(self.as_ref().to_glib_none().0) } 1302 } 1303 get_right_margin(&self) -> i321304 fn get_right_margin(&self) -> i32 { 1305 unsafe { gtk_sys::gtk_text_view_get_right_margin(self.as_ref().to_glib_none().0) } 1306 } 1307 get_tabs(&self) -> Option<pango::TabArray>1308 fn get_tabs(&self) -> Option<pango::TabArray> { 1309 unsafe { 1310 from_glib_full(gtk_sys::gtk_text_view_get_tabs( 1311 self.as_ref().to_glib_none().0, 1312 )) 1313 } 1314 } 1315 1316 #[cfg(any(feature = "v3_18", feature = "dox"))] get_top_margin(&self) -> i321317 fn get_top_margin(&self) -> i32 { 1318 unsafe { gtk_sys::gtk_text_view_get_top_margin(self.as_ref().to_glib_none().0) } 1319 } 1320 get_visible_rect(&self) -> gdk::Rectangle1321 fn get_visible_rect(&self) -> gdk::Rectangle { 1322 unsafe { 1323 let mut visible_rect = gdk::Rectangle::uninitialized(); 1324 gtk_sys::gtk_text_view_get_visible_rect( 1325 self.as_ref().to_glib_none().0, 1326 visible_rect.to_glib_none_mut().0, 1327 ); 1328 visible_rect 1329 } 1330 } 1331 get_window(&self, win: TextWindowType) -> Option<gdk::Window>1332 fn get_window(&self, win: TextWindowType) -> Option<gdk::Window> { 1333 unsafe { 1334 from_glib_none(gtk_sys::gtk_text_view_get_window( 1335 self.as_ref().to_glib_none().0, 1336 win.to_glib(), 1337 )) 1338 } 1339 } 1340 get_window_type<P: IsA<gdk::Window>>(&self, window: &P) -> TextWindowType1341 fn get_window_type<P: IsA<gdk::Window>>(&self, window: &P) -> TextWindowType { 1342 unsafe { 1343 from_glib(gtk_sys::gtk_text_view_get_window_type( 1344 self.as_ref().to_glib_none().0, 1345 window.as_ref().to_glib_none().0, 1346 )) 1347 } 1348 } 1349 get_wrap_mode(&self) -> WrapMode1350 fn get_wrap_mode(&self) -> WrapMode { 1351 unsafe { 1352 from_glib(gtk_sys::gtk_text_view_get_wrap_mode( 1353 self.as_ref().to_glib_none().0, 1354 )) 1355 } 1356 } 1357 im_context_filter_keypress(&self, event: &gdk::EventKey) -> bool1358 fn im_context_filter_keypress(&self, event: &gdk::EventKey) -> bool { 1359 unsafe { 1360 from_glib(gtk_sys::gtk_text_view_im_context_filter_keypress( 1361 self.as_ref().to_glib_none().0, 1362 mut_override(event.to_glib_none().0), 1363 )) 1364 } 1365 } 1366 move_child<P: IsA<Widget>>(&self, child: &P, xpos: i32, ypos: i32)1367 fn move_child<P: IsA<Widget>>(&self, child: &P, xpos: i32, ypos: i32) { 1368 unsafe { 1369 gtk_sys::gtk_text_view_move_child( 1370 self.as_ref().to_glib_none().0, 1371 child.as_ref().to_glib_none().0, 1372 xpos, 1373 ypos, 1374 ); 1375 } 1376 } 1377 move_mark_onscreen<P: IsA<TextMark>>(&self, mark: &P) -> bool1378 fn move_mark_onscreen<P: IsA<TextMark>>(&self, mark: &P) -> bool { 1379 unsafe { 1380 from_glib(gtk_sys::gtk_text_view_move_mark_onscreen( 1381 self.as_ref().to_glib_none().0, 1382 mark.as_ref().to_glib_none().0, 1383 )) 1384 } 1385 } 1386 move_visually(&self, iter: &mut TextIter, count: i32) -> bool1387 fn move_visually(&self, iter: &mut TextIter, count: i32) -> bool { 1388 unsafe { 1389 from_glib(gtk_sys::gtk_text_view_move_visually( 1390 self.as_ref().to_glib_none().0, 1391 iter.to_glib_none_mut().0, 1392 count, 1393 )) 1394 } 1395 } 1396 place_cursor_onscreen(&self) -> bool1397 fn place_cursor_onscreen(&self) -> bool { 1398 unsafe { 1399 from_glib(gtk_sys::gtk_text_view_place_cursor_onscreen( 1400 self.as_ref().to_glib_none().0, 1401 )) 1402 } 1403 } 1404 1405 #[cfg(any(feature = "v3_20", feature = "dox"))] reset_cursor_blink(&self)1406 fn reset_cursor_blink(&self) { 1407 unsafe { 1408 gtk_sys::gtk_text_view_reset_cursor_blink(self.as_ref().to_glib_none().0); 1409 } 1410 } 1411 reset_im_context(&self)1412 fn reset_im_context(&self) { 1413 unsafe { 1414 gtk_sys::gtk_text_view_reset_im_context(self.as_ref().to_glib_none().0); 1415 } 1416 } 1417 scroll_mark_onscreen<P: IsA<TextMark>>(&self, mark: &P)1418 fn scroll_mark_onscreen<P: IsA<TextMark>>(&self, mark: &P) { 1419 unsafe { 1420 gtk_sys::gtk_text_view_scroll_mark_onscreen( 1421 self.as_ref().to_glib_none().0, 1422 mark.as_ref().to_glib_none().0, 1423 ); 1424 } 1425 } 1426 scroll_to_iter( &self, iter: &mut TextIter, within_margin: f64, use_align: bool, xalign: f64, yalign: f64, ) -> bool1427 fn scroll_to_iter( 1428 &self, 1429 iter: &mut TextIter, 1430 within_margin: f64, 1431 use_align: bool, 1432 xalign: f64, 1433 yalign: f64, 1434 ) -> bool { 1435 unsafe { 1436 from_glib(gtk_sys::gtk_text_view_scroll_to_iter( 1437 self.as_ref().to_glib_none().0, 1438 iter.to_glib_none_mut().0, 1439 within_margin, 1440 use_align.to_glib(), 1441 xalign, 1442 yalign, 1443 )) 1444 } 1445 } 1446 scroll_to_mark<P: IsA<TextMark>>( &self, mark: &P, within_margin: f64, use_align: bool, xalign: f64, yalign: f64, )1447 fn scroll_to_mark<P: IsA<TextMark>>( 1448 &self, 1449 mark: &P, 1450 within_margin: f64, 1451 use_align: bool, 1452 xalign: f64, 1453 yalign: f64, 1454 ) { 1455 unsafe { 1456 gtk_sys::gtk_text_view_scroll_to_mark( 1457 self.as_ref().to_glib_none().0, 1458 mark.as_ref().to_glib_none().0, 1459 within_margin, 1460 use_align.to_glib(), 1461 xalign, 1462 yalign, 1463 ); 1464 } 1465 } 1466 set_accepts_tab(&self, accepts_tab: bool)1467 fn set_accepts_tab(&self, accepts_tab: bool) { 1468 unsafe { 1469 gtk_sys::gtk_text_view_set_accepts_tab( 1470 self.as_ref().to_glib_none().0, 1471 accepts_tab.to_glib(), 1472 ); 1473 } 1474 } 1475 set_border_window_size(&self, type_: TextWindowType, size: i32)1476 fn set_border_window_size(&self, type_: TextWindowType, size: i32) { 1477 unsafe { 1478 gtk_sys::gtk_text_view_set_border_window_size( 1479 self.as_ref().to_glib_none().0, 1480 type_.to_glib(), 1481 size, 1482 ); 1483 } 1484 } 1485 1486 #[cfg(any(feature = "v3_18", feature = "dox"))] set_bottom_margin(&self, bottom_margin: i32)1487 fn set_bottom_margin(&self, bottom_margin: i32) { 1488 unsafe { 1489 gtk_sys::gtk_text_view_set_bottom_margin(self.as_ref().to_glib_none().0, bottom_margin); 1490 } 1491 } 1492 set_buffer<P: IsA<TextBuffer>>(&self, buffer: Option<&P>)1493 fn set_buffer<P: IsA<TextBuffer>>(&self, buffer: Option<&P>) { 1494 unsafe { 1495 gtk_sys::gtk_text_view_set_buffer( 1496 self.as_ref().to_glib_none().0, 1497 buffer.map(|p| p.as_ref()).to_glib_none().0, 1498 ); 1499 } 1500 } 1501 set_cursor_visible(&self, setting: bool)1502 fn set_cursor_visible(&self, setting: bool) { 1503 unsafe { 1504 gtk_sys::gtk_text_view_set_cursor_visible( 1505 self.as_ref().to_glib_none().0, 1506 setting.to_glib(), 1507 ); 1508 } 1509 } 1510 set_editable(&self, setting: bool)1511 fn set_editable(&self, setting: bool) { 1512 unsafe { 1513 gtk_sys::gtk_text_view_set_editable(self.as_ref().to_glib_none().0, setting.to_glib()); 1514 } 1515 } 1516 set_indent(&self, indent: i32)1517 fn set_indent(&self, indent: i32) { 1518 unsafe { 1519 gtk_sys::gtk_text_view_set_indent(self.as_ref().to_glib_none().0, indent); 1520 } 1521 } 1522 set_input_hints(&self, hints: InputHints)1523 fn set_input_hints(&self, hints: InputHints) { 1524 unsafe { 1525 gtk_sys::gtk_text_view_set_input_hints(self.as_ref().to_glib_none().0, hints.to_glib()); 1526 } 1527 } 1528 set_input_purpose(&self, purpose: InputPurpose)1529 fn set_input_purpose(&self, purpose: InputPurpose) { 1530 unsafe { 1531 gtk_sys::gtk_text_view_set_input_purpose( 1532 self.as_ref().to_glib_none().0, 1533 purpose.to_glib(), 1534 ); 1535 } 1536 } 1537 set_justification(&self, justification: Justification)1538 fn set_justification(&self, justification: Justification) { 1539 unsafe { 1540 gtk_sys::gtk_text_view_set_justification( 1541 self.as_ref().to_glib_none().0, 1542 justification.to_glib(), 1543 ); 1544 } 1545 } 1546 set_left_margin(&self, left_margin: i32)1547 fn set_left_margin(&self, left_margin: i32) { 1548 unsafe { 1549 gtk_sys::gtk_text_view_set_left_margin(self.as_ref().to_glib_none().0, left_margin); 1550 } 1551 } 1552 1553 #[cfg(any(feature = "v3_16", feature = "dox"))] set_monospace(&self, monospace: bool)1554 fn set_monospace(&self, monospace: bool) { 1555 unsafe { 1556 gtk_sys::gtk_text_view_set_monospace( 1557 self.as_ref().to_glib_none().0, 1558 monospace.to_glib(), 1559 ); 1560 } 1561 } 1562 set_overwrite(&self, overwrite: bool)1563 fn set_overwrite(&self, overwrite: bool) { 1564 unsafe { 1565 gtk_sys::gtk_text_view_set_overwrite( 1566 self.as_ref().to_glib_none().0, 1567 overwrite.to_glib(), 1568 ); 1569 } 1570 } 1571 set_pixels_above_lines(&self, pixels_above_lines: i32)1572 fn set_pixels_above_lines(&self, pixels_above_lines: i32) { 1573 unsafe { 1574 gtk_sys::gtk_text_view_set_pixels_above_lines( 1575 self.as_ref().to_glib_none().0, 1576 pixels_above_lines, 1577 ); 1578 } 1579 } 1580 set_pixels_below_lines(&self, pixels_below_lines: i32)1581 fn set_pixels_below_lines(&self, pixels_below_lines: i32) { 1582 unsafe { 1583 gtk_sys::gtk_text_view_set_pixels_below_lines( 1584 self.as_ref().to_glib_none().0, 1585 pixels_below_lines, 1586 ); 1587 } 1588 } 1589 set_pixels_inside_wrap(&self, pixels_inside_wrap: i32)1590 fn set_pixels_inside_wrap(&self, pixels_inside_wrap: i32) { 1591 unsafe { 1592 gtk_sys::gtk_text_view_set_pixels_inside_wrap( 1593 self.as_ref().to_glib_none().0, 1594 pixels_inside_wrap, 1595 ); 1596 } 1597 } 1598 set_right_margin(&self, right_margin: i32)1599 fn set_right_margin(&self, right_margin: i32) { 1600 unsafe { 1601 gtk_sys::gtk_text_view_set_right_margin(self.as_ref().to_glib_none().0, right_margin); 1602 } 1603 } 1604 set_tabs(&self, tabs: &pango::TabArray)1605 fn set_tabs(&self, tabs: &pango::TabArray) { 1606 unsafe { 1607 gtk_sys::gtk_text_view_set_tabs( 1608 self.as_ref().to_glib_none().0, 1609 mut_override(tabs.to_glib_none().0), 1610 ); 1611 } 1612 } 1613 1614 #[cfg(any(feature = "v3_18", feature = "dox"))] set_top_margin(&self, top_margin: i32)1615 fn set_top_margin(&self, top_margin: i32) { 1616 unsafe { 1617 gtk_sys::gtk_text_view_set_top_margin(self.as_ref().to_glib_none().0, top_margin); 1618 } 1619 } 1620 set_wrap_mode(&self, wrap_mode: WrapMode)1621 fn set_wrap_mode(&self, wrap_mode: WrapMode) { 1622 unsafe { 1623 gtk_sys::gtk_text_view_set_wrap_mode( 1624 self.as_ref().to_glib_none().0, 1625 wrap_mode.to_glib(), 1626 ); 1627 } 1628 } 1629 starts_display_line(&self, iter: &TextIter) -> bool1630 fn starts_display_line(&self, iter: &TextIter) -> bool { 1631 unsafe { 1632 from_glib(gtk_sys::gtk_text_view_starts_display_line( 1633 self.as_ref().to_glib_none().0, 1634 iter.to_glib_none().0, 1635 )) 1636 } 1637 } 1638 window_to_buffer_coords( &self, win: TextWindowType, window_x: i32, window_y: i32, ) -> (i32, i32)1639 fn window_to_buffer_coords( 1640 &self, 1641 win: TextWindowType, 1642 window_x: i32, 1643 window_y: i32, 1644 ) -> (i32, i32) { 1645 unsafe { 1646 let mut buffer_x = mem::uninitialized(); 1647 let mut buffer_y = mem::uninitialized(); 1648 gtk_sys::gtk_text_view_window_to_buffer_coords( 1649 self.as_ref().to_glib_none().0, 1650 win.to_glib(), 1651 window_x, 1652 window_y, 1653 &mut buffer_x, 1654 &mut buffer_y, 1655 ); 1656 (buffer_x, buffer_y) 1657 } 1658 } 1659 get_property_im_module(&self) -> Option<GString>1660 fn get_property_im_module(&self) -> Option<GString> { 1661 unsafe { 1662 let mut value = Value::from_type(<GString as StaticType>::static_type()); 1663 gobject_sys::g_object_get_property( 1664 self.to_glib_none().0 as *mut gobject_sys::GObject, 1665 b"im-module\0".as_ptr() as *const _, 1666 value.to_glib_none_mut().0, 1667 ); 1668 value.get() 1669 } 1670 } 1671 set_property_im_module(&self, im_module: Option<&str>)1672 fn set_property_im_module(&self, im_module: Option<&str>) { 1673 unsafe { 1674 gobject_sys::g_object_set_property( 1675 self.to_glib_none().0 as *mut gobject_sys::GObject, 1676 b"im-module\0".as_ptr() as *const _, 1677 Value::from(im_module).to_glib_none().0, 1678 ); 1679 } 1680 } 1681 get_property_monospace(&self) -> bool1682 fn get_property_monospace(&self) -> bool { 1683 unsafe { 1684 let mut value = Value::from_type(<bool as StaticType>::static_type()); 1685 gobject_sys::g_object_get_property( 1686 self.to_glib_none().0 as *mut gobject_sys::GObject, 1687 b"monospace\0".as_ptr() as *const _, 1688 value.to_glib_none_mut().0, 1689 ); 1690 value.get().unwrap() 1691 } 1692 } 1693 set_property_monospace(&self, monospace: bool)1694 fn set_property_monospace(&self, monospace: bool) { 1695 unsafe { 1696 gobject_sys::g_object_set_property( 1697 self.to_glib_none().0 as *mut gobject_sys::GObject, 1698 b"monospace\0".as_ptr() as *const _, 1699 Value::from(&monospace).to_glib_none().0, 1700 ); 1701 } 1702 } 1703 get_property_populate_all(&self) -> bool1704 fn get_property_populate_all(&self) -> bool { 1705 unsafe { 1706 let mut value = Value::from_type(<bool as StaticType>::static_type()); 1707 gobject_sys::g_object_get_property( 1708 self.to_glib_none().0 as *mut gobject_sys::GObject, 1709 b"populate-all\0".as_ptr() as *const _, 1710 value.to_glib_none_mut().0, 1711 ); 1712 value.get().unwrap() 1713 } 1714 } 1715 set_property_populate_all(&self, populate_all: bool)1716 fn set_property_populate_all(&self, populate_all: bool) { 1717 unsafe { 1718 gobject_sys::g_object_set_property( 1719 self.to_glib_none().0 as *mut gobject_sys::GObject, 1720 b"populate-all\0".as_ptr() as *const _, 1721 Value::from(&populate_all).to_glib_none().0, 1722 ); 1723 } 1724 } 1725 connect_backspace<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1726 fn connect_backspace<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1727 unsafe extern "C" fn backspace_trampoline<P, F: Fn(&P) + 'static>( 1728 this: *mut gtk_sys::GtkTextView, 1729 f: glib_sys::gpointer, 1730 ) where 1731 P: IsA<TextView>, 1732 { 1733 let f: &F = &*(f as *const F); 1734 f(&TextView::from_glib_borrow(this).unsafe_cast()) 1735 } 1736 unsafe { 1737 let f: Box_<F> = Box_::new(f); 1738 connect_raw( 1739 self.as_ptr() as *mut _, 1740 b"backspace\0".as_ptr() as *const _, 1741 Some(transmute(backspace_trampoline::<Self, F> as usize)), 1742 Box_::into_raw(f), 1743 ) 1744 } 1745 } 1746 emit_backspace(&self)1747 fn emit_backspace(&self) { 1748 let _ = unsafe { 1749 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 1750 .emit("backspace", &[]) 1751 .unwrap() 1752 }; 1753 } 1754 connect_copy_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1755 fn connect_copy_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1756 unsafe extern "C" fn copy_clipboard_trampoline<P, F: Fn(&P) + 'static>( 1757 this: *mut gtk_sys::GtkTextView, 1758 f: glib_sys::gpointer, 1759 ) where 1760 P: IsA<TextView>, 1761 { 1762 let f: &F = &*(f as *const F); 1763 f(&TextView::from_glib_borrow(this).unsafe_cast()) 1764 } 1765 unsafe { 1766 let f: Box_<F> = Box_::new(f); 1767 connect_raw( 1768 self.as_ptr() as *mut _, 1769 b"copy-clipboard\0".as_ptr() as *const _, 1770 Some(transmute(copy_clipboard_trampoline::<Self, F> as usize)), 1771 Box_::into_raw(f), 1772 ) 1773 } 1774 } 1775 emit_copy_clipboard(&self)1776 fn emit_copy_clipboard(&self) { 1777 let _ = unsafe { 1778 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 1779 .emit("copy-clipboard", &[]) 1780 .unwrap() 1781 }; 1782 } 1783 connect_cut_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1784 fn connect_cut_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1785 unsafe extern "C" fn cut_clipboard_trampoline<P, F: Fn(&P) + 'static>( 1786 this: *mut gtk_sys::GtkTextView, 1787 f: glib_sys::gpointer, 1788 ) where 1789 P: IsA<TextView>, 1790 { 1791 let f: &F = &*(f as *const F); 1792 f(&TextView::from_glib_borrow(this).unsafe_cast()) 1793 } 1794 unsafe { 1795 let f: Box_<F> = Box_::new(f); 1796 connect_raw( 1797 self.as_ptr() as *mut _, 1798 b"cut-clipboard\0".as_ptr() as *const _, 1799 Some(transmute(cut_clipboard_trampoline::<Self, F> as usize)), 1800 Box_::into_raw(f), 1801 ) 1802 } 1803 } 1804 emit_cut_clipboard(&self)1805 fn emit_cut_clipboard(&self) { 1806 let _ = unsafe { 1807 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 1808 .emit("cut-clipboard", &[]) 1809 .unwrap() 1810 }; 1811 } 1812 connect_delete_from_cursor<F: Fn(&Self, DeleteType, i32) + 'static>( &self, f: F, ) -> SignalHandlerId1813 fn connect_delete_from_cursor<F: Fn(&Self, DeleteType, i32) + 'static>( 1814 &self, 1815 f: F, 1816 ) -> SignalHandlerId { 1817 unsafe extern "C" fn delete_from_cursor_trampoline< 1818 P, 1819 F: Fn(&P, DeleteType, i32) + 'static, 1820 >( 1821 this: *mut gtk_sys::GtkTextView, 1822 type_: gtk_sys::GtkDeleteType, 1823 count: libc::c_int, 1824 f: glib_sys::gpointer, 1825 ) where 1826 P: IsA<TextView>, 1827 { 1828 let f: &F = &*(f as *const F); 1829 f( 1830 &TextView::from_glib_borrow(this).unsafe_cast(), 1831 from_glib(type_), 1832 count, 1833 ) 1834 } 1835 unsafe { 1836 let f: Box_<F> = Box_::new(f); 1837 connect_raw( 1838 self.as_ptr() as *mut _, 1839 b"delete-from-cursor\0".as_ptr() as *const _, 1840 Some(transmute(delete_from_cursor_trampoline::<Self, F> as usize)), 1841 Box_::into_raw(f), 1842 ) 1843 } 1844 } 1845 emit_delete_from_cursor(&self, type_: DeleteType, count: i32)1846 fn emit_delete_from_cursor(&self, type_: DeleteType, count: i32) { 1847 let _ = unsafe { 1848 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 1849 .emit("delete-from-cursor", &[&type_, &count]) 1850 .unwrap() 1851 }; 1852 } 1853 1854 #[cfg(any(feature = "v3_16", feature = "dox"))] connect_extend_selection< F: Fn(&Self, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> Inhibit + 'static, >( &self, f: F, ) -> SignalHandlerId1855 fn connect_extend_selection< 1856 F: Fn(&Self, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> Inhibit + 'static, 1857 >( 1858 &self, 1859 f: F, 1860 ) -> SignalHandlerId { 1861 unsafe extern "C" fn extend_selection_trampoline< 1862 P, 1863 F: Fn(&P, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> Inhibit + 'static, 1864 >( 1865 this: *mut gtk_sys::GtkTextView, 1866 granularity: gtk_sys::GtkTextExtendSelection, 1867 location: *mut gtk_sys::GtkTextIter, 1868 start: *mut gtk_sys::GtkTextIter, 1869 end: *mut gtk_sys::GtkTextIter, 1870 f: glib_sys::gpointer, 1871 ) -> glib_sys::gboolean 1872 where 1873 P: IsA<TextView>, 1874 { 1875 let f: &F = &*(f as *const F); 1876 f( 1877 &TextView::from_glib_borrow(this).unsafe_cast(), 1878 from_glib(granularity), 1879 &from_glib_borrow(location), 1880 &from_glib_borrow(start), 1881 &from_glib_borrow(end), 1882 ) 1883 .to_glib() 1884 } 1885 unsafe { 1886 let f: Box_<F> = Box_::new(f); 1887 connect_raw( 1888 self.as_ptr() as *mut _, 1889 b"extend-selection\0".as_ptr() as *const _, 1890 Some(transmute(extend_selection_trampoline::<Self, F> as usize)), 1891 Box_::into_raw(f), 1892 ) 1893 } 1894 } 1895 connect_insert_at_cursor<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId1896 fn connect_insert_at_cursor<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId { 1897 unsafe extern "C" fn insert_at_cursor_trampoline<P, F: Fn(&P, &str) + 'static>( 1898 this: *mut gtk_sys::GtkTextView, 1899 string: *mut libc::c_char, 1900 f: glib_sys::gpointer, 1901 ) where 1902 P: IsA<TextView>, 1903 { 1904 let f: &F = &*(f as *const F); 1905 f( 1906 &TextView::from_glib_borrow(this).unsafe_cast(), 1907 &GString::from_glib_borrow(string), 1908 ) 1909 } 1910 unsafe { 1911 let f: Box_<F> = Box_::new(f); 1912 connect_raw( 1913 self.as_ptr() as *mut _, 1914 b"insert-at-cursor\0".as_ptr() as *const _, 1915 Some(transmute(insert_at_cursor_trampoline::<Self, F> as usize)), 1916 Box_::into_raw(f), 1917 ) 1918 } 1919 } 1920 emit_insert_at_cursor(&self, string: &str)1921 fn emit_insert_at_cursor(&self, string: &str) { 1922 let _ = unsafe { 1923 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 1924 .emit("insert-at-cursor", &[&string]) 1925 .unwrap() 1926 }; 1927 } 1928 1929 #[cfg(any(feature = "v3_22_26", feature = "dox"))] connect_insert_emoji<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1930 fn connect_insert_emoji<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1931 unsafe extern "C" fn insert_emoji_trampoline<P, F: Fn(&P) + 'static>( 1932 this: *mut gtk_sys::GtkTextView, 1933 f: glib_sys::gpointer, 1934 ) where 1935 P: IsA<TextView>, 1936 { 1937 let f: &F = &*(f as *const F); 1938 f(&TextView::from_glib_borrow(this).unsafe_cast()) 1939 } 1940 unsafe { 1941 let f: Box_<F> = Box_::new(f); 1942 connect_raw( 1943 self.as_ptr() as *mut _, 1944 b"insert-emoji\0".as_ptr() as *const _, 1945 Some(transmute(insert_emoji_trampoline::<Self, F> as usize)), 1946 Box_::into_raw(f), 1947 ) 1948 } 1949 } 1950 1951 #[cfg(any(feature = "v3_22_26", feature = "dox"))] emit_insert_emoji(&self)1952 fn emit_insert_emoji(&self) { 1953 let _ = unsafe { 1954 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 1955 .emit("insert-emoji", &[]) 1956 .unwrap() 1957 }; 1958 } 1959 connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>( &self, f: F, ) -> SignalHandlerId1960 fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>( 1961 &self, 1962 f: F, 1963 ) -> SignalHandlerId { 1964 unsafe extern "C" fn move_cursor_trampoline< 1965 P, 1966 F: Fn(&P, MovementStep, i32, bool) + 'static, 1967 >( 1968 this: *mut gtk_sys::GtkTextView, 1969 step: gtk_sys::GtkMovementStep, 1970 count: libc::c_int, 1971 extend_selection: glib_sys::gboolean, 1972 f: glib_sys::gpointer, 1973 ) where 1974 P: IsA<TextView>, 1975 { 1976 let f: &F = &*(f as *const F); 1977 f( 1978 &TextView::from_glib_borrow(this).unsafe_cast(), 1979 from_glib(step), 1980 count, 1981 from_glib(extend_selection), 1982 ) 1983 } 1984 unsafe { 1985 let f: Box_<F> = Box_::new(f); 1986 connect_raw( 1987 self.as_ptr() as *mut _, 1988 b"move-cursor\0".as_ptr() as *const _, 1989 Some(transmute(move_cursor_trampoline::<Self, F> as usize)), 1990 Box_::into_raw(f), 1991 ) 1992 } 1993 } 1994 emit_move_cursor(&self, step: MovementStep, count: i32, extend_selection: bool)1995 fn emit_move_cursor(&self, step: MovementStep, count: i32, extend_selection: bool) { 1996 let _ = unsafe { 1997 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 1998 .emit("move-cursor", &[&step, &count, &extend_selection]) 1999 .unwrap() 2000 }; 2001 } 2002 connect_move_viewport<F: Fn(&Self, ScrollStep, i32) + 'static>( &self, f: F, ) -> SignalHandlerId2003 fn connect_move_viewport<F: Fn(&Self, ScrollStep, i32) + 'static>( 2004 &self, 2005 f: F, 2006 ) -> SignalHandlerId { 2007 unsafe extern "C" fn move_viewport_trampoline<P, F: Fn(&P, ScrollStep, i32) + 'static>( 2008 this: *mut gtk_sys::GtkTextView, 2009 step: gtk_sys::GtkScrollStep, 2010 count: libc::c_int, 2011 f: glib_sys::gpointer, 2012 ) where 2013 P: IsA<TextView>, 2014 { 2015 let f: &F = &*(f as *const F); 2016 f( 2017 &TextView::from_glib_borrow(this).unsafe_cast(), 2018 from_glib(step), 2019 count, 2020 ) 2021 } 2022 unsafe { 2023 let f: Box_<F> = Box_::new(f); 2024 connect_raw( 2025 self.as_ptr() as *mut _, 2026 b"move-viewport\0".as_ptr() as *const _, 2027 Some(transmute(move_viewport_trampoline::<Self, F> as usize)), 2028 Box_::into_raw(f), 2029 ) 2030 } 2031 } 2032 emit_move_viewport(&self, step: ScrollStep, count: i32)2033 fn emit_move_viewport(&self, step: ScrollStep, count: i32) { 2034 let _ = unsafe { 2035 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 2036 .emit("move-viewport", &[&step, &count]) 2037 .unwrap() 2038 }; 2039 } 2040 connect_paste_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2041 fn connect_paste_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 2042 unsafe extern "C" fn paste_clipboard_trampoline<P, F: Fn(&P) + 'static>( 2043 this: *mut gtk_sys::GtkTextView, 2044 f: glib_sys::gpointer, 2045 ) where 2046 P: IsA<TextView>, 2047 { 2048 let f: &F = &*(f as *const F); 2049 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2050 } 2051 unsafe { 2052 let f: Box_<F> = Box_::new(f); 2053 connect_raw( 2054 self.as_ptr() as *mut _, 2055 b"paste-clipboard\0".as_ptr() as *const _, 2056 Some(transmute(paste_clipboard_trampoline::<Self, F> as usize)), 2057 Box_::into_raw(f), 2058 ) 2059 } 2060 } 2061 emit_paste_clipboard(&self)2062 fn emit_paste_clipboard(&self) { 2063 let _ = unsafe { 2064 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 2065 .emit("paste-clipboard", &[]) 2066 .unwrap() 2067 }; 2068 } 2069 connect_populate_popup<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId2070 fn connect_populate_popup<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId { 2071 unsafe extern "C" fn populate_popup_trampoline<P, F: Fn(&P, &Widget) + 'static>( 2072 this: *mut gtk_sys::GtkTextView, 2073 popup: *mut gtk_sys::GtkWidget, 2074 f: glib_sys::gpointer, 2075 ) where 2076 P: IsA<TextView>, 2077 { 2078 let f: &F = &*(f as *const F); 2079 f( 2080 &TextView::from_glib_borrow(this).unsafe_cast(), 2081 &from_glib_borrow(popup), 2082 ) 2083 } 2084 unsafe { 2085 let f: Box_<F> = Box_::new(f); 2086 connect_raw( 2087 self.as_ptr() as *mut _, 2088 b"populate-popup\0".as_ptr() as *const _, 2089 Some(transmute(populate_popup_trampoline::<Self, F> as usize)), 2090 Box_::into_raw(f), 2091 ) 2092 } 2093 } 2094 connect_preedit_changed<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId2095 fn connect_preedit_changed<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId { 2096 unsafe extern "C" fn preedit_changed_trampoline<P, F: Fn(&P, &str) + 'static>( 2097 this: *mut gtk_sys::GtkTextView, 2098 preedit: *mut libc::c_char, 2099 f: glib_sys::gpointer, 2100 ) where 2101 P: IsA<TextView>, 2102 { 2103 let f: &F = &*(f as *const F); 2104 f( 2105 &TextView::from_glib_borrow(this).unsafe_cast(), 2106 &GString::from_glib_borrow(preedit), 2107 ) 2108 } 2109 unsafe { 2110 let f: Box_<F> = Box_::new(f); 2111 connect_raw( 2112 self.as_ptr() as *mut _, 2113 b"preedit-changed\0".as_ptr() as *const _, 2114 Some(transmute(preedit_changed_trampoline::<Self, F> as usize)), 2115 Box_::into_raw(f), 2116 ) 2117 } 2118 } 2119 emit_preedit_changed(&self, preedit: &str)2120 fn emit_preedit_changed(&self, preedit: &str) { 2121 let _ = unsafe { 2122 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 2123 .emit("preedit-changed", &[&preedit]) 2124 .unwrap() 2125 }; 2126 } 2127 connect_select_all<F: Fn(&Self, bool) + 'static>(&self, f: F) -> SignalHandlerId2128 fn connect_select_all<F: Fn(&Self, bool) + 'static>(&self, f: F) -> SignalHandlerId { 2129 unsafe extern "C" fn select_all_trampoline<P, F: Fn(&P, bool) + 'static>( 2130 this: *mut gtk_sys::GtkTextView, 2131 select: glib_sys::gboolean, 2132 f: glib_sys::gpointer, 2133 ) where 2134 P: IsA<TextView>, 2135 { 2136 let f: &F = &*(f as *const F); 2137 f( 2138 &TextView::from_glib_borrow(this).unsafe_cast(), 2139 from_glib(select), 2140 ) 2141 } 2142 unsafe { 2143 let f: Box_<F> = Box_::new(f); 2144 connect_raw( 2145 self.as_ptr() as *mut _, 2146 b"select-all\0".as_ptr() as *const _, 2147 Some(transmute(select_all_trampoline::<Self, F> as usize)), 2148 Box_::into_raw(f), 2149 ) 2150 } 2151 } 2152 emit_select_all(&self, select: bool)2153 fn emit_select_all(&self, select: bool) { 2154 let _ = unsafe { 2155 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 2156 .emit("select-all", &[&select]) 2157 .unwrap() 2158 }; 2159 } 2160 connect_set_anchor<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2161 fn connect_set_anchor<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 2162 unsafe extern "C" fn set_anchor_trampoline<P, F: Fn(&P) + 'static>( 2163 this: *mut gtk_sys::GtkTextView, 2164 f: glib_sys::gpointer, 2165 ) where 2166 P: IsA<TextView>, 2167 { 2168 let f: &F = &*(f as *const F); 2169 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2170 } 2171 unsafe { 2172 let f: Box_<F> = Box_::new(f); 2173 connect_raw( 2174 self.as_ptr() as *mut _, 2175 b"set-anchor\0".as_ptr() as *const _, 2176 Some(transmute(set_anchor_trampoline::<Self, F> as usize)), 2177 Box_::into_raw(f), 2178 ) 2179 } 2180 } 2181 emit_set_anchor(&self)2182 fn emit_set_anchor(&self) { 2183 let _ = unsafe { 2184 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 2185 .emit("set-anchor", &[]) 2186 .unwrap() 2187 }; 2188 } 2189 connect_toggle_cursor_visible<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2190 fn connect_toggle_cursor_visible<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 2191 unsafe extern "C" fn toggle_cursor_visible_trampoline<P, F: Fn(&P) + 'static>( 2192 this: *mut gtk_sys::GtkTextView, 2193 f: glib_sys::gpointer, 2194 ) where 2195 P: IsA<TextView>, 2196 { 2197 let f: &F = &*(f as *const F); 2198 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2199 } 2200 unsafe { 2201 let f: Box_<F> = Box_::new(f); 2202 connect_raw( 2203 self.as_ptr() as *mut _, 2204 b"toggle-cursor-visible\0".as_ptr() as *const _, 2205 Some(transmute( 2206 toggle_cursor_visible_trampoline::<Self, F> as usize, 2207 )), 2208 Box_::into_raw(f), 2209 ) 2210 } 2211 } 2212 emit_toggle_cursor_visible(&self)2213 fn emit_toggle_cursor_visible(&self) { 2214 let _ = unsafe { 2215 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 2216 .emit("toggle-cursor-visible", &[]) 2217 .unwrap() 2218 }; 2219 } 2220 connect_toggle_overwrite<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2221 fn connect_toggle_overwrite<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 2222 unsafe extern "C" fn toggle_overwrite_trampoline<P, F: Fn(&P) + 'static>( 2223 this: *mut gtk_sys::GtkTextView, 2224 f: glib_sys::gpointer, 2225 ) where 2226 P: IsA<TextView>, 2227 { 2228 let f: &F = &*(f as *const F); 2229 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2230 } 2231 unsafe { 2232 let f: Box_<F> = Box_::new(f); 2233 connect_raw( 2234 self.as_ptr() as *mut _, 2235 b"toggle-overwrite\0".as_ptr() as *const _, 2236 Some(transmute(toggle_overwrite_trampoline::<Self, F> as usize)), 2237 Box_::into_raw(f), 2238 ) 2239 } 2240 } 2241 emit_toggle_overwrite(&self)2242 fn emit_toggle_overwrite(&self) { 2243 let _ = unsafe { 2244 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 2245 .emit("toggle-overwrite", &[]) 2246 .unwrap() 2247 }; 2248 } 2249 connect_property_accepts_tab_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2250 fn connect_property_accepts_tab_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 2251 unsafe extern "C" fn notify_accepts_tab_trampoline<P, F: Fn(&P) + 'static>( 2252 this: *mut gtk_sys::GtkTextView, 2253 _param_spec: glib_sys::gpointer, 2254 f: glib_sys::gpointer, 2255 ) where 2256 P: IsA<TextView>, 2257 { 2258 let f: &F = &*(f as *const F); 2259 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2260 } 2261 unsafe { 2262 let f: Box_<F> = Box_::new(f); 2263 connect_raw( 2264 self.as_ptr() as *mut _, 2265 b"notify::accepts-tab\0".as_ptr() as *const _, 2266 Some(transmute(notify_accepts_tab_trampoline::<Self, F> as usize)), 2267 Box_::into_raw(f), 2268 ) 2269 } 2270 } 2271 2272 #[cfg(any(feature = "v3_18", feature = "dox"))] connect_property_bottom_margin_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId2273 fn connect_property_bottom_margin_notify<F: Fn(&Self) + 'static>( 2274 &self, 2275 f: F, 2276 ) -> SignalHandlerId { 2277 unsafe extern "C" fn notify_bottom_margin_trampoline<P, F: Fn(&P) + 'static>( 2278 this: *mut gtk_sys::GtkTextView, 2279 _param_spec: glib_sys::gpointer, 2280 f: glib_sys::gpointer, 2281 ) where 2282 P: IsA<TextView>, 2283 { 2284 let f: &F = &*(f as *const F); 2285 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2286 } 2287 unsafe { 2288 let f: Box_<F> = Box_::new(f); 2289 connect_raw( 2290 self.as_ptr() as *mut _, 2291 b"notify::bottom-margin\0".as_ptr() as *const _, 2292 Some(transmute( 2293 notify_bottom_margin_trampoline::<Self, F> as usize, 2294 )), 2295 Box_::into_raw(f), 2296 ) 2297 } 2298 } 2299 connect_property_buffer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2300 fn connect_property_buffer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 2301 unsafe extern "C" fn notify_buffer_trampoline<P, F: Fn(&P) + 'static>( 2302 this: *mut gtk_sys::GtkTextView, 2303 _param_spec: glib_sys::gpointer, 2304 f: glib_sys::gpointer, 2305 ) where 2306 P: IsA<TextView>, 2307 { 2308 let f: &F = &*(f as *const F); 2309 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2310 } 2311 unsafe { 2312 let f: Box_<F> = Box_::new(f); 2313 connect_raw( 2314 self.as_ptr() as *mut _, 2315 b"notify::buffer\0".as_ptr() as *const _, 2316 Some(transmute(notify_buffer_trampoline::<Self, F> as usize)), 2317 Box_::into_raw(f), 2318 ) 2319 } 2320 } 2321 connect_property_cursor_visible_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId2322 fn connect_property_cursor_visible_notify<F: Fn(&Self) + 'static>( 2323 &self, 2324 f: F, 2325 ) -> SignalHandlerId { 2326 unsafe extern "C" fn notify_cursor_visible_trampoline<P, F: Fn(&P) + 'static>( 2327 this: *mut gtk_sys::GtkTextView, 2328 _param_spec: glib_sys::gpointer, 2329 f: glib_sys::gpointer, 2330 ) where 2331 P: IsA<TextView>, 2332 { 2333 let f: &F = &*(f as *const F); 2334 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2335 } 2336 unsafe { 2337 let f: Box_<F> = Box_::new(f); 2338 connect_raw( 2339 self.as_ptr() as *mut _, 2340 b"notify::cursor-visible\0".as_ptr() as *const _, 2341 Some(transmute( 2342 notify_cursor_visible_trampoline::<Self, F> as usize, 2343 )), 2344 Box_::into_raw(f), 2345 ) 2346 } 2347 } 2348 connect_property_editable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2349 fn connect_property_editable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 2350 unsafe extern "C" fn notify_editable_trampoline<P, F: Fn(&P) + 'static>( 2351 this: *mut gtk_sys::GtkTextView, 2352 _param_spec: glib_sys::gpointer, 2353 f: glib_sys::gpointer, 2354 ) where 2355 P: IsA<TextView>, 2356 { 2357 let f: &F = &*(f as *const F); 2358 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2359 } 2360 unsafe { 2361 let f: Box_<F> = Box_::new(f); 2362 connect_raw( 2363 self.as_ptr() as *mut _, 2364 b"notify::editable\0".as_ptr() as *const _, 2365 Some(transmute(notify_editable_trampoline::<Self, F> as usize)), 2366 Box_::into_raw(f), 2367 ) 2368 } 2369 } 2370 connect_property_im_module_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2371 fn connect_property_im_module_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 2372 unsafe extern "C" fn notify_im_module_trampoline<P, F: Fn(&P) + 'static>( 2373 this: *mut gtk_sys::GtkTextView, 2374 _param_spec: glib_sys::gpointer, 2375 f: glib_sys::gpointer, 2376 ) where 2377 P: IsA<TextView>, 2378 { 2379 let f: &F = &*(f as *const F); 2380 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2381 } 2382 unsafe { 2383 let f: Box_<F> = Box_::new(f); 2384 connect_raw( 2385 self.as_ptr() as *mut _, 2386 b"notify::im-module\0".as_ptr() as *const _, 2387 Some(transmute(notify_im_module_trampoline::<Self, F> as usize)), 2388 Box_::into_raw(f), 2389 ) 2390 } 2391 } 2392 connect_property_indent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2393 fn connect_property_indent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 2394 unsafe extern "C" fn notify_indent_trampoline<P, F: Fn(&P) + 'static>( 2395 this: *mut gtk_sys::GtkTextView, 2396 _param_spec: glib_sys::gpointer, 2397 f: glib_sys::gpointer, 2398 ) where 2399 P: IsA<TextView>, 2400 { 2401 let f: &F = &*(f as *const F); 2402 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2403 } 2404 unsafe { 2405 let f: Box_<F> = Box_::new(f); 2406 connect_raw( 2407 self.as_ptr() as *mut _, 2408 b"notify::indent\0".as_ptr() as *const _, 2409 Some(transmute(notify_indent_trampoline::<Self, F> as usize)), 2410 Box_::into_raw(f), 2411 ) 2412 } 2413 } 2414 connect_property_input_hints_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2415 fn connect_property_input_hints_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 2416 unsafe extern "C" fn notify_input_hints_trampoline<P, F: Fn(&P) + 'static>( 2417 this: *mut gtk_sys::GtkTextView, 2418 _param_spec: glib_sys::gpointer, 2419 f: glib_sys::gpointer, 2420 ) where 2421 P: IsA<TextView>, 2422 { 2423 let f: &F = &*(f as *const F); 2424 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2425 } 2426 unsafe { 2427 let f: Box_<F> = Box_::new(f); 2428 connect_raw( 2429 self.as_ptr() as *mut _, 2430 b"notify::input-hints\0".as_ptr() as *const _, 2431 Some(transmute(notify_input_hints_trampoline::<Self, F> as usize)), 2432 Box_::into_raw(f), 2433 ) 2434 } 2435 } 2436 connect_property_input_purpose_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId2437 fn connect_property_input_purpose_notify<F: Fn(&Self) + 'static>( 2438 &self, 2439 f: F, 2440 ) -> SignalHandlerId { 2441 unsafe extern "C" fn notify_input_purpose_trampoline<P, F: Fn(&P) + 'static>( 2442 this: *mut gtk_sys::GtkTextView, 2443 _param_spec: glib_sys::gpointer, 2444 f: glib_sys::gpointer, 2445 ) where 2446 P: IsA<TextView>, 2447 { 2448 let f: &F = &*(f as *const F); 2449 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2450 } 2451 unsafe { 2452 let f: Box_<F> = Box_::new(f); 2453 connect_raw( 2454 self.as_ptr() as *mut _, 2455 b"notify::input-purpose\0".as_ptr() as *const _, 2456 Some(transmute( 2457 notify_input_purpose_trampoline::<Self, F> as usize, 2458 )), 2459 Box_::into_raw(f), 2460 ) 2461 } 2462 } 2463 connect_property_justification_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId2464 fn connect_property_justification_notify<F: Fn(&Self) + 'static>( 2465 &self, 2466 f: F, 2467 ) -> SignalHandlerId { 2468 unsafe extern "C" fn notify_justification_trampoline<P, F: Fn(&P) + 'static>( 2469 this: *mut gtk_sys::GtkTextView, 2470 _param_spec: glib_sys::gpointer, 2471 f: glib_sys::gpointer, 2472 ) where 2473 P: IsA<TextView>, 2474 { 2475 let f: &F = &*(f as *const F); 2476 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2477 } 2478 unsafe { 2479 let f: Box_<F> = Box_::new(f); 2480 connect_raw( 2481 self.as_ptr() as *mut _, 2482 b"notify::justification\0".as_ptr() as *const _, 2483 Some(transmute( 2484 notify_justification_trampoline::<Self, F> as usize, 2485 )), 2486 Box_::into_raw(f), 2487 ) 2488 } 2489 } 2490 connect_property_left_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2491 fn connect_property_left_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 2492 unsafe extern "C" fn notify_left_margin_trampoline<P, F: Fn(&P) + 'static>( 2493 this: *mut gtk_sys::GtkTextView, 2494 _param_spec: glib_sys::gpointer, 2495 f: glib_sys::gpointer, 2496 ) where 2497 P: IsA<TextView>, 2498 { 2499 let f: &F = &*(f as *const F); 2500 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2501 } 2502 unsafe { 2503 let f: Box_<F> = Box_::new(f); 2504 connect_raw( 2505 self.as_ptr() as *mut _, 2506 b"notify::left-margin\0".as_ptr() as *const _, 2507 Some(transmute(notify_left_margin_trampoline::<Self, F> as usize)), 2508 Box_::into_raw(f), 2509 ) 2510 } 2511 } 2512 connect_property_monospace_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2513 fn connect_property_monospace_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 2514 unsafe extern "C" fn notify_monospace_trampoline<P, F: Fn(&P) + 'static>( 2515 this: *mut gtk_sys::GtkTextView, 2516 _param_spec: glib_sys::gpointer, 2517 f: glib_sys::gpointer, 2518 ) where 2519 P: IsA<TextView>, 2520 { 2521 let f: &F = &*(f as *const F); 2522 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2523 } 2524 unsafe { 2525 let f: Box_<F> = Box_::new(f); 2526 connect_raw( 2527 self.as_ptr() as *mut _, 2528 b"notify::monospace\0".as_ptr() as *const _, 2529 Some(transmute(notify_monospace_trampoline::<Self, F> as usize)), 2530 Box_::into_raw(f), 2531 ) 2532 } 2533 } 2534 connect_property_overwrite_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2535 fn connect_property_overwrite_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 2536 unsafe extern "C" fn notify_overwrite_trampoline<P, F: Fn(&P) + 'static>( 2537 this: *mut gtk_sys::GtkTextView, 2538 _param_spec: glib_sys::gpointer, 2539 f: glib_sys::gpointer, 2540 ) where 2541 P: IsA<TextView>, 2542 { 2543 let f: &F = &*(f as *const F); 2544 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2545 } 2546 unsafe { 2547 let f: Box_<F> = Box_::new(f); 2548 connect_raw( 2549 self.as_ptr() as *mut _, 2550 b"notify::overwrite\0".as_ptr() as *const _, 2551 Some(transmute(notify_overwrite_trampoline::<Self, F> as usize)), 2552 Box_::into_raw(f), 2553 ) 2554 } 2555 } 2556 connect_property_pixels_above_lines_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId2557 fn connect_property_pixels_above_lines_notify<F: Fn(&Self) + 'static>( 2558 &self, 2559 f: F, 2560 ) -> SignalHandlerId { 2561 unsafe extern "C" fn notify_pixels_above_lines_trampoline<P, F: Fn(&P) + 'static>( 2562 this: *mut gtk_sys::GtkTextView, 2563 _param_spec: glib_sys::gpointer, 2564 f: glib_sys::gpointer, 2565 ) where 2566 P: IsA<TextView>, 2567 { 2568 let f: &F = &*(f as *const F); 2569 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2570 } 2571 unsafe { 2572 let f: Box_<F> = Box_::new(f); 2573 connect_raw( 2574 self.as_ptr() as *mut _, 2575 b"notify::pixels-above-lines\0".as_ptr() as *const _, 2576 Some(transmute( 2577 notify_pixels_above_lines_trampoline::<Self, F> as usize, 2578 )), 2579 Box_::into_raw(f), 2580 ) 2581 } 2582 } 2583 connect_property_pixels_below_lines_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId2584 fn connect_property_pixels_below_lines_notify<F: Fn(&Self) + 'static>( 2585 &self, 2586 f: F, 2587 ) -> SignalHandlerId { 2588 unsafe extern "C" fn notify_pixels_below_lines_trampoline<P, F: Fn(&P) + 'static>( 2589 this: *mut gtk_sys::GtkTextView, 2590 _param_spec: glib_sys::gpointer, 2591 f: glib_sys::gpointer, 2592 ) where 2593 P: IsA<TextView>, 2594 { 2595 let f: &F = &*(f as *const F); 2596 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2597 } 2598 unsafe { 2599 let f: Box_<F> = Box_::new(f); 2600 connect_raw( 2601 self.as_ptr() as *mut _, 2602 b"notify::pixels-below-lines\0".as_ptr() as *const _, 2603 Some(transmute( 2604 notify_pixels_below_lines_trampoline::<Self, F> as usize, 2605 )), 2606 Box_::into_raw(f), 2607 ) 2608 } 2609 } 2610 connect_property_pixels_inside_wrap_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId2611 fn connect_property_pixels_inside_wrap_notify<F: Fn(&Self) + 'static>( 2612 &self, 2613 f: F, 2614 ) -> SignalHandlerId { 2615 unsafe extern "C" fn notify_pixels_inside_wrap_trampoline<P, F: Fn(&P) + 'static>( 2616 this: *mut gtk_sys::GtkTextView, 2617 _param_spec: glib_sys::gpointer, 2618 f: glib_sys::gpointer, 2619 ) where 2620 P: IsA<TextView>, 2621 { 2622 let f: &F = &*(f as *const F); 2623 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2624 } 2625 unsafe { 2626 let f: Box_<F> = Box_::new(f); 2627 connect_raw( 2628 self.as_ptr() as *mut _, 2629 b"notify::pixels-inside-wrap\0".as_ptr() as *const _, 2630 Some(transmute( 2631 notify_pixels_inside_wrap_trampoline::<Self, F> as usize, 2632 )), 2633 Box_::into_raw(f), 2634 ) 2635 } 2636 } 2637 connect_property_populate_all_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId2638 fn connect_property_populate_all_notify<F: Fn(&Self) + 'static>( 2639 &self, 2640 f: F, 2641 ) -> SignalHandlerId { 2642 unsafe extern "C" fn notify_populate_all_trampoline<P, F: Fn(&P) + 'static>( 2643 this: *mut gtk_sys::GtkTextView, 2644 _param_spec: glib_sys::gpointer, 2645 f: glib_sys::gpointer, 2646 ) where 2647 P: IsA<TextView>, 2648 { 2649 let f: &F = &*(f as *const F); 2650 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2651 } 2652 unsafe { 2653 let f: Box_<F> = Box_::new(f); 2654 connect_raw( 2655 self.as_ptr() as *mut _, 2656 b"notify::populate-all\0".as_ptr() as *const _, 2657 Some(transmute( 2658 notify_populate_all_trampoline::<Self, F> as usize, 2659 )), 2660 Box_::into_raw(f), 2661 ) 2662 } 2663 } 2664 connect_property_right_margin_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId2665 fn connect_property_right_margin_notify<F: Fn(&Self) + 'static>( 2666 &self, 2667 f: F, 2668 ) -> SignalHandlerId { 2669 unsafe extern "C" fn notify_right_margin_trampoline<P, F: Fn(&P) + 'static>( 2670 this: *mut gtk_sys::GtkTextView, 2671 _param_spec: glib_sys::gpointer, 2672 f: glib_sys::gpointer, 2673 ) where 2674 P: IsA<TextView>, 2675 { 2676 let f: &F = &*(f as *const F); 2677 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2678 } 2679 unsafe { 2680 let f: Box_<F> = Box_::new(f); 2681 connect_raw( 2682 self.as_ptr() as *mut _, 2683 b"notify::right-margin\0".as_ptr() as *const _, 2684 Some(transmute( 2685 notify_right_margin_trampoline::<Self, F> as usize, 2686 )), 2687 Box_::into_raw(f), 2688 ) 2689 } 2690 } 2691 connect_property_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2692 fn connect_property_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 2693 unsafe extern "C" fn notify_tabs_trampoline<P, F: Fn(&P) + 'static>( 2694 this: *mut gtk_sys::GtkTextView, 2695 _param_spec: glib_sys::gpointer, 2696 f: glib_sys::gpointer, 2697 ) where 2698 P: IsA<TextView>, 2699 { 2700 let f: &F = &*(f as *const F); 2701 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2702 } 2703 unsafe { 2704 let f: Box_<F> = Box_::new(f); 2705 connect_raw( 2706 self.as_ptr() as *mut _, 2707 b"notify::tabs\0".as_ptr() as *const _, 2708 Some(transmute(notify_tabs_trampoline::<Self, F> as usize)), 2709 Box_::into_raw(f), 2710 ) 2711 } 2712 } 2713 2714 #[cfg(any(feature = "v3_18", feature = "dox"))] connect_property_top_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2715 fn connect_property_top_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 2716 unsafe extern "C" fn notify_top_margin_trampoline<P, F: Fn(&P) + 'static>( 2717 this: *mut gtk_sys::GtkTextView, 2718 _param_spec: glib_sys::gpointer, 2719 f: glib_sys::gpointer, 2720 ) where 2721 P: IsA<TextView>, 2722 { 2723 let f: &F = &*(f as *const F); 2724 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2725 } 2726 unsafe { 2727 let f: Box_<F> = Box_::new(f); 2728 connect_raw( 2729 self.as_ptr() as *mut _, 2730 b"notify::top-margin\0".as_ptr() as *const _, 2731 Some(transmute(notify_top_margin_trampoline::<Self, F> as usize)), 2732 Box_::into_raw(f), 2733 ) 2734 } 2735 } 2736 connect_property_wrap_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId2737 fn connect_property_wrap_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 2738 unsafe extern "C" fn notify_wrap_mode_trampoline<P, F: Fn(&P) + 'static>( 2739 this: *mut gtk_sys::GtkTextView, 2740 _param_spec: glib_sys::gpointer, 2741 f: glib_sys::gpointer, 2742 ) where 2743 P: IsA<TextView>, 2744 { 2745 let f: &F = &*(f as *const F); 2746 f(&TextView::from_glib_borrow(this).unsafe_cast()) 2747 } 2748 unsafe { 2749 let f: Box_<F> = Box_::new(f); 2750 connect_raw( 2751 self.as_ptr() as *mut _, 2752 b"notify::wrap-mode\0".as_ptr() as *const _, 2753 Some(transmute(notify_wrap_mode_trampoline::<Self, F> as usize)), 2754 Box_::into_raw(f), 2755 ) 2756 } 2757 } 2758 } 2759 2760 impl fmt::Display for TextView { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result2761 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 2762 write!(f, "TextView") 2763 } 2764 } 2765