2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkTextView.html
43 * - gtk_text_child_anchor_
53 * - gtk.TextAttributes
55 * - gtk.TextChildAnchor
59 * - GdkRectangle* -> Rectangle
60 * - GdkWindow* -> Window
61 * - GtkTextAttributes* -> TextAttributes
62 * - GtkTextBuffer* -> TextBuffer
63 * - GtkTextChildAnchor* -> TextChildAnchor
64 * - GtkTextIter* -> TextIter
65 * - GtkTextMark* -> TextMark
66 * - GtkWidget* -> Widget
67 * - PangoTabArray* -> PgTabArray
78 import tango
.io
.Stdout
; // use the tango loging?
82 private import gtkc
.gtktypes
;
84 private import gtkc
.gtk
;
87 private import glib
.Str
;
88 private import gtk
.TextBuffer
;
89 private import gtk
.TextMark
;
90 private import gtk
.TextIter
;
91 private import gdk
.Rectangle
;
92 private import gtk
.Widget
;
93 private import pango
.PgTabArray
;
94 private import gtk
.TextAttributes
;
95 private import gdk
.Window
;
96 private import gtk
.TextChildAnchor
;
97 private import glib
.ListG
;
104 * You may wish to begin by reading the text widget
105 * conceptual overview which gives an overview of all the objects and data
106 * types related to the text widget and how they work together.
108 private import gtk
.Container
;
109 public class TextView
: Container
112 /** the main Gtk struct */
113 protected GtkTextView
* gtkTextView
;
116 public GtkTextView
* getTextViewStruct()
122 /** the main Gtk struct as a void* */
123 protected void* getStruct()
125 return cast(void*)gtkTextView
;
129 * Sets our main struct and passes it to the parent class
131 public this (GtkTextView
* gtkTextView
)
135 if ( gtkTextView
is null )
140 Stdout("struct gtkTextView is null on constructor").newline
;
144 printf("struct gtkTextView is null on constructor");
151 assert(gtkTextView
!is null, "struct gtkTextView is null on constructor");
153 super(cast(GtkContainer
*)gtkTextView
);
154 this.gtkTextView
= gtkTextView
;
158 * Get the text line at the pixel y
160 char[] getLineTextAt(gint y
)
163 TextIter iter
= new TextIter();
166 bufferToWindowCoords(TextWindowType
.TEXT
, 0, y
, &windowX
, &windowY
);
168 gtk_text_view_get_line_at_y(gtkTextView
, iter
.getTextIterStruct(), y
+y
-windowY
, null);
170 TextIter iterEnd
= new TextIter();
171 TextBuffer buffer
= getBuffer();
172 buffer
.getIterAtOffset(iterEnd
, iter
.getOffset()+iter
.getCharsInLine());
173 return buffer
.getText(iter
, iterEnd
, false);
177 * Simply appends some on the cursor position
178 * @param text the text to append
180 void insertText(char[] text
)
182 TextBuffer buf
= getBuffer();
183 buf
.insertAtCursor(text
);
187 * Simply appends some text to this view
188 * @param text the text to append
190 void appendText(char[] text
, bool ensureVisible
=true)
193 TextBuffer buf
= getBuffer();
194 TextIter iter
= new TextIter();
195 buf
.getEndIter(iter
);
196 buf
.insert(iter
, text
);
199 gdouble within_margin
= 0.0;
200 bool use_align
= false;
201 gdouble xalign
= 0.0;
202 gdouble yalign
= 0.0;
203 scrollToMark(buf
.createMark("",iter
,true), within_margin
, use_align
, xalign
, yalign
);
211 // imports for the signal processing
212 private import gobject
.Signals
;
213 private import gtkc
.gdktypes
;
214 int[char[]] connectedSignals
;
216 void delegate(TextView
)[] onBackspaceListeners
;
217 void addOnBackspace(void delegate(TextView
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
219 if ( !("backspace" in connectedSignals
) )
224 cast(GCallback
)&callBackBackspace
,
228 connectedSignals
["backspace"] = 1;
230 onBackspaceListeners
~= dlg
;
232 extern(C
) static void callBackBackspace(GtkTextView
* textviewStruct
, TextView textView
)
234 bool consumed
= false;
236 foreach ( void delegate(TextView
) dlg
; textView
.onBackspaceListeners
)
244 void delegate(TextView
)[] onCopyClipboardListeners
;
245 void addOnCopyClipboard(void delegate(TextView
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
247 if ( !("copy-clipboard" in connectedSignals
) )
252 cast(GCallback
)&callBackCopyClipboard
,
256 connectedSignals
["copy-clipboard"] = 1;
258 onCopyClipboardListeners
~= dlg
;
260 extern(C
) static void callBackCopyClipboard(GtkTextView
* textviewStruct
, TextView textView
)
262 bool consumed
= false;
264 foreach ( void delegate(TextView
) dlg
; textView
.onCopyClipboardListeners
)
272 void delegate(TextView
)[] onCutClipboardListeners
;
273 void addOnCutClipboard(void delegate(TextView
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
275 if ( !("cut-clipboard" in connectedSignals
) )
280 cast(GCallback
)&callBackCutClipboard
,
284 connectedSignals
["cut-clipboard"] = 1;
286 onCutClipboardListeners
~= dlg
;
288 extern(C
) static void callBackCutClipboard(GtkTextView
* textviewStruct
, TextView textView
)
290 bool consumed
= false;
292 foreach ( void delegate(TextView
) dlg
; textView
.onCutClipboardListeners
)
300 void delegate(GtkDeleteType
, gint
, TextView
)[] onDeleteFromCursorListeners
;
301 void addOnDeleteFromCursor(void delegate(GtkDeleteType
, gint
, TextView
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
303 if ( !("delete-from-cursor" in connectedSignals
) )
307 "delete-from-cursor",
308 cast(GCallback
)&callBackDeleteFromCursor
,
312 connectedSignals
["delete-from-cursor"] = 1;
314 onDeleteFromCursorListeners
~= dlg
;
316 extern(C
) static void callBackDeleteFromCursor(GtkTextView
* textviewStruct
, GtkDeleteType arg1
, gint arg2
, TextView textView
)
318 bool consumed
= false;
320 foreach ( void delegate(GtkDeleteType
, gint
, TextView
) dlg
; textView
.onDeleteFromCursorListeners
)
322 dlg(arg1
, arg2
, textView
);
328 void delegate(char[], TextView
)[] onInsertAtCursorListeners
;
329 void addOnInsertAtCursor(void delegate(char[], TextView
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
331 if ( !("insert-at-cursor" in connectedSignals
) )
336 cast(GCallback
)&callBackInsertAtCursor
,
340 connectedSignals
["insert-at-cursor"] = 1;
342 onInsertAtCursorListeners
~= dlg
;
344 extern(C
) static void callBackInsertAtCursor(GtkTextView
* textviewStruct
, gchar
* arg1
, TextView textView
)
346 bool consumed
= false;
348 foreach ( void delegate(char[], TextView
) dlg
; textView
.onInsertAtCursorListeners
)
350 dlg(Str
.toString(arg1
), textView
);
356 void delegate(GtkMovementStep
, gint
, gboolean
, TextView
)[] onMoveCursorListeners
;
357 void addOnMoveCursor(void delegate(GtkMovementStep
, gint
, gboolean
, TextView
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
359 if ( !("move-cursor" in connectedSignals
) )
364 cast(GCallback
)&callBackMoveCursor
,
368 connectedSignals
["move-cursor"] = 1;
370 onMoveCursorListeners
~= dlg
;
372 extern(C
) static void callBackMoveCursor(GtkTextView
* widgetStruct
, GtkMovementStep step
, gint count
, gboolean extendSelection
, TextView textView
)
374 bool consumed
= false;
376 foreach ( void delegate(GtkMovementStep
, gint
, gboolean
, TextView
) dlg
; textView
.onMoveCursorListeners
)
378 dlg(step
, count
, extendSelection
, textView
);
384 void delegate(GtkDirectionType
, TextView
)[] onMoveFocusListeners
;
385 void addOnMoveFocus(void delegate(GtkDirectionType
, TextView
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
387 if ( !("move-focus" in connectedSignals
) )
392 cast(GCallback
)&callBackMoveFocus
,
396 connectedSignals
["move-focus"] = 1;
398 onMoveFocusListeners
~= dlg
;
400 extern(C
) static void callBackMoveFocus(GtkTextView
* textviewStruct
, GtkDirectionType arg1
, TextView textView
)
402 bool consumed
= false;
404 foreach ( void delegate(GtkDirectionType
, TextView
) dlg
; textView
.onMoveFocusListeners
)
412 void delegate(GtkScrollStep
, gint
, TextView
)[] onMoveViewportListeners
;
413 void addOnMoveViewport(void delegate(GtkScrollStep
, gint
, TextView
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
415 if ( !("move-viewport" in connectedSignals
) )
420 cast(GCallback
)&callBackMoveViewport
,
424 connectedSignals
["move-viewport"] = 1;
426 onMoveViewportListeners
~= dlg
;
428 extern(C
) static void callBackMoveViewport(GtkTextView
* textviewStruct
, GtkScrollStep arg1
, gint arg2
, TextView textView
)
430 bool consumed
= false;
432 foreach ( void delegate(GtkScrollStep
, gint
, TextView
) dlg
; textView
.onMoveViewportListeners
)
434 dlg(arg1
, arg2
, textView
);
440 void delegate(gint
, gboolean
, TextView
)[] onPageHorizontallyListeners
;
441 void addOnPageHorizontally(void delegate(gint
, gboolean
, TextView
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
443 if ( !("page-horizontally" in connectedSignals
) )
448 cast(GCallback
)&callBackPageHorizontally
,
452 connectedSignals
["page-horizontally"] = 1;
454 onPageHorizontallyListeners
~= dlg
;
456 extern(C
) static void callBackPageHorizontally(GtkTextView
* textviewStruct
, gint arg1
, gboolean arg2
, TextView textView
)
458 bool consumed
= false;
460 foreach ( void delegate(gint
, gboolean
, TextView
) dlg
; textView
.onPageHorizontallyListeners
)
462 dlg(arg1
, arg2
, textView
);
468 void delegate(TextView
)[] onPasteClipboardListeners
;
469 void addOnPasteClipboard(void delegate(TextView
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
471 if ( !("paste-clipboard" in connectedSignals
) )
476 cast(GCallback
)&callBackPasteClipboard
,
480 connectedSignals
["paste-clipboard"] = 1;
482 onPasteClipboardListeners
~= dlg
;
484 extern(C
) static void callBackPasteClipboard(GtkTextView
* textviewStruct
, TextView textView
)
486 bool consumed
= false;
488 foreach ( void delegate(TextView
) dlg
; textView
.onPasteClipboardListeners
)
496 void delegate(GtkMenu
*, TextView
)[] onPopulatePopupListeners
;
497 void addOnPopulatePopup(void delegate(GtkMenu
*, TextView
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
499 if ( !("populate-popup" in connectedSignals
) )
504 cast(GCallback
)&callBackPopulatePopup
,
508 connectedSignals
["populate-popup"] = 1;
510 onPopulatePopupListeners
~= dlg
;
512 extern(C
) static void callBackPopulatePopup(GtkTextView
* textviewStruct
, GtkMenu
* arg1
, TextView textView
)
514 bool consumed
= false;
516 foreach ( void delegate(GtkMenu
*, TextView
) dlg
; textView
.onPopulatePopupListeners
)
524 void delegate(gboolean
, TextView
)[] onSelectAllListeners
;
525 void addOnSelectAll(void delegate(gboolean
, TextView
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
527 if ( !("select-all" in connectedSignals
) )
532 cast(GCallback
)&callBackSelectAll
,
536 connectedSignals
["select-all"] = 1;
538 onSelectAllListeners
~= dlg
;
540 extern(C
) static void callBackSelectAll(GtkTextView
* textviewStruct
, gboolean arg1
, TextView textView
)
542 bool consumed
= false;
544 foreach ( void delegate(gboolean
, TextView
) dlg
; textView
.onSelectAllListeners
)
552 void delegate(TextView
)[] onSetAnchorListeners
;
553 void addOnSetAnchor(void delegate(TextView
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
555 if ( !("set-anchor" in connectedSignals
) )
560 cast(GCallback
)&callBackSetAnchor
,
564 connectedSignals
["set-anchor"] = 1;
566 onSetAnchorListeners
~= dlg
;
568 extern(C
) static void callBackSetAnchor(GtkTextView
* textviewStruct
, TextView textView
)
570 bool consumed
= false;
572 foreach ( void delegate(TextView
) dlg
; textView
.onSetAnchorListeners
)
580 void delegate(GtkAdjustment
*, GtkAdjustment
*, TextView
)[] onSetScrollAdjustmentsListeners
;
581 void addOnSetScrollAdjustments(void delegate(GtkAdjustment
*, GtkAdjustment
*, TextView
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
583 if ( !("set-scroll-adjustments" in connectedSignals
) )
587 "set-scroll-adjustments",
588 cast(GCallback
)&callBackSetScrollAdjustments
,
592 connectedSignals
["set-scroll-adjustments"] = 1;
594 onSetScrollAdjustmentsListeners
~= dlg
;
596 extern(C
) static void callBackSetScrollAdjustments(GtkTextView
* textviewStruct
, GtkAdjustment
* arg1
, GtkAdjustment
* arg2
, TextView textView
)
598 bool consumed
= false;
600 foreach ( void delegate(GtkAdjustment
*, GtkAdjustment
*, TextView
) dlg
; textView
.onSetScrollAdjustmentsListeners
)
602 dlg(arg1
, arg2
, textView
);
608 void delegate(TextView
)[] onToggleOverwriteListeners
;
609 void addOnToggleOverwrite(void delegate(TextView
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
611 if ( !("toggle-overwrite" in connectedSignals
) )
616 cast(GCallback
)&callBackToggleOverwrite
,
620 connectedSignals
["toggle-overwrite"] = 1;
622 onToggleOverwriteListeners
~= dlg
;
624 extern(C
) static void callBackToggleOverwrite(GtkTextView
* textviewStruct
, TextView textView
)
626 bool consumed
= false;
628 foreach ( void delegate(TextView
) dlg
; textView
.onToggleOverwriteListeners
)
640 * Creates a new GtkTextView. If you don't call gtk_text_view_set_buffer()
641 * before using the text view, an empty default buffer will be created
642 * for you. Get the buffer with gtk_text_view_get_buffer(). If you want
643 * to specify your own buffer, consider gtk_text_view_new_with_buffer().
649 // GtkWidget* gtk_text_view_new (void);
650 this(cast(GtkTextView
*)gtk_text_view_new() );
654 * Creates a new GtkTextView widget displaying the buffer
655 * buffer. One buffer can be shared among many widgets.
656 * buffer may be NULL to create a default buffer, in which case
657 * this function is equivalent to gtk_text_view_new(). The
658 * text view adds its own reference count to the buffer; it does not
659 * take over an existing reference.
665 public this (TextBuffer buffer
)
667 // GtkWidget* gtk_text_view_new_with_buffer (GtkTextBuffer *buffer);
668 this(cast(GtkTextView
*)gtk_text_view_new_with_buffer((buffer
is null) ?
null : buffer
.getTextBufferStruct()) );
672 * Sets buffer as the buffer being displayed by text_view. The previous
673 * buffer displayed by the text view is unreferenced, and a reference is
674 * added to buffer. If you owned a reference to buffer before passing it
675 * to this function, you must remove that reference yourself; GtkTextView
676 * will not "adopt" it.
682 public void setBuffer(TextBuffer buffer
)
684 // void gtk_text_view_set_buffer (GtkTextView *text_view, GtkTextBuffer *buffer);
685 gtk_text_view_set_buffer(gtkTextView
, (buffer
is null) ?
null : buffer
.getTextBufferStruct());
689 * Returns the GtkTextBuffer being displayed by this text view.
690 * The reference count on the buffer is not incremented; the caller
691 * of this function won't own a new reference.
697 public TextBuffer
getBuffer()
699 // GtkTextBuffer* gtk_text_view_get_buffer (GtkTextView *text_view);
700 return new TextBuffer( gtk_text_view_get_buffer(gtkTextView
) );
704 * Scrolls text_view so that mark is on the screen in the position
705 * indicated by xalign and yalign. An alignment of 0.0 indicates
706 * left or top, 1.0 indicates right or bottom, 0.5 means center. If use_align
707 * is FALSE, the text scrolls the minimal distance to get the mark onscreen,
708 * possibly not scrolling at all. The effective screen for purposes
709 * of this function is reduced by a margin of size within_margin.
715 * margin as a [0.0,0.5) fraction of screen size
717 * whether to use alignment arguments (if FALSE, just get the mark onscreen)
719 * horizontal alignment of mark within visible area.
721 * vertical alignment of mark within visible area
723 public void scrollToMark(TextMark mark
, double withinMargin
, int useAlign
, double xalign
, double yalign
)
725 // void gtk_text_view_scroll_to_mark (GtkTextView *text_view, GtkTextMark *mark, gdouble within_margin, gboolean use_align, gdouble xalign, gdouble yalign);
726 gtk_text_view_scroll_to_mark(gtkTextView
, (mark
is null) ?
null : mark
.getTextMarkStruct(), withinMargin
, useAlign
, xalign
, yalign
);
730 * Scrolls text_view so that iter is on the screen in the position
731 * indicated by xalign and yalign. An alignment of 0.0 indicates
732 * left or top, 1.0 indicates right or bottom, 0.5 means center. If use_align
733 * is FALSE, the text scrolls the minimal distance to get the mark onscreen,
734 * possibly not scrolling at all. The effective screen for purposes
735 * of this function is reduced by a margin of size within_margin.
736 * NOTE: This function uses the currently-computed height of the
737 * lines in the text buffer. Note that line heights are computed
738 * in an idle handler; so this function may not have the desired effect
739 * if it's called before the height computations. To avoid oddness,
740 * consider using gtk_text_view_scroll_to_mark() which saves a point
741 * to be scrolled to after line validation.
747 * margin as a [0.0,0.5) fraction of screen size
749 * whether to use alignment arguments (if FALSE, just get the mark onscreen)
751 * horizontal alignment of mark within visible area.
753 * vertical alignment of mark within visible area
755 * TRUE if scrolling occurred
757 public int scrollToIter(TextIter iter
, double withinMargin
, int useAlign
, double xalign
, double yalign
)
759 // gboolean gtk_text_view_scroll_to_iter (GtkTextView *text_view, GtkTextIter *iter, gdouble within_margin, gboolean use_align, gdouble xalign, gdouble yalign);
760 return gtk_text_view_scroll_to_iter(gtkTextView
, (iter
is null) ?
null : iter
.getTextIterStruct(), withinMargin
, useAlign
, xalign
, yalign
);
764 * Scrolls text_view the minimum distance such that mark is contained
765 * within the visible area of the widget.
769 * a mark in the buffer for text_view
771 public void scrollMarkOnscreen(TextMark mark
)
773 // void gtk_text_view_scroll_mark_onscreen (GtkTextView *text_view, GtkTextMark *mark);
774 gtk_text_view_scroll_mark_onscreen(gtkTextView
, (mark
is null) ?
null : mark
.getTextMarkStruct());
778 * Moves a mark within the buffer so that it's
779 * located within the currently-visible text area.
785 * TRUE if the mark moved (wasn't already onscreen)
787 public int moveMarkOnscreen(TextMark mark
)
789 // gboolean gtk_text_view_move_mark_onscreen (GtkTextView *text_view, GtkTextMark *mark);
790 return gtk_text_view_move_mark_onscreen(gtkTextView
, (mark
is null) ?
null : mark
.getTextMarkStruct());
794 * Moves the cursor to the currently visible region of the
795 * buffer, it it isn't there already.
799 * TRUE if the cursor had to be moved.
801 public int placeCursorOnscreen()
803 // gboolean gtk_text_view_place_cursor_onscreen (GtkTextView *text_view);
804 return gtk_text_view_place_cursor_onscreen(gtkTextView
);
808 * Fills visible_rect with the currently-visible
809 * region of the buffer, in buffer coordinates. Convert to window coordinates
810 * with gtk_text_view_buffer_to_window_coords().
816 public void getVisibleRect(Rectangle visibleRect
)
818 // void gtk_text_view_get_visible_rect (GtkTextView *text_view, GdkRectangle *visible_rect);
819 gtk_text_view_get_visible_rect(gtkTextView
, (visibleRect
is null) ?
null : visibleRect
.getRectangleStruct());
823 * Gets a rectangle which roughly contains the character at iter.
824 * The rectangle position is in buffer coordinates; use
825 * gtk_text_view_buffer_to_window_coords() to convert these
826 * coordinates to coordinates for one of the windows in the text view.
832 * bounds of the character at iter
834 public void getIterLocation(TextIter iter
, Rectangle location
)
836 // void gtk_text_view_get_iter_location (GtkTextView *text_view, const GtkTextIter *iter, GdkRectangle *location);
837 gtk_text_view_get_iter_location(gtkTextView
, (iter
is null) ?
null : iter
.getTextIterStruct(), (location
is null) ?
null : location
.getRectangleStruct());
841 * Gets the GtkTextIter at the start of the line containing
842 * the coordinate y. y is in buffer coordinates, convert from
843 * window coordinates with gtk_text_view_window_to_buffer_coords().
844 * If non-NULL, line_top will be filled with the coordinate of the top
853 * return location for top coordinate of the line
855 public void getLineAtY(TextIter targetIter
, int y
, int* lineTop
)
857 // void gtk_text_view_get_line_at_y (GtkTextView *text_view, GtkTextIter *target_iter, gint y, gint *line_top);
858 gtk_text_view_get_line_at_y(gtkTextView
, (targetIter
is null) ?
null : targetIter
.getTextIterStruct(), y
, lineTop
);
862 * Gets the y coordinate of the top of the line containing iter,
863 * and the height of the line. The coordinate is a buffer coordinate;
864 * convert to window coordinates with gtk_text_view_buffer_to_window_coords().
870 * return location for a y coordinate
872 * return location for a height
874 public void getLineYrange(TextIter iter
, int* y
, int* height
)
876 // void gtk_text_view_get_line_yrange (GtkTextView *text_view, const GtkTextIter *iter, gint *y, gint *height);
877 gtk_text_view_get_line_yrange(gtkTextView
, (iter
is null) ?
null : iter
.getTextIterStruct(), y
, height
);
881 * Retrieves the iterator at buffer coordinates x and y. Buffer
882 * coordinates are coordinates for the entire buffer, not just the
883 * currently-displayed portion. If you have coordinates from an
884 * event, you have to convert those to buffer coordinates with
885 * gtk_text_view_window_to_buffer_coords().
891 * x position, in buffer coordinates
893 * y position, in buffer coordinates
895 public void getIterAtLocation(TextIter iter
, int x
, int y
)
897 // void gtk_text_view_get_iter_at_location (GtkTextView *text_view, GtkTextIter *iter, gint x, gint y);
898 gtk_text_view_get_iter_at_location(gtkTextView
, (iter
is null) ?
null : iter
.getTextIterStruct(), x
, y
);
902 * Retrieves the iterator pointing to the character at buffer
903 * coordinates x and y. Buffer coordinates are coordinates for
904 * the entire buffer, not just the currently-displayed portion.
905 * If you have coordinates from an event, you have to convert
906 * those to buffer coordinates with
907 * gtk_text_view_window_to_buffer_coords().
908 * Note that this is different from gtk_text_view_get_iter_at_location(),
909 * which returns cursor locations, i.e. positions between
916 * location to store an integer indicating where
917 * in the grapheme the user clicked. It will either be
918 * zero, or the number of characters in the grapheme.
919 * 0 represents the trailing edge of the grapheme.
921 * x position, in buffer coordinates
923 * y position, in buffer coordinates
926 public void getIterAtPosition(TextIter iter
, int* trailing
, int x
, int y
)
928 // void gtk_text_view_get_iter_at_position (GtkTextView *text_view, GtkTextIter *iter, gint *trailing, gint x, gint y);
929 gtk_text_view_get_iter_at_position(gtkTextView
, (iter
is null) ?
null : iter
.getTextIterStruct(), trailing
, x
, y
);
933 * Converts coordinate (buffer_x, buffer_y) to coordinates for the window
934 * win, and stores the result in (window_x, window_y).
935 * Note that you can't convert coordinates for a nonexisting window (see
936 * gtk_text_view_set_border_window_size()).
940 * a GtkTextWindowType except GTK_TEXT_WINDOW_PRIVATE
942 * buffer x coordinate
944 * buffer y coordinate
946 * window x coordinate return location
948 * window y coordinate return location
950 public void bufferToWindowCoords(GtkTextWindowType win
, int bufferX
, int bufferY
, int* windowX
, int* windowY
)
952 // 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);
953 gtk_text_view_buffer_to_window_coords(gtkTextView
, win
, bufferX
, bufferY
, windowX
, windowY
);
957 * Converts coordinates on the window identified by win to buffer
958 * coordinates, storing the result in (buffer_x,buffer_y).
959 * Note that you can't convert coordinates for a nonexisting window (see
960 * gtk_text_view_set_border_window_size()).
964 * a GtkTextWindowType except GTK_TEXT_WINDOW_PRIVATE
966 * window x coordinate
968 * window y coordinate
970 * buffer x coordinate return location
972 * buffer y coordinate return location
974 public void windowToBufferCoords(GtkTextWindowType win
, int windowX
, int windowY
, int* bufferX
, int* bufferY
)
976 // 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);
977 gtk_text_view_window_to_buffer_coords(gtkTextView
, win
, windowX
, windowY
, bufferX
, bufferY
);
981 * Retrieves the GdkWindow corresponding to an area of the text view;
982 * possible windows include the overall widget window, child windows
983 * on the left, right, top, bottom, and the window that displays the
984 * text buffer. Windows are NULL and nonexistent if their width or
985 * height is 0, and are nonexistent before the widget has been
992 * a GdkWindow, or NULL
994 public Window
getWindow(GtkTextWindowType win
)
996 // GdkWindow* gtk_text_view_get_window (GtkTextView *text_view, GtkTextWindowType win);
997 return new Window( gtk_text_view_get_window(gtkTextView
, win
) );
1001 * Usually used to find out which window an event corresponds to.
1002 * If you connect to an event signal on text_view, this function
1003 * should be called on event->window to
1004 * see which window it was.
1012 public GtkTextWindowType
getWindowType(Window window
)
1014 // GtkTextWindowType gtk_text_view_get_window_type (GtkTextView *text_view, GdkWindow *window);
1015 return gtk_text_view_get_window_type(gtkTextView
, (window
is null) ?
null : window
.getWindowStruct());
1019 * Sets the width of GTK_TEXT_WINDOW_LEFT or GTK_TEXT_WINDOW_RIGHT,
1020 * or the height of GTK_TEXT_WINDOW_TOP or GTK_TEXT_WINDOW_BOTTOM.
1021 * Automatically destroys the corresponding window if the size is set
1022 * to 0, and creates the window if the size is set to non-zero. This
1023 * function can only be used for the "border windows," it doesn't work
1024 * with GTK_TEXT_WINDOW_WIDGET, GTK_TEXT_WINDOW_TEXT, or
1025 * GTK_TEXT_WINDOW_PRIVATE.
1031 * width or height of the window
1033 public void setBorderWindowSize(GtkTextWindowType type
, int size
)
1035 // void gtk_text_view_set_border_window_size (GtkTextView *text_view, GtkTextWindowType type, gint size);
1036 gtk_text_view_set_border_window_size(gtkTextView
, type
, size
);
1040 * Gets the width of the specified border window. See
1041 * gtk_text_view_set_border_window_size().
1045 * window to return size from
1049 public int getBorderWindowSize(GtkTextWindowType type
)
1051 // gint gtk_text_view_get_border_window_size (GtkTextView *text_view, GtkTextWindowType type);
1052 return gtk_text_view_get_border_window_size(gtkTextView
, type
);
1056 * Moves the given iter forward by one display (wrapped) line. A
1057 * display line is different from a paragraph. Paragraphs are
1058 * separated by newlines or other paragraph separator characters.
1059 * Display lines are created by line-wrapping a paragraph. If
1060 * wrapping is turned off, display lines and paragraphs will be the
1061 * same. Display lines are divided differently for each view, since
1062 * they depend on the view's width; paragraphs are the same in all
1063 * views, since they depend on the contents of the GtkTextBuffer.
1069 * TRUE if iter was moved and is not on the end iterator
1071 public int forwardDisplayLine(TextIter iter
)
1073 // gboolean gtk_text_view_forward_display_line (GtkTextView *text_view, GtkTextIter *iter);
1074 return gtk_text_view_forward_display_line(gtkTextView
, (iter
is null) ?
null : iter
.getTextIterStruct());
1078 * Moves the given iter backward by one display (wrapped) line. A
1079 * display line is different from a paragraph. Paragraphs are
1080 * separated by newlines or other paragraph separator characters.
1081 * Display lines are created by line-wrapping a paragraph. If
1082 * wrapping is turned off, display lines and paragraphs will be the
1083 * same. Display lines are divided differently for each view, since
1084 * they depend on the view's width; paragraphs are the same in all
1085 * views, since they depend on the contents of the GtkTextBuffer.
1091 * TRUE if iter was moved and is not on the end iterator
1093 public int backwardDisplayLine(TextIter iter
)
1095 // gboolean gtk_text_view_backward_display_line (GtkTextView *text_view, GtkTextIter *iter);
1096 return gtk_text_view_backward_display_line(gtkTextView
, (iter
is null) ?
null : iter
.getTextIterStruct());
1100 * Moves the given iter forward to the next display line end. A
1101 * display line is different from a paragraph. Paragraphs are
1102 * separated by newlines or other paragraph separator characters.
1103 * Display lines are created by line-wrapping a paragraph. If
1104 * wrapping is turned off, display lines and paragraphs will be the
1105 * same. Display lines are divided differently for each view, since
1106 * they depend on the view's width; paragraphs are the same in all
1107 * views, since they depend on the contents of the GtkTextBuffer.
1113 * TRUE if iter was moved and is not on the end iterator
1115 public int forwardDisplayLineEnd(TextIter iter
)
1117 // gboolean gtk_text_view_forward_display_line_end (GtkTextView *text_view, GtkTextIter *iter);
1118 return gtk_text_view_forward_display_line_end(gtkTextView
, (iter
is null) ?
null : iter
.getTextIterStruct());
1122 * Moves the given iter backward to the next display line start. A
1123 * display line is different from a paragraph. Paragraphs are
1124 * separated by newlines or other paragraph separator characters.
1125 * Display lines are created by line-wrapping a paragraph. If
1126 * wrapping is turned off, display lines and paragraphs will be the
1127 * same. Display lines are divided differently for each view, since
1128 * they depend on the view's width; paragraphs are the same in all
1129 * views, since they depend on the contents of the GtkTextBuffer.
1135 * TRUE if iter was moved and is not on the end iterator
1137 public int backwardDisplayLineStart(TextIter iter
)
1139 // gboolean gtk_text_view_backward_display_line_start (GtkTextView *text_view, GtkTextIter *iter);
1140 return gtk_text_view_backward_display_line_start(gtkTextView
, (iter
is null) ?
null : iter
.getTextIterStruct());
1144 * Determines whether iter is at the start of a display line.
1145 * See gtk_text_view_forward_display_line() for an explanation of
1146 * display lines vs. paragraphs.
1152 * TRUE if iter begins a wrapped line
1154 public int startsDisplayLine(TextIter iter
)
1156 // gboolean gtk_text_view_starts_display_line (GtkTextView *text_view, const GtkTextIter *iter);
1157 return gtk_text_view_starts_display_line(gtkTextView
, (iter
is null) ?
null : iter
.getTextIterStruct());
1161 * Move the iterator a given number of characters visually, treating
1162 * it as the strong cursor position. If count is positive, then the
1163 * new strong cursor position will be count positions to the right of
1164 * the old cursor position. If count is negative then the new strong
1165 * cursor position will be count positions to the left of the old
1167 * In the presence of bidirection text, the correspondence
1168 * between logical and visual order will depend on the direction
1169 * of the current run, and there may be jumps when the cursor
1170 * is moved off of the end of a run.
1176 * number of characters to move (negative moves left, positive moves right)
1178 * TRUE if iter moved and is not on the end iterator
1180 public int moveVisually(TextIter iter
, int count
)
1182 // gboolean gtk_text_view_move_visually (GtkTextView *text_view, GtkTextIter *iter, gint count);
1183 return gtk_text_view_move_visually(gtkTextView
, (iter
is null) ?
null : iter
.getTextIterStruct(), count
);
1187 * Adds a child widget in the text buffer, at the given anchor.
1193 * a GtkTextChildAnchor in the GtkTextBuffer for text_view
1195 public void addChildAtAnchor(Widget child
, TextChildAnchor anchor
)
1197 // void gtk_text_view_add_child_at_anchor (GtkTextView *text_view, GtkWidget *child, GtkTextChildAnchor *anchor);
1198 gtk_text_view_add_child_at_anchor(gtkTextView
, (child
is null) ?
null : child
.getWidgetStruct(), (anchor
is null) ?
null : anchor
.getTextChildAnchorStruct());
1206 * Adds a child at fixed coordinates in one of the text widget's
1207 * windows. The window must have nonzero size (see
1208 * gtk_text_view_set_border_window_size()). Note that the child
1209 * coordinates are given relative to the GdkWindow in question, and
1210 * that these coordinates have no sane relationship to scrolling. When
1211 * placing a child in GTK_TEXT_WINDOW_WIDGET, scrolling is
1212 * irrelevant, the child floats above all scrollable areas. But when
1213 * placing a child in one of the scrollable windows (border windows or
1214 * text window), you'll need to compute the child's correct position
1215 * in buffer coordinates any time scrolling occurs or buffer changes
1216 * occur, and then call gtk_text_view_move_child() to update the
1217 * child's position. Unfortunately there's no good way to detect that
1218 * scrolling has occurred, using the current API; a possible hack
1219 * would be to update all child positions when the scroll adjustments
1220 * change or the text buffer changes. See bug 64518 on
1221 * bugzilla.gnome.org for status of fixing this issue.
1227 * which window the child should appear in
1229 * X position of child in window coordinates
1231 * Y position of child in window coordinates
1233 public void addChildInWindow(Widget child
, GtkTextWindowType whichWindow
, int xpos
, int ypos
)
1235 // void gtk_text_view_add_child_in_window (GtkTextView *text_view, GtkWidget *child, GtkTextWindowType which_window, gint xpos, gint ypos);
1236 gtk_text_view_add_child_in_window(gtkTextView
, (child
is null) ?
null : child
.getWidgetStruct(), whichWindow
, xpos
, ypos
);
1240 * Updates the position of a child, as for gtk_text_view_add_child_in_window().
1244 * child widget already added to the text view
1246 * new X position in window coordinates
1248 * new Y position in window coordinates
1250 public void moveChild(Widget child
, int xpos
, int ypos
)
1252 // void gtk_text_view_move_child (GtkTextView *text_view, GtkWidget *child, gint xpos, gint ypos);
1253 gtk_text_view_move_child(gtkTextView
, (child
is null) ?
null : child
.getWidgetStruct(), xpos
, ypos
);
1257 * Sets the line wrapping for the view.
1263 public void setWrapMode(GtkWrapMode wrapMode
)
1265 // void gtk_text_view_set_wrap_mode (GtkTextView *text_view, GtkWrapMode wrap_mode);
1266 gtk_text_view_set_wrap_mode(gtkTextView
, wrapMode
);
1270 * Gets the line wrapping for the view.
1274 * the line wrap setting
1276 public GtkWrapMode
getWrapMode()
1278 // GtkWrapMode gtk_text_view_get_wrap_mode (GtkTextView *text_view);
1279 return gtk_text_view_get_wrap_mode(gtkTextView
);
1283 * Sets the default editability of the GtkTextView. You can override
1284 * this default setting with tags in the buffer, using the "editable"
1285 * attribute of tags.
1289 * whether it's editable
1291 public void setEditable(int setting
)
1293 // void gtk_text_view_set_editable (GtkTextView *text_view, gboolean setting);
1294 gtk_text_view_set_editable(gtkTextView
, setting
);
1298 * Returns the default editability of the GtkTextView. Tags in the
1299 * buffer may override this setting for some ranges of text.
1303 * whether text is editable by default
1305 public int getEditable()
1307 // gboolean gtk_text_view_get_editable (GtkTextView *text_view);
1308 return gtk_text_view_get_editable(gtkTextView
);
1312 * Toggles whether the insertion point is displayed. A buffer with no editable
1313 * text probably shouldn't have a visible cursor, so you may want to turn
1318 * whether to show the insertion cursor
1320 public void setCursorVisible(int setting
)
1322 // void gtk_text_view_set_cursor_visible (GtkTextView *text_view, gboolean setting);
1323 gtk_text_view_set_cursor_visible(gtkTextView
, setting
);
1327 * Find out whether the cursor is being displayed.
1331 * whether the insertion mark is visible
1333 public int getCursorVisible()
1335 // gboolean gtk_text_view_get_cursor_visible (GtkTextView *text_view);
1336 return gtk_text_view_get_cursor_visible(gtkTextView
);
1340 * Changes the GtkTextView overwrite mode.
1344 * TRUE to turn on overwrite mode, FALSE to turn it off
1347 public void setOverwrite(int overwrite
)
1349 // void gtk_text_view_set_overwrite (GtkTextView *text_view, gboolean overwrite);
1350 gtk_text_view_set_overwrite(gtkTextView
, overwrite
);
1354 * Returns whether the GtkTextView is in overwrite mode or not.
1358 * whether text_view is in overwrite mode or not.
1361 public int getOverwrite()
1363 // gboolean gtk_text_view_get_overwrite (GtkTextView *text_view);
1364 return gtk_text_view_get_overwrite(gtkTextView
);
1368 * Sets the default number of blank pixels above paragraphs in text_view.
1369 * Tags in the buffer for text_view may override the defaults.
1372 * pixels_above_lines:
1373 * pixels above paragraphs
1375 public void setPixelsAboveLines(int pixelsAboveLines
)
1377 // void gtk_text_view_set_pixels_above_lines (GtkTextView *text_view, gint pixels_above_lines);
1378 gtk_text_view_set_pixels_above_lines(gtkTextView
, pixelsAboveLines
);
1382 * Gets the default number of pixels to put above paragraphs.
1386 * default number of pixels above paragraphs
1388 public int getPixelsAboveLines()
1390 // gint gtk_text_view_get_pixels_above_lines (GtkTextView *text_view);
1391 return gtk_text_view_get_pixels_above_lines(gtkTextView
);
1395 * Sets the default number of pixels of blank space
1396 * to put below paragraphs in text_view. May be overridden
1397 * by tags applied to text_view's buffer.
1400 * pixels_below_lines:
1401 * pixels below paragraphs
1403 public void setPixelsBelowLines(int pixelsBelowLines
)
1405 // void gtk_text_view_set_pixels_below_lines (GtkTextView *text_view, gint pixels_below_lines);
1406 gtk_text_view_set_pixels_below_lines(gtkTextView
, pixelsBelowLines
);
1410 * Gets the value set by gtk_text_view_set_pixels_below_lines().
1414 * default number of blank pixels below paragraphs
1416 public int getPixelsBelowLines()
1418 // gint gtk_text_view_get_pixels_below_lines (GtkTextView *text_view);
1419 return gtk_text_view_get_pixels_below_lines(gtkTextView
);
1423 * Sets the default number of pixels of blank space to leave between
1424 * display/wrapped lines within a paragraph. May be overridden by
1425 * tags in text_view's buffer.
1428 * pixels_inside_wrap:
1429 * default number of pixels between wrapped lines
1431 public void setPixelsInsideWrap(int pixelsInsideWrap
)
1433 // void gtk_text_view_set_pixels_inside_wrap (GtkTextView *text_view, gint pixels_inside_wrap);
1434 gtk_text_view_set_pixels_inside_wrap(gtkTextView
, pixelsInsideWrap
);
1438 * Gets the value set by gtk_text_view_set_pixels_inside_wrap().
1442 * default number of pixels of blank space between wrapped lines
1444 public int getPixelsInsideWrap()
1446 // gint gtk_text_view_get_pixels_inside_wrap (GtkTextView *text_view);
1447 return gtk_text_view_get_pixels_inside_wrap(gtkTextView
);
1451 * Sets the default justification of text in text_view.
1452 * Tags in the view's buffer may override the default.
1458 public void setJustification(GtkJustification justification
)
1460 // void gtk_text_view_set_justification (GtkTextView *text_view, GtkJustification justification);
1461 gtk_text_view_set_justification(gtkTextView
, justification
);
1465 * Gets the default justification of paragraphs in text_view.
1466 * Tags in the buffer may override the default.
1470 * default justification
1472 public GtkJustification
getJustification()
1474 // GtkJustification gtk_text_view_get_justification (GtkTextView *text_view);
1475 return gtk_text_view_get_justification(gtkTextView
);
1479 * Sets the default left margin for text in text_view.
1480 * Tags in the buffer may override the default.
1484 * left margin in pixels
1486 public void setLeftMargin(int leftMargin
)
1488 // void gtk_text_view_set_left_margin (GtkTextView *text_view, gint left_margin);
1489 gtk_text_view_set_left_margin(gtkTextView
, leftMargin
);
1493 * Gets the default left margin size of paragraphs in the text_view.
1494 * Tags in the buffer may override the default.
1498 * left margin in pixels
1500 public int getLeftMargin()
1502 // gint gtk_text_view_get_left_margin (GtkTextView *text_view);
1503 return gtk_text_view_get_left_margin(gtkTextView
);
1507 * Sets the default right margin for text in the text view.
1508 * Tags in the buffer may override the default.
1512 * right margin in pixels
1514 public void setRightMargin(int rightMargin
)
1516 // void gtk_text_view_set_right_margin (GtkTextView *text_view, gint right_margin);
1517 gtk_text_view_set_right_margin(gtkTextView
, rightMargin
);
1521 * Gets the default right margin for text in text_view. Tags
1522 * in the buffer may override the default.
1526 * right margin in pixels
1528 public int getRightMargin()
1530 // gint gtk_text_view_get_right_margin (GtkTextView *text_view);
1531 return gtk_text_view_get_right_margin(gtkTextView
);
1535 * Sets the default indentation for paragraphs in text_view.
1536 * Tags in the buffer may override the default.
1540 * indentation in pixels
1542 public void setIndent(int indent
)
1544 // void gtk_text_view_set_indent (GtkTextView *text_view, gint indent);
1545 gtk_text_view_set_indent(gtkTextView
, indent
);
1549 * Gets the default indentation of paragraphs in text_view.
1550 * Tags in the view's buffer may override the default.
1551 * The indentation may be negative.
1555 * number of pixels of indentation
1557 public int getIndent()
1559 // gint gtk_text_view_get_indent (GtkTextView *text_view);
1560 return gtk_text_view_get_indent(gtkTextView
);
1564 * Sets the default tab stops for paragraphs in text_view.
1565 * Tags in the buffer may override the default.
1569 * tabs as a PangoTabArray
1571 public void setTabs(PgTabArray tabs
)
1573 // void gtk_text_view_set_tabs (GtkTextView *text_view, PangoTabArray *tabs);
1574 gtk_text_view_set_tabs(gtkTextView
, (tabs
is null) ?
null : tabs
.getPgTabArrayStruct());
1578 * Gets the default tabs for text_view. Tags in the buffer may
1579 * override the defaults. The returned array will be NULL if
1580 * "standard" (8-space) tabs are used. Free the return value
1581 * with pango_tab_array_free().
1585 * copy of default tab array, or NULL if "standard" tabs are used; must be freed with pango_tab_array_free().
1587 public PgTabArray
getTabs()
1589 // PangoTabArray* gtk_text_view_get_tabs (GtkTextView *text_view);
1590 return new PgTabArray( gtk_text_view_get_tabs(gtkTextView
) );
1594 * Sets the behavior of the text widget when the Tab key is pressed. If accepts_tab
1595 * is TRUE a tab character is inserted. If accepts_tab is FALSE the keyboard focus
1596 * is moved to the next widget in the focus chain.
1600 * TRUE if pressing the Tab key should insert a tab character, FALSE, if pressing the Tab key should move the keyboard focus.
1603 public void setAcceptsTab(int acceptsTab
)
1605 // void gtk_text_view_set_accepts_tab (GtkTextView *text_view, gboolean accepts_tab);
1606 gtk_text_view_set_accepts_tab(gtkTextView
, acceptsTab
);
1610 * Returns whether pressing the Tab key inserts a tab characters.
1611 * gtk_text_view_set_accepts_tab().
1615 * TRUE if pressing the Tab key inserts a tab character, FALSE if pressing the Tab key moves the keyboard focus.
1618 public int getAcceptsTab()
1620 // gboolean gtk_text_view_get_accepts_tab (GtkTextView *text_view);
1621 return gtk_text_view_get_accepts_tab(gtkTextView
);
1625 * Obtains a copy of the default text attributes. These are the
1626 * attributes used for text unless a tag overrides them.
1627 * You'd typically pass the default attributes in to
1628 * gtk_text_iter_get_attributes() in order to get the
1629 * attributes in effect at a given text position.
1630 * The return value is a copy owned by the caller of this function,
1631 * and should be freed.
1635 * a new GtkTextAttributes
1637 public TextAttributes
getDefaultAttributes()
1639 // GtkTextAttributes* gtk_text_view_get_default_attributes (GtkTextView *text_view);
1640 return new TextAttributes( gtk_text_view_get_default_attributes(gtkTextView
) );