Mercurial > pidgin.yaz
annotate src/gtkimhtml.h @ 9037:960bb3bd9ba6
[gaim-migrate @ 9813]
simguy broke gaim in more ways than one. but he was around to fix it.
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Sun, 23 May 2004 19:39:38 +0000 |
parents | bbb8733c7818 |
children | 812e7aa7eafa |
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 */ | |
23 | |
24 #ifndef __GTK_IMHTML_H | |
25 #define __GTK_IMHTML_H | |
26 | |
27 #include <gdk/gdk.h> | |
3922 | 28 #include <gtk/gtktextview.h> |
4735 | 29 #include <gtk/gtktooltips.h> |
5012 | 30 #include <gtk/gtkimage.h> |
1428 | 31 |
32 #ifdef __cplusplus | |
33 extern "C" { | |
34 #endif | |
35 | |
9033 | 36 /************************************************************************** |
37 * @name Structures | |
38 **************************************************************************/ | |
39 /*@{*/ | |
40 | |
1428 | 41 #define GTK_TYPE_IMHTML (gtk_imhtml_get_type ()) |
42 #define GTK_IMHTML(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_IMHTML, GtkIMHtml)) | |
43 #define GTK_IMHTML_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMHTML, GtkIMHtmlClass)) | |
44 #define GTK_IS_IMHTML(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_IMHTML)) | |
45 #define GTK_IS_IMHTML_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMHTML)) | |
5967 | 46 #define GTK_IMHTML_SCALABLE(obj) ((GtkIMHtmlScalable *)obj) |
1428 | 47 |
5967 | 48 typedef struct _GtkIMHtml GtkIMHtml; |
49 typedef struct _GtkIMHtmlClass GtkIMHtmlClass; | |
50 typedef struct _GtkIMHtmlFontDetail GtkIMHtmlFontDetail; /* The five elements contained in a FONT tag */ | |
51 typedef struct _GtkSmileyTree GtkSmileyTree; | |
52 typedef struct _GtkIMHtmlSmiley GtkIMHtmlSmiley; | |
53 typedef struct _GtkIMHtmlScalable GtkIMHtmlScalable; | |
54 typedef struct _GtkIMHtmlImage GtkIMHtmlImage; | |
55 typedef struct _GtkIMHtmlHr GtkIMHtmlHr; | |
8962 | 56 typedef struct _GtkIMHtmlFuncs GtkIMHtmlFuncs; |
8061 | 57 |
8420 | 58 typedef enum { |
59 GTK_IMHTML_BOLD = 1 << 0, | |
60 GTK_IMHTML_ITALIC = 1 << 1, | |
61 GTK_IMHTML_UNDERLINE = 1 << 2, | |
62 GTK_IMHTML_GROW = 1 << 3, | |
63 GTK_IMHTML_SHRINK = 1 << 4, | |
64 GTK_IMHTML_FACE = 1 << 5, | |
65 GTK_IMHTML_FORECOLOR = 1 << 6, | |
66 GTK_IMHTML_BACKCOLOR = 1 << 7, | |
67 GTK_IMHTML_LINK = 1 << 8, | |
68 GTK_IMHTML_IMAGE = 1 << 9, | |
8677 | 69 GTK_IMHTML_SMILEY = 1 << 10, |
70 GTK_IMHTML_ALL = -1 | |
8420 | 71 } GtkIMHtmlButtons; |
8061 | 72 |
1428 | 73 struct _GtkIMHtml { |
3922 | 74 GtkTextView text_view; |
75 GtkTextBuffer *text_buffer; | |
8677 | 76 GtkTextMark *scrollpoint; |
1428 | 77 GdkCursor *hand_cursor; |
78 GdkCursor *arrow_cursor; | |
8061 | 79 GdkCursor *text_cursor; |
4032 | 80 GHashTable *smiley_data; |
81 GtkSmileyTree *default_smilies; | |
8456 | 82 char *protocol_name; |
4254 | 83 |
6124 | 84 gboolean show_comments; |
4735 | 85 |
8456 | 86 gboolean html_shortcuts; |
87 gboolean smiley_shortcuts; | |
88 | |
4735 | 89 GtkWidget *tip_window; |
90 char *tip; | |
91 guint tip_timer; | |
4895 | 92 |
93 GList *scalables; | |
4947 | 94 GdkRectangle old_rect; |
7295 | 95 |
8061 | 96 gchar *search_string; |
7694 | 97 |
8061 | 98 gboolean editable; |
8420 | 99 GtkIMHtmlButtons format_functions; |
8677 | 100 gboolean wbfo; /* Whole buffer formatting only. */ |
101 | |
102 gint insert_offset; | |
8420 | 103 |
8061 | 104 struct { |
8677 | 105 gboolean bold:1; |
106 gboolean italic:1; | |
107 gboolean underline:1; | |
108 gchar *forecolor; | |
109 gchar *backcolor; | |
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 |
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
115 double zoom; |
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
116 int original_fsize; |
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
117 |
8681 | 118 char *clipboard_text_string; |
119 char *clipboard_html_string; | |
8962 | 120 |
121 GSList *im_images; | |
122 GtkIMHtmlFuncs *funcs; | |
1428 | 123 }; |
124 | |
125 struct _GtkIMHtmlClass { | |
3922 | 126 GtkTextViewClass parent_class; |
1428 | 127 |
5967 | 128 void (*url_clicked)(GtkIMHtml *, const gchar *); |
8420 | 129 void (*buttons_update)(GtkIMHtml *, GtkIMHtmlButtons); |
130 void (*toggle_format)(GtkIMHtml *, GtkIMHtmlButtons); | |
8427 | 131 void (*clear_format)(GtkIMHtml *); |
8506 | 132 void (*update_format)(GtkIMHtml *); |
5967 | 133 }; |
134 | |
135 struct _GtkIMHtmlFontDetail { | |
136 gushort size; | |
137 gchar *face; | |
138 gchar *fore; | |
139 gchar *back; | |
140 gchar *sml; | |
8689 | 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; |
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; |
5967 | 172 }; |
4895 | 173 |
5967 | 174 struct _GtkIMHtmlHr { |
4895 | 175 GtkIMHtmlScalable scalable; |
176 GtkWidget *sep; | |
5967 | 177 }; |
178 | |
179 typedef enum { | |
180 GTK_IMHTML_NO_COLOURS = 1 << 0, | |
181 GTK_IMHTML_NO_FONTS = 1 << 1, | |
8105 | 182 GTK_IMHTML_NO_COMMENTS = 1 << 2, /* Remove */ |
5967 | 183 GTK_IMHTML_NO_TITLE = 1 << 3, |
184 GTK_IMHTML_NO_NEWLINE = 1 << 4, | |
185 GTK_IMHTML_NO_SIZES = 1 << 5, | |
186 GTK_IMHTML_NO_SCROLL = 1 << 6, | |
187 GTK_IMHTML_RETURN_LOG = 1 << 7, | |
188 GTK_IMHTML_USE_POINTSIZE = 1 << 8 | |
189 } GtkIMHtmlOptions; | |
190 | |
8962 | 191 typedef gpointer (*GtkIMHtmlGetImageFunc) (int id); |
192 typedef gpointer (*GtkIMHtmlGetImageDataFunc) (gpointer i); | |
193 typedef size_t (*GtkIMHtmlGetImageSizeFunc) (gpointer i); | |
194 typedef const char *(*GtkIMHtmlGetImageFilenameFunc)(gpointer i); | |
195 typedef void (*GtkIMHtmlImageRefFunc) (int id); | |
196 typedef void (*GtkIMHtmlImageUnrefFunc) (int id); | |
197 | |
198 struct _GtkIMHtmlFuncs { | |
199 GtkIMHtmlGetImageFunc image_get; | |
200 GtkIMHtmlGetImageDataFunc image_get_data; | |
201 GtkIMHtmlGetImageSizeFunc image_get_size; | |
202 GtkIMHtmlGetImageFilenameFunc image_get_filename; | |
203 GtkIMHtmlImageRefFunc image_ref; | |
204 GtkIMHtmlImageUnrefFunc image_unref; | |
205 }; | |
206 | |
9033 | 207 /*@}*/ |
8962 | 208 |
9033 | 209 /************************************************************************** |
210 * @name GTK+ IM/HTML rendering component API | |
211 **************************************************************************/ | |
212 /*@{*/ | |
213 | |
214 /** | |
9037 | 215 * Returns the GType object for an IM/HTML widget. |
9033 | 216 * |
9037 | 217 * @return The GType for an IM/HTML widget. |
9033 | 218 */ |
9037 | 219 GType gtk_imhtml_get_type(void); |
5967 | 220 |
9033 | 221 /** |
222 * Creates and returns a new GTK IM/HTML widget. | |
223 * | |
224 * @return The GTK IM/HTML widget created. | |
225 */ | |
226 GtkWidget *gtk_imhtml_new(void *, void *); | |
5967 | 227 |
9033 | 228 /** |
229 * Associates a smiley with a GTK IM/HTML. | |
230 * | |
231 * @param imhtml The GTK IM/HTML. | |
232 * @param sml The name of the smiley category. | |
233 * @param smiley The GtkIMSmiley to associate. | |
234 */ | |
235 void gtk_imhtml_associate_smiley(GtkIMHtml *imhtml, gchar *sml, GtkIMHtmlSmiley *smiley); | |
236 | |
237 /** | |
238 * Removes all smileys associated with a GTK IM/HTML. | |
239 * | |
240 * @param imhtml The GTK IM/HTML. | |
241 */ | |
242 void gtk_imhtml_remove_smileys(GtkIMHtml *imhtml); | |
5967 | 243 |
9033 | 244 /** |
245 * Sets the function callbacks to use with a GTK IM/HTML instance. | |
246 * | |
247 * @param imhtml The GTK IM/HTML. | |
248 * @param f The GtkIMHTMLFuncs struct containing the functions to use. | |
249 */ | |
250 void gtk_imhtml_set_funcs(GtkIMHtml *imhtml, GtkIMHtmlFuncs *f); | |
5967 | 251 |
9033 | 252 /** |
253 * Enables or disables showing the contents of HTML comments in a GTK IM/HTML. | |
254 * | |
255 * @param imhtml The GTK IM/HTML. | |
256 * @param show @c TRUE if comments should be shown, or @c FALSE otherwise. | |
257 */ | |
258 void gtk_imhtml_show_comments(GtkIMHtml *imhtml, gboolean show); | |
8962 | 259 |
9033 | 260 /** |
261 * Enables or disables formatting shortcut keys in a GTK IM/HTML. | |
262 * | |
263 * @param imhtml The GTK IM/HTML. | |
264 * @param allow @c TRUE if shortcut keys are allowed, or @c FALSE otherwise. | |
265 */ | |
266 void gtk_imhtml_html_shortcuts(GtkIMHtml *imhtml, gboolean allow); | |
5967 | 267 |
9033 | 268 /** |
269 * Enables or disables smiley insertion shortcut keys in a GTK IM/HTML. | |
270 * | |
271 * @param imhtml The GTK IM/HTML. | |
272 * @param allow @c TRUE if shortcut keys are allowed, or @c FALSE otherwise. | |
273 */ | |
274 void gtk_imhtml_smiley_shortcuts(GtkIMHtml *imhtml, gboolean allow); | |
8456 | 275 |
9033 | 276 /** |
277 * Associates a protocol name with a GTK IM/HTML. | |
278 * | |
279 * @param imhtml The GTK IM/HTML. | |
280 * @param protocol_name The protocol name to associate with the IM/HTML. | |
281 */ | |
282 void gtk_imhtml_set_protocol_name(GtkIMHtml *imhtml, const gchar *protocol_name); | |
8456 | 283 |
9033 | 284 /** |
285 * Appends HTML formatted text to a GTK IM/HTML. | |
286 * | |
287 * @param imhtml The GTK IM/HTML. | |
288 * @param text The formatted text to append. | |
289 * @param options A GtkIMHtmlOptions object indicating insert behavior. | |
290 */ | |
291 #define gtk_imhtml_append_text(x, y, z) \ | |
6982 | 292 gtk_imhtml_append_text_with_images(x, y, z, NULL) |
293 | |
9033 | 294 /** |
295 * Appends HTML formatted text to a GTK IM/HTML. | |
296 * | |
297 * @param imhtml The GTK IM/HTML. | |
298 * @param text The formatted text to append. | |
299 * @param options A GtkIMHtmlOptions object indicating insert behavior. | |
300 * @param unused Use NULL value. | |
301 */ | |
302 void gtk_imhtml_append_text_with_images(GtkIMHtml *imhtml, | |
303 const gchar *text, | |
304 GtkIMHtmlOptions options, | |
305 GSList *unused); | |
306 | |
307 /** | |
308 * Inserts HTML formatted text to a GTK IM/HTML at a given iter. | |
309 * | |
310 * @param imhtml The GTK IM/HTML. | |
311 * @param text The formatted text to append. | |
312 * @param options A GtkIMHtmlOptions object indicating insert behavior. | |
313 * @param iter A GtkTextIter in the GTK IM/HTML at which to insert text. | |
314 */ | |
8677 | 315 void gtk_imhtml_insert_html_at_iter(GtkIMHtml *imhtml, |
316 const gchar *text, | |
317 GtkIMHtmlOptions options, | |
318 GtkTextIter *iter); | |
9033 | 319 |
320 /** | |
321 * Scrolls a GTK IM/HTML to the end of its contents. | |
322 * | |
323 * @param imhtml The GTK IM/HTML. | |
324 */ | |
8729 | 325 void gtk_imhtml_scroll_to_end(GtkIMHtml *imhtml); |
9033 | 326 |
327 /** | |
328 * Purges the contents from a GTK IM/HTML and resets formatting. | |
329 * | |
330 * @param imhtml The GTK IM/HTML. | |
331 */ | |
332 void gtk_imhtml_clear(GtkIMHtml *imhtml); | |
4895 | 333 |
9033 | 334 /** |
335 * Scrolls a GTK IM/HTML up by one page. | |
336 * | |
337 * @param imhtml The GTK IM/HTML. | |
338 */ | |
339 void gtk_imhtml_page_up(GtkIMHtml *imhtml); | |
340 | |
341 /** | |
342 * Scrolls a GTK IM/HTML down by one page. | |
343 * | |
344 * @param imhtml The GTK IM/HTML. | |
345 */ | |
346 void gtk_imhtml_page_down(GtkIMHtml *imhtml); | |
347 | |
348 /** | |
349 * Scales the font sizes in a GTK IM/HTML by a given factor. | |
350 * | |
351 * @param imhtml The GTK IM/HTML. | |
352 * @param zoom The factor by which to scale the font sizes. | |
353 */ | |
8740
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
354 void gtk_imhtml_font_zoom(GtkIMHtml *imhtml, double zoom); |
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
355 |
9033 | 356 /** |
357 * Creates and returns an new GTK IM/HTML scalable object. | |
358 * | |
359 * @return A new IM/HTML Scalable object. | |
360 */ | |
4895 | 361 GtkIMHtmlScalable *gtk_imhtml_scalable_new(); |
9033 | 362 |
363 /** | |
364 * Creates and returns an new GTK IM/HTML scalable object with an image. | |
365 * | |
366 * @param img A GdkPixbuf of the image to add. | |
367 * @param filename The filename to associate with the image. | |
368 * @param id The id to associate with the image. | |
369 * | |
370 * @return A new IM/HTML Scalable object with an image. | |
371 */ | |
8962 | 372 GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename, int id); |
9033 | 373 |
374 /** | |
375 * Destroys and frees a GTK IM/HTML scalable image. | |
376 * | |
377 * @param scale The GTK IM/HTML scalable. | |
378 */ | |
379 void gtk_imhtml_image_free(GtkIMHtmlScalable *scale); | |
4895 | 380 |
9033 | 381 /** |
382 * Rescales a GTK IM/HTML scalable image to a given size. | |
383 * | |
384 * @param scale The GTK IM/HTML scalable. | |
385 * @param width The new width. | |
386 * @param height The new height. | |
387 */ | |
388 void gtk_imhtml_image_scale(GtkIMHtmlScalable *scale, int width, int height); | |
389 | |
390 /** | |
391 * Adds a GTK IM/HTML scalable image to a given GTK IM/HTML at a given iter. | |
392 * | |
393 * @param scale The GTK IM/HTML scalable. | |
394 * @param imhtml The GTK IM/HTML. | |
395 * @param iter The GtkTextIter at which to add the scalable. | |
396 */ | |
397 void gtk_imhtml_image_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTextIter *iter); | |
398 | |
399 /** | |
400 * Creates and returns an new GTK IM/HTML scalable with a horizontal rule. | |
401 * | |
402 * @return A new IM/HTML Scalable object with an image. | |
403 */ | |
5967 | 404 GtkIMHtmlScalable *gtk_imhtml_hr_new(); |
9033 | 405 |
406 /** | |
407 * Destroys and frees a GTK IM/HTML scalable horizontal rule. | |
408 * | |
409 * @param scale The GTK IM/HTML scalable. | |
410 */ | |
9034 | 411 void gtk_imhtml_hr_free(GtkIMHtmlScalable *scale); |
9033 | 412 |
413 /** | |
414 * Rescales a GTK IM/HTML scalable horizontal rule to a given size. | |
415 * | |
416 * @param scale The GTK IM/HTML scalable. | |
417 * @param width The new width. | |
418 * @param height The new height. | |
419 */ | |
9034 | 420 void gtk_imhtml_hr_scale(GtkIMHtmlScalable *scale, int width, int height); |
4895 | 421 |
9033 | 422 /** |
423 * Adds a GTK IM/HTML scalable horizontal rule to a given GTK IM/HTML at | |
424 * a given iter. | |
425 * | |
426 * @param scale The GTK IM/HTML scalable. | |
427 * @param imhtml The GTK IM/HTML. | |
428 * @param iter The GtkTextIter at which to add the scalable. | |
429 */ | |
9034 | 430 void gtk_imhtml_hr_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *, GtkTextIter *); |
9033 | 431 |
432 /** | |
433 * Finds and highlights a given string in a GTK IM/HTML. | |
434 * | |
435 * @param imhtml The GTK IM/HTML. | |
436 * @param text The string to search for. | |
437 * | |
438 * @return @c TRUE if a search was performed, or @c FALSE if not. | |
439 */ | |
7295 | 440 gboolean gtk_imhtml_search_find(GtkIMHtml *imhtml, const gchar *text); |
9033 | 441 |
442 /** | |
443 * Clears the highlighting from a prior search in a GTK IM/HTML. | |
444 * | |
445 * @param imhtml The GTK IM/HTML. | |
446 */ | |
7295 | 447 void gtk_imhtml_search_clear(GtkIMHtml *imhtml); |
4895 | 448 |
9033 | 449 /** |
450 * Enables or disables editing in a GTK IM/HTML. | |
451 * | |
452 * @param imhtml The GTK IM/HTML. | |
453 * @param editable @c TRUE to make the widget editable, or @c FALSE otherwise. | |
454 */ | |
8061 | 455 void gtk_imhtml_set_editable(GtkIMHtml *imhtml, gboolean editable); |
9033 | 456 |
457 /** | |
458 * Enables or disables whole buffer formatting only (wbfo) in a GTK IM/HTML. | |
459 * In this mode formatting options to the buffer take effect for the entire | |
460 * buffer instead of specific text. | |
461 * | |
462 * @param imhtml The GTK IM/HTML. | |
463 * @param wbfo @c TRUE to enable the mode, or @c FALSE otherwise. | |
464 */ | |
8677 | 465 void gtk_imhtml_set_whole_buffer_formatting_only(GtkIMHtml *imhtml, gboolean wbfo); |
9033 | 466 |
467 /** | |
468 * Indicates which formatting fuctions to enable and disable in a GTK IM/HTML. | |
469 * | |
470 * @param imhtml The GTK IM/HTML. | |
471 * @param buttons A GtkIMHtmlButtons bitmask indicating which fuctions to use. | |
472 */ | |
8420 | 473 void gtk_imhtml_set_format_functions(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons); |
9033 | 474 |
475 /** | |
476 * Returns which formatting fuctions are enabled in a GTK IM/HTML. | |
477 * | |
478 * @param imhtml The GTK IM/HTML. | |
479 * | |
480 * @return A GtkIMHtmlButtons bitmask indicating which fuctions to are enabled. | |
481 */ | |
8788 | 482 GtkIMHtmlButtons gtk_imhtml_get_format_functions(GtkIMHtml *imhtml); |
9033 | 483 |
484 /** | |
485 * Sets each boolean to TRUE if that formatting option is enabled at the | |
486 * current position in a GTK IM/HTML. | |
487 * | |
488 * @param imhtml The GTK IM/HTML. | |
489 * @param bold A reference to a boolean for bold. | |
490 * @param italic A reference to a boolean for italic. | |
491 * @param underline A reference to a boolean for underline. | |
492 */ | |
8516 | 493 void gtk_imhtml_get_current_format(GtkIMHtml *imhtml, gboolean *bold, gboolean *italic, gboolean *underline); |
9033 | 494 |
495 /** | |
496 * Returns a string containing the selected font face at the current position | |
497 * in a GTK IM/HTML. | |
498 * | |
499 * @param imhtml The GTK IM/HTML. | |
500 * | |
501 * @return A string containg the font face or @c NULL if none is set. | |
502 */ | |
9025 | 503 char *gtk_imhtml_get_current_fontface(GtkIMHtml *imhtml); |
9033 | 504 |
505 /** | |
506 * Returns a string containing the selected foreground color at the current | |
507 * position in a GTK IM/HTML. | |
508 * | |
509 * @param imhtml The GTK IM/HTML. | |
510 * | |
511 * @return A string containg the foreground color or @c NULL if none is set. | |
512 */ | |
9025 | 513 char *gtk_imhtml_get_current_forecolor(GtkIMHtml *imhtml); |
9033 | 514 |
515 /** | |
516 * Returns a string containing the selected background color at the current | |
517 * position in a GTK IM/HTML. | |
518 * | |
519 * @param imhtml The GTK IM/HTML. | |
520 * | |
521 * @return A string containg the background color or @c NULL if none is set. | |
522 */ | |
9025 | 523 char *gtk_imhtml_get_current_backcolor(GtkIMHtml *imhtml); |
9033 | 524 |
525 /** | |
526 * Returns a integer containing the selected HTML font size at the current | |
527 * position in a GTK IM/HTML. | |
528 * | |
529 * @param imhtml The GTK IM/HTML. | |
530 * | |
531 * @return The HTML font size. | |
532 */ | |
9025 | 533 gint gtk_imhtml_get_current_fontsize(GtkIMHtml *imhtml); |
9033 | 534 |
535 /** | |
536 * Checks whether a GTK IM/HTML is marked as editable. | |
537 * | |
538 * @param imhtml The GTK IM/HTML. | |
539 * | |
540 * @return @c TRUE if the IM/HTML is editable, or @c FALSE otherwise. | |
541 */ | |
8061 | 542 gboolean gtk_imhtml_get_editable(GtkIMHtml *imhtml); |
9033 | 543 |
544 /** | |
545 * Toggles bold at the cursor location or selection in a GTK IM/HTML. | |
546 * | |
547 * @param imhtml The GTK IM/HTML. | |
548 * | |
549 * @return @c TRUE if bold was turned on, or @c FALSE if it was turned off. | |
550 */ | |
8061 | 551 gboolean gtk_imhtml_toggle_bold(GtkIMHtml *imhtml); |
9033 | 552 |
553 /** | |
554 * Toggles italic at the cursor location or selection in a GTK IM/HTML. | |
555 * | |
556 * @param imhtml The GTK IM/HTML. | |
557 * | |
558 * @return @c TRUE if italic was turned on, or @c FALSE if it was turned off. | |
559 */ | |
8061 | 560 gboolean gtk_imhtml_toggle_italic(GtkIMHtml *imhtml); |
9033 | 561 |
562 /** | |
563 * Toggles underline at the cursor location or selection in a GTK IM/HTML. | |
564 * | |
565 * @param imhtml The GTK IM/HTML. | |
566 * | |
567 * @return @c TRUE if underline was turned on, or @c FALSE if it was turned off. | |
568 */ | |
8061 | 569 gboolean gtk_imhtml_toggle_underline(GtkIMHtml *imhtml); |
9033 | 570 |
571 /** | |
572 * Toggles a foreground color at the current location or selection in a GTK | |
573 * IM/HTML. | |
574 * | |
575 * @param imhtml The GTK IM/HTML. | |
576 * @param color The HTML-style color, or NULL or "" to clear the color. | |
577 * | |
578 * @return @c TRUE if a color was set, or @c FALSE if it was cleared. | |
579 */ | |
8061 | 580 gboolean gtk_imhtml_toggle_forecolor(GtkIMHtml *imhtml, const char *color); |
9033 | 581 |
582 /** | |
583 * Toggles a background color at the current location or selection in a GTK | |
584 * IM/HTML. | |
585 * | |
586 * @param imhtml The GTK IM/HTML. | |
587 * @param color The HTML-style color, or NULL or "" to clear the color. | |
588 * | |
589 * @return @c TRUE if a color was set, or @c FALSE if it was cleared. | |
590 */ | |
8061 | 591 gboolean gtk_imhtml_toggle_backcolor(GtkIMHtml *imhtml, const char *color); |
9033 | 592 |
593 /** | |
594 * Toggles a font face at the current location or selection in a GTK IM/HTML. | |
595 * | |
596 * @param imhtml The GTK IM/HTML. | |
597 * @param face The font face name, or NULL or "" to clear the font. | |
598 * | |
599 * @return @c TRUE if a font name was set, or @c FALSE if it was cleared. | |
600 */ | |
8061 | 601 gboolean gtk_imhtml_toggle_fontface(GtkIMHtml *imhtml, const char *face); |
9033 | 602 |
603 /** | |
604 * Toggles a link tag with the given URL at the current location or selection | |
605 * in a GTK IM/HTML. | |
606 * | |
607 * @param imhtml The GTK IM/HTML. | |
608 * @param url The URL for the link or NULL to terminate the link. | |
609 */ | |
8677 | 610 void gtk_imhtml_toggle_link(GtkIMHtml *imhtml, const char *url); |
9033 | 611 |
612 /** | |
613 * Inserts a link to the given url at the given GtkTextMark in a GTK IM/HTML. | |
614 * | |
615 * @param imhtml The GTK IM/HTML. | |
616 * @param mark The GtkTextMark to insert the link at. | |
617 * @param url The URL for the link. | |
618 * @param text The string to use for the link description. | |
619 */ | |
8677 | 620 void gtk_imhtml_insert_link(GtkIMHtml *imhtml, GtkTextMark *mark, const char *url, const char *text); |
9033 | 621 |
622 /** | |
623 * Inserts a smiley at the current location or selection in a GTK IM/HTML. | |
624 * | |
625 * @param imhtml The GTK IM/HTML. | |
626 * @param sml The category of the smiley. | |
627 * @param smiley The text of the smiley to insert. | |
628 */ | |
8061 | 629 void gtk_imhtml_insert_smiley(GtkIMHtml *imhtml, const char *sml, char *smiley); |
9033 | 630 /** |
631 * Inserts a smiley at the given iter in a GTK IM/HTML. | |
632 * | |
633 * @param imhtml The GTK IM/HTML. | |
634 * @param sml The category of the smiley. | |
635 * @param smiley The text of the smiley to insert. | |
636 * @param iter The GtkTextIter in the IM/HTML to insert the smiley at. | |
637 */ | |
8677 | 638 void gtk_imhtml_insert_smiley_at_iter(GtkIMHtml *imhtml, const char *sml, char *smiley, GtkTextIter *iter); |
9033 | 639 |
640 /** | |
641 * Inserts the IM/HTML scalable image with the given id at the given iter in a | |
642 * GTK IM/HTML. | |
643 * | |
644 * @param imhtml The GTK IM/HTML. | |
645 * @param id The id of the IM/HTML scalable. | |
646 * @param iter The GtkTextIter in the IM/HTML to insert the image at. | |
647 */ | |
8962 | 648 void gtk_imhtml_insert_image_at_iter(GtkIMHtml *imhtml, int id, GtkTextIter *iter); |
9033 | 649 |
650 /** | |
651 * Sets the font size at the current location or selection in a GTK IM/HTML. | |
652 * | |
653 * @param imhtml The GTK IM/HTML. | |
654 * @param size The HTML font size to use. | |
655 */ | |
8061 | 656 void gtk_imhtml_font_set_size(GtkIMHtml *imhtml, gint size); |
9033 | 657 |
658 /** | |
659 * Decreases the font size by 1 at the current location or selection in a GTK | |
660 * IM/HTML. | |
661 * | |
662 * @param imhtml The GTK IM/HTML. | |
663 */ | |
8061 | 664 void gtk_imhtml_font_shrink(GtkIMHtml *imhtml); |
9033 | 665 |
666 /** | |
667 * Increases the font size by 1 at the current location or selection in a GTK | |
668 * IM/HTML. | |
669 * | |
670 * @param imhtml The GTK IM/HTML. | |
671 */ | |
8061 | 672 void gtk_imhtml_font_grow(GtkIMHtml *imhtml); |
9033 | 673 |
674 /** | |
675 * Returns the HTML formatted contents between two iters in a GTK IM/HTML. | |
676 * | |
677 * @param imhtml The GTK IM/HTML. | |
678 * @param start The GtkTextIter indicating the start point in the IM/HTML. | |
679 * @param end The GtkTextIter indicating the end point in the IM/HTML. | |
680 * | |
681 * @return A string containing the HTML formatted text. | |
682 */ | |
8061 | 683 char *gtk_imhtml_get_markup_range(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *end); |
9033 | 684 |
685 /** | |
686 * Returns the entire HTML formatted contents of a GTK IM/HTML. | |
687 * | |
688 * @param imhtml The GTK IM/HTML. | |
689 * | |
690 * @return A string containing the HTML formatted text. | |
691 */ | |
8061 | 692 char *gtk_imhtml_get_markup(GtkIMHtml *imhtml); |
9033 | 693 |
694 /** | |
695 * Returns a null terminated array of pointers to null terminated strings, each | |
696 * string for each line. g_strfreev() should be called to free it when done. | |
697 * | |
698 * @param imhtml The GTK IM/HTML. | |
699 * | |
700 * @return A null terminated array of null terminated HTML formatted strings. | |
701 */ | |
8677 | 702 char **gtk_imhtml_get_markup_lines(GtkIMHtml *imhtml); |
9033 | 703 |
704 /** | |
705 * Returns the entire unformatted (plain text) contents of a GTK IM/HTML | |
706 * between two iters in a GTK IM/HTML. | |
707 * | |
708 * @param imhtml The GTK IM/HTML. | |
709 * @param start The GtkTextIter indicating the start point in the IM/HTML. | |
710 * @param end The GtkTextIter indicating the end point in the IM/HTML. | |
711 * | |
712 * @return A string containing the unformatted text. | |
713 */ | |
8677 | 714 char *gtk_imhtml_get_text(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *stop); |
8061 | 715 |
9033 | 716 /*@}*/ |
717 | |
1428 | 718 #ifdef __cplusplus |
719 } | |
720 #endif | |
721 | |
722 #endif |