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


Public Member Functions | Static Protected Attributes
Xfc::Atk::Text Class Reference

A AtkText C++ wrapper class. More...

#include <xfc/atk/text.hh>

Inheritance diagram for Xfc::Atk::Text:
Xfc::G::TypeInterface Xfc::G::TypeInstance Xfc::Trackable

List of all members.

Public Member Functions

Accessors

Protected Member Functions

Constructors

Static Protected Attributes


Detailed Description

A AtkText C++ wrapper class.

Text should be implemented by Atk::Objects on behalf of widgets that have text content which is either attributed or otherwise non-trivial. Atk::Objects whose text content is simple, unattributed, and very brief may expose that content via Atk::Object::get_name() instead; however if the text is editable, multi-line, typically longer than three or four words, attributed, selectable, or if the object already uses the 'name' ATK property for other information, the Text interface should be used to expose the text content. In the case of editable text content, EditableText (a subtype of the Text interface) should be implemented instead.

Text provides not only traversal facilities and change notification for text content, but also caret tracking and glyph bounding box calculations. Note that the text strings are exposed as UTF-8, and are therefore potentially multi-byte, and caret-to-byte offset mapping makes no assumptions about the character length; also bounding box glyph-to-offset mapping may be complex for languages which use ligatures.


Member Function Documentation

bool Xfc::Atk::Text::add_selection ( int  start_offset,
int  end_offset 
)

Adds the selection bounded by the specified offsets.

Parameters:
start_offsetThe start position of the selected region.
end_offsetThe end position of the selected region.
Returns:
true if successful, false otherwise.
std::vector<TextRange> Xfc::Atk::Text::get_bounded_ranges ( const TextRectangle rect,
CoordType  coord_type,
TextClipType  x_clip_type,
TextClipType  y_clip_type 
)

Get the ranges of text in the specified bounding box.

Parameters:
rectA TextRectagle giving the dimensions of the bounding box.
coord_typeSpecifies whether coordinates are relative to the screen or widget window.
x_clip_typeSpecifies the horizontal clip type.
y_clip_typeSpecifies the vertical clip type.
Returns:
A vector of TextRange.

Gets the character at the specified offset.

Parameters:
offsetThe character position.
Returns:
The character at offset.

Gets the character count for the text.

Returns:
The number of characters in the text.
void Xfc::Atk::Text::get_character_extents ( int  offset,
int *  x,
int *  y,
int *  width,
int *  height,
CoordType  coords 
) const

Given an offset, the x, y, width, and height values are filled appropriately.

Parameters:
offsetA character position.
xThe location for the x-position of the character at position, or null.
yThe location for the y-position of the character at position, or null.
widthThe location for the width of the character at position, or null.
heightThe location for the height of the character at position, or null.
coordsSpecify whether coordinates are relative to the screen or the widget window.

Gets a list which consists of the default values of attributes for the text.

Returns:
A vector of Attribute which contains the default values of the attributes at offset.

See the enum Atk::TextAttribute for types of text attributes that can be returned. Note that other attributes may also be returned.

Gets the number of selected regions.

Returns:
The number of selected regions, or -1 if a failure occurred.
int Xfc::Atk::Text::get_offset_at_point ( int  x,
int  y,
CoordType  coords 
) const

Gets the offset of the character located at coordinates x and y.

Parameters:
xThe x-position of a character.
yThe y-position of a character.
coordsSpecify whether the coordinates are relative to the screen or widget window.
Returns:
The offset to the character which is located at the specified x and y coordinates.

x and y are interpreted as being relative to the screen or this widget's window, depending on coords.

TextRectangle Xfc::Atk::Text::get_range_extents ( int  start_offset,
int  end_offset,
CoordType  coord_type 
)

Get the bounding box for text within the specified range.

Parameters:
start_offsetThe offset of the first text character in the range.
end_offsetThe offset of the text character after the last character in the range.
coord_typeSpecifies whether coordinates are relative to the screen or widget window.
Returns:
A TextRectangle filled with the boundaries of the text range.
void Xfc::Atk::Text::get_range_extents ( int  start_offset,
int  end_offset,
CoordType  coord_type,
TextRectangle rect 
)

Get the bounding box for text within the specified range.

Parameters:
start_offsetThe offset of the first text character in the range.
end_offsetThe offset of the text character after the last character in the range.
coord_typeSpecifies whether coordinates are relative to the screen or widget window.
rectA TextRectangle which is filled in by this method.
std::vector<Attribute> Xfc::Atk::Text::get_run_attributes ( int  offset,
int *  start_offset,
int *  end_offset 
) const

Gets a list which consists of the attributes explicitly set at the position offset in the text.

Parameters:
offsetThe offset at which to get the attributes.
start_offsetThe address to put the start offset of the range, or null.
end_offsetThe address to put the end offset of the range, or null.
Returns:
A vector of Attribute which contains the attributes explicitly set at offset.

start_offset and end_offset are set to the start and end of the range around offset where the attributes are invariant. See the enum Atk::TextAttribute for the types of text attributes that can be returned. Note that other attributes may also be returned.

String Xfc::Atk::Text::get_selection ( int  selection_num,
int *  start_offset,
int *  end_offset 
) const

Gets the text from the specified selection.

Parameters:
selection_numThe selection number.
start_offsetThe location for the start position of the selected region.
end_offsetThe location for the end position of the selected region.
Returns:
The selected text.

Selected regions are assigned numbers that correspond to how far the region is from the start of the text. The selected region closest to the beginning of the text region is assigned the number 0, etc. Note that adding, moving or deleting a selected region can change the numbering.

String Xfc::Atk::Text::get_text ( int  start_offset,
int  end_offset 
) const

Gets the specified text.

Parameters:
start_offsetThe start position.
end_offsetThe end position.
Returns:
The text from start_offset up to, but not including end_offset.
String Xfc::Atk::Text::get_text_after_offset ( int  offset,
TextBoundary  boundary_type,
int *  start_offset,
int *  end_offset 
) const

Gets the specified text.

Parameters:
offsetThe position
boundary_typeA TextBoundary.
start_offsetThe location for the start offset of the returned string.
end_offsetThe location for the end offset of the returned string.
Returns:
The text after offset bounded by the specified boundary_type.

If boundary_type is TEXT_BOUNDARY_CHAR the character after the offset is returned.

If boundary_type is TEXT_BOUNDARY_WORD_START the returned string is from the word start after the offset to the next word start. The returned string will contain the word after the offset if the offset is inside a word or if the offset is not inside a word.

If boundary_type is TEXT_BOUNDARY_WORD_END the returned string is from the word end at or after the offset to the next work end. The returned string will contain the word after the offset if the offset is inside a word and will contain the word after the word after the offset if the offset is not inside a word.

If boundary_type is TEXT_BOUNDARY_SENTENCE_START the returned string is from the sentence start after the offset to the next sentence start. The returned string will contain the sentence after the offset if the offset is inside a sentence or if the offset is not inside a sentence.

If boundary_type is TEXT_BOUNDARY_SENTENCE_END the returned string is from the sentence end at or after the offset to the next sentence end. The returned string will contain the sentence after the offset if the offset is inside a sentence and will contain the sentence after the sentence after the offset if the offset is not inside a sentence.

If boundary_type is TEXT_BOUNDARY_LINE_START the returned string is from the line start after the offset to the next line start.

If boundary_type is TEXT_BOUNDARY_LINE_END the returned string is from the line end at or after the offset to the next line start.

String Xfc::Atk::Text::get_text_at_offset ( int  offset,
TextBoundary  boundary_type,
int *  start_offset,
int *  end_offset 
) const

Gets the specified text.

Parameters:
offsetThe position
boundary_typeA TextBoundary.
start_offsetThe location for the start offset of the returned string.
end_offsetThe location for the end offset of the returned string.
Returns:
The text after offset bounded by the specified boundary_type.

If boundary_type is TEXT_BOUNDARY_CHAR the character at the offset is returned.

If boundary_type is TEXT_BOUNDARY_WORD_START the returned string is from the word start at or before the offset to the word start after the offset. The returned string will contain the word at the offset if the offset is inside a word and will contain the word before the offset if the offset is not inside a word.

If boundary_type is TEXT_BOUNDARY_WORD_END the returned string is from the word end before the offset to the word end at or after the offset. The returned string will contain the word at the offset if the offset is inside a word and will contain the word after to the offset if the offset is not inside a word.

If boundary_typee is TEXT_BOUNDARY_SENTENCE_START the returned string is from the sentence start at or before the offset to the sentence start after the offset. The returned string will contain the sentence at the offset if the offset is inside a sentence and will contain the sentence before the offset if the offset is not inside a sentence.

If boundary_type is ATK_TEXT_BOUNDARY_SENTENCE_END the returned string is from the sentence end before the offset to the sentence end at or after the offset. The returned string will contain the sentence at the offset if the offset is inside a sentence and will contain the sentence after the offset if the offset is not inside a sentence.

If boundary_type is TEXT_BOUNDARY_LINE_START the returned string is from the line start at or before the offset to the line start after the offset.

If boundary_type is TEXT_BOUNDARY_LINE_END the returned string is from the line end before the offset to the line end at or after the offset.

String Xfc::Atk::Text::get_text_before_offset ( int  offset,
TextBoundary  boundary_type,
int *  start_offset,
int *  end_offset 
) const

Gets the specified text.

Parameters:
offsetThe position
boundary_typeA TextBoundary.
start_offsetThe location for the start offset of the returned string.
end_offsetThe location for the end offset of the returned string.
Returns:
The text after offset bounded by the specified boundary_type.

If the boundary_type is TEXT_BOUNDARY_CHAR the character before the offset is returned.

If boundary_type is TEXT_BOUNDARY_WORD_START the returned string is from the word start before the word start before the offset to the word start before the offset. The returned string will contain the word before the offset if the offset is inside a word and will contain the word before the word before the offset if the offset is not inside a word.

If boundary_type is TEXT_BOUNDARY_WORD_END the returned string is from the word end before the word end at or before the offset to the word end at or before the offset. The returned string will contain the word before the offset if the offset is inside a word or if the offset is not inside a word.

If boundary_type is TEXT_BOUNDARY_SENTENCE_START the returned string is from the sentence start before the sentence start before the offset to the sentence start before the offset. The returned string will contain the sentence before the offset if the offset is inside a sentence and will contain the sentence before the sentence before the offset if the offset is not inside a sentence.

If boundary_type is TEXT_BOUNDARY_SENTENCE_END the returned string is from the sentence end before the sentence end at or before the offset to the sentence end at or before the offset. The returned string will contain the sentence before the offset if the offset is inside a sentence or if the offset is not inside a sentence.

If boundary_type is TEXT_BOUNDARY_LINE_START the returned string is from the line start before the line start at or before the offset to the line start ar or before the offset.

If boundary_type is TEXT_BOUNDARY_LINE_END the returned string is from the line end before the line end before the offset to the line end before the offset.

bool Xfc::Atk::Text::remove_selection ( int  selection_num)

Removes the specified selection.

Parameters:
selection_numThe selection number.
Returns:
true if successful, false otherwise.

Selected regions are assigned numbers that correspond to how far the region is from the start of the text. The selected region closest to the beginning of the text region is assigned the number 0, etc. Note that adding, moving or deleting a selected region can change the numbering.

bool Xfc::Atk::Text::set_caret_offset ( int  offset)

Sets the caret (cursor) position to the specified offset.

Parameters:
offsetA character position.
Returns:
true if successful, false otherwise.
bool Xfc::Atk::Text::set_selection ( int  selection_num,
int  start_offset,
int  end_offset 
)

Changes the start and end offset of the specified selection.

Parameters:
selection_numThe selection number.
start_offsetThe new start position of the selection.
end_offsetThe new end position of the selection.
Returns:
true if successful, false otherwise.

Selected regions are assigned numbers that correspond to how far the region is from the start of the text. The selected region closest to the beginning of the text region is assigned the number 0, etc. Note that adding, moving or deleting a selected region can change the numbering.


Member Data Documentation

Text attributes changed signal (see signal_text_attributes_changed()).

Calls a slot with the signature:

< void function();
<

Text caret moved signal (see signal_text_caret_moved()).

Calls a slot with the signature:

< void function(int location);
< // location: The new position of the text caret.
<

Text changed signal (see signal_text_change()).

Calls a slot with the signature:

< void function(int position, int length);
< // position: The position of the insertion or deletion.
< // length: The length of the text inserted or deleted.
<

Text selection changed signal (see signal_text_selection_changed()).

Calls a slot with the signature:

< void function();
<

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