Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Gtk::TextView Class Reference

A GtkTextView C++ wrapper class. More...

`#include <xfc/gtk/textview.hh>`

Inheritance diagram for Xfc::Gtk::TextView:

List of all members.

## Signal Prototypes

- const SetScrollAdjustmentsSignalType set_scroll_adjustments_signal
    Set scroll adjustments signal (see signal_set_scroll_adjustments()).
- const PopulatePopupSignalType populate_popup_signal
    Populate popup signal (see signal_populate_popup()).
- const SetAnchorSignalType set_anchor_signal
    Set anchor signal (see signal_set_anchor()).
- const InsertAtCursorSignalType insert_at_cursor_signal
    Insert at cursor signal (see signal_insert_at_cursor()).

## Public Member Functions

Constructors

- TextView ()
    Constructs a new text view widget.
- TextView (TextBuffer &buffer)
    Constructs a new text view widget displaying the buffer buffer.
- virtual ~TextView ()
    Destructor.

Accessors

- GtkTextView * gtk_text_view () const
    Get a pointer to the GtkTextView structure.
- operator GtkTextView * () const
    Conversion operator; safely converts a TextView to a GtkTextView pointer.
- TextBuffer * get_buffer () const
    Returns the TextBuffer being displayed by this text view.
- void get_visible_rect (Gdk::Rectangle &visible_rect)
    Fills visible_rect with the currently visible region of the buffer, in buffer coordinates.
- Gdk::Rectangle get_visible_rect () const
    Returns a rectangle filled with the currently visible region of the buffer, in buffer coordinates.
- bool get_cursor_visible () const
    Find out whether the cursor is being displayed.
- void get_iter_location (const TextIter &iter, Gdk::Rectangle &location)
    Gets a rectangle which roughly contains the character at iter.
- Gdk::Rectangle get_iter_location (const TextIter &iter) const
    Returns a rectangle which roughly contains the character at iter.
- TextIter get_iter_at_location (int x, int y) const
    Retrieves the iterator at buffer coordinates x and y.
- TextIter get_iter_at_position (int *trailing, int x, int y)
    Retrieves the iterator pointing to the character at buffer coordinates x and y.
- void get_line_yrange (const TextIter &iter, int *y, int *height) const
    Gets the y coordinate of the top of the line containing iter, and the height of the line.
- int get_line_y (const TextIter &iter) const
    Gets the y coordinate of the top of the line containing iter.
- int get_line_height (const TextIter &iter) const
    Gets the height of the line containing iter.
- void get_line_at_y (TextIter &target_iter, int y, int *line_top) const
    Gets the TextIter at the start of the line containing the coordinate y.
- TextIter get_line_at_y (int y) const
    Returns the TextIter at the start of the line containing the coordinate y.
- Gdk::Window * get_window (TextWindowType window_type) const
    Retrieves the Gdk::Window 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.
- TextWindowType get_window_type (const Gdk::Window &window) const
    Usually used to find out which window an event corresponds to.
- int get_border_window_size (TextWindowType type) const
    Gets the width of the specified border window (see set_border_window_size()).
- WrapMode get_wrap_mode () const
    Gets the line wrapping for the view.
- bool get_editable () const
    Returns the default editability of the TextView.
- bool get_overwrite () const
    Determines whether the text view is in overwrite mode or not.
- bool get_accepts_tab () const
    Determines whether pressing the Tab key inserts a tab characters (see set_accepts_tab()).
- int get_pixels_above_lines () const
    Returns the default number of pixels to put above paragraphs.
- int get_pixels_below_lines () const
    Returns the default number of blank pixels below paragraphs.
- int get_pixels_inside_wrap () const
    Returns the default number of pixels of blank space between wrapped lines.
- Justification get_justification () const
    Returns the default justification of paragraphs in the text view.
- int get_left_margin () const
    Returns the default left margin size of paragraphs in the text_view.
- int get_right_margin () const
    Returns the default right margin for text in the text view.
- int get_indent () const
    Gets the default indentation of paragraphs in the text view.
- Pointer< Pango::TabArray > get_tabs () const
    Gets the default tabs for the text view.
- Pointer< TextAttributes > get_default_attributes () const
    Obtains a copy of the default text attributes.

Methods

- void set_buffer (TextBuffer *buffer)
    Sets buffer as the buffer being displayed by text_view.
- bool scroll_to_iter (const TextIter &iter, double within_margin, bool use_align, double xalign, double yalign)
    Scrolls the text view so that iter is on the screen in the position indicated by xalign and yalign.
- void scroll_to_mark (const TextMark &mark, double within_margin, bool use_align, double xalign, double yalign)
    Scrolls the text view so that mark is on the screen in the position indicated by xalign and yalign.
- void scroll_mark_onscreen (const TextMark &mark)
    Scrolls the text view the minimum distance such that mark is contained within the visible area of the widget.
- bool move_mark_onscreen (const TextMark &mark)
    Moves a mark within the buffer so that it's located within the currently-visible text area.
- bool place_cursor_onscreen ()
    Moves the cursor to the currently visible region of the buffer, it it isn't there already.
- void set_cursor_visible (bool setting)
    Toggles whether the insertion point is displayed.
- void buffer_to_window_coords (TextWindowType window_type, int buffer_x, int buffer_y, int *window_x, int *window_y)
    Converts coordinate (buffer_x, buffer_y) to coordinates for the window window_type, and stores the result in (window_x, window_y).
- void window_to_buffer_coords (TextWindowType window_type, int window_x, int window_y, int *buffer_x, int *buffer_y)
    Converts coordinates on the window identified by window_type to buffer coordinates, storing the result in (buffer_x,buffer_y).
- void set_border_window_size (TextWindowType window_type, int size)
    Sets the width of TEXT_WINDOW_LEFT or TEXT_WINDOW_RIGHT, or the height of TEXT_WINDOW_TOP or TEXT_WINDOW_BOTTOM.
- bool forward_display_line (TextIter &iter)
    Moves the given iter forward by one display (wrapped) line.
- bool backward_display_line (TextIter &iter)
    Moves the given iter backward by one display (wrapped) line.
- bool forward_display_line_end (TextIter &iter)
    Moves the given iter forward to the next display line end.
- bool backward_display_line_start (TextIter &iter)
    Moves the given iter backward to the next display line start.
- bool starts_display_line (const TextIter &iter)
    Determines whether iter is at the start of a display line (see forward_display_line() for an explanation of display lines vs.
- bool move_visually (TextIter &iter, int count)
    Moves iter up or down by count display (wrapped) lines (see forward_display_line() for an explanation of display lines vs.
- void add_child_at_anchor (Widget &child, TextChildAnchor &anchor)
    Adds a child widget in the text buffer, at the given anchor.
- void add_child_in_window (Widget &child, TextWindowType which_window, int xpos, int ypos)
    Adds a child at fixed coordinates in one of the text widget's windows.
- void move_child (const Widget &child, int xpos, int ypos)
    Updates the position of a child, as for add_child_in_window().
- void set_wrap_mode (WrapMode wrap_mode)
    Sets the line wrapping for the view.
- void set_editable (bool setting)
    Sets the default editability of the TextView.
- void set_overwrite (bool overwrite)
    Changes the text view overwrite mode.
- void set_accepts_tab (bool accepts_tab)
    Sets the behavior of the text widget when the Tab key is pressed.
- void set_pixels_above_lines (int pixels_above_lines)
    Sets the default number of blank pixels above paragraphs in text_view.
- void set_pixels_below_lines (int pixels_below_lines)
    Sets the default number of pixels of blank space to put below paragraphs.
- void set_pixels_inside_wrap (int pixels_inside_wrap)
    Sets the default number of pixels of blank space to leave between display/wrapped lines within a paragraph.
- void set_justification (Justification justification)
    Sets the default justification of text in the text view.
- void set_left_margin (int left_margin)
    Sets the default left margin for text in text_view.
- void set_right_margin (int right_margin)
    Sets the default right margin for text in the text view.
- void set_indent (int indent)
    Sets the default indentation for paragraphs in the text view.
- void set_tabs (const Pango::TabArray &tabs)
    Sets the default tab stops for paragraphs in the text view.

Signal Proxies

- const SetScrollAdjustmentsSignalProxy signal_set_scroll_adjustments ()
    Connect to the set_scroll_adjustments_signal; emitted when a text view is added to a scrolling aware parent.
- const PopulatePopupSignalProxy signal_populate_popup ()
    Connect to the populate_popup_signal; emitted when the text view displays its context-sensitive menu.
- const SetAnchorSignalProxy signal_set_anchor ()
    Connect to the set_anchor_signal; emitted when the "anchor" is moved (what Emacs calls the mark) to the cursor position.
- const InsertAtCursorSignalProxy signal_insert_at_cursor ()
    Connect to the insert_at_cursor_signal; emited when text is inserted into the buffer at the current cursor position.

## Protected Member Functions

Constructors

- TextView (GtkTextView *text_view, bool owns_reference=false)
    Construct a new TextView from an existing GtkTextView.

## Detailed Description

A GtkTextView C++ wrapper class.

TextView is a widget which can display a TextBuffer. Each text buffer can be displayed by any number of views.

To use TextView in your application you only need to include the header file <textview.h>. This header file includes <textbuffer.h> which includes all the other header files that TextView needs.

See also: the TextView Widget HOWTO and example.

## Constructor & Destructor Documentation

Xfc::Gtk::TextView::TextView | ( | GtkTextView * | text_view,
|  | bool | owns_reference = `false`
| ) | `[explicit, protected]`

Construct a new TextView from an existing GtkTextView.

Parameters:

  | text_view | A pointer to a GtkTextView.
  | owns_reference | Set false if the initial reference count is floating, set true if it's not.

The text_view can be a newly created GtkTextView or an existing GtkTextView (see G::Object::Object).

Xfc::Gtk::TextView::TextView | ( |  | ) |

| Constructs a new text view widget. If you don't call set_buffer() before using the text view, an empty default buffer will be created for you. The buffer can be retrieved with get_buffer().

Xfc::Gtk::TextView::TextView | ( | TextBuffer & | buffer | ) | `[explicit]`

Constructs a new text view widget displaying the buffer buffer.

Parameters:

  | buffer | A TextBuffer.

One buffer can be shared among many widgets. The text view adds its own reference count to the buffer; it does not take over an existing reference.

## Member Function Documentation

void Xfc::Gtk::TextView::add_child_at_anchor | ( | Widget & | child,
|  | TextChildAnchor & | anchor
| ) |

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

Parameters:

  | child | A Widget.
  | anchor | A TextChildAnchor in the TextBuffer for text_view.

void Xfc::Gtk::TextView::add_child_in_window | ( | Widget & | child,
|  | TextWindowType | which_window,
|  | int | xpos,
|  | int | ypos
| ) |

Adds a child at fixed coordinates in one of the text widget's windows.

Parameters:

  | child | A Widget.
  | which_window | Which window the child should appear in.
  | xpos | The X position of child in window coordinates.
  | ypos | the Y position of child in window coordinates.

The window must have nonzero size (see set_border_window_size()). Note that the child coordinates are given relative to the Gdk::Window in question, and that these coordinates have no sane relationship to scrolling. When placing a child in 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 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.

bool Xfc::Gtk::TextView::backward_display_line | ( | TextIter & | iter | ) |

Moves the given iter backward by one display (wrapped) line.

Parameters:

  | iter | A TextIter.

Returns:
  true if iter was moved and is not on the end iterator.

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 TextBuffer.

bool Xfc::Gtk::TextView::backward_display_line_start | ( | TextIter & | iter | ) |

Moves the given iter backward to the next display line start.

Parameters:

  | iter | A TextIter.

Returns:
  true if iter was moved and is not on the end iterator.

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 TextBuffer.

void Xfc::Gtk::TextView::buffer_to_window_coords | ( | TextWindowType | window_type,
|  | int | buffer_x,
|  | int | buffer_y,
|  | int * | window_x,
|  | int * | window_y
| ) |

Converts coordinate (buffer_x, buffer_y) to coordinates for the window window_type, and stores the result in (window_x, window_y).

Parameters:

  | window_type | A TextWindowType, except TEXT_WINDOW_PRIVATE.
  | buffer_x | The buffer x coordinate.
  | buffer_y | The buffer y coordinate.
  | window_x | The return location for the window x coordinate.
  | window_y | The return location for the window y coordinate.

Note that you can't convert coordinates for a nonexisting window (see set_border_window_size()).

bool Xfc::Gtk::TextView::forward_display_line | ( | TextIter & | iter | ) |

Moves the given iter forward by one display (wrapped) line.

Parameters:

  | iter | A TextIter.

Returns:
  true if iter was moved and is not on the end iterator.

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 TextBuffer.

bool Xfc::Gtk::TextView::forward_display_line_end | ( | TextIter & | iter | ) |

Moves the given iter forward to the next display line end.

Parameters:

  | iter | A TextIter.

Returns:
  true if iter was moved and is not on the end iterator.

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 TextBuffer.

bool Xfc::Gtk::TextView::get_accepts_tab | ( |  | ) | const

Determines whether pressing the Tab key inserts a tab characters (see set_accepts_tab()).

Returns:
  true if pressing the Tab key inserts a tab character, false if pressing the Tab key moves the keyboard focus.

int Xfc::Gtk::TextView::get_border_window_size | ( | TextWindowType | type | ) | const

Gets the width of the specified border window (see set_border_window_size()).

,

Parameters:

  | type | The window to return the size from

Returns:
  The width of the window.

TextBuffer* Xfc::Gtk::TextView::get_buffer | ( |  | ) | const

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

bool Xfc::Gtk::TextView::get_cursor_visible | ( |  | ) | const

Find out whether the cursor is being displayed.

Returns:
  Whether the insertion mark is visible.

Pointer<TextAttributes> Xfc::Gtk::TextView::get_default_attributes | ( |  | ) | const

Obtains a copy of the default text attributes.

Returns:
  A copy of the TextAttributes.

These are the attributes used for text unless a tag overrides them. You'd typically pass the default attributes in to Gtk::TextIter::get_attributes() in order to get the attributes in effect at a given text position.

bool Xfc::Gtk::TextView::get_editable | ( |  | ) | const

Returns the default editability of the TextView.

Returns:
  Whether text is editable by default.

Tags in the buffer may override this setting for some ranges of text.

int Xfc::Gtk::TextView::get_indent | ( |  | ) | const

Gets the default indentation of paragraphs in the text view.

Returns:
  The number of pixels of indentation.

Tags in the view's buffer may override the default. The indentation may be negative.

TextIter Xfc::Gtk::TextView::get_iter_at_location | ( | int | x,
|  | int | y
| ) | const

Retrieves the iterator at buffer coordinates x and y.

Parameters:

  | x | The x position, in buffer coordinates.
  | y | The y position, in buffer coordinates.

Returns:
  A TextIter.

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 window_to_buffer_coords().

TextIter Xfc::Gtk::TextView::get_iter_at_position | ( | int * | trailing,
|  | int | x,
|  | int | y
| ) |

Retrieves the iterator pointing to the character at buffer coordinates x and y.

Parameters:

  | trailing | The location to store an integer indicating where in the grapheme the user clicked.
  | x | The x position, in buffer coordinates.
  | y | The y position, in buffer coordinates.

Returns:
  A TextIter

On return trailing will either be zero, or the number of characters in the grapheme. 0 represents the trailing edge of the grapheme. 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 window_to_buffer_coords().

Note that this method is different from get_iter_at_location(), which returns cursor locations, i.e. positions between characters.

Gdk::Rectangle Xfc::Gtk::TextView::get_iter_location | ( | const TextIter & | iter | ) | const

Returns a rectangle which roughly contains the character at iter.

Parameters:

  | iter | A TextIter.

The rectangle position is in buffer coordinates; use buffer_to_window_coords() to convert these coordinates to coordinates for one of the windows in the text view.

void Xfc::Gtk::TextView::get_iter_location | ( | const TextIter & | iter,
|  | Gdk::Rectangle & | location
| ) |

Gets a rectangle which roughly contains the character at iter.

Parameters:

  | iter | A TextIter.
  | location | The bounds of the character at iter.

The rectangle position is in buffer coordinates; use buffer_to_window_coords() to convert these coordinates to coordinates for one of the windows in the text view.

Justification Xfc::Gtk::TextView::get_justification | ( |  | ) | const

| Returns the default justification of paragraphs in the text view. Tags in the buffer may override the default.

int Xfc::Gtk::TextView::get_left_margin | ( |  | ) | const

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

TextIter Xfc::Gtk::TextView::get_line_at_y | ( | int | y | ) | const

Returns the TextIter at the start of the line containing the coordinate y.

Parameters:

  | y | A Y coordinate.

y is in buffer coordinates, convert from window coordinates with window_to_buffer_coords().

void Xfc::Gtk::TextView::get_line_at_y | ( | TextIter & | target_iter,
|  | int | y,
|  | int * | line_top
| ) | const

Gets the TextIter at the start of the line containing the coordinate y.

Parameters:

  | target_iter | A TextIter.
  | y | A Y coordinate.
  | line_top | The return location for top coordinate of the line.

y is in buffer coordinates, convert from window coordinates with window_to_buffer_coords(). If non-null, line_top will be filled with the coordinate of the top edge of the line.

int Xfc::Gtk::TextView::get_line_height | ( | const TextIter & | iter | ) | const

Gets the height of the line containing iter.

Parameters:

  | iter | A TextIter.

Returns:
  The height of the line.

int Xfc::Gtk::TextView::get_line_y | ( | const TextIter & | iter | ) | const

Gets the y coordinate of the top of the line containing iter.

Parameters:

  | iter | A TextIter.

Returns:
  The y coordinate, as a buffer coordinate.

void Xfc::Gtk::TextView::get_line_yrange | ( | const TextIter & | iter,
|  | int * | y,
|  | int * | height
| ) | const

Gets the y coordinate of the top of the line containing iter, and the height of the line.

Parameters:

  | iter | A TextIter.
  | y | The return location for a y coordinate.
  | height | The return location for a height.

The coordinate is a buffer coordinate; convert to window coordinates with buffer_to_window_coords().

bool Xfc::Gtk::TextView::get_overwrite | ( |  | ) | const

Determines whether the text view is in overwrite mode or not.

Returns:
  Whether the text view is in overwrite mode or not.

int Xfc::Gtk::TextView::get_pixels_above_lines | ( |  | ) | const

| Returns the default number of pixels to put above paragraphs. Tags in the buffer may override the default.

int Xfc::Gtk::TextView::get_pixels_below_lines | ( |  | ) | const

| Returns the default number of blank pixels below paragraphs. Tags in the buffer may override the default.

int Xfc::Gtk::TextView::get_pixels_inside_wrap | ( |  | ) | const

| Returns the default number of pixels of blank space between wrapped lines. Tags in the buffer may override the default.

int Xfc::Gtk::TextView::get_right_margin | ( |  | ) | const

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

Pointer<Pango::TabArray> Xfc::Gtk::TextView::get_tabs | ( |  | ) | const

Gets the default tabs for the text view.

Returns:
  A copy of default tab array, or null if "standard" tabs are used.

Tags in the buffer may override the defaults. The returned array will be null if "standard" (8-space) tabs are used.

Gdk::Rectangle Xfc::Gtk::TextView::get_visible_rect | ( |  | ) | const

| Returns a rectangle filled with the currently visible region of the buffer, in buffer coordinates. Convert to window coordinates with buffer_to_window_coords().

void Xfc::Gtk::TextView::get_visible_rect | ( | Gdk::Rectangle & | visible_rect | ) |

Fills visible_rect with the currently visible region of the buffer, in buffer coordinates.

Parameters:

  | visible_rect | The rectangle to fill.

Convert to window coordinates with buffer_to_window_coords().

Gdk::Window* Xfc::Gtk::TextView::get_window | ( | TextWindowType | window_type | ) | const

Retrieves the Gdk::Window 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.

Parameters:

  | window_type | The window to get.

Returns:
  A Gdk::Window, or null.

Windows are null and nonexistent if their width or height is 0, and are nonexistent before the widget has been realized.

TextWindowType Xfc::Gtk::TextView::get_window_type | ( | const Gdk::Window & | window | ) | const

Usually used to find out which window an event corresponds to.

Parameters:

  | window | A window type.

Returns:
  The window type.

If you connect to an event signal on the TextView, this method should be called on event->window to see which window it was.

WrapMode Xfc::Gtk::TextView::get_wrap_mode | ( |  | ) | const

Gets the line wrapping for the view.

Returns:
  The line wrap setting.

void Xfc::Gtk::TextView::move_child | ( | const Widget & | child,
|  | int | xpos,
|  | int | ypos
| ) |

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

Parameters:

  | child | The child widget already added to the text view.
  | xpos | The new X position in window coordinates.
  | ypos | The new Y position in window coordinates.

bool Xfc::Gtk::TextView::move_mark_onscreen | ( | const TextMark & | mark | ) |

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

Parameters:

  | mark | A TextMark.

Returns:
  true if the mark moved (wasn't already onscreen).

bool Xfc::Gtk::TextView::move_visually | ( | TextIter & | iter,
|  | int | count
| ) |

Moves iter up or down by count display (wrapped) lines (see forward_display_line() for an explanation of display lines vs.

paragraphs).

Parameters:

  | iter | A TextIter.
  | count | THe number of lines to move.

Returns:
  true if iter moved and is not on the end iterator.

bool Xfc::Gtk::TextView::place_cursor_onscreen | ( |  | ) |

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

Returns:
  true if the cursor had to be moved.

void Xfc::Gtk::TextView::scroll_mark_onscreen | ( | const TextMark & | mark | ) |

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

Parameters:

  | mark | A mark in the buffer for the text view.

bool Xfc::Gtk::TextView::scroll_to_iter | ( | const TextIter & | iter,
|  | double | within_margin,
|  | bool | use_align,
|  | double | xalign,
|  | double | yalign
| ) |

Scrolls the text view so that iter is on the screen in the position indicated by xalign and yalign.

Parameters:

  | iter | A TextIter.
  | within_margin | The margin as a (0.0,0.5) fraction of screen size.
  | use_align | Whether to use alignment arguments (if false, just get the iter onscreen).
  | xalign | The horizontal alignment of iter within visible area.
  | yalign | The vertical alignment of iter within visible area.

Returns:
  true if scrolling occurred.

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 iter onscreen, possibly not scrolling at all. The effective screen for purposes of this method is reduced by a margin of size within_margin.

Note this method uses the currently computed height of the lines in the text buffer. The line heights are computed in an idle handler; so this method may not have the desired effect if it's called before the height computations. To avoid oddness, consider using scroll_to_mark() which saves a point to be scrolled to after line validation.

void Xfc::Gtk::TextView::scroll_to_mark | ( | const TextMark & | mark,
|  | double | within_margin,
|  | bool | use_align,
|  | double | xalign,
|  | double | yalign
| ) |

Scrolls the text view so that mark is on the screen in the position indicated by xalign and yalign.

Parameters:

  | mark | A TextMark.
  | within_margin | The margin as a (0.0,0.5) fraction of screen size.
  | use_align | Whether to use alignment arguments (if false, just get the mark onscreen).
  | xalign | The horizontal alignment of mark within visible area.
  | yalign | The vertical alignment of mark within visible area.

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 method is reduced by a margin of size within_margin.

void Xfc::Gtk::TextView::set_accepts_tab | ( | bool | accepts_tab | ) |

Sets the behavior of the text widget when the Tab key is pressed.

Parameters:

  | accepts_tab | Set true if pressing the Tab key should insert a tab character, and false, if pressing the Tab key should move the keyboard focus.

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.

void Xfc::Gtk::TextView::set_border_window_size | ( | TextWindowType | window_type,
|  | int | size
| ) |

Sets the width of TEXT_WINDOW_LEFT or TEXT_WINDOW_RIGHT, or the height of TEXT_WINDOW_TOP or TEXT_WINDOW_BOTTOM.

Parameters:

  | window_type | The window to affect.
  | size | The width or height of the window.

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 method can only be used for the "border windows," it doesn't work with TEXT_WINDOW_WIDGET, TEXT_WINDOW_TEXT, or TEXT_WINDOW_PRIVATE.

void Xfc::Gtk::TextView::set_buffer | ( | TextBuffer * | buffer | ) |

Sets buffer as the buffer being displayed by text_view.

Parameters:

  | buffer | A TextBuffer.

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 method, you must remove that reference yourself; TextView will not "adopt" it.

void Xfc::Gtk::TextView::set_cursor_visible | ( | bool | setting | ) |

Toggles whether the insertion point is displayed.

Parameters:

  | setting | Whether to show the insertion cursor.

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

void Xfc::Gtk::TextView::set_editable | ( | bool | setting | ) |

Sets the default editability of the TextView.

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

Parameters:

  | setting | Whether the text view is editable.

void Xfc::Gtk::TextView::set_indent | ( | int | indent | ) |

Sets the default indentation for paragraphs in the text view.

Parameters:

  | indent | The indentation in pixels

Tags in the buffer may override the default.

void Xfc::Gtk::TextView::set_justification | ( | Justification | justification | ) |

Sets the default justification of text in the text view.

Parameters:

  | justification | The justification.

Tags in the view's buffer may override the default.

void Xfc::Gtk::TextView::set_left_margin | ( | int | left_margin | ) |

Sets the default left margin for text in text_view.

Parameters:

  | left_margin | The left margin in pixels.

Tags in the buffer may override the default.

void Xfc::Gtk::TextView::set_overwrite | ( | bool | overwrite | ) |

Changes the text view overwrite mode.

Parameters:

  | overwrite | Set true to turn on overwrite mode, false to turn it of.

void Xfc::Gtk::TextView::set_pixels_above_lines | ( | int | pixels_above_lines | ) |

Sets the default number of blank pixels above paragraphs in text_view.

Parameters:

  | pixels_above_lines | The pixels above paragraphs.

Tags in the buffer for text view may override the defaults.

void Xfc::Gtk::TextView::set_pixels_below_lines | ( | int | pixels_below_lines | ) |

Sets the default number of pixels of blank space to put below paragraphs.

Parameters:

  | pixels_below_lines | The pixels below paragraphs.

May be overridden by tags applied to text_view's buffer.

void Xfc::Gtk::TextView::set_pixels_inside_wrap | ( | int | pixels_inside_wrap | ) |

Sets the default number of pixels of blank space to leave between display/wrapped lines within a paragraph.

Parameters:

  | pixels_inside_wrap | The default number of pixels between wrapped lines.

May be overridden by tags in text_view's buffer.

void Xfc::Gtk::TextView::set_right_margin | ( | int | right_margin | ) |

Sets the default right margin for text in the text view.

Parameters:

  | right_margin | The right margin in pixels.

Tags in the buffer may override the default.

void Xfc::Gtk::TextView::set_tabs | ( | const Pango::TabArray & | tabs | ) |

Sets the default tab stops for paragraphs in the text view.

Parameters:

  | tabs | The tabs as a Pango::TabArray.

Tags in the buffer may override the default.

void Xfc::Gtk::TextView::set_wrap_mode | ( | WrapMode | wrap_mode | ) |

Sets the line wrapping for the view.

Parameters:

  | wrap_mode | A WrapMode.

bool Xfc::Gtk::TextView::starts_display_line | ( | const TextIter & | iter | ) |

Determines whether iter is at the start of a display line (see forward_display_line() for an explanation of display lines vs.

paragraphs).

Parameters:

  | iter | A TextIter.

Returns:
  true if iter begins a wrapped line.

void Xfc::Gtk::TextView::window_to_buffer_coords | ( | TextWindowType | window_type,
|  | int | window_x,
|  | int | window_y,
|  | int * | buffer_x,
|  | int * | buffer_y
| ) |

Converts coordinates on the window identified by window_type to buffer coordinates, storing the result in (buffer_x,buffer_y).

Parameters:

  | window_type | A TextWindowType, except TEXT_WINDOW_PRIVATE.
  | window_x | The window x coordinate.
  | window_y | The window y coordinate.
  | buffer_x | The return location for the buffer x coordinate.
  | buffer_y | The return location for the buffer y coordinate.

Note that you can't convert coordinates for a nonexisting window (see set_border_window_size()).

## Member Data Documentation

const InsertAtCursorSignalType Xfc::Gtk::TextView::insert_at_cursor_signal `[static, protected]`

Insert at cursor signal (see signal_insert_at_cursor()).

Calls a slot with the signature:

                 void function(const String& str);
                 // str: The new text to insert.

const PopulatePopupSignalType Xfc::Gtk::TextView::populate_popup_signal `[static, protected]`

Populate popup signal (see signal_populate_popup()).

Calls a slot with the signature:

                 void function(Menu& popup_menu);
                 // menu: The popup menu.

const SetAnchorSignalType Xfc::Gtk::TextView::set_anchor_signal `[static, protected]`

Set anchor signal (see signal_set_anchor()).

Calls a slot with the signature:

                 void function();

const SetScrollAdjustmentsSignalType Xfc::Gtk::TextView::set_scroll_adjustments_signal `[static, protected]`

Set scroll adjustments signal (see signal_set_scroll_adjustments()).

Calls a slot with the signature:

                 void function(Adjustment *hadjustment, Adjustment *vadjustment);
                 // hadjustment: The horizontal adjustment.
                 // vadjustment: The vertical adjustment.

The documentation for this class was generated from the following file:

- textview.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3