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


Public Member Functions | Static Protected Attributes
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 Xfc::Gtk::SourceBuffer

List of all members.

Public Member Functions

Static Protected Attributes

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:
bufferA pointer to a GtkTextBuffer.
owns_referenceSet 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:
tableA tag table, or null to have the text buffer create one for you.

Member Function Documentation

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

Parameters:
clipboardA 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:
tagA TextTag.
startOne bound of a range to be tagged.
endThe 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:
nameThe name of a named TextTag.
startOne bound of a range to be tagged.
endThe other bound of a range to be tagged.

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.

Copies the currently selected text to a clipboard.

Parameters:
clipboardThe Clipboard object to copy to.

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

Parameters:
iterThe 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_nameThe name for the mark, or null.
whereThe location to place the new mark.
left_gravityWhether 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.

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.

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

Parameters:
tag_nameThe 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.

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:
clipboardThe Clipboard object to cut to.
default_editableThe default editability of the buffer.

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

Parameters:
markA 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:
nameThe name of a mark in the buffer.
void Xfc::Gtk::TextBuffer::delete_range ( TextIter start,
TextIter end 
)

Deletes text between start and end.

Parameters:
startA position in the buffer.
endAnother 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:
startThe start of range to delete.
endThe end of range.
default_editableWhether 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:
interactiveWhether the deletion is caused by user interaction.
default_editableWhether 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:
startThe iterator to initialize to first position in the buffer.
endThe iterator to initialize with the end iterator.

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.

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.

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.

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

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

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

Parameters:
line_numberThe 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_numberThe line number counting from 0.
byte_indexThe 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_numberThe line number counting from 0.
char_offsetThe 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.

Obtains an initialized iterator to the current position of mark.

Parameters:
markA TextMark in the buffer.
Returns:
The initialized iterator.

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

Parameters:
char_offsetThe 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.

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:
nameA mark name.
Returns:
A TextMark, or null.

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.

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:
startThe iterator to initialize with selection start.
endThe 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:
startThe start of a range.
endThe end of a range.
include_hidden_charsWhether 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.

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.

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:
startThe start of a range.
endThe end of a range.
include_hidden_charsWhether 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 char *  text,
int  length = -1 
)

Inserts length bytes of text at position iter.

Parameters:
iterA position in the buffer.
textThe UTF-8 format text to insert.
lengthThe 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 ( TextIter iter,
const String text 
)

Inserts text at position iter.

Parameters:
iterA position in the buffer.
textThe 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_at_cursor ( const char *  text,
int  length = -1 
)

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

Parameters:
textSome text in UTF-8 format.
lengthThe length of text, in bytes.

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

Parameters:
textSome text to insert.

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

Parameters:
iterThe location to insert the anchor.
anchorA 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 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:
iterA position in the buffer.
textSome UTF-8 text.
lengthThe length of text in bytes, or -1.
default_editableThe 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 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:
iterA position in the buffer.
textSome text.
default_editableThe 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 char *  text,
int  length,
bool  default_editable 
)

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

Parameters:
textThe text in UTF-8 format.
lengthThe length of text in bytes, or -1.
default_editableThe 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 String text,
bool  default_editable 
)

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

Parameters:
textThe text to insert.
default_editableThe 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:
iterThe location to insert the pixbuf.
pixbufA 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:
iterA position in the buffer.
startA position in a TextBuffer.
endAnother 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:
iterA position in the buffer.
startA position in a TextBuffer
endAnother position in the same buffer as start.
default_editableThe 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 char *  text,
int  length,
TextTag tag 
)

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

Parameters:
iterAn iterator in the buffer.
textThe UTF-8 text to insert.
lengthThe length of text, or -1.
tagThe 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 String text,
TextTag tag 
)

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

Parameters:
iterAn iterator in the buffer.
textThe text to insert.
tagThe 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 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:
iterA position in the buffer.
textThe UTF-8 text.
lengthThe length of text, or -1.
tag_nameThe name of the tag to apply to 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:
iterA position in the buffer.
textThe text to insert.
tag_nameThe name of the tag to apply to 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:
iterAn iterator in the buffer.
textThe UTF-8 text.
lengthThe length of text, or -1.
tagsA 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 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:
iterAn iterator in the buffer.
textThe text to insert.
tagsA 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 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:
iterA position in the buffer.
textThe UTF-8 text.
lengthThe length of text, or -1.
tag_namesA vector of text tag names to apply to 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:
iterA position in the buffer.
textThe text to insert.
tag_namesA 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:
markA TextMark.
whereThe 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:
nameThe name of a mark.
whereThe 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:
clipboardThe Clipboard to paste from.
override_locationThe location to insert pasted text, or null for at the cursor.
default_editableWhether 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.

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

Parameters:
whereThe 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:
startOne bound of a range to be untagged.
endThe 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.

Removes a Clipboard added with add_selection_clipboard().

Parameters:
clipboardA 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:
tagA TextTag.
startOne bound of a range to be untagged.
endThe 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:
nameThe name of a named TextTag.
startOne bound of a range to be untagged.
endThe 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:
insertWhere to put the "insert" mark.
boundWhere 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:
settingThe 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 char *  text,
int  length = -1 
)

Deletes current contents of buffer, and inserts text instead.

Parameters:
textThe UTF-8 text to insert.
lengthThe length of text in bytes, or -1 if text is null-terminated.
void Xfc::Gtk::TextBuffer::set_text ( const String text)

Deletes current contents of buffer, and inserts text instead.

Parameters:
textThe text to insert.

Connect to the apply_tag_signal; emitted when a tag is applied to a range characters bewteen two iterators.

Connect to the begin_user_action_signal; emitted to indicate the user is starting buffer operations that are part of a single user-visible operation.

Connect to the changed_signal; emitted when the contents of the buffer are changed by an insertion or deletion action.

Connect to the delete_range_signal; emitted when contents of the buffer bewteen two iterators are removed.

Connect to the end_user_action_signal; emitted to indicate the user has ended the current buffer operations.

Connect to the modified_changed_signal; emitted when the buffer is modified since the last time it was saved.

Connect to the remove_tag_signal; emitted when all occurrences of a tag are removed from a range characters bewteen two iterators.


Member Data Documentation

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

Begin user action signal (see signal_begin_user_action()).

Calls a slot with the signature:

< void function();
<

Changed signal (see signal_changed()).

Calls a slot with the signature:

< void function();
<

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

End user action signal (see signal_end_user_action()).

Calls a slot with the signature:

< void function();
<

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

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

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

Mark deleted signal (see signal_mark_deleted()).

Calls a slot with the signature:

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

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

Modified changed signal (see signal_modified_changed()).

Calls a slot with the signature:

< void function();
<

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