Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Xfc::Gtk::TextBuffer Class Reference

A GtkTextBuffer C++ wrapper class. More...

#include <xfc/gtk/textbuffer.hh>

Inheritance diagram for Xfc::Gtk::TextBuffer:

Xfc::G::Object Xfc::G::TypeInstance Xfc::Trackable List of all members.

Signal Prototypes

Public Member Functions

Constructors
Accessors
Methods
Signal Proxies

Protected Member Functions

Constructors

Detailed Description

A GtkTextBuffer C++ wrapper class.

GTK+ has an extremely powerful framework for multiline text editing. The primary objects involved in the process are TextBuffer, which represents the text being edited, and TextView, a widget which can display a TextBuffer. Each buffer can be displayed by any number of views. One of the important things to remember about text in GTK+ is that it's in the UTF-8 encoding. This means that one character can be encoded as multiple bytes. Character counts are usually referred to as offsets, while byte counts are called indexes. If you confuse these two, things will work fine with ASCII, but as soon as your buffer contains multibyte characters, bad things will happen.

Text in a buffer can be marked with tags. A tag is an attribute that can be applied to some range of text. For example, a tag might be called "bold" and make the text inside the tag bold. Each tag is stored in a TextTagTable. A tag table defines a set of tags that can be used together. Each buffer has one tag table associated with it; only tags from that tag table can be used with the buffer. A single tag table can be shared between multiple buffers, however. Tags can have names, which is convenient sometimes (for example, you can name your tag that makes things bold "bold"), but they can also be anonymous (which is convenient if you're creating tags on-the-fly).

Most text manipulation is accomplished with iterators, represented by a TextIter. An iterator represents a position between two characters in the text buffer. Because of this, iterators can't be used to preserve positions across buffer modifications. To preserve a position, the TextMark object is ideal. You can think of a mark as an invisible cursor or insertion point; it floats in the buffer, saving a position. Like tags, marks can be either named or anonymous.

Text buffers always contain at least one line, but may be empty (that is, buffers can contain zero characters). The last line in the text buffer never ends in a line separator (such as newline); the other lines in the buffer always end in a line separator. Line separators count as characters when computing character counts and character offsets. Note that some Unicode line separators are represented with multiple bytes in UTF-8, and the two-character sequence "\\r\\n" is also considered a line separator.

Note: dynamically allocated objects must either be unreferenced or assigned to a smart pointer. Stack objects are automatically unreferenced when they go out of scope.

See also: the TextView Widget HOWTO and example.


Constructor & Destructor Documentation

Xfc::Gtk::TextBuffer::TextBuffer GtkTextBuffer *  buffer,
bool  owns_reference = true
[explicit, protected]
 

Construct a new TextBuffer from an existing GtkTextBuffer.

Parameters:
buffer A pointer to a GtkTextBuffer.
owns_reference Set false if the initial reference count is floating, set true if it's not.
The buffer can be a newly created GtkTextBuffer or an existing GtkTextBuffer (see G::Object::Object).

Xfc::Gtk::TextBuffer::TextBuffer TextTagTable table = 0  )  [explicit]
 

Constructs a new text buffer with a reference count of 1 that the caller owns.

Parameters:
table A tag table, or null to have the text buffer create one for you.


Member Function Documentation

void Xfc::Gtk::TextBuffer::add_selection_clipboard Clipboard clipboard  ) 
 

Adds clipboard to the list of clipboards in which the selection contents of the buffer are available.

Parameters:
clipboard A Clipboard.
In most cases, clipboard will be the Clipboard of type GDK_SELECTION_PRIMARY for a view of buffer.

void Xfc::Gtk::TextBuffer::apply_tag TextTag tag,
const TextIter start,
const TextIter end
 

Emits the "apply_tag" signal on the buffer.

Parameters:
tag A TextTag.
start One bound of a range to be tagged.
end The other bound of a range to be tagged.
The default handler for the signal applies tag to the given range. The start and end do not have to be in order.

void Xfc::Gtk::TextBuffer::apply_tag_by_name const String name,
const TextIter start,
const TextIter end
 

Calls Gtk::TextTagTable::lookup() on the buffer's tag table to get a TextTag, then calls apply_tag().

Parameters:
name The name of a named TextTag.
start One bound of a range to be tagged.
end The other bound of a range to be tagged.

void Xfc::Gtk::TextBuffer::begin_user_action  ) 
 

Called to indicate that the buffer operations between here and a call to buffer_end_user_action() are part of a single user-visible operation.

The operations between begin_user_action() and end_user_action() can then be grouped when creating an undo stack. TextBuffer maintains a count of calls to begin_user_action() that have not been closed with a call to end_user_action(), and emits the "begin_user_action" and "end_user_action" signals only for the outermost pair of calls. This allows you to build user actions from other user actions.

The "interactive" buffer mutation methods, such as insert_interactive(), automatically call begin/end user action around the buffer operations they perform, so there's no need to add extra calls if your user action consists solely of a single call to one of those methods.

void Xfc::Gtk::TextBuffer::copy_clipboard Clipboard clipboard  ) 
 

Copies the currently selected text to a clipboard.

Parameters:
clipboard The Clipboard object to copy to.

TextChildAnchor* Xfc::Gtk::TextBuffer::create_child_anchor TextIter iter  ) 
 

This is a convenience method which simply creates a child anchor and inserts it into the buffer with insert_child_anchor().

Parameters:
iter The location in the buffer.
Returns:
The created child anchor.
The new anchor is owned by the buffer; no reference count is returned to the caller of create_child_anchor().

TextMark* Xfc::Gtk::TextBuffer::create_mark const String mark_name,
const TextIter where,
bool  left_gravity
 

Creates a mark at position where.

Parameters:
mark_name The name for the mark, or null.
where The location to place the new mark.
left_gravity Whether the mark has left gravity.
Returns:
The new TextMark object.
If mark_name is null, the mark is anonymous; otherwise, the mark can be retrieved by name using get_mark(). If a mark has left gravity, and text is inserted at the mark's current location, the mark will be moved to the left of the newly-inserted text. If the mark has right gravity (left_gravity = false), the mark will end up on the right of newly-inserted text. The standard left-to-right cursor is a mark with right gravity (when you type, the cursor stays on the right side of the text you're typing). The caller of this method does not own a reference to the returned TextMark, so you can ignore the return value if you like. Marks are owned by the buffer and go away when the buffer does. Emits the "mark_set" signal as notification of the mark's initial placement.

TextTag* Xfc::Gtk::TextBuffer::create_tag const String tag_name  ) 
 

Creates a tag and adds it to the tag table for the buffer.

Parameters:
tag_name The name of the new tag.
Returns:
A new tag.
Equivalent to creating a new TextTag and then adding the tag to the buffer's tag table. The returned tag is owned by the buffer's tag table, so the reference count will be equal to one. If tag_name is a null String, the tag is anonymous. If tag_name is non-null, a tag called tag_name must not already exist in the tag table for this buffer.

TextTag* Xfc::Gtk::TextBuffer::create_tag  ) 
 

Creates an anonymous tag.

Returns:
A new anonymous tag.
Equivalent to creating a new TextTag and then adding the tag to the buffer's tag table. The returned tag is owned by the buffer's tag table, so the reference count will be equal to one.

void Xfc::Gtk::TextBuffer::cut_clipboard Clipboard clipboard,
bool  default_editable
 

Copies the currently selected text to a clipboard, then deletes said text if it's editable.

Parameters:
clipboard The Clipboard object to cut to.
default_editable The default editability of the buffer.

void Xfc::Gtk::TextBuffer::delete_mark TextMark mark  ) 
 

Deletes mark, so that it's no longer located anywhere in the buffer.

Parameters:
mark A TextMark in the buffer.
Removes the reference the buffer holds to the mark, so if you haven't called ref() on the mark, it will be freed. Even if the mark isn't freed, most operations on mark become invalid. There is no way to undelete a mark. Gtk::TextMark::get_deleted() will return true after this method has been called on a mark, indicating that a mark no longer belongs to a buffer. The "mark_deleted" signal will be emitted as notification after the mark is deleted.

void Xfc::Gtk::TextBuffer::delete_mark_by_name const String name  ) 
 

Deletes the mark named name; the mark must exist (see delete_mark() for details).

Parameters:
name The name of a mark in the buffer.

void Xfc::Gtk::TextBuffer::delete_range TextIter start,
TextIter end
 

Deletes text between start and end.

Parameters:
start A position in the buffer.
end Another position in the buffer.
The order of start and end is not actually relevant; delete_range() will reorder them. This method actually emits the "delete_range" signal, and the default handler of that signal deletes the text. Because the buffer is modified, all outstanding iterators become invalid after calling this method; however, the start and end will be re-initialized to point to the location where text was deleted.

bool Xfc::Gtk::TextBuffer::delete_range_interactive TextIter start,
TextIter end,
bool  default_editable
 

Deletes all editable text in the given range.

Parameters:
start The start of range to delete.
end The end of range.
default_editable Whether the buffer is editable by default.
Returns:
Whether some text was actually deleted.
Calls delete_range() for each editable sub-range of (start,end). start and end are revalidated to point to the location of the last deleted range, or left untouched if no text was deleted.

bool Xfc::Gtk::TextBuffer::delete_selection bool  interactive,
bool  default_editable
 

Deletes the range between the "insert" and "selection_bound" marks, that is, the currently selected text.

Parameters:
interactive Whether the deletion is caused by user interaction.
default_editable Whether the buffer is editable by default.
Returns:
Whether there was a non-empty selection to delete.
If interactive is true, the editability of the selection will be considered (users can't delete uneditable text).

void Xfc::Gtk::TextBuffer::get_bounds TextIter start,
TextIter end
const
 

Retrieves the first and last iterators in the buffer, that is the entire buffer lies within the range (start,end).

Parameters:
start The iterator to initialize to first position in the buffer.
end The iterator to initialize with the end iterator.

int Xfc::Gtk::TextBuffer::get_char_count  )  const
 

Gets the number of characters in the buffer.

Returns:
The number of characters in the buffer.
Note that characters and bytes are not the same, you can't for example expect the contents of the buffer in string form to be this many bytes long. The character count is cached, so this method is very fast.

TextIter Xfc::Gtk::TextBuffer::get_end_iter  )  const
 

Obtains an initialzied iterator to one past the last valid character in the text buffer.

Returns:
The initialized end iterator.
If dereferenced with Gtk::TextIter::get_char(), the end iterator has a character value of 0. The entire buffer lies in the range from the first position (call get_start_iter() to get character position 0 in the buffer) to the end iterator.

TextMark* Xfc::Gtk::TextBuffer::get_insert  )  const
 

Returns the mark that represents the cursor (insertion point).

Returns:
The insertion point mark.
Equivalent to calling get_mark() to get the mark named "insert", but slightly more efficient, and involves less typing.

TextIter Xfc::Gtk::TextBuffer::get_iter_at_child_anchor TextChildAnchor anchor  )  const
 

Obtains an initialized iterator to the location of anchor within the buffer.

Parameters:
anchor A child anchor that appears in the buffer.
Returns:
The initialized iterator.

TextIter Xfc::Gtk::TextBuffer::get_iter_at_line int  line_number  )  const
 

Obtains an initialized iterator to the start of the given line.

Parameters:
line_number The line number counting from 0.
Returns:
The initialized iterator.

TextIter Xfc::Gtk::TextBuffer::get_iter_at_line_index int  line_number,
int  byte_index
const
 

Obtains an initialized iterator pointing to byte_index within the given line.

Parameters:
line_number The line number counting from 0.
byte_index The byte index from start of the line.
Returns:
The initialized iterator.
The byte_index must be the start of a UTF-8 character, and must not be beyond the end of the line. Note bytes, not characters; UTF-8 may encode one character as multiple bytes.

TextIter Xfc::Gtk::TextBuffer::get_iter_at_line_offset int  line_number,
int  char_offset
const
 

Obtains an initialized iterator pointing to char_offset within the given line.

Parameters:
line_number The line number counting from 0.
char_offset The char offset from start of line.
Returns:
The initialized iterator.
The char_offset must exist, offsets off the end of the line are not allowed. Note characters, not bytes; UTF-8 may encode one character as multiple bytes.

TextIter Xfc::Gtk::TextBuffer::get_iter_at_mark TextMark mark  )  const
 

Obtains an initialized iterator to the current position of mark.

Parameters:
mark A TextMark in the buffer.
Returns:
The initialized iterator.

TextIter Xfc::Gtk::TextBuffer::get_iter_at_offset int  char_offset  )  const
 

Obtains an gfcalized iterater to a position char_offset chars from the start of the entire buffer.

Parameters:
char_offset The character offset from start of buffer, counting from 0, or -1.
Returns:
The initialized iterator.
If char_offset is -1 or greater than the number of characters in the buffer, the iterator is initialized to the end iterator, the iterator one past the last valid character in the buffer.

int Xfc::Gtk::TextBuffer::get_line_count  )  const
 

Obtains the number of lines in the buffer.

Returns:
The number of lines in the buffer.
This value is cached, so the function is very fast.

TextMark* Xfc::Gtk::TextBuffer::get_mark const String name  )  const
 

Returns the mark named name in the buffer, or null if no such mark exists.

Parameters:
name A mark name.
Returns:
A TextMark, or null.

bool Xfc::Gtk::TextBuffer::get_modified  )  const
 

Indicates whether the buffer has been modified since the last call to set_modified() to set the modification flag to false.

Returns:
true if the buffer has been modified.
Used for example to enable a "save" function in a text editor.

TextMark* Xfc::Gtk::TextBuffer::get_selection_bound  )  const
 

Returns the mark that represents the selection bound.

Returns:
The selection bound mark.
Equivalent to calling get_mark() to get the mark named "selection_bound", but slightly more efficient, and involves less typing. The currently selected text in buffer is the region between the "selection_bound" and "insert" marks. If "selection_bound" and "insert" are in the same place, then there is no current selection. get_selection_bounds() is another convenient method for handling the selection, if you just want to know whether there's a selection and what its bounds are.

bool Xfc::Gtk::TextBuffer::get_selection_bounds TextIter start = 0,
TextIter end = 0
const
 

Returns true if some text is selected; places the bounds of the selection in start and end.

Parameters:
start The iterator to initialize with selection start.
end The iterator to initialize with selection end.
Returns:
Whether the selection has nonzero length.
If the selection has length 0, then start and end are filled in with the same value. start and end will be in ascending order. If start and end are null, then they are not filled in, but the return value still indicates whether any text is selected.

String Xfc::Gtk::TextBuffer::get_slice const TextIter start,
const TextIter end,
bool  include_hidden_chars = false
const
 

Returns the text in the range (start,end).

Parameters:
start The start of a range.
end The end of a range.
include_hidden_chars Whether to include invisible text.
Returns:
A text string.
Excludes undisplayed text (text marked with tags that set the invisibility attribute) if include_hidden_chars is false. The returned string includes a 0xFFFC character whenever the buffer contains embedded images, so byte and character indexes into the returned string do correspond to byte and character indexes into the buffer. Contrast with get_text(). Note that 0xFFFC can occur in normal text as well, so it is not a reliable indicator that a pixbuf or widget is in the buffer.

TextIter Xfc::Gtk::TextBuffer::get_start_iter  )  const
 

Obtains an initialized iterator to the first position in the text buffer.

Returns:
The initialized start iterator.
This is the same as using get_iter_at_offset() to get the iter at character offset 0.

TextTagTable* Xfc::Gtk::TextBuffer::get_tag_table  )  const
 

Get the TextTagTable associated with this buffer.

Returns:
The buffer's tag table.

String Xfc::Gtk::TextBuffer::get_text const TextIter start,
const TextIter end,
bool  include_hidden_chars = false
const
 

Returns the text in the range (start,end).

Parameters:
start The start of a range.
end The end of a range.
include_hidden_chars Whether to include invisible text.
Returns:
The text string.
Undisplayed text is excluded (text marked with tags that set the invisibility attribute) if include_hidden_chars is false. Does not include characters representing embedded images, so byte and character indexes into the returned string do not correspond to byte and character indexes into the buffer. Contrast with get_slice().

void Xfc::Gtk::TextBuffer::insert TextIter iter,
const String text
 

Inserts text at position iter.

Parameters:
iter A position in the buffer.
text The text to insert.
Emits the "insert_text" signal; insertion actually occurs in the default handler for the signal. The iter is invalidated when insertion occurs (because the buffer contents change), but the default signal handler revalidates it to point to the end of the inserted text.

void Xfc::Gtk::TextBuffer::insert TextIter iter,
const char *  text,
int  length = -1
 

Inserts length bytes of text at position iter.

Parameters:
iter A position in the buffer.
text The UTF-8 format text to insert.
length The length of text in bytes, or -1.
If length is -1, text must be null-terminated and will be inserted in its entirety. This method emits the "insert_text" signal; insertion actually occurs in the default handler for the signal. The iter is invalidated when insertion occurs (because the buffer contents change), but the default signal handler revalidates it to point to the end of the inserted text.

void Xfc::Gtk::TextBuffer::insert_at_cursor const String text  ) 
 

Simply calls insert(), using the current cursor position as the insertion point.

Parameters:
text Some text to insert.

void Xfc::Gtk::TextBuffer::insert_at_cursor const char *  text,
int  length = -1
 

Simply calls insert(), using the current cursor position as the insertion point.

Parameters:
text Some text in UTF-8 format.
length The length of text, in bytes.

void Xfc::Gtk::TextBuffer::insert_child_anchor TextIter iter,
TextChildAnchor anchor
 

Inserts a child widget anchor into the text buffer at iter.

Parameters:
iter The location to insert the anchor.
anchor A TextChildAnchor.
The anchor will be counted as one character in character counts, and when obtaining the buffer contents as a string, will be represented by the Unicode "object replacement character" 0xFFFC. Note that the "slice" variants for obtaining portions of the buffer as a string include this character for child anchors, but the "text" variants do not. For example, see get_slice() and get_text(). Consider create_child_anchor() as a more convenient alternative to this method. The buffer will add a reference to the anchor, so you can unref it after insertion.

bool Xfc::Gtk::TextBuffer::insert_interactive TextIter iter,
const String text,
bool  default_editable
 

Like insert(), but the insertion will not occur if iter is at a non-editable location in the buffer.

Parameters:
iter A position in the buffer.
text Some text.
default_editable The default editability of the buffer.
Returns:
Whether text was actually inserted.
Usually you want to prevent insertions at ineditable locations if the insertion results from a user action (is interactive). default_editable indicates the editability of text that doesn't have a tag affecting editability applied to it. Typically the result of Gtk::TextView::get_editable() is appropriate here.

bool Xfc::Gtk::TextBuffer::insert_interactive TextIter iter,
const char *  text,
int  length,
bool  default_editable
 

Like insert(), but the insertion will not occur if iter is at a non-editable location in the buffer.

Parameters:
iter A position in the buffer.
text Some UTF-8 text.
length The length of text in bytes, or -1.
default_editable The default editability of the buffer.
Returns:
Whether text was actually inserted.
Usually you want to prevent insertions at ineditable locations if the insertion results from a user action (is interactive). default_editable indicates the editability of text that doesn't have a tag affecting editability applied to it. Typically the result of Gtk::TextView::get_editable() is appropriate here.

bool Xfc::Gtk::TextBuffer::insert_interactive_at_cursor const String text,
bool  default_editable
 

Calls insert_interactive() to insert text at the cursor position.

Parameters:
text The text to insert.
default_editable The default editability of the buffer.
Returns:
Whether the text was actually inserted.
default_editable indicates the editability of text that doesn't have a tag affecting editability applied to it. Typically the result of Gtk::TextView::get_editable() is appropriate here.

bool Xfc::Gtk::TextBuffer::insert_interactive_at_cursor const char *  text,
int  length,
bool  default_editable
 

Calls insert_interactive() to insert text at the cursor position.

Parameters:
text The text in UTF-8 format.
length The length of text in bytes, or -1.
default_editable The default editability of the buffer.
Returns:
Whether the text was actually inserted.
default_editable indicates the editability of text that doesn't have a tag affecting editability applied to it. Typically the result of Gtk::TextView::get_editable() is appropriate here.

void Xfc::Gtk::TextBuffer::insert_pixbuf TextIter iter,
Gdk::Pixbuf pixbuf
 

Inserts an image into the text buffer at iter.

Parameters:
iter The location to insert the pixbuf.
pixbuf A Gdk::Pixbuf.
The image will be counted as one character in character counts, and when obtaining the buffer contents as a string, will be represented by the Unicode "object replacement character" 0xFFFC. Note that the "slice" variants for obtaining portions of the buffer as a string include this character for pixbufs, but the "text" variants do not. e.g. see get_slice() and get_text().

void Xfc::Gtk::TextBuffer::insert_range TextIter iter,
const TextIter start,
const TextIter end
 

Copies text, tags, and pixbufs between start and end (the order of start and end doesn't matter) and inserts the copy at iter.

Parameters:
iter A position in the buffer.
start A position in a TextBuffer.
end Another position in the same buffer as start.
Used instead of simply getting/inserting text because it preserves images and tags. If start and end are in a different buffer from buffer, the two buffers must share the same tag table. Implemented via emissions of the insert_text and apply_tag signals, so expect those.

bool Xfc::Gtk::TextBuffer::insert_range_interactive TextIter iter,
const TextIter start,
const TextIter end,
bool  default_editable
 

Same as insert_range(), but does nothing if the insertion point isn't editable.

Parameters:
iter A position in the buffer.
start A position in a TextBuffer
end Another position in the same buffer as start.
default_editable The default editability of the buffer.
Returns:
Whether an insertion was possible at iter.
The default_editable parameter indicates whether the text is editable at iter if no tags enclosing iter affect editability. Typically the result of Gtk::TextView::get_editable() is appropriate here.

void Xfc::Gtk::TextBuffer::insert_with_tag TextIter iter,
const String text,
TextTag tag
 

Inserts text into the buffer at iter, applying the tag to the newly-inserted text.

Parameters:
iter An iterator in the buffer.
text The text to insert.
tag The tag to apply to text.
This method is a convenience function. It is equivalent to calling insert() and then apply_tag() on the inserted text.

void Xfc::Gtk::TextBuffer::insert_with_tag TextIter iter,
const char *  text,
int  length,
TextTag tag
 

Inserts text into the buffer at iter, applying the tag to the newly-inserted text.

Parameters:
iter An iterator in the buffer.
text The UTF-8 text to insert.
length The length of text, or -1.
tag The tag to apply to text.
This method is a convenience function. It is equivalent to calling insert() and then apply_tag() on the inserted text.

void Xfc::Gtk::TextBuffer::insert_with_tag_by_name TextIter iter,
const String text,
const char *  tag_name
 

Same as insert_with_tag(), but allows you to pass in the tag name instead of a tag object.

Parameters:
iter A position in the buffer.
text The text to insert.
tag_name The name of the tag to apply to text.

void Xfc::Gtk::TextBuffer::insert_with_tag_by_name TextIter iter,
const char *  text,
int  length,
const char *  tag_name
 

Same as insert_with_tag(), but allows you to pass in the tag name instead of a tag object.

Parameters:
iter A position in the buffer.
text The UTF-8 text.
length The length of text, or -1.
tag_name The name of the tag to apply to text.

void Xfc::Gtk::TextBuffer::insert_with_tags TextIter iter,
const String text,
const std::vector< TextTag * > &  tags
 

Inserts text into the buffer at iter, applying the list of tags to the newly-inserted text.

Parameters:
iter An iterator in the buffer.
text The text to insert.
tags A vector of text tags to apply to text.
This is a convenience method and is equivalent to calling insert(), and then apply_tag() on the inserted text.

void Xfc::Gtk::TextBuffer::insert_with_tags TextIter iter,
const char *  text,
int  length,
const std::vector< TextTag * > &  tags
 

Inserts text into the buffer at iter, applying the list of tags to the newly-inserted text.

Parameters:
iter An iterator in the buffer.
text The UTF-8 text.
length The length of text, or -1.
tags A vector of text tags to apply to text.
This is a convenience method and is equivalent to calling insert(), and then apply_tag() on the inserted text.

void Xfc::Gtk::TextBuffer::insert_with_tags_by_name TextIter iter,
const String text,
const std::vector< String > &  tag_names
 

Same as insert_with_tags(), but allows you to pass in tag names instead of tag objects.

Parameters:
iter A position in the buffer.
text The text to insert.
tag_names A vector of text tag names to apply to text.

void Xfc::Gtk::TextBuffer::insert_with_tags_by_name TextIter iter,
const char *  text,
int  length,
const std::vector< String > &  tag_names
 

Same as insert_with_tags(), but allows you to pass in tag names instead of tag objects.

Parameters:
iter A position in the buffer.
text The UTF-8 text.
length The length of text, or -1.
tag_names A vector of text tag names to apply to text.

void Xfc::Gtk::TextBuffer::move_mark TextMark mark,
const TextIter where
 

Moves mark to the new location where.

Parameters:
mark A TextMark.
where The new location for mark in the buffer.
Emits the mark_set signal as notification of the move.

void Xfc::Gtk::TextBuffer::move_mark_by_name const String name,
const TextIter where
 

Moves the mark named name (which must exist) to location where (see move_mark() for details).

Parameters:
name The name of a mark.
where The new location for mark.

void Xfc::Gtk::TextBuffer::paste_clipboard Clipboard clipboard,
TextIter override_location,
bool  default_editable
 

Pastes the contents of a clipboard at the insertion point, or at override_location.

Parameters:
clipboard The Clipboard to paste from.
override_location The location to insert pasted text, or null for at the cursor.
default_editable Whether the buffer is editable by default.
Note the pasting is asynchronous, that is, we'll ask for the paste data and return, and at some point later after the main loop runs, the paste data will be inserted.

void Xfc::Gtk::TextBuffer::place_cursor const TextIter where  ) 
 

This method moves the "insert" and "selection_bound" marks simultaneously.

Parameters:
where The where to put the cursor.
If you move them to the same place in two steps with move_mark(), you will temporarily select a region in between their old and new locations, which can be pretty inefficient since the temporarily selected region will force stuff to be recalculated. This method moves them as a unit, which can be optimized.

void Xfc::Gtk::TextBuffer::remove_all_tags const TextIter start,
const TextIter end
 

Removes all tags in the range between start and end.

Parameters:
start One bound of a range to be untagged.
end The other bound of a range to be untagged.
Be careful with this method; it could remove tags added in code unrelated to the code you're currently writing. That is, using this method is probably a bad idea if you have two or more unrelated code sections that add tags.

void Xfc::Gtk::TextBuffer::remove_selection_clipboard Clipboard clipboard  ) 
 

Removes a Clipboard added with add_selection_clipboard().

Parameters:
clipboard A Clipboard added to buffer by add_selection_clipboard().

void Xfc::Gtk::TextBuffer::remove_tag TextTag tag,
const TextIter start,
const TextIter end
 

Emits the "remove_tag" signal.

Parameters:
tag A TextTag.
start One bound of a range to be untagged.
end The other bound of a range to be untagged.
The default handler for the signal removes all occurrences of tag from the given range. The start and end don't have to be in order.

void Xfc::Gtk::TextBuffer::remove_tag_by_name const String name,
const TextIter start,
const TextIter end
 

Calls Gtk::TextTagTable::lookup() on the buffer's tag table to get a TextTag, then calls remove_tag().

Parameters:
name The name of a named TextTag.
start One bound of a range to be untagged.
end The other bound of a range to be untagged.

void Xfc::Gtk::TextBuffer::select_range const TextIter insert,
const TextIter bound
 

Move the "insert" and "selection_bound" marks simultaneously.

Parameters:
insert Where to put the "insert" mark.
bound Where to put the "selection_bound" mark
If you move insert and bound in two steps with move_mark(), you will temporarily select a region in between their old and new locations, which can be pretty inefficient since the temporarily-selected region will force stuff to be recalculated. This function moves them as a unit, which can be optimized.

void Xfc::Gtk::TextBuffer::set_modified bool  setting  ) 
 

Used to keep track of whether the buffer has been modified since the last time it was saved.

Parameters:
setting The modification flag setting.
Whenever the buffer is saved to disk, call set_modified(false). When the buffer is modified, it will automatically toggled on the modified bit again. When the modified bit flips, the buffer emits a modified_changed signal.

void Xfc::Gtk::TextBuffer::set_text const String text  ) 
 

Deletes current contents of buffer, and inserts text instead.

Parameters:
text The text to insert.

void Xfc::Gtk::TextBuffer::set_text const char *  text,
int  length = -1
 

Deletes current contents of buffer, and inserts text instead.

Parameters:
text The UTF-8 text to insert.
length The length of text in bytes, or -1 if text is null-terminated.


Member Data Documentation

const ApplyTagSignalType Xfc::Gtk::TextBuffer::apply_tag_signal [static, protected]
 

Apply tag signal (see signal_apply_tag()).

Calls a slot with the signature:

             void function(TextTag& tag, const TextIter& start_char, const TextIter& end_char);
             // tag: A TextTag.
             // start_char: One bound of a range to be tagged.
             // end_char: The other bound of a range to be tagged.

const BeginUserActionSignalType Xfc::Gtk::TextBuffer::begin_user_action_signal [static, protected]
 

Begin user action signal (see signal_begin_user_action()).

Calls a slot with the signature:

             void function();

const ChangedSignalType Xfc::Gtk::TextBuffer::changed_signal [static, protected]
 

Changed signal (see signal_changed()).

Calls a slot with the signature:

             void function();

const DeleteRangeSignalType Xfc::Gtk::TextBuffer::delete_range_signal [static, protected]
 

Delete range signal (see signal_delete_range()).

Calls a slot with the signature:

             void function(TextIter& start, TextIter& end);
             // start: A position in the buffer.
             // end: Another position in the buffer.

const EndUserActionSignalType Xfc::Gtk::TextBuffer::end_user_action_signal [static, protected]
 

End user action signal (see signal_end_user_action()).

Calls a slot with the signature:

             void function();

const InsertChildAnchorSignalType Xfc::Gtk::TextBuffer::insert_child_anchor_signal [static, protected]
 

Insert child anchor signal (see signal_insert_child_anchor()).

Calls a slot with the signature:

             void function(TextIter& pos, TextChildAnchor& anchor);
             // pos: The location to insert the anchor.
             // anchor: A TextChildAnchor.

const InsertPixbufSignalType Xfc::Gtk::TextBuffer::insert_pixbuf_signal [static, protected]
 

Insert pixbuf signal (see signal_insert_pixbuf()).

Calls a slot with the signature:

             void function(TextIter& pos, Gdk::Pixbuf& pixbuf);
             // pos: The location to insert the pixbuf.
             // pixbuf: A Gdk::Pixbuf.

const InsertTextSignalType Xfc::Gtk::TextBuffer::insert_text_signal [static, protected]
 

Insert text signal (see signal_insert_text()).

Calls a slot with the signature:

             void function(TextIter& pos, const String& text);
             // pos: A position in the buffer.
             // text: The text to insert.

const MarkDeletedSignalType Xfc::Gtk::TextBuffer::mark_deleted_signal [static, protected]
 

Mark deleted signal (see signal_mark_deleted()).

Calls a slot with the signature:

             void function(TextMark& mark);
             // mark: A TextMark.

const MarkSetSignalType Xfc::Gtk::TextBuffer::mark_set_signal [static, protected]
 

Mark set signal (see signal_mark_set()).

Calls a slot with the signature:

             void function(const TextIter& location, TextMark& mark);
             // location: The location for mark in the buffer.
             // mark: A TextMark.

const ModifiedChangedSignalType Xfc::Gtk::TextBuffer::modified_changed_signal [static, protected]
 

Modified changed signal (see signal_modified_changed()).

Calls a slot with the signature:

             void function();

const RemoveTagSignalType Xfc::Gtk::TextBuffer::remove_tag_signal [static, protected]
 

Remove tag signal (see signal_remove_tag()).

Calls a slot with the signature:

             void function(TextTag& tag, const TextIter& start_char, const TextIter& end_char);
             // tag: A TextTag.
             // start_char: One bound of a range to be untagged.
             // end_char: The other bound of a range to be untagged.


The documentation for this class was generated from the following file: Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3