gtkmm 4.17.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Symbols | List of all members
Gtk::TextMark Class Reference

Typedefed as Gtk::TextBuffer::Mark. More...

#include <gtkmm/textmark.h>

Inheritance diagram for Gtk::TextMark:
Inheritance graph
[legend]

Public Member Functions

 TextMark (TextMark &&src) noexcept
 
TextMarkoperator= (TextMark &&src) noexcept
 
 ~TextMark () noexcept override
 
GtkTextMarkgobj ()
 Provides access to the underlying C GObject.
 
const GtkTextMarkgobj () const
 Provides access to the underlying C GObject.
 
GtkTextMarkgobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
 
void set_visible (bool setting=true)
 Sets the visibility of mark.
 
bool get_visible () const
 Returns true if the mark is visible.
 
Glib::ustring get_name () const
 Returns the mark name.
 
bool get_deleted () const
 Returns true if the mark has been removed from its buffer.
 
Glib::RefPtr< TextBufferget_buffer ()
 Gets the buffer this mark is located inside.
 
Glib::RefPtr< const TextBufferget_buffer () const
 Gets the buffer this mark is located inside.
 
bool get_left_gravity () const
 Determines whether the mark has left gravity.
 
TextIter get_iter ()
 
TextConstIter get_iter () const
 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_name () const
 The name of the mark or nullptr if the mark is anonymous.
 
Glib::PropertyProxy_ReadOnly< bool > property_left_gravity () const
 Whether the mark has left gravity.
 
- Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&src) noexcept
 
Objectoperator= (Object &&src) noexcept
 
voidget_data (const QueryQuark &key)
 
void set_data (const Quark &key, void *data)
 
void set_data_with_c_callback (const Quark &key, void *data, GDestroyNotify notify)
 
void set_data (const Quark &key, void *data, DestroyNotify notify)
 
void remove_data (const QueryQuark &quark)
 
voidsteal_data (const QueryQuark &quark)
 
Glib::RefPtr< Glib::Objectwrap (GObject *object, bool take_copy=false)
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
 
ObjectBaseoperator= (const ObjectBase &)=delete
 
void set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
 
void get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
 
void set_property (const Glib::ustring &property_name, const PropertyType &value)
 
void get_property (const Glib::ustring &property_name, PropertyType &value) const
 
PropertyType get_property (const Glib::ustring &property_name) const
 
sigc::connection connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
 
sigc::connection connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
 
void freeze_notify ()
 
void thaw_notify ()
 
virtual void reference () const
 
virtual void unreference () const
 
GObjectgobj ()
 
const GObjectgobj () const
 
GObjectgobj_copy () const
 
- Public Member Functions inherited from sigc::trackable
 trackable () noexcept
 
 trackable (const trackable &src) noexcept
 
 trackable (trackable &&src) noexcept
 
 ~trackable ()
 
void add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
 
void notify_callbacks ()
 
trackableoperator= (const trackable &src)
 
trackableoperator= (trackable &&src) noexcept
 
void remove_destroy_notify_callback (notifiable *data) const
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system.
 
static Glib::RefPtr< TextMarkcreate (bool left_gravity=true)
 Creates an anoymous text mark.
 
static Glib::RefPtr< TextMarkcreate (const Glib::ustring & name, bool left_gravity=true)
 Creates a text mark.
 

Protected Member Functions

 TextMark (bool left_gravity=true)
 Creates an anoymous text mark.
 
 TextMark (const Glib::ustring & name, bool left_gravity=true)
 Creates a text mark.
 
- Protected Member Functions inherited from Glib::Object
 Object ()
 
 Object (const Glib::ConstructParams &construct_params)
 
 Object (GObject *castitem)
 
 ~Object () noexcept override
 
- Protected Member Functions inherited from Glib::ObjectBase
 ObjectBase ()
 
 ObjectBase (const char *custom_type_name)
 
 ObjectBase (const std::type_info &custom_type_info)
 
 ObjectBase (ObjectBase &&src) noexcept
 
ObjectBaseoperator= (ObjectBase &&src) noexcept
 
virtual ~ObjectBase () noexcept=0
 
void initialize (GObject *castitem)
 
void initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
 

Related Symbols

(Note that these are not member symbols.)

Glib::RefPtr< Gtk::TextMarkwrap (GtkTextMark *object, bool take_copy=false)
 A Glib::wrap() method for this object.
 

Additional Inherited Members

- Public Types inherited from Glib::Object
typedef void(*)(gpointer data DestroyNotify)
 
- Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify func_destroy_notify
 
- Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify func_destroy_notify
 

Detailed Description

Typedefed as Gtk::TextBuffer::Mark.

A position in the buffer, preserved across buffer modifications.

A Mark is like a bookmark in a text buffer; it preserves a position in the text. 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. The standard text cursor in left-to-right languages is a mark with right gravity, because it stays to the right of inserted text.

Like tags, marks can be either named or anonymous. There are two marks built-in to Gtk::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.

"left" and "right" here refer to logical direction (left is the toward the start of the buffer); in some languages such as Hebrew the logically-leftmost text is not actually on the left when displayed.

You can convert the mark to an iterator or a const_iterator using Gtk::TextBuffer::get_iter_at_mark().

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; these can be convenient to avoid passing the Gtk::TextBuffer::Mark object around.

Marks are typically created using the Gtk::TextBuffer::create_mark() function.

Constructor & Destructor Documentation

◆ TextMark() [1/3]

Gtk::TextMark::TextMark ( TextMark &&  src)
noexcept

◆ ~TextMark()

Gtk::TextMark::~TextMark ( )
overridenoexcept

◆ TextMark() [2/3]

Gtk::TextMark::TextMark ( bool  left_gravity = true)
explicitprotected

Creates an anoymous text mark.

Add it to a buffer using Gtk::TextBuffer::add_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).

Parameters
left_gravityWhether the mark should have left gravity.

◆ TextMark() [3/3]

Gtk::TextMark::TextMark ( const Glib::ustring name,
bool  left_gravity = true 
)
explicitprotected

Creates a text mark.

Add it to a buffer using Gtk::TextBuffer::add_mark(). The mark can be retrieved by name using Gtk::TextBuffer::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).

Parameters
namemark name.
left_gravityWhether the mark should have left gravity.

Member Function Documentation

◆ create() [1/2]

static Glib::RefPtr< TextMark > Gtk::TextMark::create ( bool  left_gravity = true)
static

Creates an anoymous text mark.

Add it to a buffer using Gtk::TextBuffer::add_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).

Parameters
left_gravityWhether the mark should have left gravity.
Returns
A RefPtr to a new text mark.

◆ create() [2/2]

static Glib::RefPtr< TextMark > Gtk::TextMark::create ( const Glib::ustring name,
bool  left_gravity = true 
)
static

Creates a text mark.

Add it to a buffer using Gtk::TextBuffer::add_mark(). The mark can be retrieved by name using Gtk::TextBuffer::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).

Parameters
namemark name.
left_gravityWhether the mark should have left gravity.
Returns
A RefPtr to a new text mark.

◆ get_buffer() [1/2]

Glib::RefPtr< TextBuffer > Gtk::TextMark::get_buffer ( )

Gets the buffer this mark is located inside.

Returns
The mark’s Gtk::TextBuffer.

◆ get_buffer() [2/2]

Glib::RefPtr< const TextBuffer > Gtk::TextMark::get_buffer ( ) const

Gets the buffer this mark is located inside.

Returns
The mark’s Gtk::TextBuffer.

◆ get_deleted()

bool Gtk::TextMark::get_deleted ( ) const

Returns true if the mark has been removed from its buffer.

See Gtk::TextBuffer::add_mark() for a way to add it to a buffer again.

Returns
Whether the mark is deleted.

◆ get_iter() [1/2]

TextIter Gtk::TextMark::get_iter ( )

◆ get_iter() [2/2]

TextConstIter Gtk::TextMark::get_iter ( ) const

◆ get_left_gravity()

bool Gtk::TextMark::get_left_gravity ( ) const

Determines whether the mark has left gravity.

Returns
true if the mark has left gravity, false otherwise.

◆ get_name()

Glib::ustring Gtk::TextMark::get_name ( ) const

Returns the mark name.

Returns
Mark name.

◆ get_type()

static GType Gtk::TextMark::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

◆ get_visible()

bool Gtk::TextMark::get_visible ( ) const

Returns true if the mark is visible.

A cursor is displayed for visible marks.

Returns
true if visible.

◆ gobj() [1/2]

GtkTextMark * Gtk::TextMark::gobj ( )
inline

Provides access to the underlying C GObject.

◆ gobj() [2/2]

const GtkTextMark * Gtk::TextMark::gobj ( ) const
inline

Provides access to the underlying C GObject.

◆ gobj_copy()

GtkTextMark * Gtk::TextMark::gobj_copy ( )

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

◆ operator=()

TextMark & Gtk::TextMark::operator= ( TextMark &&  src)
noexcept

◆ property_left_gravity()

Glib::PropertyProxy_ReadOnly< bool > Gtk::TextMark::property_left_gravity ( ) const

Whether the mark has left gravity.

When text is inserted at the mark’s current location, if the mark has left gravity it will be moved to the left of the newly-inserted text, otherwise to the right.

Default value: false

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_name()

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::TextMark::property_name ( ) const

The name of the mark or nullptr if the mark is anonymous.

Default value: ""

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ set_visible()

void Gtk::TextMark::set_visible ( bool  setting = true)

Sets the visibility of mark.

The insertion point is normally visible, i.e. you can see it as a vertical bar. Also, 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.

Parameters
settingVisibility of mark.

Friends And Related Symbol Documentation

◆ wrap()

Glib::RefPtr< Gtk::TextMark > wrap ( GtkTextMark object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.