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