IAnjutaEditor

IAnjutaEditor — Text editor interface

Stability Level

Unstable, unless otherwise indicated

Synopsis


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


#define             IANJUTA_TYPE_EDITOR_ATTRIBUTE
#define             IANJUTA_TYPE_EDITOR_ERROR
enum                IAnjutaEditorAttribute;
enum                IAnjutaEditorError;
#define             IANJUTA_EDITOR_ERROR
                    IAnjutaEditor;
                    IAnjutaEditorIface;
GType               ianjuta_editor_error_get_type       (void);
GQuark              ianjuta_editor_error_quark          (void);
GType               ianjuta_editor_get_type             (void);
void                ianjuta_editor_append               (IAnjutaEditor *obj,
                                                         const gchar *text,
                                                         gint length,
                                                         GError **err);
void                ianjuta_editor_begin_undo_action    (IAnjutaEditor *obj,
                                                         GError **err);
gboolean            ianjuta_editor_can_redo             (IAnjutaEditor *obj,
                                                         GError **err);
gboolean            ianjuta_editor_can_undo             (IAnjutaEditor *obj,
                                                         GError **err);
void                ianjuta_editor_end_undo_action      (IAnjutaEditor *obj,
                                                         GError **err);
void                ianjuta_editor_erase                (IAnjutaEditor *obj,
                                                         gint position,
                                                         gint length,
                                                         GError **err);
void                ianjuta_editor_erase_all            (IAnjutaEditor *obj,
                                                         GError **err);
IAnjutaIterable*    ianjuta_editor_get_cell_iter        (IAnjutaEditor *obj,
                                                         gint position,
                                                         GError **err);
gint                ianjuta_editor_get_column           (IAnjutaEditor *obj,
                                                         GError **err);
gchar*              ianjuta_editor_get_current_word     (IAnjutaEditor *obj,
                                                         GError **err);
const gchar*        ianjuta_editor_get_filename         (IAnjutaEditor *obj,
                                                         GError **err);
gint                ianjuta_editor_get_length           (IAnjutaEditor *obj,
                                                         GError **err);
gint                ianjuta_editor_get_line_begin_position
                                                        (IAnjutaEditor *obj,
                                                         gint line,
                                                         GError **err);
gint                ianjuta_editor_get_line_end_position
                                                        (IAnjutaEditor *obj,
                                                         gint line,
                                                         GError **err);
int                 ianjuta_editor_get_line_from_position
                                                        (IAnjutaEditor *obj,
                                                         int position,
                                                         GError **err);
gint                ianjuta_editor_get_lineno           (IAnjutaEditor *obj,
                                                         GError **err);
gboolean            ianjuta_editor_get_overwrite        (IAnjutaEditor *obj,
                                                         GError **err);
gint                ianjuta_editor_get_position         (IAnjutaEditor *obj,
                                                         GError **err);
gint                ianjuta_editor_get_tabsize          (IAnjutaEditor *obj,
                                                         GError **err);
gchar*              ianjuta_editor_get_text             (IAnjutaEditor *obj,
                                                         gint position,
                                                         gint length,
                                                         GError **err);
gboolean            ianjuta_editor_get_use_spaces       (IAnjutaEditor *obj,
                                                         GError **err);
void                ianjuta_editor_goto_line            (IAnjutaEditor *obj,
                                                         gint lineno,
                                                         GError **err);
void                ianjuta_editor_goto_position        (IAnjutaEditor *obj,
                                                         gint position,
                                                         GError **err);
void                ianjuta_editor_grab_focus           (IAnjutaEditor *obj,
                                                         GError **err);
void                ianjuta_editor_insert               (IAnjutaEditor *obj,
                                                         int position,
                                                         const gchar *text,
                                                         gint length,
                                                         GError **err);
void                ianjuta_editor_redo                 (IAnjutaEditor *obj,
                                                         GError **err);
void                ianjuta_editor_set_auto_indent      (IAnjutaEditor *obj,
                                                         gboolean auto_indent,
                                                         GError **err);
void                ianjuta_editor_set_popup_menu       (IAnjutaEditor *obj,
                                                         GtkWidget *menu,
                                                         GError **err);
void                ianjuta_editor_set_tabsize          (IAnjutaEditor *obj,
                                                         gint tabsize,
                                                         GError **err);
void                ianjuta_editor_set_use_spaces       (IAnjutaEditor *obj,
                                                         gboolean use_spaces,
                                                         GError **err);
void                ianjuta_editor_undo                 (IAnjutaEditor *obj,
                                                         GError **err);

Object Hierarchy


  GInterface
   +----IAnjutaEditor

Prerequisites

IAnjutaEditor requires GObject.

Known Derived Interfaces

IAnjutaEditor is required by IAnjutaEditorComment, IAnjutaEditorConvert, IAnjutaEditorZoom, IAnjutaEditorGoto, IAnjutaEditorView, IAnjutaEditorHover, IAnjutaEditorSelection, IAnjutaEditorAssist, IAnjutaEditorLineMode, IAnjutaEditorFolds and IAnjutaEditorLanguage.

Signals


  "changed"                                        : Run Last
  "char-added"                                     : Run Last
  "update-ui"                                      : Run Last

Description

Details

IANJUTA_TYPE_EDITOR_ATTRIBUTE

#define IANJUTA_TYPE_EDITOR_ATTRIBUTE (ianjuta_editor_attribute_get_type())


IANJUTA_TYPE_EDITOR_ERROR

#define IANJUTA_TYPE_EDITOR_ERROR (ianjuta_editor_error_get_type())


enum IAnjutaEditorAttribute

typedef enum {
	IANJUTA_EDITOR_TEXT,
	IANJUTA_EDITOR_KEYWORD,
	IANJUTA_EDITOR_COMMENT,
	IANJUTA_EDITOR_STRING
} IAnjutaEditorAttribute;


enum IAnjutaEditorError

typedef enum {
	IANJUTA_EDITOR_DOESNT_EXIST
} IAnjutaEditorError;


IANJUTA_EDITOR_ERROR

#define IANJUTA_EDITOR_ERROR ianjuta_editor_error_quark()


IAnjutaEditor

typedef struct _IAnjutaEditor IAnjutaEditor;


IAnjutaEditorIface

typedef struct {
	GTypeInterface g_iface;
	
	/* Signal */
	void (*changed) (IAnjutaEditor *obj, gint position,  gboolean added,  gint length,  gint lines,  const gchar *text);
	/* Signal */
	void (*char_added) (IAnjutaEditor *obj, gint position,  gchar ch);
	/* Signal */
	void (*update_ui) (IAnjutaEditor *obj);

	void (*append) (IAnjutaEditor *obj, const gchar *text,  gint length, GError **err);
	void (*begin_undo_action) (IAnjutaEditor *obj, GError **err);
	gboolean (*can_redo) (IAnjutaEditor *obj, GError **err);
	gboolean (*can_undo) (IAnjutaEditor *obj, GError **err);
	void (*end_undo_action) (IAnjutaEditor *obj, GError **err);
	void (*erase) (IAnjutaEditor *obj, gint position,  gint length, GError **err);
	void (*erase_all) (IAnjutaEditor *obj, GError **err);
	IAnjutaIterable* (*get_cell_iter) (IAnjutaEditor *obj, gint position, GError **err);
	gint (*get_column) (IAnjutaEditor *obj, GError **err);
	gchar* (*get_current_word) (IAnjutaEditor *obj, GError **err);
	const gchar* (*get_filename) (IAnjutaEditor *obj, GError **err);
	gint (*get_length) (IAnjutaEditor *obj, GError **err);
	gint (*get_line_begin_position) (IAnjutaEditor *obj, gint line, GError **err);
	gint (*get_line_end_position) (IAnjutaEditor *obj, gint line, GError **err);
	int (*get_line_from_position) (IAnjutaEditor *obj, int position, GError **err);
	gint (*get_lineno) (IAnjutaEditor *obj, GError **err);
	gboolean (*get_overwrite) (IAnjutaEditor *obj, GError **err);
	gint (*get_position) (IAnjutaEditor *obj, GError **err);
	gint (*get_tabsize) (IAnjutaEditor *obj, GError **err);
	gchar* (*get_text) (IAnjutaEditor *obj, gint position,  gint length, GError **err);
	gboolean (*get_use_spaces) (IAnjutaEditor *obj, GError **err);
	void (*goto_line) (IAnjutaEditor *obj, gint lineno, GError **err);
	void (*goto_position) (IAnjutaEditor *obj, gint position, GError **err);
	void (*grab_focus) (IAnjutaEditor *obj, GError **err);
	void (*insert) (IAnjutaEditor *obj, int position,  const gchar *text,  gint length, GError **err);
	void (*redo) (IAnjutaEditor *obj, GError **err);
	void (*set_auto_indent) (IAnjutaEditor *obj, gboolean auto_indent, GError **err);
	void (*set_popup_menu) (IAnjutaEditor *obj, GtkWidget *menu, GError **err);
	void (*set_tabsize) (IAnjutaEditor *obj, gint tabsize, GError **err);
	void (*set_use_spaces) (IAnjutaEditor *obj, gboolean use_spaces, GError **err);
	void (*undo) (IAnjutaEditor *obj, GError **err);
} IAnjutaEditorIface;


ianjuta_editor_error_get_type ()

GType               ianjuta_editor_error_get_type       (void);

Returns :

ianjuta_editor_error_quark ()

GQuark              ianjuta_editor_error_quark          (void);

Returns :

ianjuta_editor_get_type ()

GType               ianjuta_editor_get_type             (void);

Returns :

ianjuta_editor_append ()

void                ianjuta_editor_append               (IAnjutaEditor *obj,
                                                         const gchar *text,
                                                         gint length,
                                                         GError **err);

Appends length characters from text buffer at the end of editor buffer. If length is -1, the whole text is used.

obj : Self
text : Text to append.
length : Length of text to use.
err : Error propagation and reporting

ianjuta_editor_begin_undo_action ()

void                ianjuta_editor_begin_undo_action    (IAnjutaEditor *obj,
                                                         GError **err);

Begins the mark of undoable action. Calls to this are stacked and each must be ended with ianjuta_editor_end_action().

obj : Self
err : Error propagation and reporting

ianjuta_editor_can_redo ()

gboolean            ianjuta_editor_can_redo             (IAnjutaEditor *obj,
                                                         GError **err);

Can the editor redo the last operation?

obj : Self
err : Error propagation and reporting
Returns : true if editor can redo, else FALSE

ianjuta_editor_can_undo ()

gboolean            ianjuta_editor_can_undo             (IAnjutaEditor *obj,
                                                         GError **err);

Can the editor undo the last operation?

obj : Self
err : Error propagation and reporting
Returns : true if editor can undo, else FALSE

ianjuta_editor_end_undo_action ()

void                ianjuta_editor_end_undo_action      (IAnjutaEditor *obj,
                                                         GError **err);

Ends the mark of undoable action.

obj : Self
err : Error propagation and reporting

ianjuta_editor_erase ()

void                ianjuta_editor_erase                (IAnjutaEditor *obj,
                                                         gint position,
                                                         gint length,
                                                         GError **err);

Erases the length number of chars starting from position. If length is 0, nothing happens.

obj : Self
position : Start position of chars to erase. Must be 0 or more.
length : number of chars to erase. -1 means till the end of document.
err : Error propagation and reporting

ianjuta_editor_erase_all ()

void                ianjuta_editor_erase_all            (IAnjutaEditor *obj,
                                                         GError **err);

Empties the whole editor buffer. There will be zero characters.

obj : Self
err : Error propagation and reporting

ianjuta_editor_get_cell_iter ()

IAnjutaIterable*    ianjuta_editor_get_cell_iter        (IAnjutaEditor *obj,
                                                         gint position,
                                                         GError **err);

Creates and returns an iter for editor cells. The iter is placed at the unicode character position where the given byte position happens to fall (means given position does not necessarily is the current position of the iter). The returned iter is cell (character) iter and not byte iter, so all iter operations on it are character (not byte) iteration, including all position and index references in the iter. However, the position paramter passed to this function is byte position (because all editor Aoperations are based on byte positions). position could happen to be in the middle of a unicode character and that is a vaild situation.

The iter must be unreferrenced by the caller when done. The iter navigates (next/previous) in step of unicode characters (one unicode character == one cell).

Retruns: a newly created iter of IAnjutaEditorCell placed at the given position.

obj : Self
position : Byte position where the iter will be set
err : Error propagation and reporting
Returns :

ianjuta_editor_get_column ()

gint                ianjuta_editor_get_column           (IAnjutaEditor *obj,
                                                         GError **err);

obj :
err :
Returns :

ianjuta_editor_get_current_word ()

gchar*              ianjuta_editor_get_current_word     (IAnjutaEditor *obj,
                                                         GError **err);

Obtains the word on which carat is currently on.

obj : Self
err : Error propagation and reporting
Returns : Current word.

ianjuta_editor_get_filename ()

const gchar*        ianjuta_editor_get_filename         (IAnjutaEditor *obj,
                                                         GError **err);

Allows obtaining of the filename the editor was loaded from.

obj : Self
err : Error propagation and reporting
Returns : The name of the file. Not to be freed by caller.

ianjuta_editor_get_length ()

gint                ianjuta_editor_get_length           (IAnjutaEditor *obj,
                                                         GError **err);

Get length of complete text in editor. This will be the total number of characters in the file or buffer.

obj : Self
err : Error propagation and reporting
Returns : Text length.

ianjuta_editor_get_line_begin_position ()

gint                ianjuta_editor_get_line_begin_position
                                                        (IAnjutaEditor *obj,
                                                         gint line,
                                                         GError **err);

fixme

obj : Self
line : fixme
err : Error propagation and reporting.
Returns : fixme

ianjuta_editor_get_line_end_position ()

gint                ianjuta_editor_get_line_end_position
                                                        (IAnjutaEditor *obj,
                                                         gint line,
                                                         GError **err);

fixme

obj : Self
line : fixme
err : Error propagation and reporting.
Returns : fixme

ianjuta_editor_get_line_from_position ()

int                 ianjuta_editor_get_line_from_position
                                                        (IAnjutaEditor *obj,
                                                         int position,
                                                         GError **err);

obj :
position :
err :
Returns :

ianjuta_editor_get_lineno ()

gint                ianjuta_editor_get_lineno           (IAnjutaEditor *obj,
                                                         GError **err);

Obtains current line number on which carat is.

obj : Self
err : Error propagation and reporting
Returns : Line number.

ianjuta_editor_get_overwrite ()

gboolean            ianjuta_editor_get_overwrite        (IAnjutaEditor *obj,
                                                         GError **err);

Obtains editor overwirte mode: TRUE = Override, FALSE = Insert.

obj : Self
err : Error propagation and reporting
Returns : editor mode.

ianjuta_editor_get_position ()

gint                ianjuta_editor_get_position         (IAnjutaEditor *obj,
                                                         GError **err);

obj :
err :
Returns :

ianjuta_editor_get_tabsize ()

gint                ianjuta_editor_get_tabsize          (IAnjutaEditor *obj,
                                                         GError **err);

Returns the tabsize (in spaces) currently used by the editor.

obj : Self
err : Error propagation and reporting
Returns : tabsize in number of spaces

ianjuta_editor_get_text ()

gchar*              ianjuta_editor_get_text             (IAnjutaEditor *obj,
                                                         gint position,
                                                         gint length,
                                                         GError **err);

Gets length text characters beginning from position (including char pointed by position). If length is less then 0 or exceeds document length, text till the end of the document is returned. start must be 0 or greater then 0. If start is beyond document length, NULL is returned. If length is 0, NULL is returned. The characters returned are utf-8 encoded.

obj : Self
position : Begining position. Must be greater than or equal to 0.
length : length of the text. -1 means till the end of document.
err : Error propagation and reporting
Returns : A buffer of utf-8 characters. The returned buffer must be freed when no longer required.

ianjuta_editor_get_use_spaces ()

gboolean            ianjuta_editor_get_use_spaces       (IAnjutaEditor *obj,
                                                         GError **err);

Returns if the editor uses spaces for filling up tab characters.

obj : Self
err : Error propagation and reporting
Returns : TRUE if yes, FALSE if no.

ianjuta_editor_goto_line ()

void                ianjuta_editor_goto_line            (IAnjutaEditor *obj,
                                                         gint lineno,
                                                         GError **err);

Carat is moved to the given lineno line and text view is scrolled to bring it in viewable area of the editor.

obj : Self
lineno : line number where carat will be moved.
err : Error propagation and reporting

ianjuta_editor_goto_position ()

void                ianjuta_editor_goto_position        (IAnjutaEditor *obj,
                                                         gint position,
                                                         GError **err);

Carat is moved to the given position and text view is scrolled to bring position in viewable area of the editor.

obj : Self
position : Character position where carat will be moved.
err : Error propagation and reporting

ianjuta_editor_grab_focus ()

void                ianjuta_editor_grab_focus           (IAnjutaEditor *obj,
                                                         GError **err);

Grabs the focus.

obj : Self
err : Error propagation and reporting

ianjuta_editor_insert ()

void                ianjuta_editor_insert               (IAnjutaEditor *obj,
                                                         int position,
                                                         const gchar *text,
                                                         gint length,
                                                         GError **err);

Inserts length characters from text buffer at given position of editor buffer. If length is -1, the whole text is used.

obj : Self
position : Character position in editor where insert will take place.
text : Text to append.
length : Length of text to use.
err : Error propagation and reporting

ianjuta_editor_redo ()

void                ianjuta_editor_redo                 (IAnjutaEditor *obj,
                                                         GError **err);

Redo last undo operation

obj : Self
err : Error propagation and reporting

ianjuta_editor_set_auto_indent ()

void                ianjuta_editor_set_auto_indent      (IAnjutaEditor *obj,
                                                         gboolean auto_indent,
                                                         GError **err);

Sets whether the editor should auto-indent itself. A plugin that does custom auto-indent can set this to false and override the preferences setting

obj : Self
auto_indent : TRUE to enable auto-indent, FALSE to disable
err :

ianjuta_editor_set_popup_menu ()

void                ianjuta_editor_set_popup_menu       (IAnjutaEditor *obj,
                                                         GtkWidget *menu,
                                                         GError **err);

Set Editor popup menu. This is the menu shown in the editor when one right-clicks on it.

obj : Self
menu : Popupmenu
err : Error propagation and reporting

ianjuta_editor_set_tabsize ()

void                ianjuta_editor_set_tabsize          (IAnjutaEditor *obj,
                                                         gint tabsize,
                                                         GError **err);

Sets the tabsize of the editor.

obj : Self
tabsize : Tabsize in spaces
err : Error propagation and reporting

ianjuta_editor_set_use_spaces ()

void                ianjuta_editor_set_use_spaces       (IAnjutaEditor *obj,
                                                         gboolean use_spaces,
                                                         GError **err);

obj :
use_spaces :
err :

ianjuta_editor_undo ()

void                ianjuta_editor_undo                 (IAnjutaEditor *obj,
                                                         GError **err);

Undo last operation

obj : Self
err : Error propagation and reporting

Signal Details

The "changed" signal

void                user_function                      (IAnjutaEditor *ianjutaeditor,
                                                        gint           arg1,
                                                        gboolean       arg2,
                                                        gint           arg3,
                                                        gint           arg4,
                                                        gchar         *arg5,
                                                        gpointer       user_data)          : Run Last

ianjutaeditor : the object which received the signal.
arg1 :
arg2 :
arg3 :
arg4 :
arg5 :
user_data : user data set when the signal handler was connected.

The "char-added" signal

void                user_function                      (IAnjutaEditor *ianjutaeditor,
                                                        gint           arg1,
                                                        gchar          arg2,
                                                        gpointer       user_data)          : Run Last

ianjutaeditor : the object which received the signal.
arg1 :
arg2 :
user_data : user data set when the signal handler was connected.

The "update-ui" signal

void                user_function                      (IAnjutaEditor *ianjutaeditor,
                                                        gpointer       user_data)          : Run Last

ianjutaeditor : the object which received the signal.
user_data : user data set when the signal handler was connected.