SourceView

Description GtkSourceView is the main object of the gtksourceview library. It provides a text view which syntax highlighting, undo/redo and text marks. Use a GtkSourceBuffer to display text with a GtkSourceView.

class SourceView : TextView {}

Constructors

this
this(GtkSourceView* gtkSourceView)

Sets our main struct and passes it to the parent class

this
this()

Creates a new GtkSourceView. An empty default buffer will be created for you. If you want to specify your own buffer, consider gtk_source_view_new_with_buffer().

this
this(SourceBuffer buffer)

Creates a new GtkSourceView widget displaying the buffer buffer. One buffer can be shared among many widgets.

Members

Functions

addOnLineMarkActivated
void addOnLineMarkActivated(void delegate(TextIter, GdkEvent*, SourceView) dlg, ConnectFlags connectFlags)

Emitted when a line mark has been activated (for instance when there was a button press in the line marks gutter). You can use iter to determine on which line the activation took place.

addOnMoveLines
void addOnMoveLines(void delegate(gboolean, gint, SourceView) dlg, ConnectFlags connectFlags)
addOnRedo
void addOnRedo(void delegate(SourceView) dlg, ConnectFlags connectFlags)
addOnShowCompletion
void addOnShowCompletion(void delegate(SourceView) dlg, ConnectFlags connectFlags)

The ::show-completion signal is a keybinding signal which gets emitted when the user initiates a completion in default mode. Applications should not connect to it, but may emit it with g_signal_emit_by_name if they need to control the default mode completion activation.

addOnUndo
void addOnUndo(void delegate(SourceView) dlg, ConnectFlags connectFlags)

See Also GtkTextView,GtkSourceBuffer

getAutoIndent
int getAutoIndent()

Returns whether auto indentation of text is enabled.

getBuffer
SourceBuffer getBuffer()

Returns the GtkSourceBuffer being displayed by this source view. The reference count on the buffer is not incremented; the caller of this function won't own a new reference.

getCompletion
GtkSourceCompletion* getCompletion()

Gets the GtkSourceCompletion associated with view.

getDrawSpaces
GtkSourceDrawSpacesFlags getDrawSpaces()

Returns the GtkSourceDrawSpacesFlags specifying if and how spaces should be displayed for this view.

getGutter
SourceGutter getGutter(GtkTextWindowType windowType)

Returns the GtkSourceGutter object associated with window_type for view. Only GTK_TEXT_WINDOW_LEFT and GTK_TEXT_WINDOW_RIGHT are supported, respectively corresponding to the left and right gutter. The line numbers and mark category icons are rendered in the gutter corresponding to GTK_TEXT_WINDOW_LEFT. Since 2.8

getHighlightCurrentLine
int getHighlightCurrentLine()

Returns whether the current line is highlighted

getIndentOnTab
int getIndentOnTab()

Returns whether when the tab key is pressed the current selection should get indented instead of replaced with the \t character. Since 1.8

getIndentWidth
int getIndentWidth()

Returns the number of spaces to use for each step of indent. See gtk_source_view_set_indent_width() for details.

getInsertSpacesInsteadOfTabs
int getInsertSpacesInsteadOfTabs()

Returns whether when inserting a tabulator character it should be replaced by a group of space characters.

getMarkCategoryBackground
int getMarkCategoryBackground(string category, Color dest)

Gets the background color associated with given category. Since 2.4

getMarkCategoryPixbuf
Pixbuf getMarkCategoryPixbuf(string category)

Warning gtk_source_view_get_mark_category_pixbuf is deprecated and should not be used in newly-written code. Gets the pixbuf which is associated with the given mark category. Since 2.2

getMarkCategoryPriority
int getMarkCategoryPriority(string category)

Gets the priority which is associated with the given category. Since 2.2

getRightMarginPosition
uint getRightMarginPosition()

Gets the position of the right margin in the given view.

getShowLineMarks
int getShowLineMarks()

Returns whether line marks are displayed beside the text. Since 2.2

getShowLineNumbers
int getShowLineNumbers()

Returns whether line numbers are displayed beside the text.

getShowRightMargin
int getShowRightMargin()

Returns whether a right margin is displayed.

getSmartHomeEnd
GtkSourceSmartHomeEndType getSmartHomeEnd()

Returns a GtkSourceSmartHomeEndType end value specifying how the cursor will move when HOME and END keys are pressed.

getSourceViewStruct
GtkSourceView* getSourceViewStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

getTabWidth
uint getTabWidth()

Returns the width of tabulation in characters.

setAutoIndent
void setAutoIndent(int enable)

If TRUE auto indentation of text is enabled.

setDrawSpaces
void setDrawSpaces(GtkSourceDrawSpacesFlags flags)

Set if and how the spaces should be visualized. Specifying flags as 0 will disable display of spaces.

setHighlightCurrentLine
void setHighlightCurrentLine(int show)

If show is TRUE the current line is highlighted.

setIndentOnTab
void setIndentOnTab(int enable)

If TRUE, when the tab key is pressed and there is a selection, the selected text is indented of one level instead of being replaced with the \t characters. Shift+Tab unindents the selection. Since 1.8

setIndentWidth
void setIndentWidth(int width)

Sets the number of spaces to use for each step of indent. If width is -1, the value of the GtkSourceView::tab-width property will be used.

setInsertSpacesInsteadOfTabs
void setInsertSpacesInsteadOfTabs(int enable)

If TRUE any tabulator character inserted is replaced by a group of space characters.

setMarkCategoryBackground
void setMarkCategoryBackground(string category, Color color)

Sets given background color for mark category. If color is NULL, the background color is unset. Since 2.4

setMarkCategoryIconFromIconName
void setMarkCategoryIconFromIconName(string category, string name)

Sets the icon to be used for category to the named theme item name. If name is NULL, the icon is unset. Since 2.8

setMarkCategoryIconFromPixbuf
void setMarkCategoryIconFromPixbuf(string category, Pixbuf pixbuf)

Sets the icon to be used for category to pixbuf. If pixbuf is NULL, the icon is unset. Since 2.8

setMarkCategoryIconFromStock
void setMarkCategoryIconFromStock(string category, string stockId)

Sets the icon to be used for category to the stock item stock_id. If stock_id is NULL, the icon is unset. Since 2.8

setMarkCategoryPixbuf
void setMarkCategoryPixbuf(string category, Pixbuf pixbuf)

Warning 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 Associates a given pixbuf with a given mark category. If pixbuf is NULL, the pixbuf is unset. Since 2.2

setMarkCategoryPriority
void setMarkCategoryPriority(string category, int priority)

Set the priority for the given mark category. When there are multiple marks on the same line, marks of categories with higher priorities will be drawn on top. Since 2.2

setMarkCategoryTooltipFunc
void setMarkCategoryTooltipFunc(string category, GtkSourceViewMarkTooltipFunc func, void* userData, GDestroyNotify userDataNotify)

Set a GtkSourceViewMarkTooltipFunc used to set tooltip on marks from the given mark category. If you also specified a function with gtk_source_view_set_mark_category_tooltip_markup_func() the markup variant takes precedence. Since 2.8

setMarkCategoryTooltipMarkupFunc
void setMarkCategoryTooltipMarkupFunc(string category, GtkSourceViewMarkTooltipFunc markupFunc, void* userData, GDestroyNotify userDataNotify)

See gtk_source_view_set_mark_category_tooltip_func() for more information. Since 2.8

setRightMarginPosition
void setRightMarginPosition(uint pos)

Sets the position of the right margin in the given view.

setShowLineMarks
void setShowLineMarks(int show)

If TRUE line marks will be displayed beside the text. Since 2.2

setShowLineNumbers
void setShowLineNumbers(int show)

If TRUE line numbers will be displayed beside the text.

setShowRightMargin
void setShowRightMargin(int show)

If TRUE a right margin is displayed

setSmartHomeEnd
void setSmartHomeEnd(GtkSourceSmartHomeEndType smartHe)

Set the desired movement of the cursor when HOME and END keys are pressed.

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
setTabWidth
void setTabWidth(uint width)

Sets the width of tabulation in characters.

Static functions

callBackLineMarkActivated
void callBackLineMarkActivated(GtkSourceView* viewStruct, GtkTextIter* iter, GdkEvent* event, SourceView _sourceView)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackMoveLines
void callBackMoveLines(GtkSourceView* sourceviewStruct, gboolean arg1, gint arg2, SourceView _sourceView)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackRedo
void callBackRedo(GtkSourceView* sourceviewStruct, SourceView _sourceView)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackShowCompletion
void callBackShowCompletion(GtkSourceView* viewStruct, SourceView _sourceView)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackUndo
void callBackUndo(GtkSourceView* sourceviewStruct, SourceView _sourceView)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

connectedSignals
int[string] connectedSignals;
gtkSourceView
GtkSourceView* gtkSourceView;

the main Gtk struct

onLineMarkActivatedListeners
void delegate(TextIter, GdkEvent*, SourceView)[] onLineMarkActivatedListeners;
Undocumented in source.
onMoveLinesListeners
void delegate(gboolean, gint, SourceView)[] onMoveLinesListeners;
Undocumented in source.
onRedoListeners
void delegate(SourceView)[] onRedoListeners;
Undocumented in source.
onShowCompletionListeners
void delegate(SourceView)[] onShowCompletionListeners;
Undocumented in source.
onUndoListeners
void delegate(SourceView)[] onUndoListeners;
Undocumented in source.

Inherited Members

From TextView

gtkTextView
GtkTextView* gtkTextView;

the main Gtk struct

getTextViewStruct
GtkTextView* getTextViewStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
getLineTextAt
string getLineTextAt(gint y)

Get the text line at the pixel y

insertText
void insertText(string text)

Simply appends some on the cursor position

appendText
void appendText(string text, bool ensureVisible)

Simply appends some text to this view

connectedSignals
int[string] connectedSignals;
onBackspaceListeners
void delegate(TextView)[] onBackspaceListeners;
Undocumented in source.
addOnBackspace
void addOnBackspace(void delegate(TextView) dlg, ConnectFlags connectFlags)

The ::backspace signal is a keybinding signal which gets emitted when the user asks for it. The default bindings for this signal are Backspace and Shift-Backspace.

callBackBackspace
void callBackBackspace(GtkTextView* textViewStruct, TextView _textView)
Undocumented in source. Be warned that the author may not have intended to support it.
onCopyClipboardListeners
void delegate(TextView)[] onCopyClipboardListeners;
Undocumented in source.
addOnCopyClipboard
void addOnCopyClipboard(void delegate(TextView) dlg, ConnectFlags connectFlags)

The ::copy-clipboard signal is a keybinding signal which gets emitted to copy the selection to the clipboard. The default bindings for this signal are Ctrl-c and Ctrl-Insert.

callBackCopyClipboard
void callBackCopyClipboard(GtkTextView* textViewStruct, TextView _textView)
Undocumented in source. Be warned that the author may not have intended to support it.
onCutClipboardListeners
void delegate(TextView)[] onCutClipboardListeners;
Undocumented in source.
addOnCutClipboard
void addOnCutClipboard(void delegate(TextView) dlg, ConnectFlags connectFlags)

The ::cut-clipboard signal is a keybinding signal which gets emitted to cut the selection to the clipboard. The default bindings for this signal are Ctrl-x and Shift-Delete.

callBackCutClipboard
void callBackCutClipboard(GtkTextView* textViewStruct, TextView _textView)
Undocumented in source. Be warned that the author may not have intended to support it.
onDeleteFromCursorListeners
void delegate(GtkDeleteType, gint, TextView)[] onDeleteFromCursorListeners;
Undocumented in source.
addOnDeleteFromCursor
void addOnDeleteFromCursor(void delegate(GtkDeleteType, gint, TextView) dlg, ConnectFlags connectFlags)

The ::delete-from-cursor signal is a keybinding signal which gets emitted when the user initiates a text deletion. If the type is GTK_DELETE_CHARS, GTK+ deletes the selection if there is one, otherwise it deletes the requested number of characters. The default bindings for this signal are Delete for deleting a character, Ctrl-Delete for deleting a word and Ctrl-Backspace for deleting a word backwords.

callBackDeleteFromCursor
void callBackDeleteFromCursor(GtkTextView* textViewStruct, GtkDeleteType type, gint count, TextView _textView)
Undocumented in source. Be warned that the author may not have intended to support it.
onInsertAtCursorListeners
void delegate(string, TextView)[] onInsertAtCursorListeners;
Undocumented in source.
addOnInsertAtCursor
void addOnInsertAtCursor(void delegate(string, TextView) dlg, ConnectFlags connectFlags)

The ::insert-at-cursor signal is a keybinding signal which gets emitted when the user initiates the insertion of a fixed string at the cursor. This signal has no default bindings.

callBackInsertAtCursor
void callBackInsertAtCursor(GtkTextView* textViewStruct, gchar* str, TextView _textView)
Undocumented in source. Be warned that the author may not have intended to support it.
onMoveCursorListeners
void delegate(GtkMovementStep, gint, gboolean, TextView)[] onMoveCursorListeners;
Undocumented in source.
addOnMoveCursor
void addOnMoveCursor(void delegate(GtkMovementStep, gint, gboolean, TextView) dlg, ConnectFlags connectFlags)

The ::move-cursor signal is a keybinding signal which gets emitted when the user initiates a cursor movement. If the cursor is not visible in text_view, this signal causes the viewport to be moved instead. Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control the cursor programmatically. The default bindings for this signal come in two variants, the variant with the Shift modifier extends the selection, the variant without the Shift modifer does not. There are too many key combinations to list them all here. Arrow keys move by individual characters/lines Ctrl-arrow key combinations move by words/paragraphs Home/End keys move to the ends of the buffer PageUp/PageDown keys move vertically by pages Ctrl-PageUp/PageDown keys move horizontally by pages TRUE if the move should extend the selection

callBackMoveCursor
void callBackMoveCursor(GtkTextView* textViewStruct, GtkMovementStep step, gint count, gboolean extendSelection, TextView _textView)
Undocumented in source. Be warned that the author may not have intended to support it.
onMoveViewportListeners
void delegate(GtkScrollStep, gint, TextView)[] onMoveViewportListeners;
Undocumented in source.
addOnMoveViewport
void addOnMoveViewport(void delegate(GtkScrollStep, gint, TextView) dlg, ConnectFlags connectFlags)

The ::move-viewport signal is a keybinding signal which can be bound to key combinations to allow the user to move the viewport, i.e. change what part of the text view is visible in a containing scrolled window. There are no default bindings for this signal.

callBackMoveViewport
void callBackMoveViewport(GtkTextView* textViewStruct, GtkScrollStep step, gint count, TextView _textView)
Undocumented in source. Be warned that the author may not have intended to support it.
onPageHorizontallyListeners
void delegate(gint, gboolean, TextView)[] onPageHorizontallyListeners;
Undocumented in source.
addOnPageHorizontally
void addOnPageHorizontally(void delegate(gint, gboolean, TextView) dlg, ConnectFlags connectFlags)

The ::page-horizontally signal is a keybinding signal which can be bound to key combinations to allow the user to initiate horizontal cursor movement by pages. This signal should not be used anymore, instead use the "move-cursor" signal with the GTK_MOVEMENT_HORIZONTAL_PAGES granularity. TRUE if the move should extend the selection

callBackPageHorizontally
void callBackPageHorizontally(GtkTextView* textViewStruct, gint count, gboolean extendSelection, TextView _textView)
Undocumented in source. Be warned that the author may not have intended to support it.
onPasteClipboardListeners
void delegate(TextView)[] onPasteClipboardListeners;
Undocumented in source.
addOnPasteClipboard
void addOnPasteClipboard(void delegate(TextView) dlg, ConnectFlags connectFlags)

The ::paste-clipboard signal is a keybinding signal which gets emitted to paste the contents of the clipboard into the text view. The default bindings for this signal are Ctrl-v and Shift-Insert.

callBackPasteClipboard
void callBackPasteClipboard(GtkTextView* textViewStruct, TextView _textView)
Undocumented in source. Be warned that the author may not have intended to support it.
onPopulatePopupListeners
void delegate(GtkMenu*, TextView)[] onPopulatePopupListeners;
Undocumented in source.
addOnPopulatePopup
void addOnPopulatePopup(void delegate(GtkMenu*, TextView) dlg, ConnectFlags connectFlags)

The ::populate-popup signal gets emitted before showing the context menu of the text view. If you need to add items to the context menu, connect to this signal and append your menuitems to the menu.

callBackPopulatePopup
void callBackPopulatePopup(GtkTextView* entryStruct, GtkMenu* menu, TextView _textView)
Undocumented in source. Be warned that the author may not have intended to support it.
onPreeditChangedListeners
void delegate(string, TextView)[] onPreeditChangedListeners;
Undocumented in source.
addOnPreeditChanged
void addOnPreeditChanged(void delegate(string, TextView) dlg, ConnectFlags connectFlags)

If an input method is used, the typed text will not immediately be committed to the buffer. So if you are interested in the text, connect to this signal. This signal is only emitted if the text at the given position is actually editable. Since 2.20

callBackPreeditChanged
void callBackPreeditChanged(GtkTextView* textViewStruct, gchar* preedit, TextView _textView)
Undocumented in source. Be warned that the author may not have intended to support it.
onSelectAllListeners
void delegate(gboolean, TextView)[] onSelectAllListeners;
Undocumented in source.
addOnSelectAll
void addOnSelectAll(void delegate(gboolean, TextView) dlg, ConnectFlags connectFlags)

The ::select-all signal is a keybinding signal which gets emitted to select or unselect the complete contents of the text view. The default bindings for this signal are Ctrl-a and Ctrl-/ for selecting and Shift-Ctrl-a and Ctrl-\ for unselecting. TRUE to select, FALSE to unselect

callBackSelectAll
void callBackSelectAll(GtkTextView* textViewStruct, gboolean select, TextView _textView)
Undocumented in source. Be warned that the author may not have intended to support it.
onSetAnchorListeners
void delegate(TextView)[] onSetAnchorListeners;
Undocumented in source.
addOnSetAnchor
void addOnSetAnchor(void delegate(TextView) dlg, ConnectFlags connectFlags)

The ::set-anchor signal is a keybinding signal which gets emitted when the user initiates setting the "anchor" mark. The "anchor" mark gets placed at the same position as the "insert" mark. This signal has no default bindings.

callBackSetAnchor
void callBackSetAnchor(GtkTextView* textViewStruct, TextView _textView)
Undocumented in source. Be warned that the author may not have intended to support it.
onSetScrollAdjustmentsListeners
void delegate(Adjustment, Adjustment, TextView)[] onSetScrollAdjustmentsListeners;
Undocumented in source.
addOnSetScrollAdjustments
void addOnSetScrollAdjustments(void delegate(Adjustment, Adjustment, TextView) dlg, ConnectFlags connectFlags)

Set the scroll adjustments for the text view. Usually scrolled containers like GtkScrolledWindow will emit this signal to connect two instances of GtkScrollbar to the scroll directions of the GtkTextView.

callBackSetScrollAdjustments
void callBackSetScrollAdjustments(GtkTextView* horizontalStruct, GtkAdjustment* vertical, GtkAdjustment* arg2, TextView _textView)
Undocumented in source. Be warned that the author may not have intended to support it.
onToggleCursorVisibleListeners
void delegate(TextView)[] onToggleCursorVisibleListeners;
Undocumented in source.
addOnToggleCursorVisible
void addOnToggleCursorVisible(void delegate(TextView) dlg, ConnectFlags connectFlags)

The ::toggle-cursor-visible signal is a keybinding signal which gets emitted to toggle the visibility of the cursor. The default binding for this signal is F7.

callBackToggleCursorVisible
void callBackToggleCursorVisible(GtkTextView* textViewStruct, TextView _textView)
Undocumented in source. Be warned that the author may not have intended to support it.
onToggleOverwriteListeners
void delegate(TextView)[] onToggleOverwriteListeners;
Undocumented in source.
addOnToggleOverwrite
void addOnToggleOverwrite(void delegate(TextView) dlg, ConnectFlags connectFlags)

The ::toggle-overwrite signal is a keybinding signal which gets emitted to toggle the overwrite mode of the text view. The default bindings for this signal is Insert. See Also GtkTextBuffer, GtkTextIter

callBackToggleOverwrite
void callBackToggleOverwrite(GtkTextView* textViewStruct, TextView _textView)
Undocumented in source. Be warned that the author may not have intended to support it.
setBuffer
void setBuffer(TextBuffer buffer)

Sets buffer as the buffer being displayed by text_view. The previous buffer displayed by the text view is unreferenced, and a reference is added to buffer. If you owned a reference to buffer before passing it to this function, you must remove that reference yourself; GtkTextView will not "adopt" it.

getBuffer
TextBuffer getBuffer()

Returns the GtkTextBuffer being displayed by this text view. The reference count on the buffer is not incremented; the caller of this function won't own a new reference.

scrollToMark
void scrollToMark(TextMark mark, double withinMargin, int useAlign, double xalign, double yalign)

Scrolls text_view so that mark is on the screen in the position indicated by xalign and yalign. An alignment of 0.0 indicates left or top, 1.0 indicates right or bottom, 0.5 means center. If use_align is FALSE, the text scrolls the minimal distance to get the mark onscreen, possibly not scrolling at all. The effective screen for purposes of this function is reduced by a margin of size within_margin.

scrollToIter
int scrollToIter(TextIter iter, double withinMargin, int useAlign, double xalign, double yalign)

Scrolls text_view so that iter is on the screen in the position indicated by xalign and yalign. An alignment of 0.0 indicates left or top, 1.0 indicates right or bottom, 0.5 means center. If use_align is FALSE, the text scrolls the minimal distance to get the mark onscreen, possibly not scrolling at all. The effective screen for purposes of this function is reduced by a margin of size within_margin. Note that this function uses the currently-computed height of the lines in the text buffer. Line heights are computed in an idle handler; so this function may not have the desired effect if it's called before the height computations. To avoid oddness, consider using gtk_text_view_scroll_to_mark() which saves a point to be scrolled to after line validation.

scrollMarkOnscreen
void scrollMarkOnscreen(TextMark mark)

Scrolls text_view the minimum distance such that mark is contained within the visible area of the widget.

moveMarkOnscreen
int moveMarkOnscreen(TextMark mark)

Moves a mark within the buffer so that it's located within the currently-visible text area.

placeCursorOnscreen
int placeCursorOnscreen()

Moves the cursor to the currently visible region of the buffer, it it isn't there already.

getVisibleRect
void getVisibleRect(Rectangle visibleRect)

Fills visible_rect with the currently-visible region of the buffer, in buffer coordinates. Convert to window coordinates with gtk_text_view_buffer_to_window_coords().

getIterLocation
void getIterLocation(TextIter iter, Rectangle location)

Gets a rectangle which roughly contains the character at iter. The rectangle position is in buffer coordinates; use gtk_text_view_buffer_to_window_coords() to convert these coordinates to coordinates for one of the windows in the text view.

getLineAtY
void getLineAtY(TextIter targetIter, int y, int lineTop)

Gets the GtkTextIter at the start of the line containing the coordinate y. y is in buffer coordinates, convert from window coordinates with gtk_text_view_window_to_buffer_coords(). If non-NULL, line_top will be filled with the coordinate of the top edge of the line.

getLineYrange
void getLineYrange(TextIter iter, int y, int height)

Gets the y coordinate of the top of the line containing iter, and the height of the line. The coordinate is a buffer coordinate; convert to window coordinates with gtk_text_view_buffer_to_window_coords().

getIterAtLocation
void getIterAtLocation(TextIter iter, int x, int y)

Retrieves the iterator at buffer coordinates x and y. Buffer coordinates are coordinates for the entire buffer, not just the currently-displayed portion. If you have coordinates from an event, you have to convert those to buffer coordinates with gtk_text_view_window_to_buffer_coords().

getIterAtPosition
void getIterAtPosition(TextIter iter, int trailing, int x, int y)

Retrieves the iterator pointing to the character at buffer coordinates x and y. Buffer coordinates are coordinates for the entire buffer, not just the currently-displayed portion. If you have coordinates from an event, you have to convert those to buffer coordinates with gtk_text_view_window_to_buffer_coords(). Note that this is different from gtk_text_view_get_iter_at_location(), which returns cursor locations, i.e. positions between characters. Since 2.6

bufferToWindowCoords
void bufferToWindowCoords(GtkTextWindowType win, int bufferX, int bufferY, int windowX, int windowY)

Converts coordinate (buffer_x, buffer_y) to coordinates for the window win, and stores the result in (window_x, window_y). Note that you can't convert coordinates for a nonexisting window (see gtk_text_view_set_border_window_size()).

windowToBufferCoords
void windowToBufferCoords(GtkTextWindowType win, int windowX, int windowY, int bufferX, int bufferY)

Converts coordinates on the window identified by win to buffer coordinates, storing the result in (buffer_x,buffer_y). Note that you can't convert coordinates for a nonexisting window (see gtk_text_view_set_border_window_size()).

getWindow
Window getWindow(GtkTextWindowType win)

Retrieves the GdkWindow corresponding to an area of the text view; possible windows include the overall widget window, child windows on the left, right, top, bottom, and the window that displays the text buffer. Windows are NULL and nonexistent if their width or height is 0, and are nonexistent before the widget has been realized.

getWindowType
GtkTextWindowType getWindowType(Window window)

Usually used to find out which window an event corresponds to. If you connect to an event signal on text_view, this function should be called on event->window to see which window it was.

setBorderWindowSize
void setBorderWindowSize(GtkTextWindowType type, int size)

Sets the width of GTK_TEXT_WINDOW_LEFT or GTK_TEXT_WINDOW_RIGHT, or the height of GTK_TEXT_WINDOW_TOP or GTK_TEXT_WINDOW_BOTTOM. Automatically destroys the corresponding window if the size is set to 0, and creates the window if the size is set to non-zero. This function can only be used for the "border windows," it doesn't work with GTK_TEXT_WINDOW_WIDGET, GTK_TEXT_WINDOW_TEXT, or GTK_TEXT_WINDOW_PRIVATE.

getBorderWindowSize
int getBorderWindowSize(GtkTextWindowType type)

Gets the width of the specified border window. See gtk_text_view_set_border_window_size().

forwardDisplayLine
int forwardDisplayLine(TextIter iter)

Moves the given iter forward by one display (wrapped) line. A display line is different from a paragraph. Paragraphs are separated by newlines or other paragraph separator characters. Display lines are created by line-wrapping a paragraph. If wrapping is turned off, display lines and paragraphs will be the same. Display lines are divided differently for each view, since they depend on the view's width; paragraphs are the same in all views, since they depend on the contents of the GtkTextBuffer.

backwardDisplayLine
int backwardDisplayLine(TextIter iter)

Moves the given iter backward by one display (wrapped) line. A display line is different from a paragraph. Paragraphs are separated by newlines or other paragraph separator characters. Display lines are created by line-wrapping a paragraph. If wrapping is turned off, display lines and paragraphs will be the same. Display lines are divided differently for each view, since they depend on the view's width; paragraphs are the same in all views, since they depend on the contents of the GtkTextBuffer.

forwardDisplayLineEnd
int forwardDisplayLineEnd(TextIter iter)

Moves the given iter forward to the next display line end. A display line is different from a paragraph. Paragraphs are separated by newlines or other paragraph separator characters. Display lines are created by line-wrapping a paragraph. If wrapping is turned off, display lines and paragraphs will be the same. Display lines are divided differently for each view, since they depend on the view's width; paragraphs are the same in all views, since they depend on the contents of the GtkTextBuffer.

backwardDisplayLineStart
int backwardDisplayLineStart(TextIter iter)

Moves the given iter backward to the next display line start. A display line is different from a paragraph. Paragraphs are separated by newlines or other paragraph separator characters. Display lines are created by line-wrapping a paragraph. If wrapping is turned off, display lines and paragraphs will be the same. Display lines are divided differently for each view, since they depend on the view's width; paragraphs are the same in all views, since they depend on the contents of the GtkTextBuffer.

startsDisplayLine
int startsDisplayLine(TextIter iter)

Determines whether iter is at the start of a display line. See gtk_text_view_forward_display_line() for an explanation of display lines vs. paragraphs.

moveVisually
int moveVisually(TextIter iter, int count)

Move the iterator a given number of characters visually, treating it as the strong cursor position. If count is positive, then the new strong cursor position will be count positions to the right of the old cursor position. If count is negative then the new strong cursor position will be count positions to the left of the old cursor position. In the presence of bi-directional text, the correspondence between logical and visual order will depend on the direction of the current run, and there may be jumps when the cursor is moved off of the end of a run.

addChildAtAnchor
void addChildAtAnchor(Widget child, TextChildAnchor anchor)

Adds a child widget in the text buffer, at the given anchor.

addChildInWindow
void addChildInWindow(Widget child, GtkTextWindowType whichWindow, int xpos, int ypos)

Adds a child at fixed coordinates in one of the text widget's windows. The window must have nonzero size (see gtk_text_view_set_border_window_size()). Note that the child coordinates are given relative to the GdkWindow in question, and that these coordinates have no sane relationship to scrolling. When placing a child in GTK_TEXT_WINDOW_WIDGET, scrolling is irrelevant, the child floats above all scrollable areas. But when placing a child in one of the scrollable windows (border windows or text window), you'll need to compute the child's correct position in buffer coordinates any time scrolling occurs or buffer changes occur, and then call gtk_text_view_move_child() to update the child's position. Unfortunately there's no good way to detect that scrolling has occurred, using the current API; a possible hack would be to update all child positions when the scroll adjustments change or the text buffer changes. See bug 64518 on bugzilla.gnome.org for status of fixing this issue.

moveChild
void moveChild(Widget child, int xpos, int ypos)

Updates the position of a child, as for gtk_text_view_add_child_in_window().

setWrapMode
void setWrapMode(GtkWrapMode wrapMode)

Sets the line wrapping for the view.

getWrapMode
GtkWrapMode getWrapMode()

Gets the line wrapping for the view.

setEditable
void setEditable(int setting)

Sets the default editability of the GtkTextView. You can override this default setting with tags in the buffer, using the "editable" attribute of tags.

getEditable
int getEditable()

Returns the default editability of the GtkTextView. Tags in the buffer may override this setting for some ranges of text.

setCursorVisible
void setCursorVisible(int setting)

Toggles whether the insertion point is displayed. A buffer with no editable text probably shouldn't have a visible cursor, so you may want to turn the cursor off.

getCursorVisible
int getCursorVisible()

Find out whether the cursor is being displayed.

setOverwrite
void setOverwrite(int overwrite)

Changes the GtkTextView overwrite mode. Since 2.4

getOverwrite
int getOverwrite()

Returns whether the GtkTextView is in overwrite mode or not. Since 2.4

setPixelsAboveLines
void setPixelsAboveLines(int pixelsAboveLines)

Sets the default number of blank pixels above paragraphs in text_view. Tags in the buffer for text_view may override the defaults.

getPixelsAboveLines
int getPixelsAboveLines()

Gets the default number of pixels to put above paragraphs.

setPixelsBelowLines
void setPixelsBelowLines(int pixelsBelowLines)

Sets the default number of pixels of blank space to put below paragraphs in text_view. May be overridden by tags applied to text_view's buffer.

getPixelsBelowLines
int getPixelsBelowLines()

Gets the value set by gtk_text_view_set_pixels_below_lines().

setPixelsInsideWrap
void setPixelsInsideWrap(int pixelsInsideWrap)

Sets the default number of pixels of blank space to leave between display/wrapped lines within a paragraph. May be overridden by tags in text_view's buffer.

getPixelsInsideWrap
int getPixelsInsideWrap()

Gets the value set by gtk_text_view_set_pixels_inside_wrap().

setJustification
void setJustification(GtkJustification justification)

Sets the default justification of text in text_view. Tags in the view's buffer may override the default.

getJustification
GtkJustification getJustification()

Gets the default justification of paragraphs in text_view. Tags in the buffer may override the default.

setLeftMargin
void setLeftMargin(int leftMargin)

Sets the default left margin for text in text_view. Tags in the buffer may override the default.

getLeftMargin
int getLeftMargin()

Gets the default left margin size of paragraphs in the text_view. Tags in the buffer may override the default.

setRightMargin
void setRightMargin(int rightMargin)

Sets the default right margin for text in the text view. Tags in the buffer may override the default.

getRightMargin
int getRightMargin()

Gets the default right margin for text in text_view. Tags in the buffer may override the default.

setIndent
void setIndent(int indent)

Sets the default indentation for paragraphs in text_view. Tags in the buffer may override the default.

getIndent
int getIndent()

Gets the default indentation of paragraphs in text_view. Tags in the view's buffer may override the default. The indentation may be negative.

setTabs
void setTabs(PgTabArray tabs)

Sets the default tab stops for paragraphs in text_view. Tags in the buffer may override the default.

getTabs
PgTabArray getTabs()

Gets the default tabs for text_view. Tags in the buffer may override the defaults. The returned array will be NULL if "standard" (8-space) tabs are used. Free the return value with pango_tab_array_free().

setAcceptsTab
void setAcceptsTab(int acceptsTab)

Sets the behavior of the text widget when the Tab key is pressed. If accepts_tab is TRUE, a tab character is inserted. If accepts_tab is FALSE the keyboard focus is moved to the next widget in the focus chain. Since 2.4

getAcceptsTab
int getAcceptsTab()

Returns whether pressing the Tab key inserts a tab characters. gtk_text_view_set_accepts_tab(). Since 2.4

getDefaultAttributes
TextAttributes getDefaultAttributes()

Obtains a copy of the default text attributes. These are the attributes used for text unless a tag overrides them. You'd typically pass the default attributes in to gtk_text_iter_get_attributes() in order to get the attributes in effect at a given text position. The return value is a copy owned by the caller of this function, and should be freed.

imContextFilterKeypress
int imContextFilterKeypress(GdkEventKey* event)

Allow the GtkTextView input method to internally handle key press and release events. If this function returns TRUE, then no further processing should be done for this key event. See gtk_im_context_filter_keypress(). Note that you are expected to call this function from your handler when overriding key event handling. This is needed in the case when you need to insert your own key handling between the input method and the default key event handling of the GtkTextView. Since 2.22

resetImContext
void resetImContext()

Reset the input method context of the text view if needed. This can be necessary in the case where modifying the buffer would confuse on-going input method behavior. Since 2.22

getHadjustment
Adjustment getHadjustment()

Gets the horizontal-scrolling GtkAdjustment. Since 2.22

getVadjustment
Adjustment getVadjustment()

Gets the vertical-scrolling GtkAdjustment. Since 2.22

Meta