Fri, 20 Aug 2004 21:57:18 +0000
[gaim-migrate @ 10664]
Thanks to Dave West for being cool.
When I grow up I want to be a p scichologiest.
Sometimes I wish the coyote would catch the road runner.
committer: Mark Doliner <markdoliner@pidgin.im>
|
5034
077678f7b048
[gaim-migrate @ 5377]
Christian Hammond <chipx86@chipx86.com>
parents:
5012
diff
changeset
|
1 | /** |
|
5967
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
2 | * @file gtkimhtml.h GTK+ IM/HTML rendering component |
|
5034
077678f7b048
[gaim-migrate @ 5377]
Christian Hammond <chipx86@chipx86.com>
parents:
5012
diff
changeset
|
3 | * @ingroup gtkui |
| 1428 | 4 | * |
| 8046 | 5 | * Gaim is the legal property of its developers, whose names are too numerous |
| 6 | * to list here. Please refer to the COPYRIGHT file distributed with this | |
| 7 | * source distribution. | |
| 1428 | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify | |
| 10 | * under the terms of the GNU General Public License as published by | |
| 11 | * the Free Software Foundation; either version 2 of the License, or | |
| 12 | * (at your option) any later version. | |
| 13 | * | |
| 14 | * This program is distributed in the hope that it will be useful, | |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | * GNU General Public License for more details. | |
| 18 | * | |
| 19 | * You should have received a copy of the GNU General Public License | |
| 20 | * along with this program; if not, write to the Free Software | |
| 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 22 | */ | |
|
9713
bb37562302a1
[gaim-migrate @ 10574]
Mark Doliner <markdoliner@pidgin.im>
parents:
9573
diff
changeset
|
23 | #ifndef _GAIM_GTKIMHTML_H_ |
|
bb37562302a1
[gaim-migrate @ 10574]
Mark Doliner <markdoliner@pidgin.im>
parents:
9573
diff
changeset
|
24 | #define _GAIM_GTKIMHTML_H_ |
| 1428 | 25 | |
| 26 | #include <gdk/gdk.h> | |
| 3922 | 27 | #include <gtk/gtktextview.h> |
| 4735 | 28 | #include <gtk/gtktooltips.h> |
| 5012 | 29 | #include <gtk/gtkimage.h> |
| 1428 | 30 | |
| 31 | #ifdef __cplusplus | |
| 32 | extern "C" { | |
| 33 | #endif | |
| 34 | ||
| 9033 | 35 | /************************************************************************** |
| 36 | * @name Structures | |
| 37 | **************************************************************************/ | |
| 38 | /*@{*/ | |
| 39 | ||
| 1428 | 40 | #define GTK_TYPE_IMHTML (gtk_imhtml_get_type ()) |
| 41 | #define GTK_IMHTML(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_IMHTML, GtkIMHtml)) | |
| 42 | #define GTK_IMHTML_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMHTML, GtkIMHtmlClass)) | |
| 43 | #define GTK_IS_IMHTML(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_IMHTML)) | |
| 44 | #define GTK_IS_IMHTML_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMHTML)) | |
|
5967
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
45 | #define GTK_IMHTML_SCALABLE(obj) ((GtkIMHtmlScalable *)obj) |
| 1428 | 46 | |
|
5967
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
47 | typedef struct _GtkIMHtml GtkIMHtml; |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
48 | typedef struct _GtkIMHtmlClass GtkIMHtmlClass; |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
49 | typedef struct _GtkIMHtmlFontDetail GtkIMHtmlFontDetail; /* The five elements contained in a FONT tag */ |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
50 | typedef struct _GtkSmileyTree GtkSmileyTree; |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
51 | typedef struct _GtkIMHtmlSmiley GtkIMHtmlSmiley; |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
52 | typedef struct _GtkIMHtmlScalable GtkIMHtmlScalable; |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
53 | typedef struct _GtkIMHtmlImage GtkIMHtmlImage; |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
54 | typedef struct _GtkIMHtmlHr GtkIMHtmlHr; |
| 8962 | 55 | typedef struct _GtkIMHtmlFuncs GtkIMHtmlFuncs; |
| 8061 | 56 | |
| 8420 | 57 | typedef enum { |
| 58 | GTK_IMHTML_BOLD = 1 << 0, | |
| 59 | GTK_IMHTML_ITALIC = 1 << 1, | |
| 60 | GTK_IMHTML_UNDERLINE = 1 << 2, | |
| 61 | GTK_IMHTML_GROW = 1 << 3, | |
| 62 | GTK_IMHTML_SHRINK = 1 << 4, | |
| 63 | GTK_IMHTML_FACE = 1 << 5, | |
| 64 | GTK_IMHTML_FORECOLOR = 1 << 6, | |
| 65 | GTK_IMHTML_BACKCOLOR = 1 << 7, | |
| 66 | GTK_IMHTML_LINK = 1 << 8, | |
| 67 | GTK_IMHTML_IMAGE = 1 << 9, | |
| 8677 | 68 | GTK_IMHTML_SMILEY = 1 << 10, |
| 9041 | 69 | GTK_IMHTML_LINKDESC = 1 << 11, |
| 8677 | 70 | GTK_IMHTML_ALL = -1 |
| 8420 | 71 | } GtkIMHtmlButtons; |
| 8061 | 72 | |
| 1428 | 73 | struct _GtkIMHtml { |
| 3922 | 74 | GtkTextView text_view; |
| 75 | GtkTextBuffer *text_buffer; | |
| 8677 | 76 | GtkTextMark *scrollpoint; |
| 1428 | 77 | GdkCursor *hand_cursor; |
| 78 | GdkCursor *arrow_cursor; | |
| 8061 | 79 | GdkCursor *text_cursor; |
| 4032 | 80 | GHashTable *smiley_data; |
| 81 | GtkSmileyTree *default_smilies; | |
| 8456 | 82 | char *protocol_name; |
| 4254 | 83 | |
|
6124
322206d79652
[gaim-migrate @ 6598]
Mark Doliner <markdoliner@pidgin.im>
parents:
6066
diff
changeset
|
84 | gboolean show_comments; |
| 4735 | 85 | |
| 8456 | 86 | gboolean html_shortcuts; |
| 87 | gboolean smiley_shortcuts; | |
| 88 | ||
| 4735 | 89 | GtkWidget *tip_window; |
| 90 | char *tip; | |
| 91 | guint tip_timer; | |
| 4895 | 92 | |
| 93 | GList *scalables; | |
| 4947 | 94 | GdkRectangle old_rect; |
| 7295 | 95 | |
| 8061 | 96 | gchar *search_string; |
| 7694 | 97 | |
| 8061 | 98 | gboolean editable; |
| 8420 | 99 | GtkIMHtmlButtons format_functions; |
| 8677 | 100 | gboolean wbfo; /* Whole buffer formatting only. */ |
| 101 | ||
| 102 | gint insert_offset; | |
| 8420 | 103 | |
| 8061 | 104 | struct { |
| 8677 | 105 | gboolean bold:1; |
| 106 | gboolean italic:1; | |
| 107 | gboolean underline:1; | |
| 108 | gchar *forecolor; | |
| 109 | gchar *backcolor; | |
| 110 | gchar *fontface; | |
| 8061 | 111 | int fontsize; |
| 8677 | 112 | GtkTextTag *link; |
| 8061 | 113 | } edit; |
|
8740
098a43943bba
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
114 | |
|
098a43943bba
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
115 | double zoom; |
|
098a43943bba
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
116 | int original_fsize; |
|
098a43943bba
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
117 | |
| 8681 | 118 | char *clipboard_text_string; |
| 119 | char *clipboard_html_string; | |
| 8962 | 120 | |
| 121 | GSList *im_images; | |
| 122 | GtkIMHtmlFuncs *funcs; | |
| 1428 | 123 | }; |
| 124 | ||
| 125 | struct _GtkIMHtmlClass { | |
| 3922 | 126 | GtkTextViewClass parent_class; |
| 1428 | 127 | |
|
5967
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
128 | void (*url_clicked)(GtkIMHtml *, const gchar *); |
| 8420 | 129 | void (*buttons_update)(GtkIMHtml *, GtkIMHtmlButtons); |
| 130 | void (*toggle_format)(GtkIMHtml *, GtkIMHtmlButtons); | |
| 8427 | 131 | void (*clear_format)(GtkIMHtml *); |
| 8506 | 132 | void (*update_format)(GtkIMHtml *); |
|
5967
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
133 | }; |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
134 | |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
135 | struct _GtkIMHtmlFontDetail { |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
136 | gushort size; |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
137 | gchar *face; |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
138 | gchar *fore; |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
139 | gchar *back; |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
140 | gchar *sml; |
| 8689 | 141 | gboolean underline; |
|
5967
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
142 | }; |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
143 | |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
144 | struct _GtkSmileyTree { |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
145 | GString *values; |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
146 | GtkSmileyTree **children; |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
147 | GtkIMHtmlSmiley *image; |
| 1428 | 148 | }; |
| 149 | ||
| 4263 | 150 | struct _GtkIMHtmlSmiley { |
| 151 | gchar *smile; | |
| 152 | gchar *file; | |
| 6814 | 153 | GdkPixbufAnimation *icon; |
| 4263 | 154 | gboolean hidden; |
| 155 | }; | |
| 156 | ||
|
5967
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
157 | struct _GtkIMHtmlScalable { |
| 4895 | 158 | void (*scale)(struct _GtkIMHtmlScalable *, int, int); |
| 159 | void (*add_to)(struct _GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
| 160 | void (*free)(struct _GtkIMHtmlScalable *); | |
| 161 | }; | |
| 162 | ||
|
5967
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
163 | struct _GtkIMHtmlImage { |
| 4895 | 164 | GtkIMHtmlScalable scalable; |
| 5012 | 165 | GtkImage *image; |
| 5046 | 166 | GdkPixbuf *pixbuf; |
| 4895 | 167 | GtkTextMark *mark; |
| 5012 | 168 | gchar *filename; |
| 4895 | 169 | int width; |
| 170 | int height; | |
| 8962 | 171 | int id; |
|
9573
7fb26654aee8
[gaim-migrate @ 10416]
Mark Doliner <markdoliner@pidgin.im>
parents:
9307
diff
changeset
|
172 | GtkWidget *filesel; |
|
5967
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
173 | }; |
| 4895 | 174 | |
|
5967
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
175 | struct _GtkIMHtmlHr { |
| 4895 | 176 | GtkIMHtmlScalable scalable; |
| 177 | GtkWidget *sep; | |
|
5967
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
178 | }; |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
179 | |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
180 | typedef enum { |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
181 | GTK_IMHTML_NO_COLOURS = 1 << 0, |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
182 | GTK_IMHTML_NO_FONTS = 1 << 1, |
|
8105
54ea897b764e
[gaim-migrate @ 8805]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8061
diff
changeset
|
183 | GTK_IMHTML_NO_COMMENTS = 1 << 2, /* Remove */ |
|
5967
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
184 | GTK_IMHTML_NO_TITLE = 1 << 3, |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
185 | GTK_IMHTML_NO_NEWLINE = 1 << 4, |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
186 | GTK_IMHTML_NO_SIZES = 1 << 5, |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
187 | GTK_IMHTML_NO_SCROLL = 1 << 6, |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
188 | GTK_IMHTML_RETURN_LOG = 1 << 7, |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
189 | GTK_IMHTML_USE_POINTSIZE = 1 << 8 |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
190 | } GtkIMHtmlOptions; |
|
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
191 | |
| 8962 | 192 | typedef gpointer (*GtkIMHtmlGetImageFunc) (int id); |
| 193 | typedef gpointer (*GtkIMHtmlGetImageDataFunc) (gpointer i); | |
| 194 | typedef size_t (*GtkIMHtmlGetImageSizeFunc) (gpointer i); | |
| 195 | typedef const char *(*GtkIMHtmlGetImageFilenameFunc)(gpointer i); | |
| 196 | typedef void (*GtkIMHtmlImageRefFunc) (int id); | |
| 197 | typedef void (*GtkIMHtmlImageUnrefFunc) (int id); | |
| 198 | ||
| 199 | struct _GtkIMHtmlFuncs { | |
| 200 | GtkIMHtmlGetImageFunc image_get; | |
| 201 | GtkIMHtmlGetImageDataFunc image_get_data; | |
| 202 | GtkIMHtmlGetImageSizeFunc image_get_size; | |
| 203 | GtkIMHtmlGetImageFilenameFunc image_get_filename; | |
| 204 | GtkIMHtmlImageRefFunc image_ref; | |
| 205 | GtkIMHtmlImageUnrefFunc image_unref; | |
| 206 | }; | |
| 207 | ||
| 9033 | 208 | /*@}*/ |
| 8962 | 209 | |
| 9033 | 210 | /************************************************************************** |
| 211 | * @name GTK+ IM/HTML rendering component API | |
| 212 | **************************************************************************/ | |
| 213 | /*@{*/ | |
| 214 | ||
| 215 | /** | |
| 9037 | 216 | * Returns the GType object for an IM/HTML widget. |
| 9033 | 217 | * |
| 9037 | 218 | * @return The GType for an IM/HTML widget. |
| 9033 | 219 | */ |
| 9037 | 220 | GType gtk_imhtml_get_type(void); |
|
5967
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
221 | |
| 9033 | 222 | /** |
| 223 | * Creates and returns a new GTK IM/HTML widget. | |
| 224 | * | |
| 225 | * @return The GTK IM/HTML widget created. | |
| 226 | */ | |
| 227 | GtkWidget *gtk_imhtml_new(void *, void *); | |
|
5967
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
228 | |
| 9033 | 229 | /** |
| 230 | * Associates a smiley with a GTK IM/HTML. | |
| 231 | * | |
| 232 | * @param imhtml The GTK IM/HTML. | |
| 233 | * @param sml The name of the smiley category. | |
| 234 | * @param smiley The GtkIMSmiley to associate. | |
| 235 | */ | |
| 236 | void gtk_imhtml_associate_smiley(GtkIMHtml *imhtml, gchar *sml, GtkIMHtmlSmiley *smiley); | |
| 237 | ||
| 238 | /** | |
| 239 | * Removes all smileys associated with a GTK IM/HTML. | |
| 240 | * | |
| 241 | * @param imhtml The GTK IM/HTML. | |
| 242 | */ | |
| 243 | void gtk_imhtml_remove_smileys(GtkIMHtml *imhtml); | |
|
5967
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
244 | |
| 9033 | 245 | /** |
| 246 | * Sets the function callbacks to use with a GTK IM/HTML instance. | |
| 247 | * | |
| 248 | * @param imhtml The GTK IM/HTML. | |
| 249 | * @param f The GtkIMHTMLFuncs struct containing the functions to use. | |
| 250 | */ | |
| 251 | void gtk_imhtml_set_funcs(GtkIMHtml *imhtml, GtkIMHtmlFuncs *f); | |
|
5967
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
252 | |
| 9033 | 253 | /** |
| 254 | * Enables or disables showing the contents of HTML comments in a GTK IM/HTML. | |
| 255 | * | |
| 256 | * @param imhtml The GTK IM/HTML. | |
| 257 | * @param show @c TRUE if comments should be shown, or @c FALSE otherwise. | |
| 258 | */ | |
| 259 | void gtk_imhtml_show_comments(GtkIMHtml *imhtml, gboolean show); | |
| 8962 | 260 | |
| 9033 | 261 | /** |
| 262 | * Enables or disables formatting shortcut keys in a GTK IM/HTML. | |
| 263 | * | |
| 264 | * @param imhtml The GTK IM/HTML. | |
| 265 | * @param allow @c TRUE if shortcut keys are allowed, or @c FALSE otherwise. | |
| 266 | */ | |
| 267 | void gtk_imhtml_html_shortcuts(GtkIMHtml *imhtml, gboolean allow); | |
|
5967
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
268 | |
| 9033 | 269 | /** |
| 270 | * Enables or disables smiley insertion shortcut keys in a GTK IM/HTML. | |
| 271 | * | |
| 272 | * @param imhtml The GTK IM/HTML. | |
| 273 | * @param allow @c TRUE if shortcut keys are allowed, or @c FALSE otherwise. | |
| 274 | */ | |
| 275 | void gtk_imhtml_smiley_shortcuts(GtkIMHtml *imhtml, gboolean allow); | |
| 8456 | 276 | |
| 9033 | 277 | /** |
| 278 | * Associates a protocol name with a GTK IM/HTML. | |
| 279 | * | |
| 280 | * @param imhtml The GTK IM/HTML. | |
| 281 | * @param protocol_name The protocol name to associate with the IM/HTML. | |
| 282 | */ | |
| 283 | void gtk_imhtml_set_protocol_name(GtkIMHtml *imhtml, const gchar *protocol_name); | |
| 8456 | 284 | |
| 9033 | 285 | /** |
| 286 | * Appends HTML formatted text to a GTK IM/HTML. | |
| 287 | * | |
| 288 | * @param imhtml The GTK IM/HTML. | |
| 289 | * @param text The formatted text to append. | |
| 290 | * @param options A GtkIMHtmlOptions object indicating insert behavior. | |
| 291 | */ | |
| 9307 | 292 | #define gtk_imhtml_append_text(imhtml, text, options) \ |
| 293 | gtk_imhtml_append_text_with_images(imhtml, text, options, NULL) | |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6814
diff
changeset
|
294 | |
| 9033 | 295 | /** |
| 296 | * Appends HTML formatted text to a GTK IM/HTML. | |
| 297 | * | |
| 298 | * @param imhtml The GTK IM/HTML. | |
| 299 | * @param text The formatted text to append. | |
| 300 | * @param options A GtkIMHtmlOptions object indicating insert behavior. | |
| 9185 | 301 | * @param unused Use @c NULL value. |
| 9033 | 302 | */ |
| 303 | void gtk_imhtml_append_text_with_images(GtkIMHtml *imhtml, | |
| 304 | const gchar *text, | |
| 305 | GtkIMHtmlOptions options, | |
| 306 | GSList *unused); | |
| 307 | ||
| 308 | /** | |
| 309 | * Inserts HTML formatted text to a GTK IM/HTML at a given iter. | |
| 310 | * | |
| 311 | * @param imhtml The GTK IM/HTML. | |
| 312 | * @param text The formatted text to append. | |
| 313 | * @param options A GtkIMHtmlOptions object indicating insert behavior. | |
| 314 | * @param iter A GtkTextIter in the GTK IM/HTML at which to insert text. | |
| 315 | */ | |
| 8677 | 316 | void gtk_imhtml_insert_html_at_iter(GtkIMHtml *imhtml, |
| 317 | const gchar *text, | |
| 318 | GtkIMHtmlOptions options, | |
| 319 | GtkTextIter *iter); | |
| 9033 | 320 | |
| 321 | /** | |
| 322 | * Scrolls a GTK IM/HTML to the end of its contents. | |
| 323 | * | |
| 324 | * @param imhtml The GTK IM/HTML. | |
| 325 | */ | |
| 8729 | 326 | void gtk_imhtml_scroll_to_end(GtkIMHtml *imhtml); |
| 9033 | 327 | |
| 328 | /** | |
| 329 | * Purges the contents from a GTK IM/HTML and resets formatting. | |
| 330 | * | |
| 331 | * @param imhtml The GTK IM/HTML. | |
| 332 | */ | |
| 333 | void gtk_imhtml_clear(GtkIMHtml *imhtml); | |
| 4895 | 334 | |
| 9033 | 335 | /** |
| 336 | * Scrolls a GTK IM/HTML up by one page. | |
| 337 | * | |
| 338 | * @param imhtml The GTK IM/HTML. | |
| 339 | */ | |
| 340 | void gtk_imhtml_page_up(GtkIMHtml *imhtml); | |
| 341 | ||
| 342 | /** | |
| 343 | * Scrolls a GTK IM/HTML down by one page. | |
| 344 | * | |
| 345 | * @param imhtml The GTK IM/HTML. | |
| 346 | */ | |
| 347 | void gtk_imhtml_page_down(GtkIMHtml *imhtml); | |
| 348 | ||
| 349 | /** | |
| 350 | * Scales the font sizes in a GTK IM/HTML by a given factor. | |
| 351 | * | |
| 352 | * @param imhtml The GTK IM/HTML. | |
| 353 | * @param zoom The factor by which to scale the font sizes. | |
| 354 | */ | |
|
8740
098a43943bba
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
355 | void gtk_imhtml_font_zoom(GtkIMHtml *imhtml, double zoom); |
|
098a43943bba
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
356 | |
| 9033 | 357 | /** |
| 358 | * Creates and returns an new GTK IM/HTML scalable object. | |
| 359 | * | |
| 360 | * @return A new IM/HTML Scalable object. | |
| 361 | */ | |
| 4895 | 362 | GtkIMHtmlScalable *gtk_imhtml_scalable_new(); |
| 9033 | 363 | |
| 364 | /** | |
| 365 | * Creates and returns an new GTK IM/HTML scalable object with an image. | |
| 366 | * | |
| 367 | * @param img A GdkPixbuf of the image to add. | |
| 368 | * @param filename The filename to associate with the image. | |
| 369 | * @param id The id to associate with the image. | |
| 370 | * | |
| 371 | * @return A new IM/HTML Scalable object with an image. | |
| 372 | */ | |
| 8962 | 373 | GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename, int id); |
| 9033 | 374 | |
| 375 | /** | |
| 376 | * Destroys and frees a GTK IM/HTML scalable image. | |
| 377 | * | |
| 378 | * @param scale The GTK IM/HTML scalable. | |
| 379 | */ | |
| 380 | void gtk_imhtml_image_free(GtkIMHtmlScalable *scale); | |
| 4895 | 381 | |
| 9033 | 382 | /** |
| 383 | * Rescales a GTK IM/HTML scalable image to a given size. | |
| 384 | * | |
| 385 | * @param scale The GTK IM/HTML scalable. | |
| 386 | * @param width The new width. | |
| 387 | * @param height The new height. | |
| 388 | */ | |
| 389 | void gtk_imhtml_image_scale(GtkIMHtmlScalable *scale, int width, int height); | |
| 390 | ||
| 391 | /** | |
| 392 | * Adds a GTK IM/HTML scalable image to a given GTK IM/HTML at a given iter. | |
| 393 | * | |
| 394 | * @param scale The GTK IM/HTML scalable. | |
| 395 | * @param imhtml The GTK IM/HTML. | |
| 396 | * @param iter The GtkTextIter at which to add the scalable. | |
| 397 | */ | |
| 398 | void gtk_imhtml_image_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTextIter *iter); | |
| 399 | ||
| 400 | /** | |
| 401 | * Creates and returns an new GTK IM/HTML scalable with a horizontal rule. | |
| 402 | * | |
| 403 | * @return A new IM/HTML Scalable object with an image. | |
| 404 | */ | |
|
5967
df8268ccde45
[gaim-migrate @ 6414]
Mark Doliner <markdoliner@pidgin.im>
parents:
5537
diff
changeset
|
405 | GtkIMHtmlScalable *gtk_imhtml_hr_new(); |
| 9033 | 406 | |
| 407 | /** | |
| 408 | * Destroys and frees a GTK IM/HTML scalable horizontal rule. | |
| 409 | * | |
| 410 | * @param scale The GTK IM/HTML scalable. | |
| 411 | */ | |
| 9034 | 412 | void gtk_imhtml_hr_free(GtkIMHtmlScalable *scale); |
| 9033 | 413 | |
| 414 | /** | |
| 415 | * Rescales a GTK IM/HTML scalable horizontal rule to a given size. | |
| 416 | * | |
| 417 | * @param scale The GTK IM/HTML scalable. | |
| 418 | * @param width The new width. | |
| 419 | * @param height The new height. | |
| 420 | */ | |
| 9034 | 421 | void gtk_imhtml_hr_scale(GtkIMHtmlScalable *scale, int width, int height); |
| 4895 | 422 | |
| 9033 | 423 | /** |
| 424 | * Adds a GTK IM/HTML scalable horizontal rule to a given GTK IM/HTML at | |
| 425 | * a given iter. | |
| 426 | * | |
| 427 | * @param scale The GTK IM/HTML scalable. | |
| 428 | * @param imhtml The GTK IM/HTML. | |
| 429 | * @param iter The GtkTextIter at which to add the scalable. | |
| 430 | */ | |
| 9307 | 431 | void gtk_imhtml_hr_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTextIter *iter); |
| 9033 | 432 | |
| 433 | /** | |
| 434 | * Finds and highlights a given string in a GTK IM/HTML. | |
| 435 | * | |
| 436 | * @param imhtml The GTK IM/HTML. | |
| 437 | * @param text The string to search for. | |
| 438 | * | |
| 439 | * @return @c TRUE if a search was performed, or @c FALSE if not. | |
| 440 | */ | |
| 7295 | 441 | gboolean gtk_imhtml_search_find(GtkIMHtml *imhtml, const gchar *text); |
| 9033 | 442 | |
| 443 | /** | |
| 444 | * Clears the highlighting from a prior search in a GTK IM/HTML. | |
| 445 | * | |
| 446 | * @param imhtml The GTK IM/HTML. | |
| 447 | */ | |
| 7295 | 448 | void gtk_imhtml_search_clear(GtkIMHtml *imhtml); |
| 4895 | 449 | |
| 9033 | 450 | /** |
| 451 | * Enables or disables editing in a GTK IM/HTML. | |
| 452 | * | |
| 453 | * @param imhtml The GTK IM/HTML. | |
| 454 | * @param editable @c TRUE to make the widget editable, or @c FALSE otherwise. | |
| 455 | */ | |
| 8061 | 456 | void gtk_imhtml_set_editable(GtkIMHtml *imhtml, gboolean editable); |
| 9033 | 457 | |
| 458 | /** | |
| 459 | * Enables or disables whole buffer formatting only (wbfo) in a GTK IM/HTML. | |
| 460 | * In this mode formatting options to the buffer take effect for the entire | |
| 461 | * buffer instead of specific text. | |
| 462 | * | |
| 463 | * @param imhtml The GTK IM/HTML. | |
| 464 | * @param wbfo @c TRUE to enable the mode, or @c FALSE otherwise. | |
| 465 | */ | |
| 8677 | 466 | void gtk_imhtml_set_whole_buffer_formatting_only(GtkIMHtml *imhtml, gboolean wbfo); |
| 9033 | 467 | |
| 468 | /** | |
| 9185 | 469 | * Indicates which formatting functions to enable and disable in a GTK IM/HTML. |
| 9033 | 470 | * |
| 471 | * @param imhtml The GTK IM/HTML. | |
| 9185 | 472 | * @param buttons A GtkIMHtmlButtons bitmask indicating which functions to use. |
| 9033 | 473 | */ |
| 8420 | 474 | void gtk_imhtml_set_format_functions(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons); |
| 9033 | 475 | |
| 476 | /** | |
| 9185 | 477 | * Returns which formatting functions are enabled in a GTK IM/HTML. |
| 9033 | 478 | * |
| 479 | * @param imhtml The GTK IM/HTML. | |
| 480 | * | |
| 9185 | 481 | * @return A GtkIMHtmlButtons bitmask indicating which functions to are enabled. |
| 9033 | 482 | */ |
|
8788
a13634443a38
[gaim-migrate @ 9550]
Mark Doliner <markdoliner@pidgin.im>
parents:
8740
diff
changeset
|
483 | GtkIMHtmlButtons gtk_imhtml_get_format_functions(GtkIMHtml *imhtml); |
| 9033 | 484 | |
| 485 | /** | |
| 486 | * Sets each boolean to TRUE if that formatting option is enabled at the | |
| 487 | * current position in a GTK IM/HTML. | |
| 488 | * | |
| 489 | * @param imhtml The GTK IM/HTML. | |
| 490 | * @param bold A reference to a boolean for bold. | |
| 491 | * @param italic A reference to a boolean for italic. | |
| 492 | * @param underline A reference to a boolean for underline. | |
| 493 | */ | |
| 8516 | 494 | void gtk_imhtml_get_current_format(GtkIMHtml *imhtml, gboolean *bold, gboolean *italic, gboolean *underline); |
| 9033 | 495 | |
| 496 | /** | |
| 497 | * Returns a string containing the selected font face at the current position | |
| 498 | * in a GTK IM/HTML. | |
| 499 | * | |
| 500 | * @param imhtml The GTK IM/HTML. | |
| 501 | * | |
| 502 | * @return A string containg the font face or @c NULL if none is set. | |
| 503 | */ | |
| 9025 | 504 | char *gtk_imhtml_get_current_fontface(GtkIMHtml *imhtml); |
| 9033 | 505 | |
| 506 | /** | |
| 507 | * Returns a string containing the selected foreground color at the current | |
| 508 | * position in a GTK IM/HTML. | |
| 509 | * | |
| 510 | * @param imhtml The GTK IM/HTML. | |
| 511 | * | |
| 512 | * @return A string containg the foreground color or @c NULL if none is set. | |
| 513 | */ | |
| 9025 | 514 | char *gtk_imhtml_get_current_forecolor(GtkIMHtml *imhtml); |
| 9033 | 515 | |
| 516 | /** | |
| 517 | * Returns a string containing the selected background color at the current | |
| 518 | * position in a GTK IM/HTML. | |
| 519 | * | |
| 520 | * @param imhtml The GTK IM/HTML. | |
| 521 | * | |
| 522 | * @return A string containg the background color or @c NULL if none is set. | |
| 523 | */ | |
| 9025 | 524 | char *gtk_imhtml_get_current_backcolor(GtkIMHtml *imhtml); |
| 9033 | 525 | |
| 526 | /** | |
| 527 | * Returns a integer containing the selected HTML font size at the current | |
| 528 | * position in a GTK IM/HTML. | |
| 529 | * | |
| 530 | * @param imhtml The GTK IM/HTML. | |
| 531 | * | |
| 532 | * @return The HTML font size. | |
| 533 | */ | |
| 9025 | 534 | gint gtk_imhtml_get_current_fontsize(GtkIMHtml *imhtml); |
| 9033 | 535 | |
| 536 | /** | |
| 537 | * Checks whether a GTK IM/HTML is marked as editable. | |
| 538 | * | |
| 539 | * @param imhtml The GTK IM/HTML. | |
| 540 | * | |
| 541 | * @return @c TRUE if the IM/HTML is editable, or @c FALSE otherwise. | |
| 542 | */ | |
| 8061 | 543 | gboolean gtk_imhtml_get_editable(GtkIMHtml *imhtml); |
| 9033 | 544 | |
| 545 | /** | |
| 546 | * Toggles bold at the cursor location or selection in a GTK IM/HTML. | |
| 547 | * | |
| 548 | * @param imhtml The GTK IM/HTML. | |
| 549 | * | |
| 550 | * @return @c TRUE if bold was turned on, or @c FALSE if it was turned off. | |
| 551 | */ | |
| 8061 | 552 | gboolean gtk_imhtml_toggle_bold(GtkIMHtml *imhtml); |
| 9033 | 553 | |
| 554 | /** | |
| 555 | * Toggles italic at the cursor location or selection in a GTK IM/HTML. | |
| 556 | * | |
| 557 | * @param imhtml The GTK IM/HTML. | |
| 558 | * | |
| 559 | * @return @c TRUE if italic was turned on, or @c FALSE if it was turned off. | |
| 560 | */ | |
| 8061 | 561 | gboolean gtk_imhtml_toggle_italic(GtkIMHtml *imhtml); |
| 9033 | 562 | |
| 563 | /** | |
| 564 | * Toggles underline at the cursor location or selection in a GTK IM/HTML. | |
| 565 | * | |
| 566 | * @param imhtml The GTK IM/HTML. | |
| 567 | * | |
| 568 | * @return @c TRUE if underline was turned on, or @c FALSE if it was turned off. | |
| 569 | */ | |
| 8061 | 570 | gboolean gtk_imhtml_toggle_underline(GtkIMHtml *imhtml); |
| 9033 | 571 | |
| 572 | /** | |
| 573 | * Toggles a foreground color at the current location or selection in a GTK | |
| 574 | * IM/HTML. | |
| 575 | * | |
| 576 | * @param imhtml The GTK IM/HTML. | |
| 9185 | 577 | * @param color The HTML-style color, or @c NULL or "" to clear the color. |
| 9033 | 578 | * |
| 579 | * @return @c TRUE if a color was set, or @c FALSE if it was cleared. | |
| 580 | */ | |
| 8061 | 581 | gboolean gtk_imhtml_toggle_forecolor(GtkIMHtml *imhtml, const char *color); |
| 9033 | 582 | |
| 583 | /** | |
| 584 | * Toggles a background color at the current location or selection in a GTK | |
| 585 | * IM/HTML. | |
| 586 | * | |
| 587 | * @param imhtml The GTK IM/HTML. | |
| 9185 | 588 | * @param color The HTML-style color, or @c NULL or "" to clear the color. |
| 9033 | 589 | * |
| 590 | * @return @c TRUE if a color was set, or @c FALSE if it was cleared. | |
| 591 | */ | |
| 8061 | 592 | gboolean gtk_imhtml_toggle_backcolor(GtkIMHtml *imhtml, const char *color); |
| 9033 | 593 | |
| 594 | /** | |
| 595 | * Toggles a font face at the current location or selection in a GTK IM/HTML. | |
| 596 | * | |
| 597 | * @param imhtml The GTK IM/HTML. | |
| 9185 | 598 | * @param face The font face name, or @c NULL or "" to clear the font. |
| 9033 | 599 | * |
| 600 | * @return @c TRUE if a font name was set, or @c FALSE if it was cleared. | |
| 601 | */ | |
| 8061 | 602 | gboolean gtk_imhtml_toggle_fontface(GtkIMHtml *imhtml, const char *face); |
| 9033 | 603 | |
| 604 | /** | |
| 605 | * Toggles a link tag with the given URL at the current location or selection | |
| 606 | * in a GTK IM/HTML. | |
| 607 | * | |
| 608 | * @param imhtml The GTK IM/HTML. | |
| 9185 | 609 | * @param url The URL for the link or @c NULL to terminate the link. |
| 9033 | 610 | */ |
| 8677 | 611 | void gtk_imhtml_toggle_link(GtkIMHtml *imhtml, const char *url); |
| 9033 | 612 | |
| 613 | /** | |
| 614 | * Inserts a link to the given url at the given GtkTextMark in a GTK IM/HTML. | |
| 615 | * | |
| 616 | * @param imhtml The GTK IM/HTML. | |
| 617 | * @param mark The GtkTextMark to insert the link at. | |
| 618 | * @param url The URL for the link. | |
| 619 | * @param text The string to use for the link description. | |
| 620 | */ | |
| 8677 | 621 | void gtk_imhtml_insert_link(GtkIMHtml *imhtml, GtkTextMark *mark, const char *url, const char *text); |
| 9033 | 622 | |
| 623 | /** | |
| 624 | * Inserts a smiley at the current location or selection in a GTK IM/HTML. | |
| 625 | * | |
| 626 | * @param imhtml The GTK IM/HTML. | |
| 627 | * @param sml The category of the smiley. | |
| 628 | * @param smiley The text of the smiley to insert. | |
| 629 | */ | |
| 8061 | 630 | void gtk_imhtml_insert_smiley(GtkIMHtml *imhtml, const char *sml, char *smiley); |
| 9033 | 631 | /** |
| 632 | * Inserts a smiley at the given iter in a GTK IM/HTML. | |
| 633 | * | |
| 634 | * @param imhtml The GTK IM/HTML. | |
| 635 | * @param sml The category of the smiley. | |
| 636 | * @param smiley The text of the smiley to insert. | |
| 637 | * @param iter The GtkTextIter in the IM/HTML to insert the smiley at. | |
| 638 | */ | |
| 8677 | 639 | void gtk_imhtml_insert_smiley_at_iter(GtkIMHtml *imhtml, const char *sml, char *smiley, GtkTextIter *iter); |
| 9033 | 640 | |
| 641 | /** | |
| 642 | * Inserts the IM/HTML scalable image with the given id at the given iter in a | |
| 643 | * GTK IM/HTML. | |
| 644 | * | |
| 645 | * @param imhtml The GTK IM/HTML. | |
| 646 | * @param id The id of the IM/HTML scalable. | |
| 647 | * @param iter The GtkTextIter in the IM/HTML to insert the image at. | |
| 648 | */ | |
| 8962 | 649 | void gtk_imhtml_insert_image_at_iter(GtkIMHtml *imhtml, int id, GtkTextIter *iter); |
| 9033 | 650 | |
| 651 | /** | |
| 652 | * Sets the font size at the current location or selection in a GTK IM/HTML. | |
| 653 | * | |
| 654 | * @param imhtml The GTK IM/HTML. | |
| 655 | * @param size The HTML font size to use. | |
| 656 | */ | |
| 8061 | 657 | void gtk_imhtml_font_set_size(GtkIMHtml *imhtml, gint size); |
| 9033 | 658 | |
| 659 | /** | |
| 660 | * Decreases the font size by 1 at the current location or selection in a GTK | |
| 661 | * IM/HTML. | |
| 662 | * | |
| 663 | * @param imhtml The GTK IM/HTML. | |
| 664 | */ | |
| 8061 | 665 | void gtk_imhtml_font_shrink(GtkIMHtml *imhtml); |
| 9033 | 666 | |
| 667 | /** | |
| 668 | * Increases the font size by 1 at the current location or selection in a GTK | |
| 669 | * IM/HTML. | |
| 670 | * | |
| 671 | * @param imhtml The GTK IM/HTML. | |
| 672 | */ | |
| 8061 | 673 | void gtk_imhtml_font_grow(GtkIMHtml *imhtml); |
| 9033 | 674 | |
| 675 | /** | |
| 676 | * Returns the HTML formatted contents between two iters in a GTK IM/HTML. | |
| 677 | * | |
| 678 | * @param imhtml The GTK IM/HTML. | |
| 679 | * @param start The GtkTextIter indicating the start point in the IM/HTML. | |
| 680 | * @param end The GtkTextIter indicating the end point in the IM/HTML. | |
| 681 | * | |
| 682 | * @return A string containing the HTML formatted text. | |
| 683 | */ | |
| 8061 | 684 | char *gtk_imhtml_get_markup_range(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *end); |
| 9033 | 685 | |
| 686 | /** | |
| 687 | * Returns the entire HTML formatted contents of a GTK IM/HTML. | |
| 688 | * | |
| 689 | * @param imhtml The GTK IM/HTML. | |
| 690 | * | |
| 691 | * @return A string containing the HTML formatted text. | |
| 692 | */ | |
| 8061 | 693 | char *gtk_imhtml_get_markup(GtkIMHtml *imhtml); |
| 9033 | 694 | |
| 695 | /** | |
| 696 | * Returns a null terminated array of pointers to null terminated strings, each | |
| 697 | * string for each line. g_strfreev() should be called to free it when done. | |
| 698 | * | |
| 699 | * @param imhtml The GTK IM/HTML. | |
| 700 | * | |
| 701 | * @return A null terminated array of null terminated HTML formatted strings. | |
| 702 | */ | |
| 8677 | 703 | char **gtk_imhtml_get_markup_lines(GtkIMHtml *imhtml); |
| 9033 | 704 | |
| 705 | /** | |
| 706 | * Returns the entire unformatted (plain text) contents of a GTK IM/HTML | |
| 707 | * between two iters in a GTK IM/HTML. | |
| 708 | * | |
| 709 | * @param imhtml The GTK IM/HTML. | |
| 710 | * @param start The GtkTextIter indicating the start point in the IM/HTML. | |
| 9185 | 711 | * @param stop The GtkTextIter indicating the end point in the IM/HTML. |
| 9033 | 712 | * |
| 713 | * @return A string containing the unformatted text. | |
| 714 | */ | |
| 8677 | 715 | char *gtk_imhtml_get_text(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *stop); |
| 8061 | 716 | |
| 9033 | 717 | /*@}*/ |
| 718 | ||
| 1428 | 719 | #ifdef __cplusplus |
| 720 | } | |
| 721 | #endif | |
| 722 | ||
|
9713
bb37562302a1
[gaim-migrate @ 10574]
Mark Doliner <markdoliner@pidgin.im>
parents:
9573
diff
changeset
|
723 | #endif /* _GAIM_GTKIMHTML_H_ */ |