1 /* 2 * Copyright (C) 2010 - 2011 Vivien Malerba <malerba@gnome-db.org> 3 * Copyright (C) 2011 Murray Cumming <murrayc@murrayc.com> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library 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 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the 17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef __GDAUI_RT_EDITOR__ 22 #define __GDAUI_RT_EDITOR__ 23 24 #include <gtk/gtk.h> 25 26 G_BEGIN_DECLS 27 28 #define GDAUI_TYPE_RT_EDITOR (gdaui_rt_editor_get_type()) 29 #define GDAUI_RT_EDITOR(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gdaui_rt_editor_get_type(), GdauiRtEditor) 30 #define GDAUI_RT_EDITOR_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gdaui_rt_editor_get_type (), GdauiRtEditorClass) 31 #define GDAUI_IS_RT_EDITOR(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gdaui_rt_editor_get_type ()) 32 33 34 typedef struct _GdauiRtEditor GdauiRtEditor; 35 typedef struct _GdauiRtEditorClass GdauiRtEditorClass; 36 typedef struct _GdauiRtEditorPriv GdauiRtEditorPriv; 37 38 /* struct for the object's data */ 39 struct _GdauiRtEditor 40 { 41 GtkBox object; 42 43 GdauiRtEditorPriv *priv; 44 }; 45 46 /* struct for the object's class */ 47 struct _GdauiRtEditorClass 48 { 49 GtkBoxClass parent_class; 50 51 /* signals */ 52 void (* changed) (GdauiRtEditor *editor); 53 }; 54 55 /** 56 * SECTION:gdaui-rt-editor 57 * @short_description: Rich text editor which uses a subset of the <ulink url="http://www.txt2tags.org/markup.html">txt2tags</ulink> markup. 58 * @title: GdauiRtEditor 59 * @stability: Stable 60 * @Image: vi-rte.png 61 * @see_also: 62 * 63 * The text entered in the editor can be formatted using bold, underline, title, ... attributes 64 * and then extracted using a subset of the <ulink url="http://www.txt2tags.org/markup.html">txt2tags</ulink> 65 * markup. Use this widget to edit textual fields where some markup is desirable to organize the text. 66 * 67 * For example the real text used to obtain the formatting in the figure is: 68 * <programlisting> 69 *blah //italic// blah. 70 *and ** BOLD!//both italic and bold// Bold!** 71 *Nice Picture: [[[R2RrUAA...y8vLy8tYQwAA]]] Yes 72 *- List item --One-- 73 *- List item **Two** 74 * - sub1 75 * - sub2</programlisting> 76 * where the picture's serialized data has been truncated here for readability 77 * (between the [[[ and ]]] markers). Pictures are usually inserted using the incorporated 78 * tollbar and not y hand (even though it's possible). 79 */ 80 81 GType gdaui_rt_editor_get_type (void) G_GNUC_CONST; 82 83 GtkWidget *gdaui_rt_editor_new (void); 84 gchar *gdaui_rt_editor_get_contents (GdauiRtEditor *editor); 85 void gdaui_rt_editor_set_contents (GdauiRtEditor *editor, const gchar *markup, gint length); 86 void gdaui_rt_editor_set_editable (GdauiRtEditor *editor, gboolean editable); 87 88 G_END_DECLS 89 90 #endif 91 92 93 94