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