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
|
|
|
|
*
|
2006-02-23 06:03:17 -08:00
|
|
|
* Copyright (C) 2004-2006 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
2005-09-09 02:40:10 -07:00
|
|
|
*
|
|
|
|
* 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>
|
2006-04-04 23:22:26 -07:00
|
|
|
#include <mooedit/mootextsearch.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-11-14 21:56:39 -08:00
|
|
|
gboolean (* undo) (MooTextView *view);
|
|
|
|
gboolean (* redo) (MooTextView *view);
|
2005-10-13 07:08:18 -07:00
|
|
|
|
|
|
|
gboolean (* char_inserted) (MooTextView *view,
|
|
|
|
GtkTextIter *where, /* points to position after the char */
|
|
|
|
guint character); /* gunichar */
|
2005-09-09 02:40:10 -07:00
|
|
|
|
2005-12-10 20:28:37 -08:00
|
|
|
void (* set_scheme) (MooTextView *view,
|
|
|
|
MooTextStyleScheme *scheme);
|
|
|
|
|
2005-12-10 20:30:02 -08:00
|
|
|
gboolean (* line_mark_clicked) (MooTextView *view,
|
|
|
|
int line);
|
|
|
|
|
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;
|
|
|
|
|
2006-03-31 22:11:58 -08:00
|
|
|
GtkWidget *moo_text_view_new (void);
|
2005-09-09 02:40:10 -07:00
|
|
|
|
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);
|
2005-11-14 21:56:39 -08:00
|
|
|
gboolean moo_text_view_redo (MooTextView *view);
|
|
|
|
gboolean moo_text_view_undo (MooTextView *view);
|
|
|
|
void moo_text_view_begin_not_undoable_action(MooTextView *view);
|
2005-10-16 22:23:40 -07:00
|
|
|
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-12-10 23:24:37 -08:00
|
|
|
int moo_text_view_get_cursor_line (MooTextView *view);
|
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);
|
2005-12-10 20:28:37 -08:00
|
|
|
void moo_text_view_set_scheme (MooTextView *view,
|
2005-10-16 22:23:40 -07:00
|
|
|
MooTextStyleScheme *scheme);
|
|
|
|
|
2005-12-09 05:56:12 -08:00
|
|
|
void moo_text_view_set_show_line_numbers (MooTextView *view,
|
|
|
|
gboolean show);
|
2005-12-09 05:56:57 -08:00
|
|
|
void moo_text_view_set_show_scrollbar_marks (MooTextView *view,
|
|
|
|
gboolean show);
|
2005-12-10 20:23:32 -08:00
|
|
|
void moo_text_view_set_show_line_marks (MooTextView *view,
|
|
|
|
gboolean show);
|
2005-12-12 02:58:25 -08:00
|
|
|
void moo_text_view_set_enable_folding (MooTextView *view,
|
|
|
|
gboolean show);
|
2005-12-09 05:56:12 -08:00
|
|
|
|
2005-10-16 22:23:40 -07:00
|
|
|
GtkTextTag *moo_text_view_lookup_tag (MooTextView *view,
|
|
|
|
const char *name);
|
|
|
|
|
2005-11-16 23:04:35 -08:00
|
|
|
MooLang *moo_text_view_get_lang (MooTextView *view);
|
2005-10-16 22:23:40 -07:00
|
|
|
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-12-12 20:22:40 -08:00
|
|
|
void moo_text_view_add_child_in_border (MooTextView *view,
|
|
|
|
GtkWidget *child,
|
2006-03-31 22:11:58 -08:00
|
|
|
GtkTextWindowType which_border);
|
2005-12-12 20:22:40 -08:00
|
|
|
|
|
|
|
void moo_text_view_start_quick_search (MooTextView *view);
|
|
|
|
void moo_text_view_stop_quick_search (MooTextView *view);
|
2006-04-04 23:22:26 -07:00
|
|
|
void moo_text_view_set_quick_search_flags (MooTextView *view,
|
|
|
|
MooTextSearchFlags flags);
|
2005-12-12 20:22:40 -08:00
|
|
|
|
2005-09-09 02:40:10 -07:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __MOO_TEXT_VIEW_H__ */
|