GtrView

GtrView

Synopsis

enum                GtrSearchFlags;
struct              GtrView;
struct              GtrViewClass;
GType               gtr_view_register_type              (GTypeModule *module);
GtkWidget *         gtr_view_new                        (void);
gboolean            gtr_view_get_selected_text          (GtrView *view,
                                                         gchar **selected_text,
                                                         gint *len);
void                gtr_view_enable_spellcheck          (GtrView *view,
                                                         gboolean enable);
void                gtr_view_enable_visible_whitespace  (GtrView *view,
                                                         gboolean enable);
void                gtr_view_cut_clipboard              (GtrView *view);
void                gtr_view_copy_clipboard             (GtrView *view);
void                gtr_view_paste_clipboard            (GtrView *view);
void                gtr_view_set_font                   (GtrView *view,
                                                         gboolean def,
                                                         const gchar *font_name);
void                gtr_view_set_search_text            (GtrView *view,
                                                         const gchar *text,
                                                         guint flags);
gchar *             gtr_view_get_search_text            (GtrView *view,
                                                         guint *flags);
gboolean            gtr_view_get_can_search_again       (GtrView *view);
gboolean            gtr_view_search_forward             (GtrView *view,
                                                         const GtkTextIter *start,
                                                         const GtkTextIter *end,
                                                         GtkTextIter *match_start,
                                                         GtkTextIter *match_end);
gboolean            gtr_view_search_backward            (GtrView *view,
                                                         const GtkTextIter *start,
                                                         const GtkTextIter *end,
                                                         GtkTextIter *match_start,
                                                         GtkTextIter *match_end);
gint                gtr_view_replace_all                (GtrView *view,
                                                         const gchar *find,
                                                         const gchar *replace,
                                                         guint flags);
void                gtr_view_reload_scheme_color        (GtrView *view);

Description

Details

enum GtrSearchFlags

typedef enum {
  GTR_SEARCH_DONT_SET_FLAGS = 1 << 0,
  GTR_SEARCH_ENTIRE_WORD = 1 << 1,
  GTR_SEARCH_CASE_SENSITIVE = 1 << 2
} GtrSearchFlags;

GTR_SEARCH_DONT_SET_FLAGS

GTR_SEARCH_ENTIRE_WORD

GTR_SEARCH_CASE_SENSITIVE


struct GtrView

struct GtrView {
  GtkSourceView parent_instance;
};


struct GtrViewClass

struct GtrViewClass {
  GtkSourceViewClass parent_class;
};


gtr_view_register_type ()

GType               gtr_view_register_type              (GTypeModule *module);


gtr_view_new ()

GtkWidget *         gtr_view_new                        (void);

Creates a new GtrView. An empty default buffer will be created for you.

Returns :

a new GtrView

gtr_view_get_selected_text ()

gboolean            gtr_view_get_selected_text          (GtrView *view,
                                                         gchar **selected_text,
                                                         gint *len);

Gets the selected text region of the GtrView

view :

a GtrView

selected_text :

it stores the text selected in the GtrView

len :

it stores the length of the selected_text

Returns :

TRUE if the selected_text was got correctly.

gtr_view_enable_spellcheck ()

void                gtr_view_enable_spellcheck          (GtrView *view,
                                                         gboolean enable);

Enables the spellcheck

view :

a GtrView

enable :

TRUE if you want enable the spellcheck

gtr_view_enable_visible_whitespace ()

void                gtr_view_enable_visible_whitespace  (GtrView *view,
                                                         gboolean enable);

Enables special chars for white spaces including \n and \t

view :

a GtrView

enable :

TRUE if you want to enable special chars for white spaces

gtr_view_cut_clipboard ()

void                gtr_view_cut_clipboard              (GtrView *view);

Copies the currently-selected text to a clipboard, then deletes said text if it's editable.

view :

a GtrView

gtr_view_copy_clipboard ()

void                gtr_view_copy_clipboard             (GtrView *view);

Copies the currently-selected text to a clipboard.

view :

a GtrView

gtr_view_paste_clipboard ()

void                gtr_view_paste_clipboard            (GtrView *view);

Pastes the contents of a clipboard at the insertion point, or at override_location.

view :

a GtrView

gtr_view_set_font ()

void                gtr_view_set_font                   (GtrView *view,
                                                         gboolean def,
                                                         const gchar *font_name);

Sets the GtrView font.

view :

a GtrView

def :

TRUE if you want to use the default font

font_name :

The name of the font you want to use in the GtrView

gtr_view_set_search_text ()

void                gtr_view_set_search_text            (GtrView *view,
                                                         const gchar *text,
                                                         guint flags);

Stores the text to search for in the view with some specific flags.

view :

a GtrView

text :

the text to set for searching

flags :

a GtrSearchFlags

gtr_view_get_search_text ()

gchar *             gtr_view_get_search_text            (GtrView *view,
                                                         guint *flags);

Returns the text to search for it and the GtrSearchFlags of that text.

view :

a GtrView

flags :

the GtrSearchFlags of the stored text.

Returns :

the text to search for it.

gtr_view_get_can_search_again ()

gboolean            gtr_view_get_can_search_again       (GtrView *view);

view :

a GtrView

Returns :

TRUE if it can search again

gtr_view_search_forward ()

gboolean            gtr_view_search_forward             (GtrView *view,
                                                         const GtkTextIter *start,
                                                         const GtkTextIter *end,
                                                         GtkTextIter *match_start,
                                                         GtkTextIter *match_end);

Searches forward for str. Any match is returned by setting match_start to the first character of the match and match_end to the first character after the match. The search will not continue past limit. Note that a search is a linear or O(n) operation, so you may wish to use limit to avoid locking up your UI on large buffers.

view :

a GtrView

start :

start of search

end :

bound for the search, or NULL for the end of the buffer

match_start :

return location for start of match, or NULL

match_end :

return location for end of match, or NULL

Returns :

whether a match was found

gtr_view_search_backward ()

gboolean            gtr_view_search_backward            (GtrView *view,
                                                         const GtkTextIter *start,
                                                         const GtkTextIter *end,
                                                         GtkTextIter *match_start,
                                                         GtkTextIter *match_end);

Searches backward for str. Any match is returned by setting match_start to the first character of the match and match_end to the first character after the match. The search will not continue past limit. Note that a search is a linear or O(n) operation, so you may wish to use limit to avoid locking up your UI on large buffers.

view :

a GtrView

start :

start of search

end :

bound for the search, or NULL for the end of the buffer

match_start :

return location for start of match, or NULL

match_end :

return location for end of match, or NULL

Returns :

whether a match was found

gtr_view_replace_all ()

gint                gtr_view_replace_all                (GtrView *view,
                                                         const gchar *find,
                                                         const gchar *replace,
                                                         guint flags);

Replaces all matches of find with replace and returns the number of replacements.

view :

a GtrView

find :

the text to find

replace :

the text to replace find

flags :

a GtrSearchFlags

Returns :

the number of replacements made it.

gtr_view_reload_scheme_color ()

void                gtr_view_reload_scheme_color        (GtrView *view);

Reloads the gtksourceview scheme color. Neccessary when the scheme color changes.

view :

a GtrView