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