1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
4 * Copyright (C) 2008 Novell, Inc.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2 of the GNU Lesser General Public
8 * License as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
21 #ifndef GTKHTML_EDITOR_H
22 #define GTKHTML_EDITOR_H
24 #include <gtkhtml/gtkhtml.h>
26 #include <gtkhtml-editor-common.h>
27 #include <gtkhtml-editor-actions.h>
28 #include <gtkhtml-editor-widgets.h>
30 #include <gtkhtml-spell-checker.h>
31 #include <gtkhtml-spell-language.h>
35 /* Standard GObject macros */
36 #define GTKHTML_TYPE_EDITOR \
37 (gtkhtml_editor_get_type ())
38 #define GTKHTML_EDITOR(obj) \
39 (G_TYPE_CHECK_INSTANCE_CAST \
40 ((obj), GTKHTML_TYPE_EDITOR, GtkhtmlEditor))
41 #define GTKHTML_EDITOR_CLASS(cls) \
42 (G_TYPE_CHECK_CLASS_CAST \
43 ((cls), GTKHTML_TYPE_EDITOR, GtkhtmlEditorClass))
44 #define GTKHTML_IS_EDITOR(obj) \
45 (G_TYPE_CHECK_INSTANCE_TYPE \
46 ((obj), GTKHTML_TYPE_EDITOR))
47 #define GTKHTML_IS_EDITOR_CLASS(cls) \
48 (G_TYPE_CHECK_CLASS_TYPE \
49 ((cls), GTKHTML_TYPE_EDITOR))
50 #define GTKHTML_EDITOR_GET_CLASS(obj) \
51 (G_TYPE_INSTANCE_GET_CLASS \
52 ((obj), GTKHTML_TYPE_EDITOR, GtkhtmlEditorClass))
56 typedef struct _GtkhtmlEditor GtkhtmlEditor
;
57 typedef struct _GtkhtmlEditorClass GtkhtmlEditorClass
;
58 typedef struct _GtkhtmlEditorPrivate GtkhtmlEditorPrivate
;
60 struct _GtkhtmlEditor
{
63 GtkhtmlEditorPrivate
*priv
;
66 struct _GtkhtmlEditorClass
{
67 GtkWindowClass parent_class
;
69 void (*cut_clipboard
) (GtkhtmlEditor
*editor
);
70 void (*copy_clipboard
) (GtkhtmlEditor
*editor
);
71 void (*paste_clipboard
) (GtkhtmlEditor
*editor
);
72 void (*select_all
) (GtkhtmlEditor
*editor
);
75 void (*command_before
) (GtkhtmlEditor
*editor
,
76 const gchar
*command
);
77 void (*command_after
) (GtkhtmlEditor
*editor
,
78 const gchar
*command
);
79 gchar
* (*image_uri
) (GtkhtmlEditor
*editor
,
81 void (*link_clicked
) (GtkhtmlEditor
*editor
,
83 void (*object_deleted
) (GtkhtmlEditor
*editor
);
84 void (*uri_requested
) (GtkhtmlEditor
*editor
,
86 GtkHTMLStream
*stream
);
89 GType
gtkhtml_editor_get_type (void);
90 GtkWidget
* gtkhtml_editor_new (void);
91 GtkHTML
* gtkhtml_editor_get_html (GtkhtmlEditor
*editor
);
92 GtkBuilder
* gtkhtml_editor_get_builder (GtkhtmlEditor
*editor
);
93 GtkUIManager
* gtkhtml_editor_get_ui_manager (GtkhtmlEditor
*editor
);
94 GtkAction
* gtkhtml_editor_get_action (GtkhtmlEditor
*editor
,
95 const gchar
*action_name
);
96 GtkActionGroup
*gtkhtml_editor_get_action_group (GtkhtmlEditor
*editor
,
97 const gchar
*group_name
);
98 GtkWidget
* gtkhtml_editor_get_widget (GtkhtmlEditor
*editor
,
99 const gchar
*widget_name
);
100 GtkWidget
* gtkhtml_editor_get_managed_widget
101 (GtkhtmlEditor
*editor
,
102 const gchar
*widget_path
);
103 gboolean
gtkhtml_editor_get_changed (GtkhtmlEditor
*editor
);
104 void gtkhtml_editor_set_changed (GtkhtmlEditor
*editor
,
106 const gchar
* gtkhtml_editor_get_filename (GtkhtmlEditor
*editor
);
107 void gtkhtml_editor_set_filename (GtkhtmlEditor
*editor
,
108 const gchar
*filename
);
109 gboolean
gtkhtml_editor_get_html_mode (GtkhtmlEditor
*editor
);
110 void gtkhtml_editor_set_html_mode (GtkhtmlEditor
*editor
,
112 gboolean gtkhtml_editor_get_inline_spelling
113 (GtkhtmlEditor
*editor
);
114 void gtkhtml_editor_set_inline_spelling
115 (GtkhtmlEditor
*editor
,
116 gboolean inline_spelling
);
117 gboolean
gtkhtml_editor_get_magic_links (GtkhtmlEditor
*editor
);
118 void gtkhtml_editor_set_magic_links (GtkhtmlEditor
*editor
,
119 gboolean magic_links
);
120 gboolean gtkhtml_editor_get_magic_smileys
121 (GtkhtmlEditor
*editor
);
122 void gtkhtml_editor_set_magic_smileys
123 (GtkhtmlEditor
*editor
,
124 gboolean magic_smileys
);
125 GList
* gtkhtml_editor_get_spell_languages
126 (GtkhtmlEditor
*editor
);
127 void gtkhtml_editor_set_spell_languages
128 (GtkhtmlEditor
*editor
,
129 GList
*spell_languages
);
131 /*****************************************************************************
132 * High-Level Editing Interface
133 *****************************************************************************/
135 gchar
* gtkhtml_editor_get_text_html (GtkhtmlEditor
*editor
,
137 gchar
* gtkhtml_editor_get_text_plain (GtkhtmlEditor
*editor
,
139 void gtkhtml_editor_set_text_html (GtkhtmlEditor
*editor
,
142 gboolean
gtkhtml_editor_save (GtkhtmlEditor
*editor
,
143 const gchar
*filename
,
146 const gchar
* gtkhtml_editor_get_paragraph_data
147 (GtkhtmlEditor
*editor
,
149 gboolean gtkhtml_editor_set_paragraph_data
150 (GtkhtmlEditor
*editor
,
153 gboolean
gtkhtml_editor_run_command (GtkhtmlEditor
*editor
,
154 const gchar
*command
);
155 gboolean gtkhtml_editor_is_paragraph_empty
156 (GtkhtmlEditor
*editor
);
157 gboolean gtkhtml_editor_is_previous_paragraph_empty
158 (GtkhtmlEditor
*editor
);
159 void gtkhtml_editor_insert_html (GtkhtmlEditor
*editor
,
160 const gchar
*html_text
);
161 void gtkhtml_editor_insert_image (GtkhtmlEditor
*editor
,
162 const gchar
*image_uri
);
163 void gtkhtml_editor_insert_text (GtkhtmlEditor
*editor
,
164 const gchar
*plain_text
);
165 gboolean
gtkhtml_editor_search_by_data (GtkhtmlEditor
*editor
,
170 void gtkhtml_editor_freeze (GtkhtmlEditor
*editor
);
171 void gtkhtml_editor_thaw (GtkhtmlEditor
*editor
);
172 void gtkhtml_editor_undo_begin (GtkhtmlEditor
*editor
,
173 const gchar
*undo_name
,
174 const gchar
*redo_name
);
175 void gtkhtml_editor_undo_end (GtkhtmlEditor
*editor
);
176 gboolean
gtkhtml_editor_has_undo (GtkhtmlEditor
*editor
);
177 void gtkhtml_editor_drop_undo (GtkhtmlEditor
*editor
);
181 #endif /* GTKHTML_EDITOR_H */