Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gtk::TextMark Class Reference

A GtkTextMark C++ wrapper class. More...

`#include <inti/gtk/textbuffer.h>`

Inheritance diagram for Inti::Gtk::TextMark:

List of all members.

## Public Member Functions

Constructors

- virtual ~TextMark ()
    Destructor.

Accessors

- GtkTextMark * gtk_text_mark () const
    Get a pointer to the GtkTextMark structure.
- GtkTextMarkClass * gtk_text_mark_class () const
    Get a pointer to the GtkTextMarkClass structure.
- operator GtkTextMark * () const
    Conversion operator; safely converts a TextMark to a GtkTextMark pointer.
- bool get_visible () const
    Returns true if the mark is visible (that is, a cursor is displayed for it).
- String get_name () const
    Returns the mark name; or a null String for anonymous marks.
- bool get_deleted () const
    Returns true if the mark has been removed from its buffer with delete_mark().
- TextBuffer * get_buffer () const
    Gets the buffer this mark is located inside, or null if the mark is deleted.
- bool get_left_gravity () const
    Determines whether the mark has left gravity.

Methods

- void set_visible (bool setting)
    Sets the visibility of mark; the insertion point is normally visible, that is, you can see it as a vertical bar.

## Protected Member Functions

Constructors

- TextMark (GtkTextMark *mark, bool reference=false)
    Construct a new TextMark from an existing GtkTextMark.

## Detailed Description

A GtkTextMark C++ wrapper class.

A TextMark is like a bookmark in a text buffer; it preserves a position in the text across text buffer modifications. You can convert the mark to an iterator using Gtk::TextBuffer::get_iter_at_mark(). Unlike iterators, marks remain valid across buffer mutations, because their behavior is defined when text is inserted or deleted. When text containing a mark is deleted, the mark remains in the position originally occupied by the deleted text. When text is inserted at a mark, a mark with left gravity will be moved to the beginning of the newly-inserted text, and a mark with right gravity will be moved to the end.

Marks are reference counted, but the reference count only controls the validity of the memory; marks can be deleted from the buffer at any time with Gtk::TextBuffer::delete_mark(). Once deleted from the buffer, a mark is essentially useless. Marks optionally have names. There are two marks built-in to TextBuffer; these are named "insert" and "selection_bound" and refer to the insertion point and the boundary of the selection which is not the insertion point, respectively. If no text is selected, these two marks will be in the same position. You can manipulate what is selected and where the cursor appears by moving these marks around.

TextMarks can optionally have names. These names can be convenient to avoid passing the TextMark object around. Marks are typically created using the Gtk::TextBuffer::create_mark() method.

## Constructor & Destructor Documentation

Inti::Gtk::TextMark::TextMark | ( | GtkTextMark * | mark,
|  | bool | reference = false
| ) | `[explicit, protected]`

Construct a new TextMark from an existing GtkTextMark.

Parameters:

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

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

## Member Function Documentation

bool Inti::Gtk::TextMark::get_deleted | ( |  | ) | const

| Returns true if the mark has been removed from its buffer with delete_mark(). Marks can't be used once deleted.

void Inti::Gtk::TextMark::set_visible | ( | bool | setting | ) |

Sets the visibility of mark; the insertion point is normally visible, that is, you can see it as a vertical bar.

Parameters:

  setting | The visibility of mark.

The text widget uses a visible mark to indicate where a drop will occur when dragging and dropping text. Most other marks are not visible. Marks are not visible by default.

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

- textbuffer.h

Main Page - Footer