Mercurial > pidgin
annotate src/gtkimhtml.h @ 10528:c3a964f4fc61
[gaim-migrate @ 11849]
The autopackage will now be built with mozilla-nss support too.
Hopefully this helps those people who couldn't install the 1.1.1 .package
due to having the wrong version (or no version) of gnutls.
Also a spelling fix in conversation.h that I forgot to commit earlier,
thanks Evan Schoenberg, although I meant expects, not accepts.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Wed, 19 Jan 2005 01:00:31 +0000 |
parents | 55e7d72fc09a |
children | 74180743304a |
rev | line source |
---|---|
5034
4691c5936c01
[gaim-migrate @ 5377]
Christian Hammond <chipx86@chipx86.com>
parents:
5012
diff
changeset
|
1 /** |
5967 | 2 * @file gtkimhtml.h GTK+ IM/HTML rendering component |
5034
4691c5936c01
[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 | 23 #ifndef _GAIM_GTKIMHTML_H_ |
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 | 45 #define GTK_IMHTML_SCALABLE(obj) ((GtkIMHtmlScalable *)obj) |
1428 | 46 |
5967 | 47 typedef struct _GtkIMHtml GtkIMHtml; |
48 typedef struct _GtkIMHtmlClass GtkIMHtmlClass; | |
49 typedef struct _GtkIMHtmlFontDetail GtkIMHtmlFontDetail; /* The five elements contained in a FONT tag */ | |
50 typedef struct _GtkSmileyTree GtkSmileyTree; | |
51 typedef struct _GtkIMHtmlSmiley GtkIMHtmlSmiley; | |
52 typedef struct _GtkIMHtmlScalable GtkIMHtmlScalable; | |
53 typedef struct _GtkIMHtmlImage GtkIMHtmlImage; | |
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, |
9924 | 70 GTK_IMHTML_STRIKE = 1 << 12, |
8677 | 71 GTK_IMHTML_ALL = -1 |
8420 | 72 } GtkIMHtmlButtons; |
8061 | 73 |
1428 | 74 struct _GtkIMHtml { |
3922 | 75 GtkTextView text_view; |
76 GtkTextBuffer *text_buffer; | |
8677 | 77 GtkTextMark *scrollpoint; |
1428 | 78 GdkCursor *hand_cursor; |
79 GdkCursor *arrow_cursor; | |
8061 | 80 GdkCursor *text_cursor; |
4032 | 81 GHashTable *smiley_data; |
82 GtkSmileyTree *default_smilies; | |
8456 | 83 char *protocol_name; |
4254 | 84 |
6124 | 85 gboolean show_comments; |
4735 | 86 |
87 GtkWidget *tip_window; | |
88 char *tip; | |
89 guint tip_timer; | |
4895 | 90 |
91 GList *scalables; | |
4947 | 92 GdkRectangle old_rect; |
7295 | 93 |
8061 | 94 gchar *search_string; |
7694 | 95 |
8061 | 96 gboolean editable; |
8420 | 97 GtkIMHtmlButtons format_functions; |
8677 | 98 gboolean wbfo; /* Whole buffer formatting only. */ |
99 | |
100 gint insert_offset; | |
8420 | 101 |
8061 | 102 struct { |
8677 | 103 gboolean bold:1; |
104 gboolean italic:1; | |
105 gboolean underline:1; | |
9924 | 106 gboolean strike:1; |
8677 | 107 gchar *forecolor; |
108 gchar *backcolor; | |
109 gchar *fontface; | |
8061 | 110 int fontsize; |
8677 | 111 GtkTextTag *link; |
8061 | 112 } edit; |
8740
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
113 |
8681 | 114 char *clipboard_text_string; |
115 char *clipboard_html_string; | |
8962 | 116 |
117 GSList *im_images; | |
118 GtkIMHtmlFuncs *funcs; | |
1428 | 119 }; |
120 | |
121 struct _GtkIMHtmlClass { | |
3922 | 122 GtkTextViewClass parent_class; |
1428 | 123 |
5967 | 124 void (*url_clicked)(GtkIMHtml *, const gchar *); |
8420 | 125 void (*buttons_update)(GtkIMHtml *, GtkIMHtmlButtons); |
126 void (*toggle_format)(GtkIMHtml *, GtkIMHtmlButtons); | |
8427 | 127 void (*clear_format)(GtkIMHtml *); |
8506 | 128 void (*update_format)(GtkIMHtml *); |
10108 | 129 gboolean (*message_send)(GtkIMHtml *); |
5967 | 130 }; |
131 | |
132 struct _GtkIMHtmlFontDetail { | |
133 gushort size; | |
134 gchar *face; | |
135 gchar *fore; | |
136 gchar *back; | |
137 gchar *sml; | |
9950 | 138 gboolean underline; |
5967 | 139 }; |
140 | |
141 struct _GtkSmileyTree { | |
142 GString *values; | |
143 GtkSmileyTree **children; | |
144 GtkIMHtmlSmiley *image; | |
1428 | 145 }; |
146 | |
4263 | 147 struct _GtkIMHtmlSmiley { |
148 gchar *smile; | |
149 gchar *file; | |
6814
782907a6ae65
[gaim-migrate @ 7354]
Christian Hammond <chipx86@chipx86.com>
parents:
6282
diff
changeset
|
150 GdkPixbufAnimation *icon; |
4263 | 151 gboolean hidden; |
10526 | 152 GdkPixbufLoader *loader; |
4263 | 153 }; |
154 | |
5967 | 155 struct _GtkIMHtmlScalable { |
4895 | 156 void (*scale)(struct _GtkIMHtmlScalable *, int, int); |
157 void (*add_to)(struct _GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
158 void (*free)(struct _GtkIMHtmlScalable *); | |
159 }; | |
160 | |
5967 | 161 struct _GtkIMHtmlImage { |
4895 | 162 GtkIMHtmlScalable scalable; |
5012 | 163 GtkImage *image; |
5046 | 164 GdkPixbuf *pixbuf; |
4895 | 165 GtkTextMark *mark; |
5012 | 166 gchar *filename; |
4895 | 167 int width; |
168 int height; | |
8962 | 169 int id; |
9573 | 170 GtkWidget *filesel; |
5967 | 171 }; |
4895 | 172 |
5967 | 173 struct _GtkIMHtmlHr { |
4895 | 174 GtkIMHtmlScalable scalable; |
175 GtkWidget *sep; | |
5967 | 176 }; |
177 | |
178 typedef enum { | |
179 GTK_IMHTML_NO_COLOURS = 1 << 0, | |
180 GTK_IMHTML_NO_FONTS = 1 << 1, | |
8105 | 181 GTK_IMHTML_NO_COMMENTS = 1 << 2, /* Remove */ |
5967 | 182 GTK_IMHTML_NO_TITLE = 1 << 3, |
183 GTK_IMHTML_NO_NEWLINE = 1 << 4, | |
184 GTK_IMHTML_NO_SIZES = 1 << 5, | |
185 GTK_IMHTML_NO_SCROLL = 1 << 6, | |
186 GTK_IMHTML_RETURN_LOG = 1 << 7, | |
187 GTK_IMHTML_USE_POINTSIZE = 1 << 8 | |
188 } GtkIMHtmlOptions; | |
189 | |
10145 | 190 enum { |
191 GTK_IMHTML_DRAG_URL = 0, | |
192 GTK_IMHTML_DRAG_HTML, | |
193 GTK_IMHTML_DRAG_UTF8_STRING, | |
194 GTK_IMHTML_DRAG_COMPOUND_TEXT, | |
195 GTK_IMHTML_DRAG_STRING, | |
196 GTK_IMHTML_DRAG_TEXT, | |
197 GTK_IMHTML_DRAG_NUM | |
198 }; | |
199 | |
200 #define GTK_IMHTML_DND_TARGETS \ | |
10345 | 201 { "text/uri-list", 0, GTK_IMHTML_DRAG_URL }, \ |
10243 | 202 { "_NETSCAPE_URL", 0, GTK_IMHTML_DRAG_URL }, \ |
10145 | 203 { "text/html", 0, GTK_IMHTML_DRAG_HTML }, \ |
204 { "x-url/ftp", 0, GTK_IMHTML_DRAG_URL }, \ | |
205 { "x-url/http", 0, GTK_IMHTML_DRAG_URL }, \ | |
206 { "UTF8_STRING", 0, GTK_IMHTML_DRAG_UTF8_STRING }, \ | |
207 { "COMPOUND_TEXT", 0, GTK_IMHTML_DRAG_COMPOUND_TEXT }, \ | |
208 { "STRING", 0, GTK_IMHTML_DRAG_STRING }, \ | |
209 { "text/plain", 0, GTK_IMHTML_DRAG_TEXT }, \ | |
210 { "TEXT", 0, GTK_IMHTML_DRAG_TEXT } | |
211 | |
8962 | 212 typedef gpointer (*GtkIMHtmlGetImageFunc) (int id); |
213 typedef gpointer (*GtkIMHtmlGetImageDataFunc) (gpointer i); | |
214 typedef size_t (*GtkIMHtmlGetImageSizeFunc) (gpointer i); | |
215 typedef const char *(*GtkIMHtmlGetImageFilenameFunc)(gpointer i); | |
216 typedef void (*GtkIMHtmlImageRefFunc) (int id); | |
217 typedef void (*GtkIMHtmlImageUnrefFunc) (int id); | |
218 | |
219 struct _GtkIMHtmlFuncs { | |
220 GtkIMHtmlGetImageFunc image_get; | |
221 GtkIMHtmlGetImageDataFunc image_get_data; | |
222 GtkIMHtmlGetImageSizeFunc image_get_size; | |
223 GtkIMHtmlGetImageFilenameFunc image_get_filename; | |
224 GtkIMHtmlImageRefFunc image_ref; | |
225 GtkIMHtmlImageUnrefFunc image_unref; | |
226 }; | |
227 | |
9033 | 228 /*@}*/ |
8962 | 229 |
9033 | 230 /************************************************************************** |
231 * @name GTK+ IM/HTML rendering component API | |
232 **************************************************************************/ | |
233 /*@{*/ | |
234 | |
235 /** | |
9037 | 236 * Returns the GType object for an IM/HTML widget. |
9033 | 237 * |
9037 | 238 * @return The GType for an IM/HTML widget. |
9033 | 239 */ |
9037 | 240 GType gtk_imhtml_get_type(void); |
5967 | 241 |
9033 | 242 /** |
243 * Creates and returns a new GTK IM/HTML widget. | |
244 * | |
245 * @return The GTK IM/HTML widget created. | |
246 */ | |
247 GtkWidget *gtk_imhtml_new(void *, void *); | |
5967 | 248 |
9033 | 249 /** |
10526 | 250 * Returns the smiley object associated with the text. |
251 * | |
252 * @param imhtml The GTK IM/HTML. | |
253 * @param sml The name of the smiley category. | |
254 * @param text The text associated with the smiley. | |
255 */ | |
256 | |
257 GtkIMHtmlSmiley *gtk_imhtml_smiley_get(GtkIMHtml * imhtml, | |
258 const gchar * sml, const gchar * text); | |
259 | |
260 | |
261 /** | |
9033 | 262 * Associates a smiley with a GTK IM/HTML. |
263 * | |
264 * @param imhtml The GTK IM/HTML. | |
265 * @param sml The name of the smiley category. | |
266 * @param smiley The GtkIMSmiley to associate. | |
267 */ | |
268 void gtk_imhtml_associate_smiley(GtkIMHtml *imhtml, gchar *sml, GtkIMHtmlSmiley *smiley); | |
269 | |
270 /** | |
271 * Removes all smileys associated with a GTK IM/HTML. | |
272 * | |
273 * @param imhtml The GTK IM/HTML. | |
274 */ | |
275 void gtk_imhtml_remove_smileys(GtkIMHtml *imhtml); | |
5967 | 276 |
9033 | 277 /** |
278 * Sets the function callbacks to use with a GTK IM/HTML instance. | |
279 * | |
280 * @param imhtml The GTK IM/HTML. | |
281 * @param f The GtkIMHTMLFuncs struct containing the functions to use. | |
282 */ | |
283 void gtk_imhtml_set_funcs(GtkIMHtml *imhtml, GtkIMHtmlFuncs *f); | |
5967 | 284 |
9033 | 285 /** |
286 * Enables or disables showing the contents of HTML comments in a GTK IM/HTML. | |
287 * | |
288 * @param imhtml The GTK IM/HTML. | |
289 * @param show @c TRUE if comments should be shown, or @c FALSE otherwise. | |
290 */ | |
291 void gtk_imhtml_show_comments(GtkIMHtml *imhtml, gboolean show); | |
8962 | 292 |
9033 | 293 /** |
294 * Associates a protocol name with a GTK IM/HTML. | |
295 * | |
296 * @param imhtml The GTK IM/HTML. | |
297 * @param protocol_name The protocol name to associate with the IM/HTML. | |
298 */ | |
299 void gtk_imhtml_set_protocol_name(GtkIMHtml *imhtml, const gchar *protocol_name); | |
8456 | 300 |
9033 | 301 /** |
302 * Appends HTML formatted text to a GTK IM/HTML. | |
303 * | |
304 * @param imhtml The GTK IM/HTML. | |
305 * @param text The formatted text to append. | |
306 * @param options A GtkIMHtmlOptions object indicating insert behavior. | |
307 */ | |
9307 | 308 #define gtk_imhtml_append_text(imhtml, text, options) \ |
309 gtk_imhtml_append_text_with_images(imhtml, text, options, NULL) | |
6982 | 310 |
9033 | 311 /** |
312 * Appends HTML formatted text to a GTK IM/HTML. | |
313 * | |
314 * @param imhtml The GTK IM/HTML. | |
315 * @param text The formatted text to append. | |
316 * @param options A GtkIMHtmlOptions object indicating insert behavior. | |
9185 | 317 * @param unused Use @c NULL value. |
9033 | 318 */ |
319 void gtk_imhtml_append_text_with_images(GtkIMHtml *imhtml, | |
320 const gchar *text, | |
321 GtkIMHtmlOptions options, | |
322 GSList *unused); | |
323 | |
324 /** | |
325 * Inserts HTML formatted text to a GTK IM/HTML at a given iter. | |
326 * | |
327 * @param imhtml The GTK IM/HTML. | |
328 * @param text The formatted text to append. | |
329 * @param options A GtkIMHtmlOptions object indicating insert behavior. | |
330 * @param iter A GtkTextIter in the GTK IM/HTML at which to insert text. | |
331 */ | |
8677 | 332 void gtk_imhtml_insert_html_at_iter(GtkIMHtml *imhtml, |
333 const gchar *text, | |
334 GtkIMHtmlOptions options, | |
335 GtkTextIter *iter); | |
9033 | 336 |
337 /** | |
338 * Scrolls a GTK IM/HTML to the end of its contents. | |
339 * | |
340 * @param imhtml The GTK IM/HTML. | |
341 */ | |
8729 | 342 void gtk_imhtml_scroll_to_end(GtkIMHtml *imhtml); |
9033 | 343 |
344 /** | |
345 * Purges the contents from a GTK IM/HTML and resets formatting. | |
346 * | |
347 * @param imhtml The GTK IM/HTML. | |
348 */ | |
349 void gtk_imhtml_clear(GtkIMHtml *imhtml); | |
4895 | 350 |
9033 | 351 /** |
352 * Scrolls a GTK IM/HTML up by one page. | |
353 * | |
354 * @param imhtml The GTK IM/HTML. | |
355 */ | |
356 void gtk_imhtml_page_up(GtkIMHtml *imhtml); | |
357 | |
358 /** | |
359 * Scrolls a GTK IM/HTML down by one page. | |
360 * | |
361 * @param imhtml The GTK IM/HTML. | |
362 */ | |
363 void gtk_imhtml_page_down(GtkIMHtml *imhtml); | |
364 | |
365 /** | |
366 * Creates and returns an new GTK IM/HTML scalable object. | |
367 * | |
368 * @return A new IM/HTML Scalable object. | |
369 */ | |
4895 | 370 GtkIMHtmlScalable *gtk_imhtml_scalable_new(); |
9033 | 371 |
372 /** | |
373 * Creates and returns an new GTK IM/HTML scalable object with an image. | |
374 * | |
375 * @param img A GdkPixbuf of the image to add. | |
376 * @param filename The filename to associate with the image. | |
377 * @param id The id to associate with the image. | |
378 * | |
379 * @return A new IM/HTML Scalable object with an image. | |
380 */ | |
8962 | 381 GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename, int id); |
9033 | 382 |
383 /** | |
384 * Destroys and frees a GTK IM/HTML scalable image. | |
385 * | |
386 * @param scale The GTK IM/HTML scalable. | |
387 */ | |
388 void gtk_imhtml_image_free(GtkIMHtmlScalable *scale); | |
4895 | 389 |
9033 | 390 /** |
391 * Rescales a GTK IM/HTML scalable image to a given size. | |
392 * | |
393 * @param scale The GTK IM/HTML scalable. | |
394 * @param width The new width. | |
395 * @param height The new height. | |
396 */ | |
397 void gtk_imhtml_image_scale(GtkIMHtmlScalable *scale, int width, int height); | |
398 | |
399 /** | |
400 * Adds a GTK IM/HTML scalable image to a given GTK IM/HTML at a given iter. | |
401 * | |
402 * @param scale The GTK IM/HTML scalable. | |
403 * @param imhtml The GTK IM/HTML. | |
404 * @param iter The GtkTextIter at which to add the scalable. | |
405 */ | |
406 void gtk_imhtml_image_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTextIter *iter); | |
407 | |
408 /** | |
409 * Creates and returns an new GTK IM/HTML scalable with a horizontal rule. | |
410 * | |
411 * @return A new IM/HTML Scalable object with an image. | |
412 */ | |
5967 | 413 GtkIMHtmlScalable *gtk_imhtml_hr_new(); |
9033 | 414 |
415 /** | |
416 * Destroys and frees a GTK IM/HTML scalable horizontal rule. | |
417 * | |
418 * @param scale The GTK IM/HTML scalable. | |
419 */ | |
9034 | 420 void gtk_imhtml_hr_free(GtkIMHtmlScalable *scale); |
9033 | 421 |
422 /** | |
423 * Rescales a GTK IM/HTML scalable horizontal rule to a given size. | |
424 * | |
425 * @param scale The GTK IM/HTML scalable. | |
426 * @param width The new width. | |
427 * @param height The new height. | |
428 */ | |
9034 | 429 void gtk_imhtml_hr_scale(GtkIMHtmlScalable *scale, int width, int height); |
4895 | 430 |
9033 | 431 /** |
432 * Adds a GTK IM/HTML scalable horizontal rule to a given GTK IM/HTML at | |
433 * a given iter. | |
434 * | |
435 * @param scale The GTK IM/HTML scalable. | |
436 * @param imhtml The GTK IM/HTML. | |
437 * @param iter The GtkTextIter at which to add the scalable. | |
438 */ | |
9307 | 439 void gtk_imhtml_hr_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTextIter *iter); |
9033 | 440 |
441 /** | |
442 * Finds and highlights a given string in a GTK IM/HTML. | |
443 * | |
444 * @param imhtml The GTK IM/HTML. | |
445 * @param text The string to search for. | |
446 * | |
447 * @return @c TRUE if a search was performed, or @c FALSE if not. | |
448 */ | |
7295 | 449 gboolean gtk_imhtml_search_find(GtkIMHtml *imhtml, const gchar *text); |
9033 | 450 |
451 /** | |
452 * Clears the highlighting from a prior search in a GTK IM/HTML. | |
453 * | |
454 * @param imhtml The GTK IM/HTML. | |
455 */ | |
7295 | 456 void gtk_imhtml_search_clear(GtkIMHtml *imhtml); |
4895 | 457 |
9033 | 458 /** |
459 * Enables or disables editing in a GTK IM/HTML. | |
460 * | |
461 * @param imhtml The GTK IM/HTML. | |
462 * @param editable @c TRUE to make the widget editable, or @c FALSE otherwise. | |
463 */ | |
8061 | 464 void gtk_imhtml_set_editable(GtkIMHtml *imhtml, gboolean editable); |
9033 | 465 |
466 /** | |
467 * Enables or disables whole buffer formatting only (wbfo) in a GTK IM/HTML. | |
468 * In this mode formatting options to the buffer take effect for the entire | |
469 * buffer instead of specific text. | |
470 * | |
471 * @param imhtml The GTK IM/HTML. | |
472 * @param wbfo @c TRUE to enable the mode, or @c FALSE otherwise. | |
473 */ | |
8677 | 474 void gtk_imhtml_set_whole_buffer_formatting_only(GtkIMHtml *imhtml, gboolean wbfo); |
9033 | 475 |
476 /** | |
9185 | 477 * Indicates which formatting functions to enable and disable in a GTK IM/HTML. |
9033 | 478 * |
479 * @param imhtml The GTK IM/HTML. | |
9185 | 480 * @param buttons A GtkIMHtmlButtons bitmask indicating which functions to use. |
9033 | 481 */ |
8420 | 482 void gtk_imhtml_set_format_functions(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons); |
9033 | 483 |
484 /** | |
9185 | 485 * Returns which formatting functions are enabled in a GTK IM/HTML. |
9033 | 486 * |
487 * @param imhtml The GTK IM/HTML. | |
488 * | |
9185 | 489 * @return A GtkIMHtmlButtons bitmask indicating which functions to are enabled. |
9033 | 490 */ |
8788 | 491 GtkIMHtmlButtons gtk_imhtml_get_format_functions(GtkIMHtml *imhtml); |
9033 | 492 |
493 /** | |
494 * Sets each boolean to TRUE if that formatting option is enabled at the | |
495 * current position in a GTK IM/HTML. | |
496 * | |
497 * @param imhtml The GTK IM/HTML. | |
498 * @param bold A reference to a boolean for bold. | |
499 * @param italic A reference to a boolean for italic. | |
500 * @param underline A reference to a boolean for underline. | |
501 */ | |
8516 | 502 void gtk_imhtml_get_current_format(GtkIMHtml *imhtml, gboolean *bold, gboolean *italic, gboolean *underline); |
9033 | 503 |
504 /** | |
505 * Returns a string containing the selected font face at the current position | |
506 * in a GTK IM/HTML. | |
507 * | |
508 * @param imhtml The GTK IM/HTML. | |
509 * | |
510 * @return A string containg the font face or @c NULL if none is set. | |
511 */ | |
9025 | 512 char *gtk_imhtml_get_current_fontface(GtkIMHtml *imhtml); |
9033 | 513 |
514 /** | |
515 * Returns a string containing the selected foreground color at the current | |
516 * position in a GTK IM/HTML. | |
517 * | |
518 * @param imhtml The GTK IM/HTML. | |
519 * | |
520 * @return A string containg the foreground color or @c NULL if none is set. | |
521 */ | |
9025 | 522 char *gtk_imhtml_get_current_forecolor(GtkIMHtml *imhtml); |
9033 | 523 |
524 /** | |
525 * Returns a string containing the selected background color at the current | |
526 * position in a GTK IM/HTML. | |
527 * | |
528 * @param imhtml The GTK IM/HTML. | |
529 * | |
530 * @return A string containg the background color or @c NULL if none is set. | |
531 */ | |
9025 | 532 char *gtk_imhtml_get_current_backcolor(GtkIMHtml *imhtml); |
9033 | 533 |
534 /** | |
535 * Returns a integer containing the selected HTML font size at the current | |
536 * position in a GTK IM/HTML. | |
537 * | |
538 * @param imhtml The GTK IM/HTML. | |
539 * | |
540 * @return The HTML font size. | |
541 */ | |
9025 | 542 gint gtk_imhtml_get_current_fontsize(GtkIMHtml *imhtml); |
9033 | 543 |
544 /** | |
545 * Checks whether a GTK IM/HTML is marked as editable. | |
546 * | |
547 * @param imhtml The GTK IM/HTML. | |
548 * | |
549 * @return @c TRUE if the IM/HTML is editable, or @c FALSE otherwise. | |
550 */ | |
8061 | 551 gboolean gtk_imhtml_get_editable(GtkIMHtml *imhtml); |
9033 | 552 |
553 /** | |
554 * Toggles bold at the cursor location or selection in a GTK IM/HTML. | |
555 * | |
556 * @param imhtml The GTK IM/HTML. | |
557 * | |
558 * @return @c TRUE if bold was turned on, or @c FALSE if it was turned off. | |
559 */ | |
8061 | 560 gboolean gtk_imhtml_toggle_bold(GtkIMHtml *imhtml); |
9033 | 561 |
562 /** | |
563 * Toggles italic at the cursor location or selection in a GTK IM/HTML. | |
564 * | |
565 * @param imhtml The GTK IM/HTML. | |
566 * | |
567 * @return @c TRUE if italic was turned on, or @c FALSE if it was turned off. | |
568 */ | |
8061 | 569 gboolean gtk_imhtml_toggle_italic(GtkIMHtml *imhtml); |
9033 | 570 |
571 /** | |
572 * Toggles underline at the cursor location or selection in a GTK IM/HTML. | |
573 * | |
574 * @param imhtml The GTK IM/HTML. | |
575 * | |
576 * @return @c TRUE if underline was turned on, or @c FALSE if it was turned off. | |
577 */ | |
8061 | 578 gboolean gtk_imhtml_toggle_underline(GtkIMHtml *imhtml); |
9033 | 579 |
580 /** | |
9924 | 581 * Toggles strikethrough at the cursor location or selection in a GTK IM/HTML. |
582 * | |
583 * @param imhtml The GTK IM/HTML. | |
584 * | |
585 * @return @c TRUE if strikethrough was turned on, or @c FALSE if it was turned off. | |
586 */ | |
587 gboolean gtk_imhtml_toggle_strike(GtkIMHtml *imhtml); | |
588 | |
589 /** | |
9033 | 590 * Toggles a foreground color at the current location or selection in a GTK |
591 * IM/HTML. | |
592 * | |
593 * @param imhtml The GTK IM/HTML. | |
9185 | 594 * @param color The HTML-style color, or @c NULL or "" to clear the color. |
9033 | 595 * |
596 * @return @c TRUE if a color was set, or @c FALSE if it was cleared. | |
597 */ | |
8061 | 598 gboolean gtk_imhtml_toggle_forecolor(GtkIMHtml *imhtml, const char *color); |
9033 | 599 |
600 /** | |
601 * Toggles a background color at the current location or selection in a GTK | |
602 * IM/HTML. | |
603 * | |
604 * @param imhtml The GTK IM/HTML. | |
9185 | 605 * @param color The HTML-style color, or @c NULL or "" to clear the color. |
9033 | 606 * |
607 * @return @c TRUE if a color was set, or @c FALSE if it was cleared. | |
608 */ | |
8061 | 609 gboolean gtk_imhtml_toggle_backcolor(GtkIMHtml *imhtml, const char *color); |
9033 | 610 |
611 /** | |
612 * Toggles a font face at the current location or selection in a GTK IM/HTML. | |
613 * | |
614 * @param imhtml The GTK IM/HTML. | |
9185 | 615 * @param face The font face name, or @c NULL or "" to clear the font. |
9033 | 616 * |
617 * @return @c TRUE if a font name was set, or @c FALSE if it was cleared. | |
618 */ | |
8061 | 619 gboolean gtk_imhtml_toggle_fontface(GtkIMHtml *imhtml, const char *face); |
9033 | 620 |
621 /** | |
622 * Toggles a link tag with the given URL at the current location or selection | |
623 * in a GTK IM/HTML. | |
624 * | |
625 * @param imhtml The GTK IM/HTML. | |
9185 | 626 * @param url The URL for the link or @c NULL to terminate the link. |
9033 | 627 */ |
8677 | 628 void gtk_imhtml_toggle_link(GtkIMHtml *imhtml, const char *url); |
9033 | 629 |
630 /** | |
631 * Inserts a link to the given url at the given GtkTextMark in a GTK IM/HTML. | |
632 * | |
633 * @param imhtml The GTK IM/HTML. | |
634 * @param mark The GtkTextMark to insert the link at. | |
635 * @param url The URL for the link. | |
636 * @param text The string to use for the link description. | |
637 */ | |
8677 | 638 void gtk_imhtml_insert_link(GtkIMHtml *imhtml, GtkTextMark *mark, const char *url, const char *text); |
9033 | 639 |
640 /** | |
641 * Inserts a smiley at the current location or selection in a GTK IM/HTML. | |
642 * | |
643 * @param imhtml The GTK IM/HTML. | |
644 * @param sml The category of the smiley. | |
645 * @param smiley The text of the smiley to insert. | |
646 */ | |
8061 | 647 void gtk_imhtml_insert_smiley(GtkIMHtml *imhtml, const char *sml, char *smiley); |
9033 | 648 /** |
649 * Inserts a smiley at the given iter in a GTK IM/HTML. | |
650 * | |
651 * @param imhtml The GTK IM/HTML. | |
652 * @param sml The category of the smiley. | |
653 * @param smiley The text of the smiley to insert. | |
654 * @param iter The GtkTextIter in the IM/HTML to insert the smiley at. | |
655 */ | |
8677 | 656 void gtk_imhtml_insert_smiley_at_iter(GtkIMHtml *imhtml, const char *sml, char *smiley, GtkTextIter *iter); |
9033 | 657 |
658 /** | |
659 * Inserts the IM/HTML scalable image with the given id at the given iter in a | |
660 * GTK IM/HTML. | |
661 * | |
662 * @param imhtml The GTK IM/HTML. | |
663 * @param id The id of the IM/HTML scalable. | |
664 * @param iter The GtkTextIter in the IM/HTML to insert the image at. | |
665 */ | |
8962 | 666 void gtk_imhtml_insert_image_at_iter(GtkIMHtml *imhtml, int id, GtkTextIter *iter); |
9033 | 667 |
668 /** | |
669 * Sets the font size at the current location or selection in a GTK IM/HTML. | |
670 * | |
671 * @param imhtml The GTK IM/HTML. | |
672 * @param size The HTML font size to use. | |
673 */ | |
8061 | 674 void gtk_imhtml_font_set_size(GtkIMHtml *imhtml, gint size); |
9033 | 675 |
676 /** | |
677 * Decreases the font size by 1 at the current location or selection in a GTK | |
678 * IM/HTML. | |
679 * | |
680 * @param imhtml The GTK IM/HTML. | |
681 */ | |
8061 | 682 void gtk_imhtml_font_shrink(GtkIMHtml *imhtml); |
9033 | 683 |
684 /** | |
685 * Increases the font size by 1 at the current location or selection in a GTK | |
686 * IM/HTML. | |
687 * | |
688 * @param imhtml The GTK IM/HTML. | |
689 */ | |
8061 | 690 void gtk_imhtml_font_grow(GtkIMHtml *imhtml); |
9033 | 691 |
692 /** | |
693 * Returns the HTML formatted contents between two iters in a GTK IM/HTML. | |
694 * | |
695 * @param imhtml The GTK IM/HTML. | |
696 * @param start The GtkTextIter indicating the start point in the IM/HTML. | |
697 * @param end The GtkTextIter indicating the end point in the IM/HTML. | |
698 * | |
699 * @return A string containing the HTML formatted text. | |
700 */ | |
8061 | 701 char *gtk_imhtml_get_markup_range(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *end); |
9033 | 702 |
703 /** | |
704 * Returns the entire HTML formatted contents of a GTK IM/HTML. | |
705 * | |
706 * @param imhtml The GTK IM/HTML. | |
707 * | |
708 * @return A string containing the HTML formatted text. | |
709 */ | |
8061 | 710 char *gtk_imhtml_get_markup(GtkIMHtml *imhtml); |
9033 | 711 |
712 /** | |
713 * Returns a null terminated array of pointers to null terminated strings, each | |
714 * string for each line. g_strfreev() should be called to free it when done. | |
715 * | |
716 * @param imhtml The GTK IM/HTML. | |
717 * | |
718 * @return A null terminated array of null terminated HTML formatted strings. | |
719 */ | |
8677 | 720 char **gtk_imhtml_get_markup_lines(GtkIMHtml *imhtml); |
9033 | 721 |
722 /** | |
723 * Returns the entire unformatted (plain text) contents of a GTK IM/HTML | |
724 * between two iters in a GTK IM/HTML. | |
725 * | |
726 * @param imhtml The GTK IM/HTML. | |
727 * @param start The GtkTextIter indicating the start point in the IM/HTML. | |
9185 | 728 * @param stop The GtkTextIter indicating the end point in the IM/HTML. |
9033 | 729 * |
730 * @return A string containing the unformatted text. | |
731 */ | |
8677 | 732 char *gtk_imhtml_get_text(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *stop); |
8061 | 733 |
9033 | 734 /*@}*/ |
735 | |
1428 | 736 #ifdef __cplusplus |
737 } | |
738 #endif | |
739 | |
9713 | 740 #endif /* _GAIM_GTKIMHTML_H_ */ |