![]() |
![]() |
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 might make the text inside the tag bold. However, the tag concept is more general than that; tags don't have to affect appearance. They can instead affect the behavior of mouse and key presses, "lock" a range of text so the user can't edit it, or countless other things. One tag can be applied to any number of text ranges in any number of Gtk::TextBuffers.
Each tag is stored in a Gtk::TextBuffer::TagTable, and Tags should be in the Gtk::TextBuffer::TagTable for a given Gtk::TextBuffer before using them with that buffer.
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).
Gtk::TextBuffer::create_tag() is the best way to create tags. See the demo for numerous examples.
Public Member Functions | ||||
bool | event (const Glib::RefPtr<Glib::Object>& event_object, GdkEvent* event, const TextIter& iter) | |||
Emits the "event" signal on the Gtk::TextTag. | ||||
int | get_priority () const | |||
Get the tag priority. | ||||
const GtkTextTag* | gobj () const | |||
Provides access to the underlying C GObject. | ||||
GtkTextTag* | gobj () | |||
Provides access to the underlying C GObject. | ||||
GtkTextTag* | gobj_copy () | |||
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | ||||
void | set_priority (int priority) | |||
Sets the priority of a Gtk::TextTag. | ||||
Glib::SignalProxy3< bool, const Glib::RefPtr< Glib::Object > &, GdkEvent*, const TextIter& > | signal_event () | |||
| ||||
virtual | ~TextTag () | |||
Static Public Member Functions | ||||
static Glib::RefPtr<TextTag> | create (const Glib::ustring& name) | |||
static Glib::RefPtr<TextTag> | create () | |||
Protected Member Functions | ||||
TextTag (const Glib::ustring& name) | ||||
TextTag () | ||||
Related Functions | ||||
(Note that these are not member functions.) | ||||
Glib::RefPtr<Gtk::TextTag> | wrap (GtkTextTag* object, bool take_copy=false) | |||
|
virtual Gtk::TextTag::~TextTag | ( | ) | [virtual] |
Gtk::TextTag::TextTag | ( | ) | [protected] |
Gtk::TextTag::TextTag | ( | const Glib::ustring & | name | ) | [explicit, protected] |
static Glib::RefPtr<TextTag> Gtk::TextTag::create | ( | const Glib::ustring & | name | ) | [static] |
static Glib::RefPtr<TextTag> Gtk::TextTag::create | ( | ) | [static] |
bool Gtk::TextTag::event | ( | const Glib::RefPtr< Glib::Object > & | event_object, | |
GdkEvent * | event, | |||
const TextIter& | iter | |||
) |
Emits the "event" signal on the Gtk::TextTag.
event_object | Object that received the event, such as a widget. | |
event | The event. | |
iter | Location where the event was received. |
int Gtk::TextTag::get_priority | ( | ) | const |
Get the tag priority.
const GtkTextTag* Gtk::TextTag::gobj | ( | ) | const [inline] |
Provides access to the underlying C GObject.
GtkTextTag* Gtk::TextTag::gobj | ( | ) | [inline] |
Provides access to the underlying C GObject.
GtkTextTag* Gtk::TextTag::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
void Gtk::TextTag::set_priority | ( | int | priority | ) |
Sets the priority of a Gtk::TextTag.
Valid priorities are start at 0 and go to one less than Gtk::TextTagTable::get_size(). Each tag in a table has a unique priority; setting the priority of one tag shifts the priorities of all the other tags in the table to maintain a unique priority for each tag. Higher priority tags "win" if two tags both set the same text attribute. When adding a tag to a tag table, it will be assigned the highest priority in the table by default; so normally the precedence of a set of tags is the order in which they were added to the table, or created with Gtk::TextBuffer::create_tag(), which adds the tag to the buffer's table automatically.
priority | The new priority. |
Glib::SignalProxy3<bool,const Glib::RefPtr<Glib::Object>&,GdkEvent*,const TextIter&> Gtk::TextTag::signal_event | ( | ) |
bool event(const Glib::RefPtr<Glib::Object>& event_object, GdkEvent* event, const TextIter& iter)
Glib::RefPtr<Gtk::TextTag> wrap | ( | GtkTextTag * | object, | |
bool | take_copy = false | |||
) | [related] |
object | The C instance |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |