home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / include / pidgin / gtkimhtml.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-05-04  |  23.2 KB  |  796 lines

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