## IAnjutaEditorSelection

IAnjutaEditorSelection — Text editor selection interface

## Stability Level

Unstable, unless otherwise indicated

## Synopsis

    #include <libanjuta/interfaces/ianjuta-editor-selection.h>

    #define             IANJUTA_EDITOR_SELECTION_ERROR
                        IAnjutaEditorSelection;
                        IAnjutaEditorSelectionIface;
    GQuark              ianjuta_editor_selection_error_quark
                                                            (void);
    gchar*              ianjuta_editor_selection_get        (IAnjutaEditorSelection *obj,
                                                             GError **err);
    IAnjutaIterable*    ianjuta_editor_selection_get_end    (IAnjutaEditorSelection *obj,
                                                             GError **err);
    IAnjutaIterable*    ianjuta_editor_selection_get_start  (IAnjutaEditorSelection *obj,
                                                             GError **err);
    gboolean            ianjuta_editor_selection_has_selection
                                                            (IAnjutaEditorSelection *obj,
                                                             GError **err);
    void                ianjuta_editor_selection_replace    (IAnjutaEditorSelection *obj,
                                                             const gchar *text,
                                                             gint length,
                                                             GError **err);
    void                ianjuta_editor_selection_select_all (IAnjutaEditorSelection *obj,
                                                             GError **err);
    void                ianjuta_editor_selection_select_block
                                                            (IAnjutaEditorSelection *obj,
                                                             GError **err);
    void                ianjuta_editor_selection_select_function
                                                            (IAnjutaEditorSelection *obj,
                                                             GError **err);
    void                ianjuta_editor_selection_set        (IAnjutaEditorSelection *obj,
                                                             IAnjutaIterable *start,
                                                             IAnjutaIterable *end,
                                                             gboolean scroll,
                                                             GError **err);

## Object Hierarchy

      GInterface
       +----IAnjutaEditorSelection

## Prerequisites

IAnjutaEditorSelection requires IAnjutaEditor and GObject.

## Description

## Details

### IANJUTA_EDITOR_SELECTION_ERROR

    #define IANJUTA_EDITOR_SELECTION_ERROR ianjuta_editor_selection_error_quark()

### IAnjutaEditorSelection

    typedef struct _IAnjutaEditorSelection IAnjutaEditorSelection;

### IAnjutaEditorSelectionIface

    typedef struct {
    	IAnjutaEditorIface g_iface;

    	gchar* (*get) (IAnjutaEditorSelection *obj, GError **err);
    	IAnjutaIterable* (*get_end) (IAnjutaEditorSelection *obj, GError **err);
    	IAnjutaIterable* (*get_start) (IAnjutaEditorSelection *obj, GError **err);
    	gboolean (*has_selection) (IAnjutaEditorSelection *obj, GError **err);
    	void (*replace) (IAnjutaEditorSelection *obj, const gchar *text,  gint length, GError **err);
    	void (*select_all) (IAnjutaEditorSelection *obj, GError **err);
    	void (*select_block) (IAnjutaEditorSelection *obj, GError **err);
    	void (*select_function) (IAnjutaEditorSelection *obj, GError **err);
    	void (*set) (IAnjutaEditorSelection *obj, IAnjutaIterable* start,  IAnjutaIterable* end,  gboolean scroll, GError **err);
    } IAnjutaEditorSelectionIface;

### ianjuta_editor_selection_error_quark ()

    GQuark              ianjuta_editor_selection_error_quark
                                                            (void);

Returns : |

### ianjuta_editor_selection_get ()

    gchar*              ianjuta_editor_selection_get        (IAnjutaEditorSelection *obj,
                                                             GError **err);

Gets curerntly selected text in editor.

`obj` : | Self
`err` : | Error propagation and reporting
Returns : | A newly allocated buffer of currently selected characters. NULL if there is no selection. The returned buffer must be freed after use.

### ianjuta_editor_selection_get_end ()

    IAnjutaIterable*    ianjuta_editor_selection_get_end    (IAnjutaEditorSelection *obj,
                                                             GError **err);

Get end position of selection. If there is no selection, returns NULL.

`obj` : | Self
`err` : | Error propagation and reporting
Returns : | End of selection or NULL if there is no selection.

### ianjuta_editor_selection_get_start ()

    IAnjutaIterable*    ianjuta_editor_selection_get_start  (IAnjutaEditorSelection *obj,
                                                             GError **err);

Gets start position of selection text.

Return: Start of selection or NULL if there is no selection.

`obj` : | Self
`err` : | Error propagation and reporting
Returns : |

### ianjuta_editor_selection_has_selection ()

    gboolean            ianjuta_editor_selection_has_selection
                                                            (IAnjutaEditorSelection *obj,
                                                             GError **err);

Returns TRUE if editor has any text selected. The selection positions can be retrieved with `ianjuta_editor_selection_get_start()` and `ianjuta_editor_selection_get_end()`.

`obj` : | Self
`err` : | Error propagation and reporting
Returns : | TRUE if there is text selected else FALSE.

### ianjuta_editor_selection_replace ()

    void                ianjuta_editor_selection_replace    (IAnjutaEditorSelection *obj,
                                                             const gchar *text,
                                                             gint length,
                                                             GError **err);

Replaces currently selected text with the `text`. Only `length` amount of characters are used from `text` buffer to replace.

`obj` : | Self
`text` : | Replacement text.
`length` : | Length of the text to used in `text`.
`err` : | Error propagation and reporting

### ianjuta_editor_selection_select_all ()

    void                ianjuta_editor_selection_select_all (IAnjutaEditorSelection *obj,
                                                             GError **err);

`obj` : |
`err` : |

### ianjuta_editor_selection_select_block ()

    void                ianjuta_editor_selection_select_block
                                                            (IAnjutaEditorSelection *obj,
                                                             GError **err);

Selects current block of code. The definition of block of code depends on highlight mode used (programming language). Some highlight mode does not have block concept, in that case this method does not do anything.

`obj` : | Self
`err` : | Error propagation and reporting

### ianjuta_editor_selection_select_function ()

    void                ianjuta_editor_selection_select_function
                                                            (IAnjutaEditorSelection *obj,
                                                             GError **err);

Select current function block. The definition of function block depends on highlight mode used (programming language). Some highlight mode does not have function concept, in that case this method does not do anything.

`obj` : | Self
`err` : | Error propagation and reporting

### ianjuta_editor_selection_set ()

    void                ianjuta_editor_selection_set        (IAnjutaEditorSelection *obj,
                                                             IAnjutaIterable *start,
                                                             IAnjutaIterable *end,
                                                             gboolean scroll,
                                                             GError **err);

Select characters between start and end. Start and end don't have to be ordered.

`obj` : | Self
`start` : | Begin of selection
`end` : | End of selection
`scroll` : | Scroll selection onscreen
`err` : | Error propagation and reporting