## GailTextUtil

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

## Synopsis

    struct              GailTextUtil;
    enum                GailOffsetType;
    GailTextUtil *      gail_text_util_new                  (void);
    void                gail_text_util_text_setup           (GailTextUtil *textutil,
                                                             const gchar *text);
    void                gail_text_util_buffer_setup         (GailTextUtil *textutil,
                                                             GtkTextBuffer *buffer);
    gchar *             gail_text_util_get_text             (GailTextUtil *textutil,
                                                             gpointer layout,
                                                             GailOffsetType function,
                                                             AtkTextBoundary boundary_type,
                                                             gint offset,
                                                             gint *start_offset,
                                                             gint *end_offset);
    gchar *             gail_text_util_get_substring        (GailTextUtil *textutil,
                                                             gint start_pos,
                                                             gint end_pos);

## Description

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

In GAIL it is used by the accsesible objects for GnomeCanvasText, GtkEntry, GtkLabel, GtkCellRendererText and GtkTextView.

## Details

### struct GailTextUtil

    struct GailTextUtil {
      GObject parent;

      GtkTextBuffer *buffer;
    };

### enum GailOffsetType

    typedef enum {
      GAIL_BEFORE_OFFSET,
      GAIL_AT_OFFSET,
      GAIL_AFTER_OFFSET
    } GailOffsetType;

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 `gail_text_util_get_text()` is being called for.

`GAIL_BEFORE_OFFSET` | Text before offset is required.
`GAIL_AT_OFFSET` | Text at offset is required,
`GAIL_AFTER_OFFSET` | Text after offset is required.

### gail_text_util_new ()

    GailTextUtil *      gail_text_util_new                  (void);

This function creates a new GailTextUtil object.

Returns : | the GailTextUtil object

### gail_text_util_text_setup ()

    void                gail_text_util_text_setup           (GailTextUtil *textutil,
                                                             const gchar *text);

This function initializes the GailTextUtil with the specified character string,

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

### gail_text_util_buffer_setup ()

    void                gail_text_util_buffer_setup         (GailTextUtil *textutil,
                                                             GtkTextBuffer *buffer);

This function initializes the GailTextUtil with the specified GtkTextBuffer

`textutil` : | A GailTextUtil to be initialized
`buffer` : | The GtkTextBuffer which identifies the text to be stored in the GailUtil.

### gail_text_util_get_text ()

    gchar *             gail_text_util_get_text             (GailTextUtil *textutil,
                                                             gpointer layout,
                                                             GailOffsetType function,
                                                             AtkTextBoundary boundary_type,
                                                             gint offset,
                                                             gint *start_offset,
                                                             gint *end_offset);

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

`textutil` : | A GailTextUtil
`layout` : | A gpointer which is a PangoLayout, a GtkTreeView 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 GailTextUtil
`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

### gail_text_util_get_substring ()

    gchar *             gail_text_util_get_substring        (GailTextUtil *textutil,
                                                             gint start_pos,
                                                             gint end_pos);

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

`textutil` : | A GailTextUtil
`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`