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 = GtkSourceView.html 27 * outPack = gsv 28 * outFile = SourceView 29 * strct = GtkSourceView 30 * realStrct= 31 * ctorStrct= 32 * clss = SourceView 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_source_view_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - gdk.Pixbuf 47 * - gdk.Color 48 * - gtk.TextIter 49 * - gsv.SourceGutter 50 * - gsv.SourceBuffer 51 * - gtkc.gtk 52 * - glib.Str 53 * structWrap: 54 * - GdkColor* -> Color 55 * - GdkPixbuf* -> Pixbuf 56 * - GtkSourceBuffer* -> SourceBuffer 57 * - GtkSourceGutter* -> SourceGutter 58 * - GtkTextIter* -> TextIter 59 * module aliases: 60 * local aliases: 61 * overrides: 62 */ 63 64 module gsv.SourceView; 65 66 public import gsvc.gsvtypes; 67 68 private import gsvc.gsv; 69 private import glib.ConstructionException; 70 private import gobject.ObjectG; 71 72 private import gobject.Signals; 73 public import gtkc.gdktypes; 74 75 private import gdk.Pixbuf; 76 private import gdk.Color; 77 private import gtk.TextIter; 78 private import gsv.SourceGutter; 79 private import gsv.SourceBuffer; 80 private import gtkc.gtk; 81 private import glib.Str; 82 83 84 85 private import gtk.TextView; 86 87 /** 88 * Description 89 * GtkSourceView is the main object of the gtksourceview library. It provides 90 * a text view which syntax highlighting, undo/redo and text marks. Use a 91 * GtkSourceBuffer to display text with a GtkSourceView. 92 */ 93 public class SourceView : TextView 94 { 95 96 /** the main Gtk struct */ 97 protected GtkSourceView* gtkSourceView; 98 99 100 public GtkSourceView* getSourceViewStruct() 101 { 102 return gtkSourceView; 103 } 104 105 106 /** the main Gtk struct as a void* */ 107 protected override void* getStruct() 108 { 109 return cast(void*)gtkSourceView; 110 } 111 112 /** 113 * Sets our main struct and passes it to the parent class 114 */ 115 public this (GtkSourceView* gtkSourceView) 116 { 117 super(cast(GtkTextView*)gtkSourceView); 118 this.gtkSourceView = gtkSourceView; 119 } 120 121 protected override void setStruct(GObject* obj) 122 { 123 super.setStruct(obj); 124 gtkSourceView = cast(GtkSourceView*)obj; 125 } 126 127 /** 128 * Returns the GtkSourceBuffer being displayed by this source view. 129 * The reference count on the buffer is not incremented; the caller 130 * of this function won't own a new reference. 131 * Returns: 132 * a GtkSourceBuffer 133 */ 134 public override SourceBuffer getBuffer() 135 { 136 // GtkSourceBuffer* gtk_text_view_get_buffer (GtkTextView *text_view); 137 auto p = gtk_text_view_get_buffer(cast(GtkTextView*)gtkSourceView); 138 139 if ( p is null ) 140 { 141 return null; 142 } 143 144 return ObjectG.getDObject!(SourceBuffer)( cast(GtkSourceBuffer*)p ); 145 } 146 147 /** 148 */ 149 int[string] connectedSignals; 150 151 void delegate(TextIter, GdkEvent*, SourceView)[] onLineMarkActivatedListeners; 152 /** 153 * Emitted when a line mark has been activated (for instance when there 154 * was a button press in the line marks gutter). You can use iter to 155 * determine on which line the activation took place. 156 */ 157 void addOnLineMarkActivated(void delegate(TextIter, GdkEvent*, SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 158 { 159 if ( !("line-mark-activated" in connectedSignals) ) 160 { 161 Signals.connectData( 162 getStruct(), 163 "line-mark-activated", 164 cast(GCallback)&callBackLineMarkActivated, 165 cast(void*)this, 166 null, 167 connectFlags); 168 connectedSignals["line-mark-activated"] = 1; 169 } 170 onLineMarkActivatedListeners ~= dlg; 171 } 172 extern(C) static void callBackLineMarkActivated(GtkSourceView* viewStruct, GtkTextIter* iter, GdkEvent* event, SourceView _sourceView) 173 { 174 foreach ( void delegate(TextIter, GdkEvent*, SourceView) dlg ; _sourceView.onLineMarkActivatedListeners ) 175 { 176 dlg(ObjectG.getDObject!(TextIter)(iter), event, _sourceView); 177 } 178 } 179 180 void delegate(gboolean, gint, SourceView)[] onMoveLinesListeners; 181 /** 182 */ 183 void addOnMoveLines(void delegate(gboolean, gint, SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 184 { 185 if ( !("move-lines" in connectedSignals) ) 186 { 187 Signals.connectData( 188 getStruct(), 189 "move-lines", 190 cast(GCallback)&callBackMoveLines, 191 cast(void*)this, 192 null, 193 connectFlags); 194 connectedSignals["move-lines"] = 1; 195 } 196 onMoveLinesListeners ~= dlg; 197 } 198 extern(C) static void callBackMoveLines(GtkSourceView* sourceviewStruct, gboolean arg1, gint arg2, SourceView _sourceView) 199 { 200 foreach ( void delegate(gboolean, gint, SourceView) dlg ; _sourceView.onMoveLinesListeners ) 201 { 202 dlg(arg1, arg2, _sourceView); 203 } 204 } 205 206 void delegate(SourceView)[] onRedoListeners; 207 /** 208 */ 209 void addOnRedo(void delegate(SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 210 { 211 if ( !("redo" in connectedSignals) ) 212 { 213 Signals.connectData( 214 getStruct(), 215 "redo", 216 cast(GCallback)&callBackRedo, 217 cast(void*)this, 218 null, 219 connectFlags); 220 connectedSignals["redo"] = 1; 221 } 222 onRedoListeners ~= dlg; 223 } 224 extern(C) static void callBackRedo(GtkSourceView* sourceviewStruct, SourceView _sourceView) 225 { 226 foreach ( void delegate(SourceView) dlg ; _sourceView.onRedoListeners ) 227 { 228 dlg(_sourceView); 229 } 230 } 231 232 void delegate(SourceView)[] onShowCompletionListeners; 233 /** 234 * The ::show-completion signal is a keybinding signal which gets 235 * emitted when the user initiates a completion in default mode. 236 * Applications should not connect to it, but may emit it with 237 * g_signal_emit_by_name if they need to control the default mode 238 * completion activation. 239 */ 240 void addOnShowCompletion(void delegate(SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 241 { 242 if ( !("show-completion" in connectedSignals) ) 243 { 244 Signals.connectData( 245 getStruct(), 246 "show-completion", 247 cast(GCallback)&callBackShowCompletion, 248 cast(void*)this, 249 null, 250 connectFlags); 251 connectedSignals["show-completion"] = 1; 252 } 253 onShowCompletionListeners ~= dlg; 254 } 255 extern(C) static void callBackShowCompletion(GtkSourceView* viewStruct, SourceView _sourceView) 256 { 257 foreach ( void delegate(SourceView) dlg ; _sourceView.onShowCompletionListeners ) 258 { 259 dlg(_sourceView); 260 } 261 } 262 263 void delegate(SourceView)[] onUndoListeners; 264 /** 265 * See Also 266 * GtkTextView,GtkSourceBuffer 267 */ 268 void addOnUndo(void delegate(SourceView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 269 { 270 if ( !("undo" in connectedSignals) ) 271 { 272 Signals.connectData( 273 getStruct(), 274 "undo", 275 cast(GCallback)&callBackUndo, 276 cast(void*)this, 277 null, 278 connectFlags); 279 connectedSignals["undo"] = 1; 280 } 281 onUndoListeners ~= dlg; 282 } 283 extern(C) static void callBackUndo(GtkSourceView* sourceviewStruct, SourceView _sourceView) 284 { 285 foreach ( void delegate(SourceView) dlg ; _sourceView.onUndoListeners ) 286 { 287 dlg(_sourceView); 288 } 289 } 290 291 292 /** 293 * Creates a new GtkSourceView. An empty default buffer will be 294 * created for you. If you want to specify your own buffer, consider 295 * gtk_source_view_new_with_buffer(). 296 * Throws: ConstructionException GTK+ fails to create the object. 297 */ 298 public this () 299 { 300 // GtkWidget * gtk_source_view_new (void); 301 auto p = gtk_source_view_new(); 302 if(p is null) 303 { 304 throw new ConstructionException("null returned by gtk_source_view_new()"); 305 } 306 this(cast(GtkSourceView*) p); 307 } 308 309 /** 310 * Creates a new GtkSourceView widget displaying the buffer 311 * buffer. One buffer can be shared among many widgets. 312 * Params: 313 * buffer = a GtkSourceBuffer. 314 * Throws: ConstructionException GTK+ fails to create the object. 315 */ 316 public this (SourceBuffer buffer) 317 { 318 // GtkWidget * gtk_source_view_new_with_buffer (GtkSourceBuffer *buffer); 319 auto p = gtk_source_view_new_with_buffer((buffer is null) ? null : buffer.getSourceBufferStruct()); 320 if(p is null) 321 { 322 throw new ConstructionException("null returned by gtk_source_view_new_with_buffer((buffer is null) ? null : buffer.getSourceBufferStruct())"); 323 } 324 this(cast(GtkSourceView*) p); 325 } 326 327 /** 328 * If TRUE auto indentation of text is enabled. 329 * Params: 330 * enable = whether to enable auto indentation. 331 */ 332 public void setAutoIndent(int enable) 333 { 334 // void gtk_source_view_set_auto_indent (GtkSourceView *view, gboolean enable); 335 gtk_source_view_set_auto_indent(gtkSourceView, enable); 336 } 337 338 /** 339 * Returns whether auto indentation of text is enabled. 340 * Returns: TRUE if auto indentation is enabled. 341 */ 342 public int getAutoIndent() 343 { 344 // gboolean gtk_source_view_get_auto_indent (GtkSourceView *view); 345 return gtk_source_view_get_auto_indent(gtkSourceView); 346 } 347 348 /** 349 * If TRUE, when the tab key is pressed and there is a selection, the 350 * selected text is indented of one level instead of being replaced with 351 * the \t characters. Shift+Tab unindents the selection. 352 * Since 1.8 353 * Params: 354 * enable = whether to indent a block when tab is pressed. 355 */ 356 public void setIndentOnTab(int enable) 357 { 358 // void gtk_source_view_set_indent_on_tab (GtkSourceView *view, gboolean enable); 359 gtk_source_view_set_indent_on_tab(gtkSourceView, enable); 360 } 361 362 /** 363 * Returns whether when the tab key is pressed the current selection 364 * should get indented instead of replaced with the \t character. 365 * Since 1.8 366 * Returns: TRUE if the selection is indented when tab is pressed. 367 */ 368 public int getIndentOnTab() 369 { 370 // gboolean gtk_source_view_get_indent_on_tab (GtkSourceView *view); 371 return gtk_source_view_get_indent_on_tab(gtkSourceView); 372 } 373 374 /** 375 * Sets the number of spaces to use for each step of indent. 376 * If width is -1, the value of the GtkSourceView::tab-width property 377 * will be used. 378 * Params: 379 * width = indent width in characters. 380 */ 381 public void setIndentWidth(int width) 382 { 383 // void gtk_source_view_set_indent_width (GtkSourceView *view, gint width); 384 gtk_source_view_set_indent_width(gtkSourceView, width); 385 } 386 387 /** 388 * Returns the number of spaces to use for each step of indent. 389 * See gtk_source_view_set_indent_width() for details. 390 * Returns: indent width. 391 */ 392 public int getIndentWidth() 393 { 394 // gint gtk_source_view_get_indent_width (GtkSourceView *view); 395 return gtk_source_view_get_indent_width(gtkSourceView); 396 } 397 398 /** 399 * If TRUE any tabulator character inserted is replaced by a group 400 * of space characters. 401 * Params: 402 * enable = whether to insert spaces instead of tabs. 403 */ 404 public void setInsertSpacesInsteadOfTabs(int enable) 405 { 406 // void gtk_source_view_set_insert_spaces_instead_of_tabs (GtkSourceView *view, gboolean enable); 407 gtk_source_view_set_insert_spaces_instead_of_tabs(gtkSourceView, enable); 408 } 409 410 /** 411 * Returns whether when inserting a tabulator character it should 412 * be replaced by a group of space characters. 413 * Returns: TRUE if spaces are inserted instead of tabs. 414 */ 415 public int getInsertSpacesInsteadOfTabs() 416 { 417 // gboolean gtk_source_view_get_insert_spaces_instead_of_tabs (GtkSourceView *view); 418 return gtk_source_view_get_insert_spaces_instead_of_tabs(gtkSourceView); 419 } 420 421 /** 422 * Set the desired movement of the cursor when HOME and END keys 423 * are pressed. 424 * Params: 425 * smartHe = the desired behavior among GtkSourceSmartHomeEndType. 426 */ 427 public void setSmartHomeEnd(GtkSourceSmartHomeEndType smartHe) 428 { 429 // void gtk_source_view_set_smart_home_end (GtkSourceView *view, GtkSourceSmartHomeEndType smart_he); 430 gtk_source_view_set_smart_home_end(gtkSourceView, smartHe); 431 } 432 433 /** 434 * Returns a GtkSourceSmartHomeEndType end value specifying 435 * how the cursor will move when HOME and END keys are pressed. 436 * Returns: a GtkSourceSmartHomeEndTypeend value. 437 */ 438 public GtkSourceSmartHomeEndType getSmartHomeEnd() 439 { 440 // GtkSourceSmartHomeEndType gtk_source_view_get_smart_home_end (GtkSourceView *view); 441 return gtk_source_view_get_smart_home_end(gtkSourceView); 442 } 443 444 /** 445 * Set the priority for the given mark category. When there are 446 * multiple marks on the same line, marks of categories with 447 * higher priorities will be drawn on top. 448 * Since 2.2 449 * Params: 450 * category = a mark category. 451 * priority = the priority for the category 452 */ 453 public void setMarkCategoryPriority(string category, int priority) 454 { 455 // void gtk_source_view_set_mark_category_priority (GtkSourceView *view, const gchar *category, gint priority); 456 gtk_source_view_set_mark_category_priority(gtkSourceView, Str.toStringz(category), priority); 457 } 458 459 /** 460 * Gets the priority which is associated with the given category. 461 * Since 2.2 462 * Params: 463 * category = a mark category. 464 * Returns: the priority or if category exists but no priority was set, it defaults to 0. 465 */ 466 public int getMarkCategoryPriority(string category) 467 { 468 // gint gtk_source_view_get_mark_category_priority (GtkSourceView *view, const gchar *category); 469 return gtk_source_view_get_mark_category_priority(gtkSourceView, Str.toStringz(category)); 470 } 471 472 /** 473 * Warning 474 * gtk_source_view_set_mark_category_pixbuf is deprecated and should not be used in newly-written code. Use gtk_source_view_set_mark_category_icon_from_pixbuf instead 475 * Associates a given pixbuf with a given mark category. 476 * If pixbuf is NULL, the pixbuf is unset. 477 * Since 2.2 478 * Params: 479 * category = a mark category. 480 * pixbuf = a GdkPixbuf or NULL. 481 */ 482 public void setMarkCategoryPixbuf(string category, Pixbuf pixbuf) 483 { 484 // void gtk_source_view_set_mark_category_pixbuf (GtkSourceView *view, const gchar *category, GdkPixbuf *pixbuf); 485 gtk_source_view_set_mark_category_pixbuf(gtkSourceView, Str.toStringz(category), (pixbuf is null) ? null : pixbuf.getPixbufStruct()); 486 } 487 488 /** 489 * Warning 490 * gtk_source_view_get_mark_category_pixbuf is deprecated and should not be used in newly-written code. 491 * Gets the pixbuf which is associated with the given mark category. 492 * Since 2.2 493 * Params: 494 * category = a mark category. 495 * Returns: the associated GdkPixbuf, or NULL if not found. 496 */ 497 public Pixbuf getMarkCategoryPixbuf(string category) 498 { 499 // GdkPixbuf * gtk_source_view_get_mark_category_pixbuf (GtkSourceView *view, const gchar *category); 500 auto p = gtk_source_view_get_mark_category_pixbuf(gtkSourceView, Str.toStringz(category)); 501 502 if(p is null) 503 { 504 return null; 505 } 506 507 return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p); 508 } 509 510 /** 511 * Sets the icon to be used for category to pixbuf. 512 * If pixbuf is NULL, the icon is unset. 513 * Since 2.8 514 * Params: 515 * category = a mark category. 516 * pixbuf = a GdkPixbuf or NULL. 517 */ 518 public void setMarkCategoryIconFromPixbuf(string category, Pixbuf pixbuf) 519 { 520 // void gtk_source_view_set_mark_category_icon_from_pixbuf (GtkSourceView *view, const gchar *category, GdkPixbuf *pixbuf); 521 gtk_source_view_set_mark_category_icon_from_pixbuf(gtkSourceView, Str.toStringz(category), (pixbuf is null) ? null : pixbuf.getPixbufStruct()); 522 } 523 524 /** 525 * Sets the icon to be used for category to the stock item stock_id. 526 * If stock_id is NULL, the icon is unset. 527 * Since 2.8 528 * Params: 529 * category = a mark category. 530 * stockId = the stock id or NULL. 531 */ 532 public void setMarkCategoryIconFromStock(string category, string stockId) 533 { 534 // void gtk_source_view_set_mark_category_icon_from_stock (GtkSourceView *view, const gchar *category, const gchar *stock_id); 535 gtk_source_view_set_mark_category_icon_from_stock(gtkSourceView, Str.toStringz(category), Str.toStringz(stockId)); 536 } 537 538 /** 539 * Sets the icon to be used for category to the named theme item name. 540 * If name is NULL, the icon is unset. 541 * Since 2.8 542 * Params: 543 * category = a mark category. 544 * name = the themed icon name or NULL. 545 */ 546 public void setMarkCategoryIconFromIconName(string category, string name) 547 { 548 // void gtk_source_view_set_mark_category_icon_from_icon_name (GtkSourceView *view, const gchar *category, const gchar *name); 549 gtk_source_view_set_mark_category_icon_from_icon_name(gtkSourceView, Str.toStringz(category), Str.toStringz(name)); 550 } 551 552 /** 553 * Gets the background color associated with given category. 554 * Since 2.4 555 * Params: 556 * category = a mark category. 557 * dest = destination GdkColor structure to fill in. 558 * Returns: TRUE if background color for category was set and dest is set to a valid color, or FALSE otherwise. 559 */ 560 public int getMarkCategoryBackground(string category, Color dest) 561 { 562 // gboolean gtk_source_view_get_mark_category_background (GtkSourceView *view, const gchar *category, GdkColor *dest); 563 return gtk_source_view_get_mark_category_background(gtkSourceView, Str.toStringz(category), (dest is null) ? null : dest.getColorStruct()); 564 } 565 566 /** 567 * Sets given background color for mark category. 568 * If color is NULL, the background color is unset. 569 * Since 2.4 570 * Params: 571 * category = a mark category. 572 * color = background color or NULL to unset it. 573 */ 574 public void setMarkCategoryBackground(string category, Color color) 575 { 576 // void gtk_source_view_set_mark_category_background (GtkSourceView *view, const gchar *category, const GdkColor *color); 577 gtk_source_view_set_mark_category_background(gtkSourceView, Str.toStringz(category), (color is null) ? null : color.getColorStruct()); 578 } 579 580 /** 581 * Set a GtkSourceViewMarkTooltipFunc used to set tooltip on marks from the 582 * given mark category. 583 * If you also specified a function with 584 * gtk_source_view_set_mark_category_tooltip_markup_func() the markup 585 * variant takes precedence. 586 * $(DDOC_COMMENT example) 587 * Since 2.8 588 * Params: 589 * category = a mark category. 590 * func = a GtkSourceViewMarkTooltipFunc or NULL. 591 * userData = user data which will be passed to func. 592 * userDataNotify = a function to free the memory allocated for user_data 593 * or NULL if you do not want to supply such a function. 594 */ 595 public void setMarkCategoryTooltipFunc(string category, GtkSourceViewMarkTooltipFunc func, void* userData, GDestroyNotify userDataNotify) 596 { 597 // void gtk_source_view_set_mark_category_tooltip_func (GtkSourceView *view, const gchar *category, GtkSourceViewMarkTooltipFunc func, gpointer user_data, GDestroyNotify user_data_notify); 598 gtk_source_view_set_mark_category_tooltip_func(gtkSourceView, Str.toStringz(category), func, userData, userDataNotify); 599 } 600 601 /** 602 * See gtk_source_view_set_mark_category_tooltip_func() for more information. 603 * Since 2.8 604 * Params: 605 * category = a mark category. 606 * markupFunc = a GtkSourceViewMarkTooltipFunc or NULL. 607 * userData = user data which will be passed to func. 608 * userDataNotify = a function to free the memory allocated for user_data 609 * or NULL if you do not want to supply such a function. 610 */ 611 public void setMarkCategoryTooltipMarkupFunc(string category, GtkSourceViewMarkTooltipFunc markupFunc, void* userData, GDestroyNotify userDataNotify) 612 { 613 // void gtk_source_view_set_mark_category_tooltip_markup_func (GtkSourceView *view, const gchar *category, GtkSourceViewMarkTooltipFunc markup_func, gpointer user_data, GDestroyNotify user_data_notify); 614 gtk_source_view_set_mark_category_tooltip_markup_func(gtkSourceView, Str.toStringz(category), markupFunc, userData, userDataNotify); 615 } 616 617 /** 618 * If show is TRUE the current line is highlighted. 619 * Params: 620 * show = whether to highlight the current line 621 */ 622 public void setHighlightCurrentLine(int show) 623 { 624 // void gtk_source_view_set_highlight_current_line (GtkSourceView *view, gboolean show); 625 gtk_source_view_set_highlight_current_line(gtkSourceView, show); 626 } 627 628 /** 629 * Returns whether the current line is highlighted 630 * Returns: TRUE if the current line is highlighted. 631 */ 632 public int getHighlightCurrentLine() 633 { 634 // gboolean gtk_source_view_get_highlight_current_line (GtkSourceView *view); 635 return gtk_source_view_get_highlight_current_line(gtkSourceView); 636 } 637 638 /** 639 * If TRUE line marks will be displayed beside the text. 640 * Since 2.2 641 * Params: 642 * show = whether line marks should be displayed. 643 */ 644 public void setShowLineMarks(int show) 645 { 646 // void gtk_source_view_set_show_line_marks (GtkSourceView *view, gboolean show); 647 gtk_source_view_set_show_line_marks(gtkSourceView, show); 648 } 649 650 /** 651 * Returns whether line marks are displayed beside the text. 652 * Since 2.2 653 * Returns: TRUE if the line marks are displayed. 654 */ 655 public int getShowLineMarks() 656 { 657 // gboolean gtk_source_view_get_show_line_marks (GtkSourceView *view); 658 return gtk_source_view_get_show_line_marks(gtkSourceView); 659 } 660 661 /** 662 * If TRUE line numbers will be displayed beside the text. 663 * Params: 664 * show = whether line numbers should be displayed. 665 */ 666 public void setShowLineNumbers(int show) 667 { 668 // void gtk_source_view_set_show_line_numbers (GtkSourceView *view, gboolean show); 669 gtk_source_view_set_show_line_numbers(gtkSourceView, show); 670 } 671 672 /** 673 * Returns whether line numbers are displayed beside the text. 674 * Returns: TRUE if the line numbers are displayed. 675 */ 676 public int getShowLineNumbers() 677 { 678 // gboolean gtk_source_view_get_show_line_numbers (GtkSourceView *view); 679 return gtk_source_view_get_show_line_numbers(gtkSourceView); 680 } 681 682 /** 683 * If TRUE a right margin is displayed 684 * Params: 685 * show = whether to show a right margin. 686 */ 687 public void setShowRightMargin(int show) 688 { 689 // void gtk_source_view_set_show_right_margin (GtkSourceView *view, gboolean show); 690 gtk_source_view_set_show_right_margin(gtkSourceView, show); 691 } 692 693 /** 694 * Returns whether a right margin is displayed. 695 * Returns: TRUE if the right margin is shown. 696 */ 697 public int getShowRightMargin() 698 { 699 // gboolean gtk_source_view_get_show_right_margin (GtkSourceView *view); 700 return gtk_source_view_get_show_right_margin(gtkSourceView); 701 } 702 703 /** 704 * Sets the position of the right margin in the given view. 705 * Params: 706 * pos = the width in characters where to position the right margin. 707 */ 708 public void setRightMarginPosition(uint pos) 709 { 710 // void gtk_source_view_set_right_margin_position (GtkSourceView *view, guint pos); 711 gtk_source_view_set_right_margin_position(gtkSourceView, pos); 712 } 713 714 /** 715 * Gets the position of the right margin in the given view. 716 * Returns: the position of the right margin. 717 */ 718 public uint getRightMarginPosition() 719 { 720 // guint gtk_source_view_get_right_margin_position (GtkSourceView *view); 721 return gtk_source_view_get_right_margin_position(gtkSourceView); 722 } 723 724 /** 725 * Sets the width of tabulation in characters. 726 * Params: 727 * width = width of tab in characters. 728 */ 729 public void setTabWidth(uint width) 730 { 731 // void gtk_source_view_set_tab_width (GtkSourceView *view, guint width); 732 gtk_source_view_set_tab_width(gtkSourceView, width); 733 } 734 735 /** 736 * Returns the width of tabulation in characters. 737 * Returns: width of tab. 738 */ 739 public uint getTabWidth() 740 { 741 // guint gtk_source_view_get_tab_width (GtkSourceView *view); 742 return gtk_source_view_get_tab_width(gtkSourceView); 743 } 744 745 /** 746 * Set if and how the spaces should be visualized. Specifying flags as 0 will 747 * disable display of spaces. 748 * Params: 749 * flags = GtkSourceDrawSpacesFlags specifing how white spaces should 750 * be displayed 751 */ 752 public void setDrawSpaces(GtkSourceDrawSpacesFlags flags) 753 { 754 // void gtk_source_view_set_draw_spaces (GtkSourceView *view, GtkSourceDrawSpacesFlags flags); 755 gtk_source_view_set_draw_spaces(gtkSourceView, flags); 756 } 757 758 /** 759 * Returns the GtkSourceDrawSpacesFlags specifying if and how spaces 760 * should be displayed for this view. 761 * Returns: the GtkSourceDrawSpacesFlags, 0 if no spaces should be drawn. 762 */ 763 public GtkSourceDrawSpacesFlags getDrawSpaces() 764 { 765 // GtkSourceDrawSpacesFlags gtk_source_view_get_draw_spaces (GtkSourceView *view); 766 return gtk_source_view_get_draw_spaces(gtkSourceView); 767 } 768 769 /** 770 * Gets the GtkSourceCompletion associated with view. 771 * Returns: the GtkSourceCompletion associated with view. 772 */ 773 public GtkSourceCompletion* getCompletion() 774 { 775 // GtkSourceCompletion * gtk_source_view_get_completion (GtkSourceView *view); 776 return gtk_source_view_get_completion(gtkSourceView); 777 } 778 779 /** 780 * Returns the GtkSourceGutter object associated with window_type for view. 781 * Only GTK_TEXT_WINDOW_LEFT and GTK_TEXT_WINDOW_RIGHT are supported, 782 * respectively corresponding to the left and right gutter. The line numbers 783 * and mark category icons are rendered in the gutter corresponding to 784 * GTK_TEXT_WINDOW_LEFT. 785 * Since 2.8 786 * Params: 787 * windowType = the gutter window type 788 * Returns: the GtkSourceGutter. 789 */ 790 public SourceGutter getGutter(GtkTextWindowType windowType) 791 { 792 // GtkSourceGutter * gtk_source_view_get_gutter (GtkSourceView *view, GtkTextWindowType window_type); 793 auto p = gtk_source_view_get_gutter(gtkSourceView, windowType); 794 795 if(p is null) 796 { 797 return null; 798 } 799 800 return ObjectG.getDObject!(SourceGutter)(cast(GtkSourceGutter*) p); 801 } 802 }