*** Plucked rev 3f699c081b38f9d19632fcee1c23cbc96fce3092 (sulabh@soc.pidgin.im):
[pidgin-git.git] / pidgin / gtkimhtml.h
blobef18d99445ff5e60616fdda05430456990328244
1 /**
2 * @file gtkimhtml.h GTK+ IM/HTML rendering component
3 * @ingroup pidgin
4 * @see @ref gtkimhtml-signals
5 */
7 /* Pidgin is the legal property of its developers, whose names are too numerous
8 * to list here. Please refer to the COPYRIGHT file distributed with this
9 * source distribution.
11 * This program is free software; you can redistribute it and/or modify
12 * under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25 #ifndef _PIDGINIMHTML_H_
26 #define _PIDGINIMHTML_H_
28 #include <gdk/gdk.h>
29 #include <gtk/gtktextview.h>
30 #include <gtk/gtktooltips.h>
31 #include <gtk/gtkimage.h>
32 #include "gtksourceundomanager.h"
34 #include "connection.h"
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
40 /**************************************************************************
41 * @name Structures
42 **************************************************************************/
43 /*@{*/
45 #define GTK_TYPE_IMHTML (gtk_imhtml_get_type ())
46 #define GTK_IMHTML(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_IMHTML, GtkIMHtml))
47 #define GTK_IMHTML_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMHTML, GtkIMHtmlClass))
48 #define GTK_IS_IMHTML(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_IMHTML))
49 #define GTK_IS_IMHTML_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMHTML))
50 #define GTK_IMHTML_SCALABLE(obj) ((GtkIMHtmlScalable *)obj)
51 #define GTK_IMHTML_ANIMATION(obj) ((GtkIMHtmlAnimation *)obj)
53 typedef struct _GtkIMHtml GtkIMHtml;
54 typedef struct _GtkIMHtmlClass GtkIMHtmlClass;
55 typedef struct _GtkIMHtmlFontDetail GtkIMHtmlFontDetail; /* The five elements contained in a FONT tag */
56 typedef struct _GtkSmileyTree GtkSmileyTree;
57 typedef struct _GtkIMHtmlSmiley GtkIMHtmlSmiley;
58 typedef struct _GtkIMHtmlScalable GtkIMHtmlScalable;
59 typedef struct _GtkIMHtmlImage GtkIMHtmlImage;
60 typedef struct _GtkIMHtmlAnimation GtkIMHtmlAnimation;
61 typedef struct _GtkIMHtmlHr GtkIMHtmlHr;
62 typedef struct _GtkIMHtmlFuncs GtkIMHtmlFuncs;
64 typedef enum {
65 GTK_IMHTML_BOLD = 1 << 0,
66 GTK_IMHTML_ITALIC = 1 << 1,
67 GTK_IMHTML_UNDERLINE = 1 << 2,
68 GTK_IMHTML_GROW = 1 << 3,
69 GTK_IMHTML_SHRINK = 1 << 4,
70 GTK_IMHTML_FACE = 1 << 5,
71 GTK_IMHTML_FORECOLOR = 1 << 6,
72 GTK_IMHTML_BACKCOLOR = 1 << 7,
73 GTK_IMHTML_BACKGROUND = 1 << 8,
74 GTK_IMHTML_LINK = 1 << 9,
75 GTK_IMHTML_IMAGE = 1 << 10,
76 GTK_IMHTML_SMILEY = 1 << 11,
77 GTK_IMHTML_LINKDESC = 1 << 12,
78 GTK_IMHTML_STRIKE = 1 << 13,
79 /** Show custom smileys when appropriate. @since 2.5.0 */
80 GTK_IMHTML_CUSTOM_SMILEY = 1 << 14,
81 GTK_IMHTML_ALL = -1
82 } GtkIMHtmlButtons;
84 typedef enum {
85 GTK_IMHTML_SMILEY_CUSTOM = 1 << 0
86 } GtkIMHtmlSmileyFlags;
88 struct _GtkIMHtml {
89 GtkTextView text_view;
90 GtkTextBuffer *text_buffer;
91 GdkCursor *hand_cursor;
92 GdkCursor *arrow_cursor;
93 GdkCursor *text_cursor;
94 GHashTable *smiley_data;
95 GtkSmileyTree *default_smilies;
96 char *protocol_name;
97 guint scroll_src;
98 GTimer *scroll_time;
99 GQueue *animations;
100 int num_animations;
102 gboolean show_comments;
104 GtkWidget *tip_window;
105 char *tip;
106 guint tip_timer;
107 GtkTextTag *prelit_tag;
109 GList *scalables;
110 GdkRectangle old_rect;
112 gchar *search_string;
114 gboolean editable;
115 GtkIMHtmlButtons format_functions;
116 gboolean wbfo; /* Whole buffer formatting only. */
118 gint insert_offset;
120 struct {
121 gboolean bold:1;
122 gboolean italic:1;
123 gboolean underline:1;
124 gboolean strike:1;
125 gchar *forecolor;
126 gchar *backcolor;
127 gchar *background;
128 gchar *fontface;
129 int fontsize;
130 GtkTextTag *link;
131 } edit;
133 #if !(defined PIDGIN_DISABLE_DEPRECATED) || (defined _PIDGIN_GTKIMHTML_C_)
134 /** @deprecated */
135 char *clipboard_text_string;
136 /** @deprecated */
137 char *clipboard_html_string;
138 #else
139 char *depr1;
140 char *depr2;
141 #endif
143 GSList *im_images;
144 GtkIMHtmlFuncs *funcs;
145 GtkSourceUndoManager *undo_manager;
148 struct _GtkIMHtmlClass {
149 GtkTextViewClass parent_class;
151 void (*url_clicked)(GtkIMHtml *, const gchar *);
152 void (*buttons_update)(GtkIMHtml *, GtkIMHtmlButtons);
153 void (*toggle_format)(GtkIMHtml *, GtkIMHtmlButtons);
154 void (*clear_format)(GtkIMHtml *);
155 void (*update_format)(GtkIMHtml *);
156 gboolean (*message_send)(GtkIMHtml *);
157 void (*undo)(GtkIMHtml *);
158 void (*redo)(GtkIMHtml *);
161 struct _GtkIMHtmlFontDetail {
162 gushort size;
163 gchar *face;
164 gchar *fore;
165 gchar *back;
166 gchar *bg;
167 gchar *sml;
168 gboolean underline;
169 gshort bold;
172 struct _GtkSmileyTree {
173 GString *values;
174 GtkSmileyTree **children;
175 GtkIMHtmlSmiley *image;
178 struct _GtkIMHtmlSmiley {
179 gchar *smile;
180 gchar *file;
181 GdkPixbufAnimation *icon;
182 gboolean hidden;
183 GdkPixbufLoader *loader;
184 GSList *anchors;
185 GtkIMHtmlSmileyFlags flags;
186 GtkIMHtml *imhtml;
189 struct _GtkIMHtmlScalable {
190 void (*scale)(struct _GtkIMHtmlScalable *, int, int);
191 void (*add_to)(struct _GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *);
192 void (*free)(struct _GtkIMHtmlScalable *);
195 struct _GtkIMHtmlImage {
196 GtkIMHtmlScalable scalable;
197 GtkImage *image; /**< Contains the scaled version of this pixbuf. */
198 GdkPixbuf *pixbuf; /**< The original pixbuf, before any scaling. */
199 GtkTextMark *mark;
200 gchar *filename;
201 int width;
202 int height;
203 int id;
204 GtkWidget *filesel;
207 struct _GtkIMHtmlAnimation {
208 GtkIMHtmlImage imhtmlimage;
209 GdkPixbufAnimation *anim; /**< The original animation, before any scaling. */
210 GdkPixbufAnimationIter *iter;
211 guint timer;
214 struct _GtkIMHtmlHr {
215 GtkIMHtmlScalable scalable;
216 GtkWidget *sep;
219 typedef enum {
220 GTK_IMHTML_NO_COLOURS = 1 << 0,
221 GTK_IMHTML_NO_FONTS = 1 << 1,
222 GTK_IMHTML_NO_COMMENTS = 1 << 2, /* Remove */
223 GTK_IMHTML_NO_TITLE = 1 << 3,
224 GTK_IMHTML_NO_NEWLINE = 1 << 4,
225 GTK_IMHTML_NO_SIZES = 1 << 5,
226 GTK_IMHTML_NO_SCROLL = 1 << 6,
227 GTK_IMHTML_RETURN_LOG = 1 << 7,
228 GTK_IMHTML_USE_POINTSIZE = 1 << 8,
229 GTK_IMHTML_NO_FORMATTING = 1 << 9,
230 GTK_IMHTML_USE_SMOOTHSCROLLING = 1 << 10,
231 GTK_IMHTML_NO_SMILEY = 1 << 11,
232 } GtkIMHtmlOptions;
234 enum {
235 GTK_IMHTML_DRAG_URL = 0,
236 GTK_IMHTML_DRAG_HTML,
237 GTK_IMHTML_DRAG_UTF8_STRING,
238 GTK_IMHTML_DRAG_COMPOUND_TEXT,
239 GTK_IMHTML_DRAG_STRING,
240 GTK_IMHTML_DRAG_TEXT,
241 GTK_IMHTML_DRAG_NUM
244 #define GTK_IMHTML_DND_TARGETS \
245 { "text/uri-list", 0, GTK_IMHTML_DRAG_URL }, \
246 { "_NETSCAPE_URL", 0, GTK_IMHTML_DRAG_URL }, \
247 { "text/html", 0, GTK_IMHTML_DRAG_HTML }, \
248 { "x-url/ftp", 0, GTK_IMHTML_DRAG_URL }, \
249 { "x-url/http", 0, GTK_IMHTML_DRAG_URL }, \
250 { "UTF8_STRING", 0, GTK_IMHTML_DRAG_UTF8_STRING }, \
251 { "COMPOUND_TEXT", 0, GTK_IMHTML_DRAG_COMPOUND_TEXT }, \
252 { "STRING", 0, GTK_IMHTML_DRAG_STRING }, \
253 { "text/plain", 0, GTK_IMHTML_DRAG_TEXT }, \
254 { "TEXT", 0, GTK_IMHTML_DRAG_TEXT }
256 typedef gpointer (*GtkIMHtmlGetImageFunc) (int id);
257 typedef gpointer (*GtkIMHtmlGetImageDataFunc) (gpointer i);
258 typedef size_t (*GtkIMHtmlGetImageSizeFunc) (gpointer i);
259 typedef const char *(*GtkIMHtmlGetImageFilenameFunc)(gpointer i);
260 typedef void (*GtkIMHtmlImageRefFunc) (int id);
261 typedef void (*GtkIMHtmlImageUnrefFunc) (int id);
263 struct _GtkIMHtmlFuncs {
264 GtkIMHtmlGetImageFunc image_get;
265 GtkIMHtmlGetImageDataFunc image_get_data;
266 GtkIMHtmlGetImageSizeFunc image_get_size;
267 GtkIMHtmlGetImageFilenameFunc image_get_filename;
268 GtkIMHtmlImageRefFunc image_ref;
269 GtkIMHtmlImageUnrefFunc image_unref;
272 /*@}*/
274 /**************************************************************************
275 * @name GTK+ IM/HTML rendering component API
276 **************************************************************************/
277 /*@{*/
280 * Returns the GType object for an IM/HTML widget.
282 * @return The GType for an IM/HTML widget.
284 GType gtk_imhtml_get_type(void);
287 * Creates and returns a new GTK+ IM/HTML widget.
289 * @return The GTK+ IM/HTML widget created.
291 GtkWidget *gtk_imhtml_new(void *, void *);
294 * Returns the smiley object associated with the text.
296 * @param imhtml The GTK+ IM/HTML.
297 * @param sml The name of the smiley category.
298 * @param text The text associated with the smiley.
301 GtkIMHtmlSmiley *gtk_imhtml_smiley_get(GtkIMHtml * imhtml,
302 const gchar * sml, const gchar * text);
306 * Associates a smiley with a GTK+ IM/HTML.
308 * @param imhtml The GTK+ IM/HTML.
309 * @param sml The name of the smiley category.
310 * @param smiley The GtkIMSmiley to associate.
312 void gtk_imhtml_associate_smiley(GtkIMHtml *imhtml, const gchar *sml, GtkIMHtmlSmiley *smiley);
315 * Removes all smileys associated with a GTK+ IM/HTML.
317 * @param imhtml The GTK+ IM/HTML.
319 void gtk_imhtml_remove_smileys(GtkIMHtml *imhtml);
322 * Sets the function callbacks to use with a GTK+ IM/HTML instance.
324 * @param imhtml The GTK+ IM/HTML.
325 * @param f The GtkIMHTMLFuncs struct containing the functions to use.
327 void gtk_imhtml_set_funcs(GtkIMHtml *imhtml, GtkIMHtmlFuncs *f);
330 * Enables or disables showing the contents of HTML comments in a GTK+ IM/HTML.
332 * @param imhtml The GTK+ IM/HTML.
333 * @param show @c TRUE if comments should be shown, or @c FALSE otherwise.
335 void gtk_imhtml_show_comments(GtkIMHtml *imhtml, gboolean show);
338 * Gets the protocol name associated with this GTK+ IM/HTML.
340 * @param imhtml The GTK+ IM/HTML
342 const char *gtk_imhtml_get_protocol_name(GtkIMHtml *imhtml);
345 * Associates a protocol name with a GTK+ IM/HTML.
347 * @param imhtml The GTK+ IM/HTML.
348 * @param protocol_name The protocol name to associate with the IM/HTML.
350 void gtk_imhtml_set_protocol_name(GtkIMHtml *imhtml, const gchar *protocol_name);
353 * Appends HTML formatted text to a GTK+ IM/HTML.
355 * @param imhtml The GTK+ IM/HTML.
356 * @param text The formatted text to append.
357 * @param options A GtkIMHtmlOptions object indicating insert behavior.
359 #define gtk_imhtml_append_text(imhtml, text, options) \
360 gtk_imhtml_append_text_with_images(imhtml, text, options, NULL)
363 * Appends HTML formatted text to a GTK+ IM/HTML.
365 * @param imhtml The GTK+ IM/HTML.
366 * @param text The formatted text to append.
367 * @param options A GtkIMHtmlOptions object indicating insert behavior.
368 * @param unused Use @c NULL value.
370 void gtk_imhtml_append_text_with_images(GtkIMHtml *imhtml,
371 const gchar *text,
372 GtkIMHtmlOptions options,
373 GSList *unused);
376 * Inserts HTML formatted text to a GTK+ IM/HTML at a given iter.
378 * @param imhtml The GTK+ IM/HTML.
379 * @param text The formatted text to append.
380 * @param options A GtkIMHtmlOptions object indicating insert behavior.
381 * @param iter A GtkTextIter in the GTK+ IM/HTML at which to insert text.
383 void gtk_imhtml_insert_html_at_iter(GtkIMHtml *imhtml,
384 const gchar *text,
385 GtkIMHtmlOptions options,
386 GtkTextIter *iter);
389 * Scrolls a GTK+ IM/HTML to the end of its contents.
391 * @param imhtml The GTK+ IM/HTML.
392 * @param smooth A boolean indicating if smooth scrolling should be used.
394 void gtk_imhtml_scroll_to_end(GtkIMHtml *imhtml, gboolean smooth);
397 * Delete the contents of a GTK+ IM/HTML between start and end.
399 * @param imhtml The GTK+ IM/HTML.
400 * @param start a postition in the imhtml's buffer
401 * @param end another postition in the imhtml's buffer
403 void gtk_imhtml_delete(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *end);
406 * Purges the contents from a GTK+ IM/HTML and resets formatting.
408 * @param imhtml The GTK+ IM/HTML.
410 #define gtk_imhtml_clear(imhtml) \
411 gtk_imhtml_delete(imhtml, NULL, NULL)
414 * Scrolls a GTK+ IM/HTML up by one page.
416 * @param imhtml The GTK+ IM/HTML.
418 void gtk_imhtml_page_up(GtkIMHtml *imhtml);
421 * Scrolls a GTK+ IM/HTML down by one page.
423 * @param imhtml The GTK+ IM/HTML.
425 void gtk_imhtml_page_down(GtkIMHtml *imhtml);
428 * Creates and returns an new GTK+ IM/HTML scalable object.
430 * @return A new IM/HTML Scalable object.
432 GtkIMHtmlScalable *gtk_imhtml_scalable_new(void);
435 * Creates and returns a new GTK+ IM/HTML scalable object with an image.
437 * @param img A GdkPixbuf of the image to add.
438 * @param filename The filename to associate with the image.
439 * @param id The id to associate with the image.
441 * @return A new IM/HTML Scalable object with an image.
443 GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename, int id);
446 * Creates and returns a new GTK+ IM/HTML scalable object with an
447 * animated image.
449 * @param img A GdkPixbufAnimation of the image to add.
450 * @param filename The filename to associate with the image.
451 * @param id The id to associate with the image.
453 * @return A new IM/HTML Scalable object with an image.
455 * @since 2.1.0
458 * TODO: All this animation code could be combined much better with
459 * the image code. It couldn't be done when it was written
460 * because it requires breaking backward compatibility. It
461 * would be good to do it for 3.0.0.
463 GtkIMHtmlScalable *gtk_imhtml_animation_new(GdkPixbufAnimation *img, const gchar *filename, int id);
466 * Destroys and frees a GTK+ IM/HTML scalable image.
468 * @param scale The GTK+ IM/HTML scalable.
470 /* TODO: Is there any reason this isn't private? */
471 void gtk_imhtml_image_free(GtkIMHtmlScalable *scale);
474 * Destroys and frees a GTK+ IM/HTML scalable animation.
476 * @param scale The GTK+ IM/HTML scalable.
478 /* TODO: Is there any reason this isn't private? */
479 void gtk_imhtml_animation_free(GtkIMHtmlScalable *scale);
482 * Rescales a GTK+ IM/HTML scalable image to a given size.
484 * @param scale The GTK+ IM/HTML scalable.
485 * @param width The new width.
486 * @param height The new height.
488 /* TODO: Is there any reason this isn't private? */
489 void gtk_imhtml_image_scale(GtkIMHtmlScalable *scale, int width, int height);
492 * Adds a GTK+ IM/HTML scalable image to a given GTK+ IM/HTML at a given iter.
494 * @param scale The GTK+ IM/HTML scalable.
495 * @param imhtml The GTK+ IM/HTML.
496 * @param iter The GtkTextIter at which to add the scalable.
498 /* TODO: Is there any reason this isn't private? */
499 void gtk_imhtml_image_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTextIter *iter);
502 * Creates and returns an new GTK+ IM/HTML scalable with a horizontal rule.
504 * @return A new IM/HTML Scalable object with an image.
506 GtkIMHtmlScalable *gtk_imhtml_hr_new(void);
509 * Destroys and frees a GTK+ IM/HTML scalable horizontal rule.
511 * @param scale The GTK+ IM/HTML scalable.
513 void gtk_imhtml_hr_free(GtkIMHtmlScalable *scale);
516 * Rescales a GTK+ IM/HTML scalable horizontal rule to a given size.
518 * @param scale The GTK+ IM/HTML scalable.
519 * @param width The new width.
520 * @param height The new height.
522 void gtk_imhtml_hr_scale(GtkIMHtmlScalable *scale, int width, int height);
525 * Adds a GTK+ IM/HTML scalable horizontal rule to a given GTK+ IM/HTML at
526 * a given iter.
528 * @param scale The GTK+ IM/HTML scalable.
529 * @param imhtml The GTK+ IM/HTML.
530 * @param iter The GtkTextIter at which to add the scalable.
532 void gtk_imhtml_hr_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTextIter *iter);
535 * Finds and highlights a given string in a GTK+ IM/HTML.
537 * @param imhtml The GTK+ IM/HTML.
538 * @param text The string to search for.
540 * @return @c TRUE if a search was performed, or @c FALSE if not.
542 gboolean gtk_imhtml_search_find(GtkIMHtml *imhtml, const gchar *text);
545 * Clears the highlighting from a prior search in a GTK+ IM/HTML.
547 * @param imhtml The GTK+ IM/HTML.
549 void gtk_imhtml_search_clear(GtkIMHtml *imhtml);
552 * Enables or disables editing in a GTK+ IM/HTML.
554 * @param imhtml The GTK+ IM/HTML.
555 * @param editable @c TRUE to make the widget editable, or @c FALSE otherwise.
557 void gtk_imhtml_set_editable(GtkIMHtml *imhtml, gboolean editable);
560 * Enables or disables whole buffer formatting only (wbfo) in a GTK+ IM/HTML.
561 * In this mode formatting options to the buffer take effect for the entire
562 * buffer instead of specific text.
564 * @param imhtml The GTK+ IM/HTML.
565 * @param wbfo @c TRUE to enable the mode, or @c FALSE otherwise.
567 void gtk_imhtml_set_whole_buffer_formatting_only(GtkIMHtml *imhtml, gboolean wbfo);
570 * Indicates which formatting functions to enable and disable in a GTK+ IM/HTML.
572 * @param imhtml The GTK+ IM/HTML.
573 * @param buttons A GtkIMHtmlButtons bitmask indicating which functions to use.
575 void gtk_imhtml_set_format_functions(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons);
578 * Returns which formatting functions are enabled in a GTK+ IM/HTML.
580 * @param imhtml The GTK+ IM/HTML.
582 * @return A GtkIMHtmlButtons bitmask indicating which functions to are enabled.
584 GtkIMHtmlButtons gtk_imhtml_get_format_functions(GtkIMHtml *imhtml);
587 * Sets each boolean to @c TRUE or @c FALSE to indicate if that formatting option
588 * is enabled at the current position in a GTK+ IM/HTML.
590 * @param imhtml The GTK+ IM/HTML.
591 * @param bold The boolean to set for bold or @c NULL.
592 * @param italic The boolean to set for italic or @c NULL.
593 * @param underline The boolean to set for underline or @c NULL.
595 void gtk_imhtml_get_current_format(GtkIMHtml *imhtml, gboolean *bold, gboolean *italic, gboolean *underline);
598 * Returns a string containing the selected font face at the current position
599 * in a GTK+ IM/HTML.
601 * @param imhtml The GTK+ IM/HTML.
603 * @return A string containg the font face or @c NULL if none is set.
605 char *gtk_imhtml_get_current_fontface(GtkIMHtml *imhtml);
608 * Returns a string containing the selected foreground color at the current
609 * position in a GTK+ IM/HTML.
611 * @param imhtml The GTK+ IM/HTML.
613 * @return A string containg the foreground color or @c NULL if none is set.
615 char *gtk_imhtml_get_current_forecolor(GtkIMHtml *imhtml);
618 * Returns a string containing the selected font background color at the current
619 * position in a GTK+ IM/HTML.
621 * @param imhtml The GTK+ IM/HTML.
623 * @return A string containg the font background color or @c NULL if none is set.
625 char *gtk_imhtml_get_current_backcolor(GtkIMHtml *imhtml);
628 * Returns a string containing the selected background color at the current
629 * position in a GTK+ IM/HTML.
631 * @param imhtml The GTK+ IM/HTML.
633 * @return A string containg the background color or @c NULL if none is set.
635 char *gtk_imhtml_get_current_background(GtkIMHtml *imhtml);
638 * Returns a integer containing the selected HTML font size at the current
639 * position in a GTK+ IM/HTML.
641 * @param imhtml The GTK+ IM/HTML.
643 * @return The HTML font size.
645 gint gtk_imhtml_get_current_fontsize(GtkIMHtml *imhtml);
648 * Checks whether a GTK+ IM/HTML is marked as editable.
650 * @param imhtml The GTK+ IM/HTML.
652 * @return @c TRUE if the IM/HTML is editable, or @c FALSE otherwise.
654 gboolean gtk_imhtml_get_editable(GtkIMHtml *imhtml);
657 * Clear all the formatting on a GTK+ IM/HTML.
659 * @param imhtml The GTK+ IM/HTML.
661 void gtk_imhtml_clear_formatting(GtkIMHtml *imhtml);
664 * Toggles bold at the cursor location or selection in a GTK+ IM/HTML.
666 * @param imhtml The GTK+ IM/HTML.
668 void gtk_imhtml_toggle_bold(GtkIMHtml *imhtml);
671 * Toggles italic at the cursor location or selection in a GTK+ IM/HTML.
673 * @param imhtml The GTK+ IM/HTML.
675 void gtk_imhtml_toggle_italic(GtkIMHtml *imhtml);
678 * Toggles underline at the cursor location or selection in a GTK+ IM/HTML.
680 * @param imhtml The GTK+ IM/HTML.
682 void gtk_imhtml_toggle_underline(GtkIMHtml *imhtml);
685 * Toggles strikethrough at the cursor location or selection in a GTK+ IM/HTML.
687 * @param imhtml The GTK+ IM/HTML.
689 void gtk_imhtml_toggle_strike(GtkIMHtml *imhtml);
692 * Toggles a foreground color at the current location or selection in a GTK
693 * IM/HTML.
695 * @param imhtml The GTK+ IM/HTML.
696 * @param color The HTML-style color, or @c NULL or "" to clear the color.
698 * @return @c TRUE if a color was set, or @c FALSE if it was cleared.
700 gboolean gtk_imhtml_toggle_forecolor(GtkIMHtml *imhtml, const char *color);
703 * Toggles a background color at the current location or selection in a GTK
704 * IM/HTML.
706 * @param imhtml The GTK+ IM/HTML.
707 * @param color The HTML-style color, or @c NULL or "" to clear the color.
709 * @return @c TRUE if a color was set, or @c FALSE if it was cleared.
711 gboolean gtk_imhtml_toggle_backcolor(GtkIMHtml *imhtml, const char *color);
714 * Toggles a background color at the current location or selection in a GTK
715 * IM/HTML.
717 * @param imhtml The GTK+ IM/HTML.
718 * @param color The HTML-style color, or @c NULL or "" to clear the color.
720 * @return @c TRUE if a color was set, or @c FALSE if it was cleared.
722 gboolean gtk_imhtml_toggle_background(GtkIMHtml *imhtml, const char *color);
725 * Toggles a font face at the current location or selection in a GTK+ IM/HTML.
727 * @param imhtml The GTK+ IM/HTML.
728 * @param face The font face name, or @c NULL or "" to clear the font.
730 * @return @c TRUE if a font name was set, or @c FALSE if it was cleared.
732 gboolean gtk_imhtml_toggle_fontface(GtkIMHtml *imhtml, const char *face);
735 * Toggles a link tag with the given URL at the current location or selection
736 * in a GTK+ IM/HTML.
738 * @param imhtml The GTK+ IM/HTML.
739 * @param url The URL for the link or @c NULL to terminate the link.
741 void gtk_imhtml_toggle_link(GtkIMHtml *imhtml, const char *url);
744 * Inserts a link to the given url at the given GtkTextMark in a GTK+ IM/HTML.
746 * @param imhtml The GTK+ IM/HTML.
747 * @param mark The GtkTextMark to insert the link at.
748 * @param url The URL for the link.
749 * @param text The string to use for the link description.
751 void gtk_imhtml_insert_link(GtkIMHtml *imhtml, GtkTextMark *mark, const char *url, const char *text);
754 * Inserts a smiley at the current location or selection in a GTK+ IM/HTML.
756 * @param imhtml The GTK+ IM/HTML.
757 * @param sml The category of the smiley.
758 * @param smiley The text of the smiley to insert.
760 void gtk_imhtml_insert_smiley(GtkIMHtml *imhtml, const char *sml, char *smiley);
762 * Inserts a smiley at the given iter in a GTK+ IM/HTML.
764 * @param imhtml The GTK+ IM/HTML.
765 * @param sml The category of the smiley.
766 * @param smiley The text of the smiley to insert.
767 * @param iter The GtkTextIter in the IM/HTML to insert the smiley at.
769 void gtk_imhtml_insert_smiley_at_iter(GtkIMHtml *imhtml, const char *sml, char *smiley, GtkTextIter *iter);
772 * Inserts the IM/HTML scalable image with the given id at the given iter in a
773 * GTK+ IM/HTML.
775 * @param imhtml The GTK+ IM/HTML.
776 * @param id The id of the IM/HTML scalable.
777 * @param iter The GtkTextIter in the IM/HTML to insert the image at.
779 void gtk_imhtml_insert_image_at_iter(GtkIMHtml *imhtml, int id, GtkTextIter *iter);
782 * Sets the font size at the current location or selection in a GTK+ IM/HTML.
784 * @param imhtml The GTK+ IM/HTML.
785 * @param size The HTML font size to use.
787 void gtk_imhtml_font_set_size(GtkIMHtml *imhtml, gint size);
790 * Decreases the font size by 1 at the current location or selection in a GTK
791 * IM/HTML.
793 * @param imhtml The GTK+ IM/HTML.
795 void gtk_imhtml_font_shrink(GtkIMHtml *imhtml);
798 * Increases the font size by 1 at the current location or selection in a GTK
799 * IM/HTML.
801 * @param imhtml The GTK+ IM/HTML.
803 void gtk_imhtml_font_grow(GtkIMHtml *imhtml);
806 * Returns the HTML formatted contents between two iters in a GTK+ IM/HTML.
808 * @param imhtml The GTK+ IM/HTML.
809 * @param start The GtkTextIter indicating the start point in the IM/HTML.
810 * @param end The GtkTextIter indicating the end point in the IM/HTML.
812 * @return A string containing the HTML formatted text.
814 char *gtk_imhtml_get_markup_range(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *end);
817 * Returns the entire HTML formatted contents of a GTK+ IM/HTML.
819 * @param imhtml The GTK+ IM/HTML.
821 * @return A string containing the HTML formatted text.
823 char *gtk_imhtml_get_markup(GtkIMHtml *imhtml);
826 * Returns a null terminated array of pointers to null terminated strings, each
827 * string for each line. g_strfreev() should be called to free it when done.
829 * @param imhtml The GTK+ IM/HTML.
831 * @return A null terminated array of null terminated HTML formatted strings.
833 char **gtk_imhtml_get_markup_lines(GtkIMHtml *imhtml);
836 * Returns the entire unformatted (plain text) contents of a GTK+ IM/HTML
837 * between two iters in a GTK+ IM/HTML.
839 * @param imhtml The GTK+ IM/HTML.
840 * @param start The GtkTextIter indicating the start point in the IM/HTML.
841 * @param stop The GtkTextIter indicating the end point in the IM/HTML.
843 * @return A string containing the unformatted text.
845 char *gtk_imhtml_get_text(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *stop);
848 * Setup formatting for an imhtml depending on the flags specified.
850 * @param imhtml The GTK+ IM/HTML.
851 * @param flags The connection flag which describes the allowed types of formatting.
853 * @since 2.1.0
855 void gtk_imhtml_setup_entry(GtkIMHtml *imhtml, PurpleConnectionFlags flags);
858 * Create a new GtkIMHtmlSmiley.
860 * @param file The image file for the smiley
861 * @param shortcut The key shortcut for the smiley
862 * @param hide @c TRUE if the smiley should be hidden in the smiley dialog, @c FALSE otherwise
863 * @param flags The smiley flags
865 * @return The newly created smiley
866 * @since 2.5.0
868 GtkIMHtmlSmiley *gtk_imhtml_smiley_create(const char *file, const char *shortcut, gboolean hide,
869 GtkIMHtmlSmileyFlags flags);
872 * Reload the image data for the smiley.
874 * @param smiley The smiley to reload
876 * @since 2.5.0
878 void gtk_imhtml_smiley_reload(GtkIMHtmlSmiley *smiley);
881 * Destroy a GtkIMHtmlSmiley.
883 * @param smiley The smiley to destroy
885 * @since 2.5.0
887 void gtk_imhtml_smiley_destroy(GtkIMHtmlSmiley *smiley);
888 /*@}*/
890 #ifdef __cplusplus
892 #endif
894 #endif /* _PIDGINIMHTML_H_ */