1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 /* 25 * Conversion parameters: 26 * inFile = GtkTextView.html 27 * outPack = gtk 28 * outFile = TextView 29 * strct = GtkTextView 30 * realStrct= 31 * ctorStrct= 32 * clss = TextView 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * - ScrollableIF 40 * prefixes: 41 * - gtk_text_view_ 42 * omit structs: 43 * omit prefixes: 44 * - gtk_text_child_anchor_ 45 * omit code: 46 * - gtk_text_view_get_hadjustment 47 * - gtk_text_view_get_vadjustment 48 * omit signals: 49 * imports: 50 * - glib.Str 51 * - glib.ListG 52 * - gdk.Window 53 * - gtk.Adjustment 54 * - gtk.TextAttributes 55 * - gtk.TextBuffer 56 * - gtk.TextChildAnchor 57 * - gtk.TextIter 58 * - gtk.TextMark 59 * - gtk.Widget 60 * - pango.PgTabArray 61 * - gtk.ScrollableIF 62 * - gtk.ScrollableT 63 * structWrap: 64 * - GList* -> ListG 65 * - GdkWindow* -> Window 66 * - GtkAdjustment* -> Adjustment 67 * - GtkTextAttributes* -> TextAttributes 68 * - GtkTextBuffer* -> TextBuffer 69 * - GtkTextChildAnchor* -> TextChildAnchor 70 * - GtkTextIter* -> TextIter 71 * - GtkTextMark* -> TextMark 72 * - GtkWidget* -> Widget 73 * - PangoTabArray* -> PgTabArray 74 * module aliases: 75 * local aliases: 76 * overrides: 77 */ 78 79 module gtk.TextView; 80 81 public import gtkc.gtktypes; 82 83 private import gtkc.gtk; 84 private import glib.ConstructionException; 85 private import gobject.ObjectG; 86 87 private import gobject.Signals; 88 public import gtkc.gdktypes; 89 90 private import glib.Str; 91 private import glib.ListG; 92 private import gdk.Window; 93 private import gtk.Adjustment; 94 private import gtk.TextAttributes; 95 private import gtk.TextBuffer; 96 private import gtk.TextChildAnchor; 97 private import gtk.TextIter; 98 private import gtk.TextMark; 99 private import gtk.Widget; 100 private import pango.PgTabArray; 101 private import gtk.ScrollableIF; 102 private import gtk.ScrollableT; 103 104 105 106 private import gtk.Container; 107 108 /** 109 * You may wish to begin by reading the text widget 110 * conceptual overview which gives an overview of all the objects and data 111 * types related to the text widget and how they work together. 112 */ 113 public class TextView : Container, ScrollableIF 114 { 115 116 /** the main Gtk struct */ 117 protected GtkTextView* gtkTextView; 118 119 120 public GtkTextView* getTextViewStruct() 121 { 122 return gtkTextView; 123 } 124 125 126 /** the main Gtk struct as a void* */ 127 protected override void* getStruct() 128 { 129 return cast(void*)gtkTextView; 130 } 131 132 /** 133 * Sets our main struct and passes it to the parent class 134 */ 135 public this (GtkTextView* gtkTextView) 136 { 137 super(cast(GtkContainer*)gtkTextView); 138 this.gtkTextView = gtkTextView; 139 } 140 141 protected override void setStruct(GObject* obj) 142 { 143 super.setStruct(obj); 144 gtkTextView = cast(GtkTextView*)obj; 145 } 146 147 // add the Scrollable capabilities 148 mixin ScrollableT!(GtkTextView); 149 150 /** 151 * Get the text line at the pixel y 152 */ 153 string getLineTextAt(gint y) 154 { 155 156 TextIter iter = new TextIter(); 157 int windowX; 158 int windowY; 159 bufferToWindowCoords(TextWindowType.TEXT, 0, y, windowX, windowY); 160 161 gtk_text_view_get_line_at_y(gtkTextView, iter.getTextIterStruct(), y+y-windowY, null); 162 163 TextIter iterEnd = new TextIter(); 164 TextBuffer buffer = getBuffer(); 165 buffer.getIterAtOffset(iterEnd, iter.getOffset()+iter.getCharsInLine()); 166 return buffer.getText(iter, iterEnd, false); 167 } 168 169 /** 170 * Simply appends some on the cursor position 171 * Params: 172 * text = the text to append 173 */ 174 void insertText(string text) 175 { 176 TextBuffer buf = getBuffer(); 177 buf.insertAtCursor(text); 178 } 179 180 /** 181 * Simply appends some text to this view 182 * Params: 183 * text = the text to append 184 */ 185 void appendText(string text, bool ensureVisible=true) 186 { 187 TextBuffer buf = getBuffer(); 188 TextIter iter = new TextIter(); 189 buf.getEndIter(iter); 190 buf.insert(iter, text); 191 if ( ensureVisible ) 192 { 193 gdouble within_margin = 0.0; 194 bool use_align = false; 195 gdouble xalign = 0.0; 196 gdouble yalign = 0.0; 197 scrollToMark(buf.createMark("",iter,true), within_margin, use_align, xalign, yalign); 198 } 199 } 200 201 /** 202 */ 203 int[string] connectedSignals; 204 205 void delegate(TextView)[] onBackspaceListeners; 206 /** 207 * The ::backspace signal is a 208 * keybinding signal 209 * which gets emitted when the user asks for it. 210 * The default bindings for this signal are 211 * Backspace and Shift-Backspace. 212 */ 213 void addOnBackspace(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 214 { 215 if ( !("backspace" in connectedSignals) ) 216 { 217 Signals.connectData( 218 getStruct(), 219 "backspace", 220 cast(GCallback)&callBackBackspace, 221 cast(void*)this, 222 null, 223 connectFlags); 224 connectedSignals["backspace"] = 1; 225 } 226 onBackspaceListeners ~= dlg; 227 } 228 extern(C) static void callBackBackspace(GtkTextView* textViewStruct, TextView _textView) 229 { 230 foreach ( void delegate(TextView) dlg ; _textView.onBackspaceListeners ) 231 { 232 dlg(_textView); 233 } 234 } 235 236 void delegate(TextView)[] onCopyClipboardListeners; 237 /** 238 * The ::copy-clipboard signal is a 239 * keybinding signal 240 * which gets emitted to copy the selection to the clipboard. 241 * The default bindings for this signal are 242 * Ctrl-c and Ctrl-Insert. 243 */ 244 void addOnCopyClipboard(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 245 { 246 if ( !("copy-clipboard" in connectedSignals) ) 247 { 248 Signals.connectData( 249 getStruct(), 250 "copy-clipboard", 251 cast(GCallback)&callBackCopyClipboard, 252 cast(void*)this, 253 null, 254 connectFlags); 255 connectedSignals["copy-clipboard"] = 1; 256 } 257 onCopyClipboardListeners ~= dlg; 258 } 259 extern(C) static void callBackCopyClipboard(GtkTextView* textViewStruct, TextView _textView) 260 { 261 foreach ( void delegate(TextView) dlg ; _textView.onCopyClipboardListeners ) 262 { 263 dlg(_textView); 264 } 265 } 266 267 void delegate(TextView)[] onCutClipboardListeners; 268 /** 269 * The ::cut-clipboard signal is a 270 * keybinding signal 271 * which gets emitted to cut the selection to the clipboard. 272 * The default bindings for this signal are 273 * Ctrl-x and Shift-Delete. 274 */ 275 void addOnCutClipboard(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 276 { 277 if ( !("cut-clipboard" in connectedSignals) ) 278 { 279 Signals.connectData( 280 getStruct(), 281 "cut-clipboard", 282 cast(GCallback)&callBackCutClipboard, 283 cast(void*)this, 284 null, 285 connectFlags); 286 connectedSignals["cut-clipboard"] = 1; 287 } 288 onCutClipboardListeners ~= dlg; 289 } 290 extern(C) static void callBackCutClipboard(GtkTextView* textViewStruct, TextView _textView) 291 { 292 foreach ( void delegate(TextView) dlg ; _textView.onCutClipboardListeners ) 293 { 294 dlg(_textView); 295 } 296 } 297 298 void delegate(GtkDeleteType, gint, TextView)[] onDeleteFromCursorListeners; 299 /** 300 * The ::delete-from-cursor signal is a 301 * keybinding signal 302 * which gets emitted when the user initiates a text deletion. 303 * If the type is GTK_DELETE_CHARS, GTK+ deletes the selection 304 * if there is one, otherwise it deletes the requested number 305 * of characters. 306 * The default bindings for this signal are 307 * Delete for deleting a character, Ctrl-Delete for 308 * deleting a word and Ctrl-Backspace for deleting a word 309 * backwords. 310 */ 311 void addOnDeleteFromCursor(void delegate(GtkDeleteType, gint, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 312 { 313 if ( !("delete-from-cursor" in connectedSignals) ) 314 { 315 Signals.connectData( 316 getStruct(), 317 "delete-from-cursor", 318 cast(GCallback)&callBackDeleteFromCursor, 319 cast(void*)this, 320 null, 321 connectFlags); 322 connectedSignals["delete-from-cursor"] = 1; 323 } 324 onDeleteFromCursorListeners ~= dlg; 325 } 326 extern(C) static void callBackDeleteFromCursor(GtkTextView* textViewStruct, GtkDeleteType type, gint count, TextView _textView) 327 { 328 foreach ( void delegate(GtkDeleteType, gint, TextView) dlg ; _textView.onDeleteFromCursorListeners ) 329 { 330 dlg(type, count, _textView); 331 } 332 } 333 334 void delegate(string, TextView)[] onInsertAtCursorListeners; 335 /** 336 * The ::insert-at-cursor signal is a 337 * keybinding signal 338 * which gets emitted when the user initiates the insertion of a 339 * fixed string at the cursor. 340 * This signal has no default bindings. 341 */ 342 void addOnInsertAtCursor(void delegate(string, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 343 { 344 if ( !("insert-at-cursor" in connectedSignals) ) 345 { 346 Signals.connectData( 347 getStruct(), 348 "insert-at-cursor", 349 cast(GCallback)&callBackInsertAtCursor, 350 cast(void*)this, 351 null, 352 connectFlags); 353 connectedSignals["insert-at-cursor"] = 1; 354 } 355 onInsertAtCursorListeners ~= dlg; 356 } 357 extern(C) static void callBackInsertAtCursor(GtkTextView* textViewStruct, gchar* str, TextView _textView) 358 { 359 foreach ( void delegate(string, TextView) dlg ; _textView.onInsertAtCursorListeners ) 360 { 361 dlg(Str.toString(str), _textView); 362 } 363 } 364 365 void delegate(GtkMovementStep, gint, gboolean, TextView)[] onMoveCursorListeners; 366 /** 367 * The ::move-cursor signal is a 368 * keybinding signal 369 * which gets emitted when the user initiates a cursor movement. 370 * If the cursor is not visible in text_view, this signal causes 371 * the viewport to be moved instead. 372 * Applications should not connect to it, but may emit it with 373 * g_signal_emit_by_name() if they need to control the cursor 374 * programmatically. 375 * The default bindings for this signal come in two variants, 376 * the variant with the Shift modifier extends the selection, 377 * the variant without the Shift modifer does not. 378 * There are too many key combinations to list them all here. 379 * Arrow keys move by individual characters/lines 380 * Ctrl-arrow key combinations move by words/paragraphs 381 * Home/End keys move to the ends of the buffer 382 * PageUp/PageDown keys move vertically by pages 383 * Ctrl-PageUp/PageDown keys move horizontally by pages 384 * TRUE if the move should extend the selection 385 */ 386 void addOnMoveCursor(void delegate(GtkMovementStep, gint, gboolean, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 387 { 388 if ( !("move-cursor" in connectedSignals) ) 389 { 390 Signals.connectData( 391 getStruct(), 392 "move-cursor", 393 cast(GCallback)&callBackMoveCursor, 394 cast(void*)this, 395 null, 396 connectFlags); 397 connectedSignals["move-cursor"] = 1; 398 } 399 onMoveCursorListeners ~= dlg; 400 } 401 extern(C) static void callBackMoveCursor(GtkTextView* textViewStruct, GtkMovementStep step, gint count, gboolean extendSelection, TextView _textView) 402 { 403 foreach ( void delegate(GtkMovementStep, gint, gboolean, TextView) dlg ; _textView.onMoveCursorListeners ) 404 { 405 dlg(step, count, extendSelection, _textView); 406 } 407 } 408 409 void delegate(GtkScrollStep, gint, TextView)[] onMoveViewportListeners; 410 /** 411 * The ::move-viewport signal is a 412 * keybinding signal 413 * which can be bound to key combinations to allow the user 414 * to move the viewport, i.e. change what part of the text view 415 * is visible in a containing scrolled window. 416 * There are no default bindings for this signal. 417 */ 418 void addOnMoveViewport(void delegate(GtkScrollStep, gint, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 419 { 420 if ( !("move-viewport" in connectedSignals) ) 421 { 422 Signals.connectData( 423 getStruct(), 424 "move-viewport", 425 cast(GCallback)&callBackMoveViewport, 426 cast(void*)this, 427 null, 428 connectFlags); 429 connectedSignals["move-viewport"] = 1; 430 } 431 onMoveViewportListeners ~= dlg; 432 } 433 extern(C) static void callBackMoveViewport(GtkTextView* textViewStruct, GtkScrollStep step, gint count, TextView _textView) 434 { 435 foreach ( void delegate(GtkScrollStep, gint, TextView) dlg ; _textView.onMoveViewportListeners ) 436 { 437 dlg(step, count, _textView); 438 } 439 } 440 441 void delegate(TextView)[] onPasteClipboardListeners; 442 /** 443 * The ::paste-clipboard signal is a 444 * keybinding signal 445 * which gets emitted to paste the contents of the clipboard 446 * into the text view. 447 * The default bindings for this signal are 448 * Ctrl-v and Shift-Insert. 449 */ 450 void addOnPasteClipboard(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 451 { 452 if ( !("paste-clipboard" in connectedSignals) ) 453 { 454 Signals.connectData( 455 getStruct(), 456 "paste-clipboard", 457 cast(GCallback)&callBackPasteClipboard, 458 cast(void*)this, 459 null, 460 connectFlags); 461 connectedSignals["paste-clipboard"] = 1; 462 } 463 onPasteClipboardListeners ~= dlg; 464 } 465 extern(C) static void callBackPasteClipboard(GtkTextView* textViewStruct, TextView _textView) 466 { 467 foreach ( void delegate(TextView) dlg ; _textView.onPasteClipboardListeners ) 468 { 469 dlg(_textView); 470 } 471 } 472 473 void delegate(Widget, TextView)[] onPopulatePopupListeners; 474 /** 475 * The ::populate-popup signal gets emitted before showing the 476 * context menu of the text view. 477 * If you need to add items to the context menu, connect 478 * to this signal and append your items to the popup, which 479 * will be a GtkMenu in this case. 480 * If "populate-all" is TRUE, this signal will 481 * also be emitted to populate touch popups. In this case, 482 * popup will be a different container, e.g. a GtkToolbar. 483 * The signal handler should not make assumptions about the 484 * type of widget, but check whether popup is a GtkMenu 485 * or GtkToolbar or another kind of container. 486 */ 487 void addOnPopulatePopup(void delegate(Widget, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 488 { 489 if ( !("populate-popup" in connectedSignals) ) 490 { 491 Signals.connectData( 492 getStruct(), 493 "populate-popup", 494 cast(GCallback)&callBackPopulatePopup, 495 cast(void*)this, 496 null, 497 connectFlags); 498 connectedSignals["populate-popup"] = 1; 499 } 500 onPopulatePopupListeners ~= dlg; 501 } 502 extern(C) static void callBackPopulatePopup(GtkTextView* textViewStruct, GtkWidget* popup, TextView _textView) 503 { 504 foreach ( void delegate(Widget, TextView) dlg ; _textView.onPopulatePopupListeners ) 505 { 506 dlg(ObjectG.getDObject!(Widget)(popup), _textView); 507 } 508 } 509 510 void delegate(string, TextView)[] onPreeditChangedListeners; 511 /** 512 * If an input method is used, the typed text will not immediately 513 * be committed to the buffer. So if you are interested in the text, 514 * connect to this signal. 515 * This signal is only emitted if the text at the given position 516 * is actually editable. 517 * Since 2.20 518 */ 519 void addOnPreeditChanged(void delegate(string, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 520 { 521 if ( !("preedit-changed" in connectedSignals) ) 522 { 523 Signals.connectData( 524 getStruct(), 525 "preedit-changed", 526 cast(GCallback)&callBackPreeditChanged, 527 cast(void*)this, 528 null, 529 connectFlags); 530 connectedSignals["preedit-changed"] = 1; 531 } 532 onPreeditChangedListeners ~= dlg; 533 } 534 extern(C) static void callBackPreeditChanged(GtkTextView* textViewStruct, gchar* preedit, TextView _textView) 535 { 536 foreach ( void delegate(string, TextView) dlg ; _textView.onPreeditChangedListeners ) 537 { 538 dlg(Str.toString(preedit), _textView); 539 } 540 } 541 542 void delegate(gboolean, TextView)[] onSelectAllListeners; 543 /** 544 * The ::select-all signal is a 545 * keybinding signal 546 * which gets emitted to select or unselect the complete 547 * contents of the text view. 548 * The default bindings for this signal are Ctrl-a and Ctrl-/ 549 * for selecting and Shift-Ctrl-a and Ctrl-\ for unselecting. 550 * TRUE to select, FALSE to unselect 551 */ 552 void addOnSelectAll(void delegate(gboolean, TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 553 { 554 if ( !("select-all" in connectedSignals) ) 555 { 556 Signals.connectData( 557 getStruct(), 558 "select-all", 559 cast(GCallback)&callBackSelectAll, 560 cast(void*)this, 561 null, 562 connectFlags); 563 connectedSignals["select-all"] = 1; 564 } 565 onSelectAllListeners ~= dlg; 566 } 567 extern(C) static void callBackSelectAll(GtkTextView* textViewStruct, gboolean select, TextView _textView) 568 { 569 foreach ( void delegate(gboolean, TextView) dlg ; _textView.onSelectAllListeners ) 570 { 571 dlg(select, _textView); 572 } 573 } 574 575 void delegate(TextView)[] onSetAnchorListeners; 576 /** 577 * The ::set-anchor signal is a 578 * keybinding signal 579 * which gets emitted when the user initiates setting the "anchor" 580 * mark. The "anchor" mark gets placed at the same position as the 581 * "insert" mark. 582 * This signal has no default bindings. 583 */ 584 void addOnSetAnchor(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 585 { 586 if ( !("set-anchor" in connectedSignals) ) 587 { 588 Signals.connectData( 589 getStruct(), 590 "set-anchor", 591 cast(GCallback)&callBackSetAnchor, 592 cast(void*)this, 593 null, 594 connectFlags); 595 connectedSignals["set-anchor"] = 1; 596 } 597 onSetAnchorListeners ~= dlg; 598 } 599 extern(C) static void callBackSetAnchor(GtkTextView* textViewStruct, TextView _textView) 600 { 601 foreach ( void delegate(TextView) dlg ; _textView.onSetAnchorListeners ) 602 { 603 dlg(_textView); 604 } 605 } 606 607 void delegate(TextView)[] onToggleCursorVisibleListeners; 608 /** 609 * The ::toggle-cursor-visible signal is a 610 * keybinding signal 611 * which gets emitted to toggle the visibility of the cursor. 612 * The default binding for this signal is F7. 613 */ 614 void addOnToggleCursorVisible(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 615 { 616 if ( !("toggle-cursor-visible" in connectedSignals) ) 617 { 618 Signals.connectData( 619 getStruct(), 620 "toggle-cursor-visible", 621 cast(GCallback)&callBackToggleCursorVisible, 622 cast(void*)this, 623 null, 624 connectFlags); 625 connectedSignals["toggle-cursor-visible"] = 1; 626 } 627 onToggleCursorVisibleListeners ~= dlg; 628 } 629 extern(C) static void callBackToggleCursorVisible(GtkTextView* textViewStruct, TextView _textView) 630 { 631 foreach ( void delegate(TextView) dlg ; _textView.onToggleCursorVisibleListeners ) 632 { 633 dlg(_textView); 634 } 635 } 636 637 void delegate(TextView)[] onToggleOverwriteListeners; 638 /** 639 * The ::toggle-overwrite signal is a 640 * keybinding signal 641 * which gets emitted to toggle the overwrite mode of the text view. 642 * The default bindings for this signal is Insert. 643 * See Also 644 * GtkTextBuffer, GtkTextIter 645 */ 646 void addOnToggleOverwrite(void delegate(TextView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 647 { 648 if ( !("toggle-overwrite" in connectedSignals) ) 649 { 650 Signals.connectData( 651 getStruct(), 652 "toggle-overwrite", 653 cast(GCallback)&callBackToggleOverwrite, 654 cast(void*)this, 655 null, 656 connectFlags); 657 connectedSignals["toggle-overwrite"] = 1; 658 } 659 onToggleOverwriteListeners ~= dlg; 660 } 661 extern(C) static void callBackToggleOverwrite(GtkTextView* textViewStruct, TextView _textView) 662 { 663 foreach ( void delegate(TextView) dlg ; _textView.onToggleOverwriteListeners ) 664 { 665 dlg(_textView); 666 } 667 } 668 669 670 /** 671 * Creates a new GtkTextView. If you don't call gtk_text_view_set_buffer() 672 * before using the text view, an empty default buffer will be created 673 * for you. Get the buffer with gtk_text_view_get_buffer(). If you want 674 * to specify your own buffer, consider gtk_text_view_new_with_buffer(). 675 * Throws: ConstructionException GTK+ fails to create the object. 676 */ 677 public this () 678 { 679 // GtkWidget * gtk_text_view_new (void); 680 auto p = gtk_text_view_new(); 681 if(p is null) 682 { 683 throw new ConstructionException("null returned by gtk_text_view_new()"); 684 } 685 this(cast(GtkTextView*) p); 686 } 687 688 /** 689 * Creates a new GtkTextView widget displaying the buffer 690 * buffer. One buffer can be shared among many widgets. 691 * buffer may be NULL to create a default buffer, in which case 692 * this function is equivalent to gtk_text_view_new(). The 693 * text view adds its own reference count to the buffer; it does not 694 * take over an existing reference. 695 * Params: 696 * buffer = a GtkTextBuffer 697 * Throws: ConstructionException GTK+ fails to create the object. 698 */ 699 public this (TextBuffer buffer) 700 { 701 // GtkWidget * gtk_text_view_new_with_buffer (GtkTextBuffer *buffer); 702 auto p = gtk_text_view_new_with_buffer((buffer is null) ? null : buffer.getTextBufferStruct()); 703 if(p is null) 704 { 705 throw new ConstructionException("null returned by gtk_text_view_new_with_buffer((buffer is null) ? null : buffer.getTextBufferStruct())"); 706 } 707 this(cast(GtkTextView*) p); 708 } 709 710 /** 711 * Sets buffer as the buffer being displayed by text_view. The previous 712 * buffer displayed by the text view is unreferenced, and a reference is 713 * added to buffer. If you owned a reference to buffer before passing it 714 * to this function, you must remove that reference yourself; GtkTextView 715 * will not "adopt" it. 716 * Params: 717 * buffer = a GtkTextBuffer. [allow-none] 718 */ 719 public void setBuffer(TextBuffer buffer) 720 { 721 // void gtk_text_view_set_buffer (GtkTextView *text_view, GtkTextBuffer *buffer); 722 gtk_text_view_set_buffer(gtkTextView, (buffer is null) ? null : buffer.getTextBufferStruct()); 723 } 724 725 /** 726 * Returns the GtkTextBuffer being displayed by this text view. 727 * The reference count on the buffer is not incremented; the caller 728 * of this function won't own a new reference. 729 * Returns: a GtkTextBuffer. [transfer none] 730 */ 731 public TextBuffer getBuffer() 732 { 733 // GtkTextBuffer * gtk_text_view_get_buffer (GtkTextView *text_view); 734 auto p = gtk_text_view_get_buffer(gtkTextView); 735 736 if(p is null) 737 { 738 return null; 739 } 740 741 return ObjectG.getDObject!(TextBuffer)(cast(GtkTextBuffer*) p); 742 } 743 744 /** 745 * Scrolls text_view so that mark is on the screen in the position 746 * indicated by xalign and yalign. An alignment of 0.0 indicates 747 * left or top, 1.0 indicates right or bottom, 0.5 means center. 748 * If use_align is FALSE, the text scrolls the minimal distance to 749 * get the mark onscreen, possibly not scrolling at all. The effective 750 * screen for purposes of this function is reduced by a margin of size 751 * within_margin. 752 * Params: 753 * mark = a GtkTextMark 754 * withinMargin = margin as a [0.0,0.5) fraction of screen size 755 * useAlign = whether to use alignment arguments (if FALSE, just 756 * get the mark onscreen) 757 * xalign = horizontal alignment of mark within visible area 758 * yalign = vertical alignment of mark within visible area 759 */ 760 public void scrollToMark(TextMark mark, double withinMargin, int useAlign, double xalign, double yalign) 761 { 762 // void gtk_text_view_scroll_to_mark (GtkTextView *text_view, GtkTextMark *mark, gdouble within_margin, gboolean use_align, gdouble xalign, gdouble yalign); 763 gtk_text_view_scroll_to_mark(gtkTextView, (mark is null) ? null : mark.getTextMarkStruct(), withinMargin, useAlign, xalign, yalign); 764 } 765 766 /** 767 * Scrolls text_view so that iter is on the screen in the position 768 * indicated by xalign and yalign. An alignment of 0.0 indicates 769 * left or top, 1.0 indicates right or bottom, 0.5 means center. 770 * If use_align is FALSE, the text scrolls the minimal distance to 771 * get the mark onscreen, possibly not scrolling at all. The effective 772 * screen for purposes of this function is reduced by a margin of size 773 * within_margin. 774 * Note that this function uses the currently-computed height of the 775 * lines in the text buffer. Line heights are computed in an idle 776 * handler; so this function may not have the desired effect if it's 777 * called before the height computations. To avoid oddness, consider 778 * using gtk_text_view_scroll_to_mark() which saves a point to be 779 * scrolled to after line validation. 780 * Params: 781 * iter = a GtkTextIter 782 * withinMargin = margin as a [0.0,0.5) fraction of screen size 783 * useAlign = whether to use alignment arguments (if FALSE, 784 * just get the mark onscreen) 785 * xalign = horizontal alignment of mark within visible area 786 * yalign = vertical alignment of mark within visible area 787 * Returns: TRUE if scrolling occurred 788 */ 789 public int scrollToIter(TextIter iter, double withinMargin, int useAlign, double xalign, double yalign) 790 { 791 // gboolean gtk_text_view_scroll_to_iter (GtkTextView *text_view, GtkTextIter *iter, gdouble within_margin, gboolean use_align, gdouble xalign, gdouble yalign); 792 return gtk_text_view_scroll_to_iter(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), withinMargin, useAlign, xalign, yalign); 793 } 794 795 /** 796 * Scrolls text_view the minimum distance such that mark is contained 797 * within the visible area of the widget. 798 * Params: 799 * mark = a mark in the buffer for text_view 800 */ 801 public void scrollMarkOnscreen(TextMark mark) 802 { 803 // void gtk_text_view_scroll_mark_onscreen (GtkTextView *text_view, GtkTextMark *mark); 804 gtk_text_view_scroll_mark_onscreen(gtkTextView, (mark is null) ? null : mark.getTextMarkStruct()); 805 } 806 807 /** 808 * Moves a mark within the buffer so that it's 809 * located within the currently-visible text area. 810 * Params: 811 * mark = a GtkTextMark 812 * Returns: TRUE if the mark moved (wasn't already onscreen) 813 */ 814 public int moveMarkOnscreen(TextMark mark) 815 { 816 // gboolean gtk_text_view_move_mark_onscreen (GtkTextView *text_view, GtkTextMark *mark); 817 return gtk_text_view_move_mark_onscreen(gtkTextView, (mark is null) ? null : mark.getTextMarkStruct()); 818 } 819 820 /** 821 * Moves the cursor to the currently visible region of the 822 * buffer, it it isn't there already. 823 * Returns: TRUE if the cursor had to be moved. 824 */ 825 public int placeCursorOnscreen() 826 { 827 // gboolean gtk_text_view_place_cursor_onscreen (GtkTextView *text_view); 828 return gtk_text_view_place_cursor_onscreen(gtkTextView); 829 } 830 831 /** 832 * Fills visible_rect with the currently-visible 833 * region of the buffer, in buffer coordinates. Convert to window coordinates 834 * with gtk_text_view_buffer_to_window_coords(). 835 * Params: 836 * visibleRect = rectangle to fill. [out] 837 */ 838 public void getVisibleRect(out Rectangle visibleRect) 839 { 840 // void gtk_text_view_get_visible_rect (GtkTextView *text_view, GdkRectangle *visible_rect); 841 gtk_text_view_get_visible_rect(gtkTextView, &visibleRect); 842 } 843 844 /** 845 * Gets a rectangle which roughly contains the character at iter. 846 * The rectangle position is in buffer coordinates; use 847 * gtk_text_view_buffer_to_window_coords() to convert these 848 * coordinates to coordinates for one of the windows in the text view. 849 * Params: 850 * iter = a GtkTextIter 851 * location = bounds of the character at iter. [out] 852 */ 853 public void getIterLocation(TextIter iter, out Rectangle location) 854 { 855 // void gtk_text_view_get_iter_location (GtkTextView *text_view, const GtkTextIter *iter, GdkRectangle *location); 856 gtk_text_view_get_iter_location(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), &location); 857 } 858 859 /** 860 * Given an iter within a text layout, determine the positions of the 861 * strong and weak cursors if the insertion point is at that 862 * iterator. The position of each cursor is stored as a zero-width 863 * rectangle. The strong cursor location is the location where 864 * characters of the directionality equal to the base direction of the 865 * paragraph are inserted. The weak cursor location is the location 866 * where characters of the directionality opposite to the base 867 * direction of the paragraph are inserted. 868 * If iter is NULL, the actual cursor position is used. 869 * Note that if iter happens to be the actual cursor position, and 870 * there is currently an IM preedit sequence being entered, the 871 * returned locations will be adjusted to account for the preedit 872 * cursor's offset within the preedit sequence. 873 * The rectangle position is in buffer coordinates; use 874 * gtk_text_view_buffer_to_window_coords() to convert these 875 * coordinates to coordinates for one of the windows in the text view. 876 * Params: 877 * iter = a GtkTextIter. [allow-none] 878 * strong = location to store the strong 879 * cursor position (may be NULL). [out][allow-none] 880 * weak = location to store the weak 881 * cursor position (may be NULL). [out][allow-none] 882 * Since 3.0 883 */ 884 public void getCursorLocations(TextIter iter, out Rectangle strong, out Rectangle weak) 885 { 886 // void gtk_text_view_get_cursor_locations (GtkTextView *text_view, const GtkTextIter *iter, GdkRectangle *strong, GdkRectangle *weak); 887 gtk_text_view_get_cursor_locations(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), &strong, &weak); 888 } 889 890 /** 891 * Gets the GtkTextIter at the start of the line containing 892 * the coordinate y. y is in buffer coordinates, convert from 893 * window coordinates with gtk_text_view_window_to_buffer_coords(). 894 * If non-NULL, line_top will be filled with the coordinate of the top 895 * edge of the line. 896 * Params: 897 * targetIter = a GtkTextIter. [out] 898 * y = a y coordinate 899 * lineTop = return location for top coordinate of the line. [out] 900 */ 901 public void getLineAtY(TextIter targetIter, int y, out int lineTop) 902 { 903 // void gtk_text_view_get_line_at_y (GtkTextView *text_view, GtkTextIter *target_iter, gint y, gint *line_top); 904 gtk_text_view_get_line_at_y(gtkTextView, (targetIter is null) ? null : targetIter.getTextIterStruct(), y, &lineTop); 905 } 906 907 /** 908 * Gets the y coordinate of the top of the line containing iter, 909 * and the height of the line. The coordinate is a buffer coordinate; 910 * convert to window coordinates with gtk_text_view_buffer_to_window_coords(). 911 * Params: 912 * iter = a GtkTextIter 913 * y = return location for a y coordinate. [out] 914 * height = return location for a height. [out] 915 */ 916 public void getLineYrange(TextIter iter, out int y, out int height) 917 { 918 // void gtk_text_view_get_line_yrange (GtkTextView *text_view, const GtkTextIter *iter, gint *y, gint *height); 919 gtk_text_view_get_line_yrange(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), &y, &height); 920 } 921 922 /** 923 * Retrieves the iterator at buffer coordinates x and y. Buffer 924 * coordinates are coordinates for the entire buffer, not just the 925 * currently-displayed portion. If you have coordinates from an 926 * event, you have to convert those to buffer coordinates with 927 * gtk_text_view_window_to_buffer_coords(). 928 * Params: 929 * iter = a GtkTextIter. [out] 930 * x = x position, in buffer coordinates 931 * y = y position, in buffer coordinates 932 */ 933 public void getIterAtLocation(TextIter iter, int x, int y) 934 { 935 // void gtk_text_view_get_iter_at_location (GtkTextView *text_view, GtkTextIter *iter, gint x, gint y); 936 gtk_text_view_get_iter_at_location(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), x, y); 937 } 938 939 /** 940 * Retrieves the iterator pointing to the character at buffer 941 * coordinates x and y. Buffer coordinates are coordinates for 942 * the entire buffer, not just the currently-displayed portion. 943 * If you have coordinates from an event, you have to convert 944 * those to buffer coordinates with 945 * gtk_text_view_window_to_buffer_coords(). 946 * Note that this is different from gtk_text_view_get_iter_at_location(), 947 * which returns cursor locations, i.e. positions between 948 * characters. 949 * Since 2.6 950 * Params: 951 * iter = a GtkTextIter. [out] 952 * trailing = if non-NULL, location to store an integer indicating where 953 * in the grapheme the user clicked. It will either be 954 * zero, or the number of characters in the grapheme. 955 * 0 represents the trailing edge of the grapheme. [out][allow-none] 956 * x = x position, in buffer coordinates 957 * y = y position, in buffer coordinates 958 */ 959 public void getIterAtPosition(TextIter iter, out int trailing, int x, int y) 960 { 961 // void gtk_text_view_get_iter_at_position (GtkTextView *text_view, GtkTextIter *iter, gint *trailing, gint x, gint y); 962 gtk_text_view_get_iter_at_position(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), &trailing, x, y); 963 } 964 965 /** 966 * Converts coordinate (buffer_x, buffer_y) to coordinates for the window 967 * win, and stores the result in (window_x, window_y). 968 * Note that you can't convert coordinates for a nonexisting window (see 969 * gtk_text_view_set_border_window_size()). 970 * Params: 971 * win = a GtkTextWindowType except GTK_TEXT_WINDOW_PRIVATE 972 * bufferX = buffer x coordinate 973 * bufferY = buffer y coordinate 974 * windowX = window x coordinate return location or NULL. [out][allow-none] 975 * windowY = window y coordinate return location or NULL. [out][allow-none] 976 */ 977 public void bufferToWindowCoords(GtkTextWindowType win, int bufferX, int bufferY, out int windowX, out int windowY) 978 { 979 // void gtk_text_view_buffer_to_window_coords (GtkTextView *text_view, GtkTextWindowType win, gint buffer_x, gint buffer_y, gint *window_x, gint *window_y); 980 gtk_text_view_buffer_to_window_coords(gtkTextView, win, bufferX, bufferY, &windowX, &windowY); 981 } 982 983 /** 984 * Converts coordinates on the window identified by win to buffer 985 * coordinates, storing the result in (buffer_x,buffer_y). 986 * Note that you can't convert coordinates for a nonexisting window (see 987 * gtk_text_view_set_border_window_size()). 988 * Params: 989 * win = a GtkTextWindowType except GTK_TEXT_WINDOW_PRIVATE 990 * windowX = window x coordinate 991 * windowY = window y coordinate 992 * bufferX = buffer x coordinate return location or NULL. [out][allow-none] 993 * bufferY = buffer y coordinate return location or NULL. [out][allow-none] 994 */ 995 public void windowToBufferCoords(GtkTextWindowType win, int windowX, int windowY, out int bufferX, out int bufferY) 996 { 997 // void gtk_text_view_window_to_buffer_coords (GtkTextView *text_view, GtkTextWindowType win, gint window_x, gint window_y, gint *buffer_x, gint *buffer_y); 998 gtk_text_view_window_to_buffer_coords(gtkTextView, win, windowX, windowY, &bufferX, &bufferY); 999 } 1000 1001 /** 1002 * Retrieves the GdkWindow corresponding to an area of the text view; 1003 * possible windows include the overall widget window, child windows 1004 * on the left, right, top, bottom, and the window that displays the 1005 * text buffer. Windows are NULL and nonexistent if their width or 1006 * height is 0, and are nonexistent before the widget has been 1007 * realized. 1008 * Params: 1009 * win = window to get 1010 * Returns: a GdkWindow, or NULL. [transfer none] 1011 */ 1012 public Window getWindow(GtkTextWindowType win) 1013 { 1014 // GdkWindow * gtk_text_view_get_window (GtkTextView *text_view, GtkTextWindowType win); 1015 auto p = gtk_text_view_get_window(gtkTextView, win); 1016 1017 if(p is null) 1018 { 1019 return null; 1020 } 1021 1022 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 1023 } 1024 1025 /** 1026 * Usually used to find out which window an event corresponds to. 1027 * If you connect to an event signal on text_view, this function 1028 * should be called on event->window to 1029 * see which window it was. 1030 * Params: 1031 * window = a window type 1032 * Returns: the window type. 1033 */ 1034 public GtkTextWindowType getWindowType(Window window) 1035 { 1036 // GtkTextWindowType gtk_text_view_get_window_type (GtkTextView *text_view, GdkWindow *window); 1037 return gtk_text_view_get_window_type(gtkTextView, (window is null) ? null : window.getWindowStruct()); 1038 } 1039 1040 /** 1041 * Sets the width of GTK_TEXT_WINDOW_LEFT or GTK_TEXT_WINDOW_RIGHT, 1042 * or the height of GTK_TEXT_WINDOW_TOP or GTK_TEXT_WINDOW_BOTTOM. 1043 * Automatically destroys the corresponding window if the size is set 1044 * to 0, and creates the window if the size is set to non-zero. This 1045 * function can only be used for the "border windows," it doesn't work 1046 * with GTK_TEXT_WINDOW_WIDGET, GTK_TEXT_WINDOW_TEXT, or 1047 * GTK_TEXT_WINDOW_PRIVATE. 1048 * Params: 1049 * type = window to affect 1050 * size = width or height of the window 1051 */ 1052 public void setBorderWindowSize(GtkTextWindowType type, int size) 1053 { 1054 // void gtk_text_view_set_border_window_size (GtkTextView *text_view, GtkTextWindowType type, gint size); 1055 gtk_text_view_set_border_window_size(gtkTextView, type, size); 1056 } 1057 1058 /** 1059 * Gets the width of the specified border window. See 1060 * gtk_text_view_set_border_window_size(). 1061 * Params: 1062 * type = window to return size from 1063 * Returns: width of window 1064 */ 1065 public int getBorderWindowSize(GtkTextWindowType type) 1066 { 1067 // gint gtk_text_view_get_border_window_size (GtkTextView *text_view, GtkTextWindowType type); 1068 return gtk_text_view_get_border_window_size(gtkTextView, type); 1069 } 1070 1071 /** 1072 * Moves the given iter forward by one display (wrapped) line. 1073 * A display line is different from a paragraph. Paragraphs are 1074 * separated by newlines or other paragraph separator characters. 1075 * Display lines are created by line-wrapping a paragraph. If 1076 * wrapping is turned off, display lines and paragraphs will be the 1077 * same. Display lines are divided differently for each view, since 1078 * they depend on the view's width; paragraphs are the same in all 1079 * views, since they depend on the contents of the GtkTextBuffer. 1080 * Params: 1081 * iter = a GtkTextIter 1082 * Returns: TRUE if iter was moved and is not on the end iterator 1083 */ 1084 public int forwardDisplayLine(TextIter iter) 1085 { 1086 // gboolean gtk_text_view_forward_display_line (GtkTextView *text_view, GtkTextIter *iter); 1087 return gtk_text_view_forward_display_line(gtkTextView, (iter is null) ? null : iter.getTextIterStruct()); 1088 } 1089 1090 /** 1091 * Moves the given iter backward by one display (wrapped) line. 1092 * A display line is different from a paragraph. Paragraphs are 1093 * separated by newlines or other paragraph separator characters. 1094 * Display lines are created by line-wrapping a paragraph. If 1095 * wrapping is turned off, display lines and paragraphs will be the 1096 * same. Display lines are divided differently for each view, since 1097 * they depend on the view's width; paragraphs are the same in all 1098 * views, since they depend on the contents of the GtkTextBuffer. 1099 * Params: 1100 * iter = a GtkTextIter 1101 * Returns: TRUE if iter was moved and is not on the end iterator 1102 */ 1103 public int backwardDisplayLine(TextIter iter) 1104 { 1105 // gboolean gtk_text_view_backward_display_line (GtkTextView *text_view, GtkTextIter *iter); 1106 return gtk_text_view_backward_display_line(gtkTextView, (iter is null) ? null : iter.getTextIterStruct()); 1107 } 1108 1109 /** 1110 * Moves the given iter forward to the next display line end. 1111 * A display line is different from a paragraph. Paragraphs are 1112 * separated by newlines or other paragraph separator characters. 1113 * Display lines are created by line-wrapping a paragraph. If 1114 * wrapping is turned off, display lines and paragraphs will be the 1115 * same. Display lines are divided differently for each view, since 1116 * they depend on the view's width; paragraphs are the same in all 1117 * views, since they depend on the contents of the GtkTextBuffer. 1118 * Params: 1119 * iter = a GtkTextIter 1120 * Returns: TRUE if iter was moved and is not on the end iterator 1121 */ 1122 public int forwardDisplayLineEnd(TextIter iter) 1123 { 1124 // gboolean gtk_text_view_forward_display_line_end (GtkTextView *text_view, GtkTextIter *iter); 1125 return gtk_text_view_forward_display_line_end(gtkTextView, (iter is null) ? null : iter.getTextIterStruct()); 1126 } 1127 1128 /** 1129 * Moves the given iter backward to the next display line start. 1130 * A display line is different from a paragraph. Paragraphs are 1131 * separated by newlines or other paragraph separator characters. 1132 * Display lines are created by line-wrapping a paragraph. If 1133 * wrapping is turned off, display lines and paragraphs will be the 1134 * same. Display lines are divided differently for each view, since 1135 * they depend on the view's width; paragraphs are the same in all 1136 * views, since they depend on the contents of the GtkTextBuffer. 1137 * Params: 1138 * iter = a GtkTextIter 1139 * Returns: TRUE if iter was moved and is not on the end iterator 1140 */ 1141 public int backwardDisplayLineStart(TextIter iter) 1142 { 1143 // gboolean gtk_text_view_backward_display_line_start (GtkTextView *text_view, GtkTextIter *iter); 1144 return gtk_text_view_backward_display_line_start(gtkTextView, (iter is null) ? null : iter.getTextIterStruct()); 1145 } 1146 1147 /** 1148 * Determines whether iter is at the start of a display line. 1149 * See gtk_text_view_forward_display_line() for an explanation of 1150 * display lines vs. paragraphs. 1151 * Params: 1152 * iter = a GtkTextIter 1153 * Returns: TRUE if iter begins a wrapped line 1154 */ 1155 public int startsDisplayLine(TextIter iter) 1156 { 1157 // gboolean gtk_text_view_starts_display_line (GtkTextView *text_view, const GtkTextIter *iter); 1158 return gtk_text_view_starts_display_line(gtkTextView, (iter is null) ? null : iter.getTextIterStruct()); 1159 } 1160 1161 /** 1162 * Move the iterator a given number of characters visually, treating 1163 * it as the strong cursor position. If count is positive, then the 1164 * new strong cursor position will be count positions to the right of 1165 * the old cursor position. If count is negative then the new strong 1166 * cursor position will be count positions to the left of the old 1167 * cursor position. 1168 * In the presence of bi-directional text, the correspondence 1169 * between logical and visual order will depend on the direction 1170 * of the current run, and there may be jumps when the cursor 1171 * is moved off of the end of a run. 1172 * Params: 1173 * iter = a GtkTextIter 1174 * count = number of characters to move (negative moves left, 1175 * positive moves right) 1176 * Returns: TRUE if iter moved and is not on the end iterator 1177 */ 1178 public int moveVisually(TextIter iter, int count) 1179 { 1180 // gboolean gtk_text_view_move_visually (GtkTextView *text_view, GtkTextIter *iter, gint count); 1181 return gtk_text_view_move_visually(gtkTextView, (iter is null) ? null : iter.getTextIterStruct(), count); 1182 } 1183 1184 /** 1185 * Adds a child widget in the text buffer, at the given anchor. 1186 * Params: 1187 * child = a GtkWidget 1188 * anchor = a GtkTextChildAnchor in the GtkTextBuffer for text_view 1189 */ 1190 public void addChildAtAnchor(Widget child, TextChildAnchor anchor) 1191 { 1192 // void gtk_text_view_add_child_at_anchor (GtkTextView *text_view, GtkWidget *child, GtkTextChildAnchor *anchor); 1193 gtk_text_view_add_child_at_anchor(gtkTextView, (child is null) ? null : child.getWidgetStruct(), (anchor is null) ? null : anchor.getTextChildAnchorStruct()); 1194 } 1195 1196 /** 1197 * Adds a child at fixed coordinates in one of the text widget's 1198 * windows. 1199 * The window must have nonzero size (see 1200 * gtk_text_view_set_border_window_size()). Note that the child 1201 * coordinates are given relative to the GdkWindow in question, and 1202 * that these coordinates have no sane relationship to scrolling. When 1203 * placing a child in GTK_TEXT_WINDOW_WIDGET, scrolling is 1204 * irrelevant, the child floats above all scrollable areas. But when 1205 * placing a child in one of the scrollable windows (border windows or 1206 * text window), you'll need to compute the child's correct position 1207 * in buffer coordinates any time scrolling occurs or buffer changes 1208 * occur, and then call gtk_text_view_move_child() to update the 1209 * child's position. 1210 * Params: 1211 * child = a GtkWidget 1212 * whichWindow = which window the child should appear in 1213 * xpos = X position of child in window coordinates 1214 * ypos = Y position of child in window coordinates 1215 */ 1216 public void addChildInWindow(Widget child, GtkTextWindowType whichWindow, int xpos, int ypos) 1217 { 1218 // void gtk_text_view_add_child_in_window (GtkTextView *text_view, GtkWidget *child, GtkTextWindowType which_window, gint xpos, gint ypos); 1219 gtk_text_view_add_child_in_window(gtkTextView, (child is null) ? null : child.getWidgetStruct(), whichWindow, xpos, ypos); 1220 } 1221 1222 /** 1223 * Updates the position of a child, as for gtk_text_view_add_child_in_window(). 1224 * Params: 1225 * child = child widget already added to the text view 1226 * xpos = new X position in window coordinates 1227 * ypos = new Y position in window coordinates 1228 */ 1229 public void moveChild(Widget child, int xpos, int ypos) 1230 { 1231 // void gtk_text_view_move_child (GtkTextView *text_view, GtkWidget *child, gint xpos, gint ypos); 1232 gtk_text_view_move_child(gtkTextView, (child is null) ? null : child.getWidgetStruct(), xpos, ypos); 1233 } 1234 1235 /** 1236 * Sets the line wrapping for the view. 1237 * Params: 1238 * wrapMode = a GtkWrapMode 1239 */ 1240 public void setWrapMode(GtkWrapMode wrapMode) 1241 { 1242 // void gtk_text_view_set_wrap_mode (GtkTextView *text_view, GtkWrapMode wrap_mode); 1243 gtk_text_view_set_wrap_mode(gtkTextView, wrapMode); 1244 } 1245 1246 /** 1247 * Gets the line wrapping for the view. 1248 * Returns: the line wrap setting 1249 */ 1250 public GtkWrapMode getWrapMode() 1251 { 1252 // GtkWrapMode gtk_text_view_get_wrap_mode (GtkTextView *text_view); 1253 return gtk_text_view_get_wrap_mode(gtkTextView); 1254 } 1255 1256 /** 1257 * Sets the default editability of the GtkTextView. You can override 1258 * this default setting with tags in the buffer, using the "editable" 1259 * attribute of tags. 1260 * Params: 1261 * setting = whether it's editable 1262 */ 1263 public void setEditable(int setting) 1264 { 1265 // void gtk_text_view_set_editable (GtkTextView *text_view, gboolean setting); 1266 gtk_text_view_set_editable(gtkTextView, setting); 1267 } 1268 1269 /** 1270 * Returns the default editability of the GtkTextView. Tags in the 1271 * buffer may override this setting for some ranges of text. 1272 * Returns: whether text is editable by default 1273 */ 1274 public int getEditable() 1275 { 1276 // gboolean gtk_text_view_get_editable (GtkTextView *text_view); 1277 return gtk_text_view_get_editable(gtkTextView); 1278 } 1279 1280 /** 1281 * Toggles whether the insertion point is displayed. A buffer with no editable 1282 * text probably shouldn't have a visible cursor, so you may want to turn 1283 * the cursor off. 1284 * Params: 1285 * setting = whether to show the insertion cursor 1286 */ 1287 public void setCursorVisible(int setting) 1288 { 1289 // void gtk_text_view_set_cursor_visible (GtkTextView *text_view, gboolean setting); 1290 gtk_text_view_set_cursor_visible(gtkTextView, setting); 1291 } 1292 1293 /** 1294 * Find out whether the cursor is being displayed. 1295 * Returns: whether the insertion mark is visible 1296 */ 1297 public int getCursorVisible() 1298 { 1299 // gboolean gtk_text_view_get_cursor_visible (GtkTextView *text_view); 1300 return gtk_text_view_get_cursor_visible(gtkTextView); 1301 } 1302 1303 /** 1304 * Changes the GtkTextView overwrite mode. 1305 * Since 2.4 1306 * Params: 1307 * overwrite = TRUE to turn on overwrite mode, FALSE to turn it off 1308 */ 1309 public void setOverwrite(int overwrite) 1310 { 1311 // void gtk_text_view_set_overwrite (GtkTextView *text_view, gboolean overwrite); 1312 gtk_text_view_set_overwrite(gtkTextView, overwrite); 1313 } 1314 1315 /** 1316 * Returns whether the GtkTextView is in overwrite mode or not. 1317 * Since 2.4 1318 * Returns: whether text_view is in overwrite mode or not. 1319 */ 1320 public int getOverwrite() 1321 { 1322 // gboolean gtk_text_view_get_overwrite (GtkTextView *text_view); 1323 return gtk_text_view_get_overwrite(gtkTextView); 1324 } 1325 1326 /** 1327 * Sets the default number of blank pixels above paragraphs in text_view. 1328 * Tags in the buffer for text_view may override the defaults. 1329 * Params: 1330 * pixelsAboveLines = pixels above paragraphs 1331 */ 1332 public void setPixelsAboveLines(int pixelsAboveLines) 1333 { 1334 // void gtk_text_view_set_pixels_above_lines (GtkTextView *text_view, gint pixels_above_lines); 1335 gtk_text_view_set_pixels_above_lines(gtkTextView, pixelsAboveLines); 1336 } 1337 1338 /** 1339 * Gets the default number of pixels to put above paragraphs. 1340 * Returns: default number of pixels above paragraphs 1341 */ 1342 public int getPixelsAboveLines() 1343 { 1344 // gint gtk_text_view_get_pixels_above_lines (GtkTextView *text_view); 1345 return gtk_text_view_get_pixels_above_lines(gtkTextView); 1346 } 1347 1348 /** 1349 * Sets the default number of pixels of blank space 1350 * to put below paragraphs in text_view. May be overridden 1351 * by tags applied to text_view's buffer. 1352 * Params: 1353 * pixelsBelowLines = pixels below paragraphs 1354 */ 1355 public void setPixelsBelowLines(int pixelsBelowLines) 1356 { 1357 // void gtk_text_view_set_pixels_below_lines (GtkTextView *text_view, gint pixels_below_lines); 1358 gtk_text_view_set_pixels_below_lines(gtkTextView, pixelsBelowLines); 1359 } 1360 1361 /** 1362 * Gets the value set by gtk_text_view_set_pixels_below_lines(). 1363 * Returns: default number of blank pixels below paragraphs 1364 */ 1365 public int getPixelsBelowLines() 1366 { 1367 // gint gtk_text_view_get_pixels_below_lines (GtkTextView *text_view); 1368 return gtk_text_view_get_pixels_below_lines(gtkTextView); 1369 } 1370 1371 /** 1372 * Sets the default number of pixels of blank space to leave between 1373 * display/wrapped lines within a paragraph. May be overridden by 1374 * tags in text_view's buffer. 1375 * Params: 1376 * pixelsInsideWrap = default number of pixels between wrapped lines 1377 */ 1378 public void setPixelsInsideWrap(int pixelsInsideWrap) 1379 { 1380 // void gtk_text_view_set_pixels_inside_wrap (GtkTextView *text_view, gint pixels_inside_wrap); 1381 gtk_text_view_set_pixels_inside_wrap(gtkTextView, pixelsInsideWrap); 1382 } 1383 1384 /** 1385 * Gets the value set by gtk_text_view_set_pixels_inside_wrap(). 1386 * Returns: default number of pixels of blank space between wrapped lines 1387 */ 1388 public int getPixelsInsideWrap() 1389 { 1390 // gint gtk_text_view_get_pixels_inside_wrap (GtkTextView *text_view); 1391 return gtk_text_view_get_pixels_inside_wrap(gtkTextView); 1392 } 1393 1394 /** 1395 * Sets the default justification of text in text_view. 1396 * Tags in the view's buffer may override the default. 1397 * Params: 1398 * justification = justification 1399 */ 1400 public void setJustification(GtkJustification justification) 1401 { 1402 // void gtk_text_view_set_justification (GtkTextView *text_view, GtkJustification justification); 1403 gtk_text_view_set_justification(gtkTextView, justification); 1404 } 1405 1406 /** 1407 * Gets the default justification of paragraphs in text_view. 1408 * Tags in the buffer may override the default. 1409 * Returns: default justification 1410 */ 1411 public GtkJustification getJustification() 1412 { 1413 // GtkJustification gtk_text_view_get_justification (GtkTextView *text_view); 1414 return gtk_text_view_get_justification(gtkTextView); 1415 } 1416 1417 /** 1418 * Sets the default left margin for text in text_view. 1419 * Tags in the buffer may override the default. 1420 * Params: 1421 * leftMargin = left margin in pixels 1422 */ 1423 public void setLeftMargin(int leftMargin) 1424 { 1425 // void gtk_text_view_set_left_margin (GtkTextView *text_view, gint left_margin); 1426 gtk_text_view_set_left_margin(gtkTextView, leftMargin); 1427 } 1428 1429 /** 1430 * Gets the default left margin size of paragraphs in the text_view. 1431 * Tags in the buffer may override the default. 1432 * Returns: left margin in pixels 1433 */ 1434 public int getLeftMargin() 1435 { 1436 // gint gtk_text_view_get_left_margin (GtkTextView *text_view); 1437 return gtk_text_view_get_left_margin(gtkTextView); 1438 } 1439 1440 /** 1441 * Sets the default right margin for text in the text view. 1442 * Tags in the buffer may override the default. 1443 * Params: 1444 * rightMargin = right margin in pixels 1445 */ 1446 public void setRightMargin(int rightMargin) 1447 { 1448 // void gtk_text_view_set_right_margin (GtkTextView *text_view, gint right_margin); 1449 gtk_text_view_set_right_margin(gtkTextView, rightMargin); 1450 } 1451 1452 /** 1453 * Gets the default right margin for text in text_view. Tags 1454 * in the buffer may override the default. 1455 * Returns: right margin in pixels 1456 */ 1457 public int getRightMargin() 1458 { 1459 // gint gtk_text_view_get_right_margin (GtkTextView *text_view); 1460 return gtk_text_view_get_right_margin(gtkTextView); 1461 } 1462 1463 /** 1464 * Sets the default indentation for paragraphs in text_view. 1465 * Tags in the buffer may override the default. 1466 * Params: 1467 * indent = indentation in pixels 1468 */ 1469 public void setIndent(int indent) 1470 { 1471 // void gtk_text_view_set_indent (GtkTextView *text_view, gint indent); 1472 gtk_text_view_set_indent(gtkTextView, indent); 1473 } 1474 1475 /** 1476 * Gets the default indentation of paragraphs in text_view. 1477 * Tags in the view's buffer may override the default. 1478 * The indentation may be negative. 1479 * Returns: number of pixels of indentation 1480 */ 1481 public int getIndent() 1482 { 1483 // gint gtk_text_view_get_indent (GtkTextView *text_view); 1484 return gtk_text_view_get_indent(gtkTextView); 1485 } 1486 1487 /** 1488 * Sets the default tab stops for paragraphs in text_view. 1489 * Tags in the buffer may override the default. 1490 * Params: 1491 * tabs = tabs as a PangoTabArray 1492 */ 1493 public void setTabs(PgTabArray tabs) 1494 { 1495 // void gtk_text_view_set_tabs (GtkTextView *text_view, PangoTabArray *tabs); 1496 gtk_text_view_set_tabs(gtkTextView, (tabs is null) ? null : tabs.getPgTabArrayStruct()); 1497 } 1498 1499 /** 1500 * Gets the default tabs for text_view. Tags in the buffer may 1501 * override the defaults. The returned array will be NULL if 1502 * "standard" (8-space) tabs are used. Free the return value 1503 * with pango_tab_array_free(). 1504 * Returns: copy of default tab array, or NULL if "standard" tabs are used; must be freed with pango_tab_array_free(). 1505 */ 1506 public PgTabArray getTabs() 1507 { 1508 // PangoTabArray * gtk_text_view_get_tabs (GtkTextView *text_view); 1509 auto p = gtk_text_view_get_tabs(gtkTextView); 1510 1511 if(p is null) 1512 { 1513 return null; 1514 } 1515 1516 return ObjectG.getDObject!(PgTabArray)(cast(PangoTabArray*) p); 1517 } 1518 1519 /** 1520 * Sets the behavior of the text widget when the Tab key is pressed. 1521 * If accepts_tab is TRUE, a tab character is inserted. If accepts_tab 1522 * is FALSE the keyboard focus is moved to the next widget in the focus 1523 * chain. 1524 * Since 2.4 1525 * Params: 1526 * acceptsTab = TRUE if pressing the Tab key should insert a tab 1527 * character, FALSE, if pressing the Tab key should move the 1528 * keyboard focus. 1529 */ 1530 public void setAcceptsTab(int acceptsTab) 1531 { 1532 // void gtk_text_view_set_accepts_tab (GtkTextView *text_view, gboolean accepts_tab); 1533 gtk_text_view_set_accepts_tab(gtkTextView, acceptsTab); 1534 } 1535 1536 /** 1537 * Returns whether pressing the Tab key inserts a tab characters. 1538 * gtk_text_view_set_accepts_tab(). 1539 * Since 2.4 1540 * Returns: TRUE if pressing the Tab key inserts a tab character, FALSE if pressing the Tab key moves the keyboard focus. 1541 */ 1542 public int getAcceptsTab() 1543 { 1544 // gboolean gtk_text_view_get_accepts_tab (GtkTextView *text_view); 1545 return gtk_text_view_get_accepts_tab(gtkTextView); 1546 } 1547 1548 /** 1549 * Obtains a copy of the default text attributes. These are the 1550 * attributes used for text unless a tag overrides them. 1551 * You'd typically pass the default attributes in to 1552 * gtk_text_iter_get_attributes() in order to get the 1553 * attributes in effect at a given text position. 1554 * The return value is a copy owned by the caller of this function, 1555 * and should be freed. 1556 * Returns: a new GtkTextAttributes 1557 */ 1558 public TextAttributes getDefaultAttributes() 1559 { 1560 // GtkTextAttributes * gtk_text_view_get_default_attributes (GtkTextView *text_view); 1561 auto p = gtk_text_view_get_default_attributes(gtkTextView); 1562 1563 if(p is null) 1564 { 1565 return null; 1566 } 1567 1568 return ObjectG.getDObject!(TextAttributes)(cast(GtkTextAttributes*) p); 1569 } 1570 1571 /** 1572 * Allow the GtkTextView input method to internally handle key press 1573 * and release events. If this function returns TRUE, then no further 1574 * processing should be done for this key event. See 1575 * gtk_im_context_filter_keypress(). 1576 * Note that you are expected to call this function from your handler 1577 * when overriding key event handling. This is needed in the case when 1578 * you need to insert your own key handling between the input method 1579 * and the default key event handling of the GtkTextView. 1580 * $(DDOC_COMMENT example) 1581 * Since 2.22 1582 * Params: 1583 * event = the key event 1584 * Returns: TRUE if the input method handled the key event. 1585 */ 1586 public int imContextFilterKeypress(GdkEventKey* event) 1587 { 1588 // gboolean gtk_text_view_im_context_filter_keypress (GtkTextView *text_view, GdkEventKey *event); 1589 return gtk_text_view_im_context_filter_keypress(gtkTextView, event); 1590 } 1591 1592 /** 1593 * Reset the input method context of the text view if needed. 1594 * This can be necessary in the case where modifying the buffer 1595 * would confuse on-going input method behavior. 1596 * Since 2.22 1597 */ 1598 public void resetImContext() 1599 { 1600 // void gtk_text_view_reset_im_context (GtkTextView *text_view); 1601 gtk_text_view_reset_im_context(gtkTextView); 1602 } 1603 1604 /** 1605 * Sets the "input-purpose" property which 1606 * can be used by on-screen keyboards and other input 1607 * methods to adjust their behaviour. 1608 * Params: 1609 * purpose = the purpose 1610 * Since 3.6 1611 */ 1612 public void setInputPurpose(GtkInputPurpose purpose) 1613 { 1614 // void gtk_text_view_set_input_purpose (GtkTextView *text_view, GtkInputPurpose purpose); 1615 gtk_text_view_set_input_purpose(gtkTextView, purpose); 1616 } 1617 1618 /** 1619 * Gets the value of the "input-purpose" property. 1620 */ 1621 public GtkInputPurpose getInputPurpose() 1622 { 1623 // GtkInputPurpose gtk_text_view_get_input_purpose (GtkTextView *text_view); 1624 return gtk_text_view_get_input_purpose(gtkTextView); 1625 } 1626 1627 /** 1628 * Sets the "input-hints" property, which 1629 * allows input methods to fine-tune their behaviour. 1630 * Params: 1631 * hints = the hints 1632 * Since 3.6 1633 */ 1634 public void setInputHints(GtkInputHints hints) 1635 { 1636 // void gtk_text_view_set_input_hints (GtkTextView *text_view, GtkInputHints hints); 1637 gtk_text_view_set_input_hints(gtkTextView, hints); 1638 } 1639 1640 /** 1641 * Gets the value of the "input-hints" property. 1642 */ 1643 public GtkInputHints getInputHints() 1644 { 1645 // GtkInputHints gtk_text_view_get_input_hints (GtkTextView *text_view); 1646 return gtk_text_view_get_input_hints(gtkTextView); 1647 } 1648 }