CailTextUtil: CAIL Reference Manual

## CailTextUtil CailTextUtil — CailTextUtil is a utility class which can be used to implement some of the AtkText functions for accessible objects which implement AtkText. |

## Functions

CailTextUtil * | cail_text_util_new ()
void | cail_text_util_text_setup ()
void | cail_text_util_buffer_setup ()
gchar * | cail_text_util_get_text ()
gchar * | cail_text_util_get_substring ()

## Types and Values

struct | CailTextUtil
enum | CailOffsetType

## Description

CailTextUtil is a utility class which can be used to implement the AtkText functions which get text for accessible objects which implement AtkText.

In CAIL it is used by the accsesible objects for GnomeCanvasText, CtkEntry, CtkLabel, CtkCellRendererText and CtkTextView.

## Functions

### cail_text_util_new ()

    CailTextUtil *
    cail_text_util_new (void);

This function creates a new CailTextUtil object.

#### Returns

the CailTextUtil object

### cail_text_util_text_setup ()

    void
    cail_text_util_text_setup (CailTextUtil *textutil,
                               const gchar *text);

This function initializes the CailTextUtil with the specified character string,

#### Parameters

textutil | The CailTextUtil to be initialized. |
text | A gchar* which points to the text to be stored in the CailTextUtil |

### cail_text_util_buffer_setup ()

    void
    cail_text_util_buffer_setup (CailTextUtil *textutil,
                                 CtkTextBuffer *buffer);

This function initializes the CailTextUtil with the specified CtkTextBuffer

#### Parameters

textutil | A CailTextUtil to be initialized |
buffer | The CtkTextBuffer which identifies the text to be stored in the CailUtil. |

### cail_text_util_get_text ()

    gchar *
    cail_text_util_get_text (CailTextUtil *textutil,
                             gpointer layout,
                             CailOffsetType function,
                             AtkTextBoundary boundary_type,
                             gint offset,
                             gint *start_offset,
                             gint *end_offset);

This function gets the requested substring from the text in the CtkTextUtil. The layout is used only for getting the text on a line. The value is NULL for a CtkTextView which is not wrapped, is a CtkTextView for a CtkTextView which is wrapped and is a PangoLayout otherwise.

#### Parameters

textutil | A CailTextUtil |
layout | A gpointer which is a PangoLayout, a CtkTreeView of NULL |
function | An enumeration specifying whether to return the text before, at, or after the offset. |
boundary_type | The boundary type. |
offset | The offset of the text in the CailTextUtil |
start_offset | Address of location in which the start offset is returned |
end_offset | Address of location in which the end offset is returned |

#### Returns

the substring requested

### cail_text_util_get_substring ()

    gchar *
    cail_text_util_get_substring (CailTextUtil *textutil,
                                  gint start_pos,
                                  gint end_pos);

Gets the substring indicated by `start_pos` and `end_pos`

#### Parameters

textutil | A CailTextUtil |
start_pos | The start position of the substring |
end_pos | The end position of the substring. |

#### Returns

the substring indicated by `start_pos` and `end_pos`

## Types and Values

### struct CailTextUtil

    struct CailTextUtil {
      CtkTextBuffer *buffer;
    };

#### Members

CtkTextBuffer *`buffer`; | The CtkTextBuffer which identifies the text. |

### enum CailOffsetType

Specifies which of the functions `atk_text_get_text_before_offset()`, `atk_text_get_text_at_offset()`, `atk_text_get_text_after_offset()` the function `cail_text_util_get_text()` is being called for.

#### Members

CAIL_BEFORE_OFFSET | Text before offset is required. |
CAIL_AT_OFFSET | Text at offset is required, |
CAIL_AFTER_OFFSET | Text after offset is required. |