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