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