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