Mercurial > pidgin.yaz
annotate src/gtkimhtml.h @ 9613:1b13160bf5a4
[gaim-migrate @ 10456]
"Okay, now it's better. Still should close #997210. Note
the list below is mostly the same as my initial comment and
replaces the former information.
1) Prevent a crash if you sign off and try to dequeue
messages from the away dialog. This was because we tried to
use the destroyed GaimConnection in a couple places to get
the prpl's name for the HTML logger and other conversation
data. We look up the information via the account instead.
2) Prevent a possible crash if gaim_gtkconv_write_conv is
called with who as NULL.
3) Prevent (null) or an empty string from being logged as
the sender's name if the sender no longer has an alias
because the
account is signed off." --Kevin Stange
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Thu, 29 Jul 2004 03:11:00 +0000 |
parents | c8e0426c63ed |
children | db62420a53a2 |
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, |
9041 | 70 GTK_IMHTML_LINKDESC = 1 << 11, |
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; | |
109 gchar *forecolor; | |
110 gchar *backcolor; | |
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 |
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
116 double zoom; |
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
117 int original_fsize; |
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
118 |
8681 | 119 char *clipboard_text_string; |
120 char *clipboard_html_string; | |
8962 | 121 |
122 GSList *im_images; | |
123 GtkIMHtmlFuncs *funcs; | |
1428 | 124 }; |
125 | |
126 struct _GtkIMHtmlClass { | |
3922 | 127 GtkTextViewClass parent_class; |
1428 | 128 |
5967 | 129 void (*url_clicked)(GtkIMHtml *, const gchar *); |
8420 | 130 void (*buttons_update)(GtkIMHtml *, GtkIMHtmlButtons); |
131 void (*toggle_format)(GtkIMHtml *, GtkIMHtmlButtons); | |
8427 | 132 void (*clear_format)(GtkIMHtml *); |
8506 | 133 void (*update_format)(GtkIMHtml *); |
5967 | 134 }; |
135 | |
136 struct _GtkIMHtmlFontDetail { | |
137 gushort size; | |
138 gchar *face; | |
139 gchar *fore; | |
140 gchar *back; | |
141 gchar *sml; | |
8689 | 142 gboolean underline; |
5967 | 143 }; |
144 | |
145 struct _GtkSmileyTree { | |
146 GString *values; | |
147 GtkSmileyTree **children; | |
148 GtkIMHtmlSmiley *image; | |
1428 | 149 }; |
150 | |
4263 | 151 struct _GtkIMHtmlSmiley { |
152 gchar *smile; | |
153 gchar *file; | |
6814
782907a6ae65
[gaim-migrate @ 7354]
Christian Hammond <chipx86@chipx86.com>
parents:
6282
diff
changeset
|
154 GdkPixbufAnimation *icon; |
4263 | 155 gboolean hidden; |
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 | |
8962 | 193 typedef gpointer (*GtkIMHtmlGetImageFunc) (int id); |
194 typedef gpointer (*GtkIMHtmlGetImageDataFunc) (gpointer i); | |
195 typedef size_t (*GtkIMHtmlGetImageSizeFunc) (gpointer i); | |
196 typedef const char *(*GtkIMHtmlGetImageFilenameFunc)(gpointer i); | |
197 typedef void (*GtkIMHtmlImageRefFunc) (int id); | |
198 typedef void (*GtkIMHtmlImageUnrefFunc) (int id); | |
199 | |
200 struct _GtkIMHtmlFuncs { | |
201 GtkIMHtmlGetImageFunc image_get; | |
202 GtkIMHtmlGetImageDataFunc image_get_data; | |
203 GtkIMHtmlGetImageSizeFunc image_get_size; | |
204 GtkIMHtmlGetImageFilenameFunc image_get_filename; | |
205 GtkIMHtmlImageRefFunc image_ref; | |
206 GtkIMHtmlImageUnrefFunc image_unref; | |
207 }; | |
208 | |
9033 | 209 /*@}*/ |
8962 | 210 |
9033 | 211 /************************************************************************** |
212 * @name GTK+ IM/HTML rendering component API | |
213 **************************************************************************/ | |
214 /*@{*/ | |
215 | |
216 /** | |
9037 | 217 * Returns the GType object for an IM/HTML widget. |
9033 | 218 * |
9037 | 219 * @return The GType for an IM/HTML widget. |
9033 | 220 */ |
9037 | 221 GType gtk_imhtml_get_type(void); |
5967 | 222 |
9033 | 223 /** |
224 * Creates and returns a new GTK IM/HTML widget. | |
225 * | |
226 * @return The GTK IM/HTML widget created. | |
227 */ | |
228 GtkWidget *gtk_imhtml_new(void *, void *); | |
5967 | 229 |
9033 | 230 /** |
231 * Associates a smiley with a GTK IM/HTML. | |
232 * | |
233 * @param imhtml The GTK IM/HTML. | |
234 * @param sml The name of the smiley category. | |
235 * @param smiley The GtkIMSmiley to associate. | |
236 */ | |
237 void gtk_imhtml_associate_smiley(GtkIMHtml *imhtml, gchar *sml, GtkIMHtmlSmiley *smiley); | |
238 | |
239 /** | |
240 * Removes all smileys associated with a GTK IM/HTML. | |
241 * | |
242 * @param imhtml The GTK IM/HTML. | |
243 */ | |
244 void gtk_imhtml_remove_smileys(GtkIMHtml *imhtml); | |
5967 | 245 |
9033 | 246 /** |
247 * Sets the function callbacks to use with a GTK IM/HTML instance. | |
248 * | |
249 * @param imhtml The GTK IM/HTML. | |
250 * @param f The GtkIMHTMLFuncs struct containing the functions to use. | |
251 */ | |
252 void gtk_imhtml_set_funcs(GtkIMHtml *imhtml, GtkIMHtmlFuncs *f); | |
5967 | 253 |
9033 | 254 /** |
255 * Enables or disables showing the contents of HTML comments in a GTK IM/HTML. | |
256 * | |
257 * @param imhtml The GTK IM/HTML. | |
258 * @param show @c TRUE if comments should be shown, or @c FALSE otherwise. | |
259 */ | |
260 void gtk_imhtml_show_comments(GtkIMHtml *imhtml, gboolean show); | |
8962 | 261 |
9033 | 262 /** |
263 * Enables or disables formatting shortcut keys in a GTK IM/HTML. | |
264 * | |
265 * @param imhtml The GTK IM/HTML. | |
266 * @param allow @c TRUE if shortcut keys are allowed, or @c FALSE otherwise. | |
267 */ | |
268 void gtk_imhtml_html_shortcuts(GtkIMHtml *imhtml, gboolean allow); | |
5967 | 269 |
9033 | 270 /** |
271 * Enables or disables smiley insertion shortcut keys in a GTK IM/HTML. | |
272 * | |
273 * @param imhtml The GTK IM/HTML. | |
274 * @param allow @c TRUE if shortcut keys are allowed, or @c FALSE otherwise. | |
275 */ | |
276 void gtk_imhtml_smiley_shortcuts(GtkIMHtml *imhtml, gboolean allow); | |
8456 | 277 |
9033 | 278 /** |
279 * Associates a protocol name with a GTK IM/HTML. | |
280 * | |
281 * @param imhtml The GTK IM/HTML. | |
282 * @param protocol_name The protocol name to associate with the IM/HTML. | |
283 */ | |
284 void gtk_imhtml_set_protocol_name(GtkIMHtml *imhtml, const gchar *protocol_name); | |
8456 | 285 |
9033 | 286 /** |
287 * Appends HTML formatted text to a GTK IM/HTML. | |
288 * | |
289 * @param imhtml The GTK IM/HTML. | |
290 * @param text The formatted text to append. | |
291 * @param options A GtkIMHtmlOptions object indicating insert behavior. | |
292 */ | |
9307 | 293 #define gtk_imhtml_append_text(imhtml, text, options) \ |
294 gtk_imhtml_append_text_with_images(imhtml, text, options, NULL) | |
6982 | 295 |
9033 | 296 /** |
297 * Appends HTML formatted text to a GTK IM/HTML. | |
298 * | |
299 * @param imhtml The GTK IM/HTML. | |
300 * @param text The formatted text to append. | |
301 * @param options A GtkIMHtmlOptions object indicating insert behavior. | |
9185 | 302 * @param unused Use @c NULL value. |
9033 | 303 */ |
304 void gtk_imhtml_append_text_with_images(GtkIMHtml *imhtml, | |
305 const gchar *text, | |
306 GtkIMHtmlOptions options, | |
307 GSList *unused); | |
308 | |
309 /** | |
310 * Inserts HTML formatted text to a GTK IM/HTML at a given iter. | |
311 * | |
312 * @param imhtml The GTK IM/HTML. | |
313 * @param text The formatted text to append. | |
314 * @param options A GtkIMHtmlOptions object indicating insert behavior. | |
315 * @param iter A GtkTextIter in the GTK IM/HTML at which to insert text. | |
316 */ | |
8677 | 317 void gtk_imhtml_insert_html_at_iter(GtkIMHtml *imhtml, |
318 const gchar *text, | |
319 GtkIMHtmlOptions options, | |
320 GtkTextIter *iter); | |
9033 | 321 |
322 /** | |
323 * Scrolls a GTK IM/HTML to the end of its contents. | |
324 * | |
325 * @param imhtml The GTK IM/HTML. | |
326 */ | |
8729 | 327 void gtk_imhtml_scroll_to_end(GtkIMHtml *imhtml); |
9033 | 328 |
329 /** | |
330 * Purges the contents from a GTK IM/HTML and resets formatting. | |
331 * | |
332 * @param imhtml The GTK IM/HTML. | |
333 */ | |
334 void gtk_imhtml_clear(GtkIMHtml *imhtml); | |
4895 | 335 |
9033 | 336 /** |
337 * Scrolls a GTK IM/HTML up by one page. | |
338 * | |
339 * @param imhtml The GTK IM/HTML. | |
340 */ | |
341 void gtk_imhtml_page_up(GtkIMHtml *imhtml); | |
342 | |
343 /** | |
344 * Scrolls a GTK IM/HTML down by one page. | |
345 * | |
346 * @param imhtml The GTK IM/HTML. | |
347 */ | |
348 void gtk_imhtml_page_down(GtkIMHtml *imhtml); | |
349 | |
350 /** | |
351 * Scales the font sizes in a GTK IM/HTML by a given factor. | |
352 * | |
353 * @param imhtml The GTK IM/HTML. | |
354 * @param zoom The factor by which to scale the font sizes. | |
355 */ | |
8740
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
356 void gtk_imhtml_font_zoom(GtkIMHtml *imhtml, double zoom); |
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
357 |
9033 | 358 /** |
359 * Creates and returns an new GTK IM/HTML scalable object. | |
360 * | |
361 * @return A new IM/HTML Scalable object. | |
362 */ | |
4895 | 363 GtkIMHtmlScalable *gtk_imhtml_scalable_new(); |
9033 | 364 |
365 /** | |
366 * Creates and returns an new GTK IM/HTML scalable object with an image. | |
367 * | |
368 * @param img A GdkPixbuf of the image to add. | |
369 * @param filename The filename to associate with the image. | |
370 * @param id The id to associate with the image. | |
371 * | |
372 * @return A new IM/HTML Scalable object with an image. | |
373 */ | |
8962 | 374 GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename, int id); |
9033 | 375 |
376 /** | |
377 * Destroys and frees a GTK IM/HTML scalable image. | |
378 * | |
379 * @param scale The GTK IM/HTML scalable. | |
380 */ | |
381 void gtk_imhtml_image_free(GtkIMHtmlScalable *scale); | |
4895 | 382 |
9033 | 383 /** |
384 * Rescales a GTK IM/HTML scalable image to a given size. | |
385 * | |
386 * @param scale The GTK IM/HTML scalable. | |
387 * @param width The new width. | |
388 * @param height The new height. | |
389 */ | |
390 void gtk_imhtml_image_scale(GtkIMHtmlScalable *scale, int width, int height); | |
391 | |
392 /** | |
393 * Adds a GTK IM/HTML scalable image to a given GTK IM/HTML at a given iter. | |
394 * | |
395 * @param scale The GTK IM/HTML scalable. | |
396 * @param imhtml The GTK IM/HTML. | |
397 * @param iter The GtkTextIter at which to add the scalable. | |
398 */ | |
399 void gtk_imhtml_image_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTextIter *iter); | |
400 | |
401 /** | |
402 * Creates and returns an new GTK IM/HTML scalable with a horizontal rule. | |
403 * | |
404 * @return A new IM/HTML Scalable object with an image. | |
405 */ | |
5967 | 406 GtkIMHtmlScalable *gtk_imhtml_hr_new(); |
9033 | 407 |
408 /** | |
409 * Destroys and frees a GTK IM/HTML scalable horizontal rule. | |
410 * | |
411 * @param scale The GTK IM/HTML scalable. | |
412 */ | |
9034 | 413 void gtk_imhtml_hr_free(GtkIMHtmlScalable *scale); |
9033 | 414 |
415 /** | |
416 * Rescales a GTK IM/HTML scalable horizontal rule to a given size. | |
417 * | |
418 * @param scale The GTK IM/HTML scalable. | |
419 * @param width The new width. | |
420 * @param height The new height. | |
421 */ | |
9034 | 422 void gtk_imhtml_hr_scale(GtkIMHtmlScalable *scale, int width, int height); |
4895 | 423 |
9033 | 424 /** |
425 * Adds a GTK IM/HTML scalable horizontal rule to a given GTK IM/HTML at | |
426 * a given iter. | |
427 * | |
428 * @param scale The GTK IM/HTML scalable. | |
429 * @param imhtml The GTK IM/HTML. | |
430 * @param iter The GtkTextIter at which to add the scalable. | |
431 */ | |
9307 | 432 void gtk_imhtml_hr_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTextIter *iter); |
9033 | 433 |
434 /** | |
435 * Finds and highlights a given string in a GTK IM/HTML. | |
436 * | |
437 * @param imhtml The GTK IM/HTML. | |
438 * @param text The string to search for. | |
439 * | |
440 * @return @c TRUE if a search was performed, or @c FALSE if not. | |
441 */ | |
7295 | 442 gboolean gtk_imhtml_search_find(GtkIMHtml *imhtml, const gchar *text); |
9033 | 443 |
444 /** | |
445 * Clears the highlighting from a prior search in a GTK IM/HTML. | |
446 * | |
447 * @param imhtml The GTK IM/HTML. | |
448 */ | |
7295 | 449 void gtk_imhtml_search_clear(GtkIMHtml *imhtml); |
4895 | 450 |
9033 | 451 /** |
452 * Enables or disables editing in a GTK IM/HTML. | |
453 * | |
454 * @param imhtml The GTK IM/HTML. | |
455 * @param editable @c TRUE to make the widget editable, or @c FALSE otherwise. | |
456 */ | |
8061 | 457 void gtk_imhtml_set_editable(GtkIMHtml *imhtml, gboolean editable); |
9033 | 458 |
459 /** | |
460 * Enables or disables whole buffer formatting only (wbfo) in a GTK IM/HTML. | |
461 * In this mode formatting options to the buffer take effect for the entire | |
462 * buffer instead of specific text. | |
463 * | |
464 * @param imhtml The GTK IM/HTML. | |
465 * @param wbfo @c TRUE to enable the mode, or @c FALSE otherwise. | |
466 */ | |
8677 | 467 void gtk_imhtml_set_whole_buffer_formatting_only(GtkIMHtml *imhtml, gboolean wbfo); |
9033 | 468 |
469 /** | |
9185 | 470 * Indicates which formatting functions to enable and disable in a GTK IM/HTML. |
9033 | 471 * |
472 * @param imhtml The GTK IM/HTML. | |
9185 | 473 * @param buttons A GtkIMHtmlButtons bitmask indicating which functions to use. |
9033 | 474 */ |
8420 | 475 void gtk_imhtml_set_format_functions(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons); |
9033 | 476 |
477 /** | |
9185 | 478 * Returns which formatting functions are enabled in a GTK IM/HTML. |
9033 | 479 * |
480 * @param imhtml The GTK IM/HTML. | |
481 * | |
9185 | 482 * @return A GtkIMHtmlButtons bitmask indicating which functions to are enabled. |
9033 | 483 */ |
8788 | 484 GtkIMHtmlButtons gtk_imhtml_get_format_functions(GtkIMHtml *imhtml); |
9033 | 485 |
486 /** | |
487 * Sets each boolean to TRUE if that formatting option is enabled at the | |
488 * current position in a GTK IM/HTML. | |
489 * | |
490 * @param imhtml The GTK IM/HTML. | |
491 * @param bold A reference to a boolean for bold. | |
492 * @param italic A reference to a boolean for italic. | |
493 * @param underline A reference to a boolean for underline. | |
494 */ | |
8516 | 495 void gtk_imhtml_get_current_format(GtkIMHtml *imhtml, gboolean *bold, gboolean *italic, gboolean *underline); |
9033 | 496 |
497 /** | |
498 * Returns a string containing the selected font face at the current position | |
499 * in a GTK IM/HTML. | |
500 * | |
501 * @param imhtml The GTK IM/HTML. | |
502 * | |
503 * @return A string containg the font face or @c NULL if none is set. | |
504 */ | |
9025 | 505 char *gtk_imhtml_get_current_fontface(GtkIMHtml *imhtml); |
9033 | 506 |
507 /** | |
508 * Returns a string containing the selected foreground color at the current | |
509 * position in a GTK IM/HTML. | |
510 * | |
511 * @param imhtml The GTK IM/HTML. | |
512 * | |
513 * @return A string containg the foreground color or @c NULL if none is set. | |
514 */ | |
9025 | 515 char *gtk_imhtml_get_current_forecolor(GtkIMHtml *imhtml); |
9033 | 516 |
517 /** | |
518 * Returns a string containing the selected background 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 background color or @c NULL if none is set. | |
524 */ | |
9025 | 525 char *gtk_imhtml_get_current_backcolor(GtkIMHtml *imhtml); |
9033 | 526 |
527 /** | |
528 * Returns a integer containing the selected HTML font size at the current | |
529 * position in a GTK IM/HTML. | |
530 * | |
531 * @param imhtml The GTK IM/HTML. | |
532 * | |
533 * @return The HTML font size. | |
534 */ | |
9025 | 535 gint gtk_imhtml_get_current_fontsize(GtkIMHtml *imhtml); |
9033 | 536 |
537 /** | |
538 * Checks whether a GTK IM/HTML is marked as editable. | |
539 * | |
540 * @param imhtml The GTK IM/HTML. | |
541 * | |
542 * @return @c TRUE if the IM/HTML is editable, or @c FALSE otherwise. | |
543 */ | |
8061 | 544 gboolean gtk_imhtml_get_editable(GtkIMHtml *imhtml); |
9033 | 545 |
546 /** | |
547 * Toggles bold at the cursor location or selection in a GTK IM/HTML. | |
548 * | |
549 * @param imhtml The GTK IM/HTML. | |
550 * | |
551 * @return @c TRUE if bold was turned on, or @c FALSE if it was turned off. | |
552 */ | |
8061 | 553 gboolean gtk_imhtml_toggle_bold(GtkIMHtml *imhtml); |
9033 | 554 |
555 /** | |
556 * Toggles italic at the cursor location or selection in a GTK IM/HTML. | |
557 * | |
558 * @param imhtml The GTK IM/HTML. | |
559 * | |
560 * @return @c TRUE if italic was turned on, or @c FALSE if it was turned off. | |
561 */ | |
8061 | 562 gboolean gtk_imhtml_toggle_italic(GtkIMHtml *imhtml); |
9033 | 563 |
564 /** | |
565 * Toggles underline at the cursor location or selection in a GTK IM/HTML. | |
566 * | |
567 * @param imhtml The GTK IM/HTML. | |
568 * | |
569 * @return @c TRUE if underline was turned on, or @c FALSE if it was turned off. | |
570 */ | |
8061 | 571 gboolean gtk_imhtml_toggle_underline(GtkIMHtml *imhtml); |
9033 | 572 |
573 /** | |
574 * Toggles a foreground color at the current location or selection in a GTK | |
575 * IM/HTML. | |
576 * | |
577 * @param imhtml The GTK IM/HTML. | |
9185 | 578 * @param color The HTML-style color, or @c NULL or "" to clear the color. |
9033 | 579 * |
580 * @return @c TRUE if a color was set, or @c FALSE if it was cleared. | |
581 */ | |
8061 | 582 gboolean gtk_imhtml_toggle_forecolor(GtkIMHtml *imhtml, const char *color); |
9033 | 583 |
584 /** | |
585 * Toggles a background color at the current location or selection in a GTK | |
586 * IM/HTML. | |
587 * | |
588 * @param imhtml The GTK IM/HTML. | |
9185 | 589 * @param color The HTML-style color, or @c NULL or "" to clear the color. |
9033 | 590 * |
591 * @return @c TRUE if a color was set, or @c FALSE if it was cleared. | |
592 */ | |
8061 | 593 gboolean gtk_imhtml_toggle_backcolor(GtkIMHtml *imhtml, const char *color); |
9033 | 594 |
595 /** | |
596 * Toggles a font face at the current location or selection in a GTK IM/HTML. | |
597 * | |
598 * @param imhtml The GTK IM/HTML. | |
9185 | 599 * @param face The font face name, or @c NULL or "" to clear the font. |
9033 | 600 * |
601 * @return @c TRUE if a font name was set, or @c FALSE if it was cleared. | |
602 */ | |
8061 | 603 gboolean gtk_imhtml_toggle_fontface(GtkIMHtml *imhtml, const char *face); |
9033 | 604 |
605 /** | |
606 * Toggles a link tag with the given URL at the current location or selection | |
607 * in a GTK IM/HTML. | |
608 * | |
609 * @param imhtml The GTK IM/HTML. | |
9185 | 610 * @param url The URL for the link or @c NULL to terminate the link. |
9033 | 611 */ |
8677 | 612 void gtk_imhtml_toggle_link(GtkIMHtml *imhtml, const char *url); |
9033 | 613 |
614 /** | |
615 * Inserts a link to the given url at the given GtkTextMark in a GTK IM/HTML. | |
616 * | |
617 * @param imhtml The GTK IM/HTML. | |
618 * @param mark The GtkTextMark to insert the link at. | |
619 * @param url The URL for the link. | |
620 * @param text The string to use for the link description. | |
621 */ | |
8677 | 622 void gtk_imhtml_insert_link(GtkIMHtml *imhtml, GtkTextMark *mark, const char *url, const char *text); |
9033 | 623 |
624 /** | |
625 * Inserts a smiley at the current location or selection in a GTK IM/HTML. | |
626 * | |
627 * @param imhtml The GTK IM/HTML. | |
628 * @param sml The category of the smiley. | |
629 * @param smiley The text of the smiley to insert. | |
630 */ | |
8061 | 631 void gtk_imhtml_insert_smiley(GtkIMHtml *imhtml, const char *sml, char *smiley); |
9033 | 632 /** |
633 * Inserts a smiley at the given iter in a GTK IM/HTML. | |
634 * | |
635 * @param imhtml The GTK IM/HTML. | |
636 * @param sml The category of the smiley. | |
637 * @param smiley The text of the smiley to insert. | |
638 * @param iter The GtkTextIter in the IM/HTML to insert the smiley at. | |
639 */ | |
8677 | 640 void gtk_imhtml_insert_smiley_at_iter(GtkIMHtml *imhtml, const char *sml, char *smiley, GtkTextIter *iter); |
9033 | 641 |
642 /** | |
643 * Inserts the IM/HTML scalable image with the given id at the given iter in a | |
644 * GTK IM/HTML. | |
645 * | |
646 * @param imhtml The GTK IM/HTML. | |
647 * @param id The id of the IM/HTML scalable. | |
648 * @param iter The GtkTextIter in the IM/HTML to insert the image at. | |
649 */ | |
8962 | 650 void gtk_imhtml_insert_image_at_iter(GtkIMHtml *imhtml, int id, GtkTextIter *iter); |
9033 | 651 |
652 /** | |
653 * Sets the font size at the current location or selection in a GTK IM/HTML. | |
654 * | |
655 * @param imhtml The GTK IM/HTML. | |
656 * @param size The HTML font size to use. | |
657 */ | |
8061 | 658 void gtk_imhtml_font_set_size(GtkIMHtml *imhtml, gint size); |
9033 | 659 |
660 /** | |
661 * Decreases the font size by 1 at the current location or selection in a GTK | |
662 * IM/HTML. | |
663 * | |
664 * @param imhtml The GTK IM/HTML. | |
665 */ | |
8061 | 666 void gtk_imhtml_font_shrink(GtkIMHtml *imhtml); |
9033 | 667 |
668 /** | |
669 * Increases the font size by 1 at the current location or selection in a GTK | |
670 * IM/HTML. | |
671 * | |
672 * @param imhtml The GTK IM/HTML. | |
673 */ | |
8061 | 674 void gtk_imhtml_font_grow(GtkIMHtml *imhtml); |
9033 | 675 |
676 /** | |
677 * Returns the HTML formatted contents between two iters in a GTK IM/HTML. | |
678 * | |
679 * @param imhtml The GTK IM/HTML. | |
680 * @param start The GtkTextIter indicating the start point in the IM/HTML. | |
681 * @param end The GtkTextIter indicating the end point in the IM/HTML. | |
682 * | |
683 * @return A string containing the HTML formatted text. | |
684 */ | |
8061 | 685 char *gtk_imhtml_get_markup_range(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *end); |
9033 | 686 |
687 /** | |
688 * Returns the entire HTML formatted contents of a GTK IM/HTML. | |
689 * | |
690 * @param imhtml The GTK IM/HTML. | |
691 * | |
692 * @return A string containing the HTML formatted text. | |
693 */ | |
8061 | 694 char *gtk_imhtml_get_markup(GtkIMHtml *imhtml); |
9033 | 695 |
696 /** | |
697 * Returns a null terminated array of pointers to null terminated strings, each | |
698 * string for each line. g_strfreev() should be called to free it when done. | |
699 * | |
700 * @param imhtml The GTK IM/HTML. | |
701 * | |
702 * @return A null terminated array of null terminated HTML formatted strings. | |
703 */ | |
8677 | 704 char **gtk_imhtml_get_markup_lines(GtkIMHtml *imhtml); |
9033 | 705 |
706 /** | |
707 * Returns the entire unformatted (plain text) contents of a GTK IM/HTML | |
708 * between two iters in a GTK IM/HTML. | |
709 * | |
710 * @param imhtml The GTK IM/HTML. | |
711 * @param start The GtkTextIter indicating the start point in the IM/HTML. | |
9185 | 712 * @param stop The GtkTextIter indicating the end point in the IM/HTML. |
9033 | 713 * |
714 * @return A string containing the unformatted text. | |
715 */ | |
8677 | 716 char *gtk_imhtml_get_text(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *stop); |
8061 | 717 |
9033 | 718 /*@}*/ |
719 | |
1428 | 720 #ifdef __cplusplus |
721 } | |
722 #endif | |
723 | |
724 #endif |