Créer  Editer  FrontPage  Index  Chercher  Changements  History  RSS  Login

Gtk::SourceBuffer

class Gtk::SourceBuffer

Text buffer object for Gtk::SourceView.

Class Methods

Gtk::SourceBuffer.new(obj=nil)
Creates a new source buffer. If a Gtk::SourceTagTable is provided, the buffer will use it, otherwise it will create a new one. If a Gtk::SourceLanguage object is given, the buffer will be created using highlightings patterns in this language. This is equivalent to creating a new source buffer with the default tag table and then setting the 'language' property.

Instance Methods

bracket_match_style=(style)
Sets the style used for highlighting matching brackets.
  • style: the Gtk::SourceTagStyle specifying colors and text attributes.
  • Returns: the given parameter 'style'.
can_redo?
Determines whether a source buffer can redo the last action (i.e. if the last operation was an undo).
  • Returns: whether a redo is possible.
can_undo?
Determines whether a source buffer can undo the last action.
  • Returns: whether it's possible to undo the last action.
create_marker(name=nil, type=nil, where)
Creates a marker in the buffer of the given type. A marker is semantically very similar to a Gtk::TextMark, except it has a type which is used by the Gtk::SourceView object displaying the buffer to show a pixmap on the left margin, at the line the marker is in. Because of this, a marker is generally associated to a line and not a character position. Markers are also accessible through a position or range in the buffer. Markers are implemented using Gtk::TextMark, so all characteristics and restrictions to marks apply to markers too. These includes life cycle issues and "mark-set" and "mark-deleted" signal emissions. Like a Gtk::TextMark, a Gtk::SourceMarker can be anonymous if the passed name is nil. Markers always have left gravity and are moved to the beginning of the line when the user deletes the line they were in. Also, if the user deletes a region of text which contained lines with markers, those are deleted. Typical uses for a marker are bookmarks, breakpoints, current executing instruction indication in a source file, etc..
  • where: a location to place the marker, as a Gtk::TreeIter object.
  • name: the name of the marker.
  • type: a string defining the marker type.
  • Returns: a new Gtk::SourceMarker object, owned by the buffer.
delete_marker(marker)
Deletes a marker from the source buffer. The same conditions as for Gtk::TextMark apply here.
first_marker
Gets the first (nearest to the top of the buffer) marker in the buffer.
  • Returns: a reference to the first Gtk::SourceMarker, or nil if there are no markers in the buffer.
get_iter_at_marker(iter, marker)
Initializes iter at the location of marker.
get_marker(name)
Looks up the Gtk::SourceMarker named name in buffer, returning nil if it doesn't exists.
  • name: the name of the marker to retrieve.
  • Returns: a reference to a Gtk::SourceMarker object, or nil if it's not found.
get_markers(begin, end)
Returns an ordered (by position) list of Gtk::SourceMarker objects inside the region delimited by the Gtk::TextIter begin and end. The iters may be in any order.
get_next_marker(iter)
Returns the nearest marker to the right of iter. If there are multiple markers at the same position, this method will always return the first one (from the internal linked list), even if starting the search exactly at its location. You can get the others using Gtk::SourceMarker#next.
  • iter: the location to search from, as a Gtk::TextIter object.
  • Returns: the Gtk::SourceMarker nearest to the right of iter, or nil if there are no more markers after iter.
get_prev_marker(iter)
Returns the nearest marker to the left of iter. If there are multiple markers at the same position, this method will always return the last one (from the internal linked list), even if starting the search exactly at its location. You can get the others using Gtk::SourceMarker#next.
  • iter: the location to search from, as a Gtk::TextIter object.
  • Returns: the Gtk::SourceMarker nearest to the left of iter, or nil if there are no more markers after iter.
last_marker
Returns the last (nearest to the bottom of the buffer) marker in buffer.
  • Returns: a reference to the first Gtk::SourceMarker, or nil if there are no markers in the buffer.
move_marker(marker, where)
Moves a marker to a new location in the buffer.
non_undoable_action { ... }
Synonym for Gtk::SourceBuffer#not_undoable_action.
  • Returns: the return value of the provided block.
begin_not_undoable_action
begin_not_undoable_action { ... }
Marks the beginning of a not undoable action on the buffer, disabling the undo manager. If a block is given, the block is called after marking the beginning of a not undoable action on the buffer. At the end of the block, marks the end of a not undoable action on the buffer. When the last not undoable block is finished, the list of undo actions is cleared and the undo manager is re-enabled.
  • Returns: self
end_not_undoable_action
Marks the end of a not undoable action on the buffer. When the last not undoable block is finished, the list of undo actions is cleared and the undo manager is re-enabled.
  • Returns: self
not_undoable_action { ... }
Marks the beginning of a not undoable action on the buffer, disabling the undo manager, then calls the provided block of code. At the end of the block, marks the end of a not undoable action on the buffer. When the last not undoable block is finished, the list of undo actions is cleared and the undo manager is re-enabled. Deprecated Use begin_not_undoable_action instead.
  • Returns: the return value of the provided block.
redo!
Redoes the last undo operation. Use Gtk::SourceBuffer#can_redo? to check whether a call to this function will have any effect.
  • Returns: self.
set_bracket_match_style(style)
Sets the style used for highlighting matching brackets.
undo!
Undoes the last user action which modified the buffer. Use Gtk::SourceBuffer#can_undo? to check whether a call to this function will have any effect. Actions are defined as groups of operations between a call to Gtk::TextBuffer#begin_user_action and Gtk::TextBuffer#end_user_action, or sequences of similar edits (inserts or deletes) on the same line.
  • Returns: self.

Properties

check-brackets: true or false (Read/Write)
Whether to check and highlight matching brackets.
escape-char: Integer (Read/Write)
Escaping character for syntax patterns.
highlight: true or false (Read/Write)
Whether to highlight syntax in the buffer.
language: Gtk::SourceLanguage (Read/Write)
Language object to get highlighting patterns from.
max-undo-levels: Integer (Read/Write)
Number of undo levels for the buffer.
Dernière modification:2011/06/09 07:25:56
Mots clef:
Références:[Gtk::SourceView] [Gtk::SourceBuffer] [Gtk::SourceMarker]