2005-09-09 02:40:10 -07:00
|
|
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4; coding: utf-8 -*-
|
2005-09-09 02:54:58 -07:00
|
|
|
*
|
2005-09-09 02:40:10 -07:00
|
|
|
* mooedit.h
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004-2005 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* See COPYING file that comes with this distribution.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MOO_TEXT_VIEW_H__
|
|
|
|
#define __MOO_TEXT_VIEW_H__
|
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
#include <gtk/gtktextview.h>
|
|
|
|
#include <mooedit/mooindenter.h>
|
2005-10-16 22:23:40 -07:00
|
|
|
#include <mooedit/moolang.h>
|
2005-09-09 02:40:10 -07:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
|
|
|
|
#define MOO_TYPE_TEXT_SELECTION_TYPE (moo_text_selection_type_get_type ())
|
|
|
|
|
|
|
|
#define MOO_TYPE_TEXT_VIEW (moo_text_view_get_type ())
|
|
|
|
#define MOO_TEXT_VIEW(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_TEXT_VIEW, MooTextView))
|
|
|
|
#define MOO_TEXT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_TEXT_VIEW, MooTextViewClass))
|
|
|
|
#define MOO_IS_TEXT_VIEW(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_TEXT_VIEW))
|
|
|
|
#define MOO_IS_TEXT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_TEXT_VIEW))
|
|
|
|
#define MOO_TEXT_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_TEXT_VIEW, MooTextViewClass))
|
|
|
|
|
|
|
|
|
2005-10-13 07:08:18 -07:00
|
|
|
typedef struct _MooTextView MooTextView;
|
|
|
|
typedef struct _MooTextViewPrivate MooTextViewPrivate;
|
|
|
|
typedef struct _MooTextViewClass MooTextViewClass;
|
|
|
|
|
2005-09-09 02:40:10 -07:00
|
|
|
typedef enum {
|
|
|
|
MOO_TEXT_SELECT_CHARS,
|
|
|
|
MOO_TEXT_SELECT_WORDS,
|
|
|
|
MOO_TEXT_SELECT_LINES
|
|
|
|
} MooTextSelectionType;
|
|
|
|
|
|
|
|
struct _MooTextView
|
|
|
|
{
|
2005-10-13 07:08:18 -07:00
|
|
|
GtkTextView parent;
|
2005-09-09 02:40:10 -07:00
|
|
|
|
|
|
|
MooTextViewPrivate *priv;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _MooTextViewClass
|
|
|
|
{
|
2005-10-13 07:08:18 -07:00
|
|
|
GtkTextViewClass parent_class;
|
2005-09-09 02:40:10 -07:00
|
|
|
|
|
|
|
void (* delete_selection) (MooTextView *view);
|
2005-10-13 07:08:18 -07:00
|
|
|
void (* undo) (MooTextView *view);
|
|
|
|
void (* redo) (MooTextView *view);
|
|
|
|
|
|
|
|
gboolean (* char_inserted) (MooTextView *view,
|
|
|
|
GtkTextIter *where, /* points to position after the char */
|
|
|
|
guint character); /* gunichar */
|
2005-09-09 02:40:10 -07:00
|
|
|
|
|
|
|
/* these are made signals for convenience */
|
2005-10-13 07:08:18 -07:00
|
|
|
void (* find_interactive) (MooTextView *view);
|
|
|
|
void (* replace_interactive) (MooTextView *view);
|
|
|
|
void (* find_next_interactive) (MooTextView *view);
|
|
|
|
void (* find_prev_interactive) (MooTextView *view);
|
|
|
|
void (* goto_line_interactive) (MooTextView *view);
|
2005-09-09 02:40:10 -07:00
|
|
|
|
|
|
|
/* methods */
|
|
|
|
/* adjusts start and end so that selection bound goes to start
|
|
|
|
and insert goes to end,
|
|
|
|
returns whether selection is not empty */
|
2005-10-13 07:08:18 -07:00
|
|
|
gboolean (* extend_selection) (MooTextView *view,
|
|
|
|
MooTextSelectionType type,
|
|
|
|
GtkTextIter *start,
|
|
|
|
GtkTextIter *end);
|
2005-09-09 02:40:10 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
GType moo_text_view_get_type (void) G_GNUC_CONST;
|
|
|
|
GType moo_text_selection_type_get_type (void) G_GNUC_CONST;
|
|
|
|
|
|
|
|
MooTextView *moo_text_view_new (void);
|
|
|
|
|
2005-10-16 22:23:40 -07:00
|
|
|
void moo_text_view_select_all (MooTextView *view);
|
2005-09-09 02:40:10 -07:00
|
|
|
|
2005-10-16 22:23:40 -07:00
|
|
|
char *moo_text_view_get_selection (MooTextView *view);
|
|
|
|
char *moo_text_view_get_text (MooTextView *view);
|
|
|
|
gboolean moo_text_view_has_selection (MooTextView *view);
|
|
|
|
gboolean moo_text_view_has_text (MooTextView *view);
|
2005-09-09 02:40:10 -07:00
|
|
|
|
2005-10-16 22:23:40 -07:00
|
|
|
void moo_text_view_delete_selection (MooTextView *view);
|
2005-09-09 02:40:10 -07:00
|
|
|
|
2005-10-16 22:23:40 -07:00
|
|
|
gboolean moo_text_view_can_redo (MooTextView *view);
|
|
|
|
gboolean moo_text_view_can_undo (MooTextView *view);
|
|
|
|
void moo_text_view_redo (MooTextView *view);
|
|
|
|
void moo_text_view_undo (MooTextView *view);
|
|
|
|
void moo_text_view_start_not_undoable_action(MooTextView *view);
|
|
|
|
void moo_text_view_end_not_undoable_action (MooTextView *view);
|
2005-10-13 07:08:18 -07:00
|
|
|
|
2005-10-16 22:23:40 -07:00
|
|
|
void moo_text_view_goto_line (MooTextView *view,
|
|
|
|
int line);
|
2005-09-09 02:40:10 -07:00
|
|
|
|
2005-10-16 22:23:40 -07:00
|
|
|
void moo_text_view_set_font_from_string (MooTextView *view,
|
|
|
|
const char *font);
|
2005-09-09 02:40:10 -07:00
|
|
|
|
2005-10-16 22:23:40 -07:00
|
|
|
MooIndenter *moo_text_view_get_indenter (MooTextView *view);
|
|
|
|
void moo_text_view_set_indenter (MooTextView *view,
|
|
|
|
MooIndenter *indenter);
|
2005-09-09 02:40:10 -07:00
|
|
|
|
2005-11-09 23:15:16 -08:00
|
|
|
void moo_text_view_get_cursor (MooTextView *view,
|
|
|
|
GtkTextIter *iter);
|
2005-10-16 22:23:40 -07:00
|
|
|
void moo_text_view_move_cursor (MooTextView *view,
|
|
|
|
int line,
|
|
|
|
int character,
|
|
|
|
gboolean in_idle);
|
2005-09-09 02:40:10 -07:00
|
|
|
|
2005-09-09 02:54:58 -07:00
|
|
|
void moo_text_view_set_highlight_current_line
|
2005-10-16 22:23:40 -07:00
|
|
|
(MooTextView *view,
|
|
|
|
gboolean highlight);
|
|
|
|
void moo_text_view_set_current_line_color (MooTextView *view,
|
|
|
|
const GdkColor *color);
|
|
|
|
void moo_text_view_set_cursor_color (MooTextView *view,
|
|
|
|
const GdkColor *color);
|
|
|
|
void moo_text_view_set_show_tabs (MooTextView *view,
|
|
|
|
gboolean show);
|
|
|
|
void moo_text_view_apply_scheme (MooTextView *view,
|
|
|
|
MooTextStyleScheme *scheme);
|
|
|
|
|
|
|
|
GtkTextTag *moo_text_view_lookup_tag (MooTextView *view,
|
|
|
|
const char *name);
|
|
|
|
|
|
|
|
void moo_text_view_set_lang (MooTextView *view,
|
|
|
|
MooLang *lang);
|
2005-09-11 10:51:34 -07:00
|
|
|
|
2005-11-11 12:03:30 -08:00
|
|
|
void moo_text_view_strip_whitespace (MooTextView *view);
|
|
|
|
|
2005-09-09 02:40:10 -07:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __MOO_TEXT_VIEW_H__ */
|