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


Public Member Functions | Static Protected Attributes
Xfc::Gtk::TextTag Class Reference

A GtkTextTag C++ wrapper class. More...

#include <xfc/gtk/texttag.hh>

Inheritance diagram for Xfc::Gtk::TextTag:
Xfc::G::Object Xfc::G::TypeInstance Xfc::Trackable Xfc::Gtk::SourceTag Xfc::Gtk::PatternTag Xfc::Gtk::SyntaxTag Xfc::Gtk::KeywordListTag Xfc::Gtk::LineCommentTag Xfc::Gtk::StringTag

List of all members.

Public Member Functions

Static Protected Attributes

Constructors


Detailed Description

A GtkTextTag C++ wrapper class.

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

A tag is represented by a TextTag object. One TextTag can be applied to any number of text ranges in any number of buffers. 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).

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::TextTag::TextTag ( GtkTextTag *  tag,
bool  owns_reference = true 
) [explicit, protected]

Construct a new TextTag from an existing GtkTextTag.

Parameters:
tagA pointer to a GtkTextTag.
owns_referenceSet false if the initial reference count is floating, set true if it's not.

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

Xfc::Gtk::TextTag::TextTag ( const String name) [explicit]

Constructs a new text tag with a reference count of 1 that the caller owns.

Parameters:
nameThe name for the text tag.

Member Function Documentation

bool Xfc::Gtk::TextTag::event ( G::Object event_object,
Gdk::Event event,
const TextIter iter 
)

Emits the event signal on the TextTag.

Parameters:
event_objectThe object that received the event, such as a widget.
eventThe event.
iterThe location where the event was received.
Returns:
The result of signal emission (whether the event was handled).

Gets the tag priority.

Returns:
The tag's priority.
const BackgroundFullHeightPropertyProxy Xfc::Gtk::TextTag::property_background_full_height ( )

Whether the background color fills the entire line height or only the height of the tagged characters (bool : Read / Write).

const LanguagePropertyProxy Xfc::Gtk::TextTag::property_language ( )

The language this text is in, as an ISO code.

Pango can use this as a hint when rendering the text. If you don't understand this parameter, you probably don't need it (String : Read / Write).

const NamePropertyProxy Xfc::Gtk::TextTag::property_name ( )

The name used to refer to the text tag; null for anonymous tags (String : Read / Write / Construct Only).

const RisePropertyProxy Xfc::Gtk::TextTag::property_rise ( )

The offset of text above the baseline (below the baseline if rise is negative) in pixels (int : Read / Write).

const ScalePropertyProxy Xfc::Gtk::TextTag::property_scale ( )

The font size as a scale factor relative to the default font size.

This properly adapts to theme changes etc. so is recommended. Pango predefines some scales such as PANGO_SCALE_X_LARGE (double : Read / Write).

const WrapModePropertyProxy Xfc::Gtk::TextTag::property_wrap_mode ( )

Whether to wrap lines never, at word boundaries, or at character boundaries (WrapMode : Read / Write).

void Xfc::Gtk::TextTag::set_priority ( int  priority)

Sets the priority of the TextTag.

Parameters:
priorityThe new priority.

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_text_buffer_create_tag(), which adds the tag to the buffer's table automatically.

Returns the tag table for the tag.

Returns:
The tag table.

Returns a smart pointer to the TextAttributes the tag uses for displaying text.

The information specified acts an override on information specified by lower-priority tags. If no value is specified, then the next-lower-priority tag on the text determines the value. The text widget itself provides defaults if no tag specifies an override.


Member Data Documentation

Event signal (see signal_event()).

Calls a slot with the signature:

< bool function(G::Object& event_object, Gdk::Event& event, const TextIter& iter);
< // event_object: The object that received the event, such as a widget.
< // event: The event.
< // iter: The location where the event was received.
< // return: true if the event was handled, false if it wasn't handled.
<

The documentation for this class was generated from the following file:
Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC