Mercurial > pidgin
annotate src/gtkimhtml.h @ 9166:1e51236d825e
[gaim-migrate @ 9951]
This removes some stuff for im image that isn't used anymore.
Basicly one of the things I did when i brought it back, was to make it so
the host widget doesn't have to do any special handling for its imhtml to
support <img id="###"> tags. And while this goal was achieved in 0.78,
there's still code all over the place that checks flags that aren't used
and iterates over lists that will always be empty. This doesn't remove all
of it, but removes some of it anyway.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Wed, 02 Jun 2004 05:08:49 +0000 |
parents | 812e7aa7eafa |
children | f2e75dd2971a |
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; |
5967 | 173 }; |
4895 | 174 |
5967 | 175 struct _GtkIMHtmlHr { |
4895 | 176 GtkIMHtmlScalable scalable; |
177 GtkWidget *sep; | |
5967 | 178 }; |
179 | |
180 typedef enum { | |
181 GTK_IMHTML_NO_COLOURS = 1 << 0, | |
182 GTK_IMHTML_NO_FONTS = 1 << 1, | |
8105 | 183 GTK_IMHTML_NO_COMMENTS = 1 << 2, /* Remove */ |
5967 | 184 GTK_IMHTML_NO_TITLE = 1 << 3, |
185 GTK_IMHTML_NO_NEWLINE = 1 << 4, | |
186 GTK_IMHTML_NO_SIZES = 1 << 5, | |
187 GTK_IMHTML_NO_SCROLL = 1 << 6, | |
188 GTK_IMHTML_RETURN_LOG = 1 << 7, | |
189 GTK_IMHTML_USE_POINTSIZE = 1 << 8 | |
190 } GtkIMHtmlOptions; | |
191 | |
8962 | 192 typedef gpointer (*GtkIMHtmlGetImageFunc) (int id); |
193 typedef gpointer (*GtkIMHtmlGetImageDataFunc) (gpointer i); | |
194 typedef size_t (*GtkIMHtmlGetImageSizeFunc) (gpointer i); | |
195 typedef const char *(*GtkIMHtmlGetImageFilenameFunc)(gpointer i); | |
196 typedef void (*GtkIMHtmlImageRefFunc) (int id); | |
197 typedef void (*GtkIMHtmlImageUnrefFunc) (int id); | |
198 | |
199 struct _GtkIMHtmlFuncs { | |
200 GtkIMHtmlGetImageFunc image_get; | |
201 GtkIMHtmlGetImageDataFunc image_get_data; | |
202 GtkIMHtmlGetImageSizeFunc image_get_size; | |
203 GtkIMHtmlGetImageFilenameFunc image_get_filename; | |
204 GtkIMHtmlImageRefFunc image_ref; | |
205 GtkIMHtmlImageUnrefFunc image_unref; | |
206 }; | |
207 | |
9033 | 208 /*@}*/ |
8962 | 209 |
9033 | 210 /************************************************************************** |
211 * @name GTK+ IM/HTML rendering component API | |
212 **************************************************************************/ | |
213 /*@{*/ | |
214 | |
215 /** | |
9037 | 216 * Returns the GType object for an IM/HTML widget. |
9033 | 217 * |
9037 | 218 * @return The GType for an IM/HTML widget. |
9033 | 219 */ |
9037 | 220 GType gtk_imhtml_get_type(void); |
5967 | 221 |
9033 | 222 /** |
223 * Creates and returns a new GTK IM/HTML widget. | |
224 * | |
225 * @return The GTK IM/HTML widget created. | |
226 */ | |
227 GtkWidget *gtk_imhtml_new(void *, void *); | |
5967 | 228 |
9033 | 229 /** |
230 * Associates a smiley with a GTK IM/HTML. | |
231 * | |
232 * @param imhtml The GTK IM/HTML. | |
233 * @param sml The name of the smiley category. | |
234 * @param smiley The GtkIMSmiley to associate. | |
235 */ | |
236 void gtk_imhtml_associate_smiley(GtkIMHtml *imhtml, gchar *sml, GtkIMHtmlSmiley *smiley); | |
237 | |
238 /** | |
239 * Removes all smileys associated with a GTK IM/HTML. | |
240 * | |
241 * @param imhtml The GTK IM/HTML. | |
242 */ | |
243 void gtk_imhtml_remove_smileys(GtkIMHtml *imhtml); | |
5967 | 244 |
9033 | 245 /** |
246 * Sets the function callbacks to use with a GTK IM/HTML instance. | |
247 * | |
248 * @param imhtml The GTK IM/HTML. | |
249 * @param f The GtkIMHTMLFuncs struct containing the functions to use. | |
250 */ | |
251 void gtk_imhtml_set_funcs(GtkIMHtml *imhtml, GtkIMHtmlFuncs *f); | |
5967 | 252 |
9033 | 253 /** |
254 * Enables or disables showing the contents of HTML comments in a GTK IM/HTML. | |
255 * | |
256 * @param imhtml The GTK IM/HTML. | |
257 * @param show @c TRUE if comments should be shown, or @c FALSE otherwise. | |
258 */ | |
259 void gtk_imhtml_show_comments(GtkIMHtml *imhtml, gboolean show); | |
8962 | 260 |
9033 | 261 /** |
262 * Enables or disables formatting shortcut keys in a GTK IM/HTML. | |
263 * | |
264 * @param imhtml The GTK IM/HTML. | |
265 * @param allow @c TRUE if shortcut keys are allowed, or @c FALSE otherwise. | |
266 */ | |
267 void gtk_imhtml_html_shortcuts(GtkIMHtml *imhtml, gboolean allow); | |
5967 | 268 |
9033 | 269 /** |
270 * Enables or disables smiley insertion shortcut keys in a GTK IM/HTML. | |
271 * | |
272 * @param imhtml The GTK IM/HTML. | |
273 * @param allow @c TRUE if shortcut keys are allowed, or @c FALSE otherwise. | |
274 */ | |
275 void gtk_imhtml_smiley_shortcuts(GtkIMHtml *imhtml, gboolean allow); | |
8456 | 276 |
9033 | 277 /** |
278 * Associates a protocol name with a GTK IM/HTML. | |
279 * | |
280 * @param imhtml The GTK IM/HTML. | |
281 * @param protocol_name The protocol name to associate with the IM/HTML. | |
282 */ | |
283 void gtk_imhtml_set_protocol_name(GtkIMHtml *imhtml, const gchar *protocol_name); | |
8456 | 284 |
9033 | 285 /** |
286 * Appends HTML formatted text to a GTK IM/HTML. | |
287 * | |
288 * @param imhtml The GTK IM/HTML. | |
289 * @param text The formatted text to append. | |
290 * @param options A GtkIMHtmlOptions object indicating insert behavior. | |
291 */ | |
292 #define gtk_imhtml_append_text(x, y, z) \ | |
6982 | 293 gtk_imhtml_append_text_with_images(x, y, z, NULL) |
294 | |
9033 | 295 /** |
296 * Appends HTML formatted text to a GTK IM/HTML. | |
297 * | |
298 * @param imhtml The GTK IM/HTML. | |
299 * @param text The formatted text to append. | |
300 * @param options A GtkIMHtmlOptions object indicating insert behavior. | |
301 * @param unused Use NULL value. | |
302 */ | |
303 void gtk_imhtml_append_text_with_images(GtkIMHtml *imhtml, | |
304 const gchar *text, | |
305 GtkIMHtmlOptions options, | |
306 GSList *unused); | |
307 | |
308 /** | |
309 * Inserts HTML formatted text to a GTK IM/HTML at a given iter. | |
310 * | |
311 * @param imhtml The GTK IM/HTML. | |
312 * @param text The formatted text to append. | |
313 * @param options A GtkIMHtmlOptions object indicating insert behavior. | |
314 * @param iter A GtkTextIter in the GTK IM/HTML at which to insert text. | |
315 */ | |
8677 | 316 void gtk_imhtml_insert_html_at_iter(GtkIMHtml *imhtml, |
317 const gchar *text, | |
318 GtkIMHtmlOptions options, | |
319 GtkTextIter *iter); | |
9033 | 320 |
321 /** | |
322 * Scrolls a GTK IM/HTML to the end of its contents. | |
323 * | |
324 * @param imhtml The GTK IM/HTML. | |
325 */ | |
8729 | 326 void gtk_imhtml_scroll_to_end(GtkIMHtml *imhtml); |
9033 | 327 |
328 /** | |
329 * Purges the contents from a GTK IM/HTML and resets formatting. | |
330 * | |
331 * @param imhtml The GTK IM/HTML. | |
332 */ | |
333 void gtk_imhtml_clear(GtkIMHtml *imhtml); | |
4895 | 334 |
9033 | 335 /** |
336 * Scrolls a GTK IM/HTML up by one page. | |
337 * | |
338 * @param imhtml The GTK IM/HTML. | |
339 */ | |
340 void gtk_imhtml_page_up(GtkIMHtml *imhtml); | |
341 | |
342 /** | |
343 * Scrolls a GTK IM/HTML down by one page. | |
344 * | |
345 * @param imhtml The GTK IM/HTML. | |
346 */ | |
347 void gtk_imhtml_page_down(GtkIMHtml *imhtml); | |
348 | |
349 /** | |
350 * Scales the font sizes in a GTK IM/HTML by a given factor. | |
351 * | |
352 * @param imhtml The GTK IM/HTML. | |
353 * @param zoom The factor by which to scale the font sizes. | |
354 */ | |
8740
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
355 void gtk_imhtml_font_zoom(GtkIMHtml *imhtml, double zoom); |
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
356 |
9033 | 357 /** |
358 * Creates and returns an new GTK IM/HTML scalable object. | |
359 * | |
360 * @return A new IM/HTML Scalable object. | |
361 */ | |
4895 | 362 GtkIMHtmlScalable *gtk_imhtml_scalable_new(); |
9033 | 363 |
364 /** | |
365 * Creates and returns an new GTK IM/HTML scalable object with an image. | |
366 * | |
367 * @param img A GdkPixbuf of the image to add. | |
368 * @param filename The filename to associate with the image. | |
369 * @param id The id to associate with the image. | |
370 * | |
371 * @return A new IM/HTML Scalable object with an image. | |
372 */ | |
8962 | 373 GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename, int id); |
9033 | 374 |
375 /** | |
376 * Destroys and frees a GTK IM/HTML scalable image. | |
377 * | |
378 * @param scale The GTK IM/HTML scalable. | |
379 */ | |
380 void gtk_imhtml_image_free(GtkIMHtmlScalable *scale); | |
4895 | 381 |
9033 | 382 /** |
383 * Rescales a GTK IM/HTML scalable image to a given size. | |
384 * | |
385 * @param scale The GTK IM/HTML scalable. | |
386 * @param width The new width. | |
387 * @param height The new height. | |
388 */ | |
389 void gtk_imhtml_image_scale(GtkIMHtmlScalable *scale, int width, int height); | |
390 | |
391 /** | |
392 * Adds a GTK IM/HTML scalable image to a given GTK IM/HTML at a given iter. | |
393 * | |
394 * @param scale The GTK IM/HTML scalable. | |
395 * @param imhtml The GTK IM/HTML. | |
396 * @param iter The GtkTextIter at which to add the scalable. | |
397 */ | |
398 void gtk_imhtml_image_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTextIter *iter); | |
399 | |
400 /** | |
401 * Creates and returns an new GTK IM/HTML scalable with a horizontal rule. | |
402 * | |
403 * @return A new IM/HTML Scalable object with an image. | |
404 */ | |
5967 | 405 GtkIMHtmlScalable *gtk_imhtml_hr_new(); |
9033 | 406 |
407 /** | |
408 * Destroys and frees a GTK IM/HTML scalable horizontal rule. | |
409 * | |
410 * @param scale The GTK IM/HTML scalable. | |
411 */ | |
9034 | 412 void gtk_imhtml_hr_free(GtkIMHtmlScalable *scale); |
9033 | 413 |
414 /** | |
415 * Rescales a GTK IM/HTML scalable horizontal rule to a given size. | |
416 * | |
417 * @param scale The GTK IM/HTML scalable. | |
418 * @param width The new width. | |
419 * @param height The new height. | |
420 */ | |
9034 | 421 void gtk_imhtml_hr_scale(GtkIMHtmlScalable *scale, int width, int height); |
4895 | 422 |
9033 | 423 /** |
424 * Adds a GTK IM/HTML scalable horizontal rule to a given GTK IM/HTML at | |
425 * a given iter. | |
426 * | |
427 * @param scale The GTK IM/HTML scalable. | |
428 * @param imhtml The GTK IM/HTML. | |
429 * @param iter The GtkTextIter at which to add the scalable. | |
430 */ | |
9034 | 431 void gtk_imhtml_hr_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *, GtkTextIter *); |
9033 | 432 |
433 /** | |
434 * Finds and highlights a given string in a GTK IM/HTML. | |
435 * | |
436 * @param imhtml The GTK IM/HTML. | |
437 * @param text The string to search for. | |
438 * | |
439 * @return @c TRUE if a search was performed, or @c FALSE if not. | |
440 */ | |
7295 | 441 gboolean gtk_imhtml_search_find(GtkIMHtml *imhtml, const gchar *text); |
9033 | 442 |
443 /** | |
444 * Clears the highlighting from a prior search in a GTK IM/HTML. | |
445 * | |
446 * @param imhtml The GTK IM/HTML. | |
447 */ | |
7295 | 448 void gtk_imhtml_search_clear(GtkIMHtml *imhtml); |
4895 | 449 |
9033 | 450 /** |
451 * Enables or disables editing in a GTK IM/HTML. | |
452 * | |
453 * @param imhtml The GTK IM/HTML. | |
454 * @param editable @c TRUE to make the widget editable, or @c FALSE otherwise. | |
455 */ | |
8061 | 456 void gtk_imhtml_set_editable(GtkIMHtml *imhtml, gboolean editable); |
9033 | 457 |
458 /** | |
459 * Enables or disables whole buffer formatting only (wbfo) in a GTK IM/HTML. | |
460 * In this mode formatting options to the buffer take effect for the entire | |
461 * buffer instead of specific text. | |
462 * | |
463 * @param imhtml The GTK IM/HTML. | |
464 * @param wbfo @c TRUE to enable the mode, or @c FALSE otherwise. | |
465 */ | |
8677 | 466 void gtk_imhtml_set_whole_buffer_formatting_only(GtkIMHtml *imhtml, gboolean wbfo); |
9033 | 467 |
468 /** | |
469 * Indicates which formatting fuctions to enable and disable in a GTK IM/HTML. | |
470 * | |
471 * @param imhtml The GTK IM/HTML. | |
472 * @param buttons A GtkIMHtmlButtons bitmask indicating which fuctions to use. | |
473 */ | |
8420 | 474 void gtk_imhtml_set_format_functions(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons); |
9033 | 475 |
476 /** | |
477 * Returns which formatting fuctions are enabled in a GTK IM/HTML. | |
478 * | |
479 * @param imhtml The GTK IM/HTML. | |
480 * | |
481 * @return A GtkIMHtmlButtons bitmask indicating which fuctions to are enabled. | |
482 */ | |
8788 | 483 GtkIMHtmlButtons gtk_imhtml_get_format_functions(GtkIMHtml *imhtml); |
9033 | 484 |
485 /** | |
486 * Sets each boolean to TRUE if that formatting option is enabled at the | |
487 * current position in a GTK IM/HTML. | |
488 * | |
489 * @param imhtml The GTK IM/HTML. | |
490 * @param bold A reference to a boolean for bold. | |
491 * @param italic A reference to a boolean for italic. | |
492 * @param underline A reference to a boolean for underline. | |
493 */ | |
8516 | 494 void gtk_imhtml_get_current_format(GtkIMHtml *imhtml, gboolean *bold, gboolean *italic, gboolean *underline); |
9033 | 495 |
496 /** | |
497 * Returns a string containing the selected font face at the current position | |
498 * in a GTK IM/HTML. | |
499 * | |
500 * @param imhtml The GTK IM/HTML. | |
501 * | |
502 * @return A string containg the font face or @c NULL if none is set. | |
503 */ | |
9025 | 504 char *gtk_imhtml_get_current_fontface(GtkIMHtml *imhtml); |
9033 | 505 |
506 /** | |
507 * Returns a string containing the selected foreground color at the current | |
508 * position in a GTK IM/HTML. | |
509 * | |
510 * @param imhtml The GTK IM/HTML. | |
511 * | |
512 * @return A string containg the foreground color or @c NULL if none is set. | |
513 */ | |
9025 | 514 char *gtk_imhtml_get_current_forecolor(GtkIMHtml *imhtml); |
9033 | 515 |
516 /** | |
517 * Returns a string containing the selected background color at the current | |
518 * position in a GTK IM/HTML. | |
519 * | |
520 * @param imhtml The GTK IM/HTML. | |
521 * | |
522 * @return A string containg the background color or @c NULL if none is set. | |
523 */ | |
9025 | 524 char *gtk_imhtml_get_current_backcolor(GtkIMHtml *imhtml); |
9033 | 525 |
526 /** | |
527 * Returns a integer containing the selected HTML font size at the current | |
528 * position in a GTK IM/HTML. | |
529 * | |
530 * @param imhtml The GTK IM/HTML. | |
531 * | |
532 * @return The HTML font size. | |
533 */ | |
9025 | 534 gint gtk_imhtml_get_current_fontsize(GtkIMHtml *imhtml); |
9033 | 535 |
536 /** | |
537 * Checks whether a GTK IM/HTML is marked as editable. | |
538 * | |
539 * @param imhtml The GTK IM/HTML. | |
540 * | |
541 * @return @c TRUE if the IM/HTML is editable, or @c FALSE otherwise. | |
542 */ | |
8061 | 543 gboolean gtk_imhtml_get_editable(GtkIMHtml *imhtml); |
9033 | 544 |
545 /** | |
546 * Toggles bold at the cursor location or selection in a GTK IM/HTML. | |
547 * | |
548 * @param imhtml The GTK IM/HTML. | |
549 * | |
550 * @return @c TRUE if bold was turned on, or @c FALSE if it was turned off. | |
551 */ | |
8061 | 552 gboolean gtk_imhtml_toggle_bold(GtkIMHtml *imhtml); |
9033 | 553 |
554 /** | |
555 * Toggles italic at the cursor location or selection in a GTK IM/HTML. | |
556 * | |
557 * @param imhtml The GTK IM/HTML. | |
558 * | |
559 * @return @c TRUE if italic was turned on, or @c FALSE if it was turned off. | |
560 */ | |
8061 | 561 gboolean gtk_imhtml_toggle_italic(GtkIMHtml *imhtml); |
9033 | 562 |
563 /** | |
564 * Toggles underline at the cursor location or selection in a GTK IM/HTML. | |
565 * | |
566 * @param imhtml The GTK IM/HTML. | |
567 * | |
568 * @return @c TRUE if underline was turned on, or @c FALSE if it was turned off. | |
569 */ | |
8061 | 570 gboolean gtk_imhtml_toggle_underline(GtkIMHtml *imhtml); |
9033 | 571 |
572 /** | |
573 * Toggles a foreground color at the current location or selection in a GTK | |
574 * IM/HTML. | |
575 * | |
576 * @param imhtml The GTK IM/HTML. | |
577 * @param color The HTML-style color, or NULL or "" to clear the color. | |
578 * | |
579 * @return @c TRUE if a color was set, or @c FALSE if it was cleared. | |
580 */ | |
8061 | 581 gboolean gtk_imhtml_toggle_forecolor(GtkIMHtml *imhtml, const char *color); |
9033 | 582 |
583 /** | |
584 * Toggles a background color at the current location or selection in a GTK | |
585 * IM/HTML. | |
586 * | |
587 * @param imhtml The GTK IM/HTML. | |
588 * @param color The HTML-style color, or NULL or "" to clear the color. | |
589 * | |
590 * @return @c TRUE if a color was set, or @c FALSE if it was cleared. | |
591 */ | |
8061 | 592 gboolean gtk_imhtml_toggle_backcolor(GtkIMHtml *imhtml, const char *color); |
9033 | 593 |
594 /** | |
595 * Toggles a font face at the current location or selection in a GTK IM/HTML. | |
596 * | |
597 * @param imhtml The GTK IM/HTML. | |
598 * @param face The font face name, or NULL or "" to clear the font. | |
599 * | |
600 * @return @c TRUE if a font name was set, or @c FALSE if it was cleared. | |
601 */ | |
8061 | 602 gboolean gtk_imhtml_toggle_fontface(GtkIMHtml *imhtml, const char *face); |
9033 | 603 |
604 /** | |
605 * Toggles a link tag with the given URL at the current location or selection | |
606 * in a GTK IM/HTML. | |
607 * | |
608 * @param imhtml The GTK IM/HTML. | |
609 * @param url The URL for the link or NULL to terminate the link. | |
610 */ | |
8677 | 611 void gtk_imhtml_toggle_link(GtkIMHtml *imhtml, const char *url); |
9033 | 612 |
613 /** | |
614 * Inserts a link to the given url at the given GtkTextMark in a GTK IM/HTML. | |
615 * | |
616 * @param imhtml The GTK IM/HTML. | |
617 * @param mark The GtkTextMark to insert the link at. | |
618 * @param url The URL for the link. | |
619 * @param text The string to use for the link description. | |
620 */ | |
8677 | 621 void gtk_imhtml_insert_link(GtkIMHtml *imhtml, GtkTextMark *mark, const char *url, const char *text); |
9033 | 622 |
623 /** | |
624 * Inserts a smiley at the current location or selection in a GTK IM/HTML. | |
625 * | |
626 * @param imhtml The GTK IM/HTML. | |
627 * @param sml The category of the smiley. | |
628 * @param smiley The text of the smiley to insert. | |
629 */ | |
8061 | 630 void gtk_imhtml_insert_smiley(GtkIMHtml *imhtml, const char *sml, char *smiley); |
9033 | 631 /** |
632 * Inserts a smiley at the given iter in a GTK IM/HTML. | |
633 * | |
634 * @param imhtml The GTK IM/HTML. | |
635 * @param sml The category of the smiley. | |
636 * @param smiley The text of the smiley to insert. | |
637 * @param iter The GtkTextIter in the IM/HTML to insert the smiley at. | |
638 */ | |
8677 | 639 void gtk_imhtml_insert_smiley_at_iter(GtkIMHtml *imhtml, const char *sml, char *smiley, GtkTextIter *iter); |
9033 | 640 |
641 /** | |
642 * Inserts the IM/HTML scalable image with the given id at the given iter in a | |
643 * GTK IM/HTML. | |
644 * | |
645 * @param imhtml The GTK IM/HTML. | |
646 * @param id The id of the IM/HTML scalable. | |
647 * @param iter The GtkTextIter in the IM/HTML to insert the image at. | |
648 */ | |
8962 | 649 void gtk_imhtml_insert_image_at_iter(GtkIMHtml *imhtml, int id, GtkTextIter *iter); |
9033 | 650 |
651 /** | |
652 * Sets the font size at the current location or selection in a GTK IM/HTML. | |
653 * | |
654 * @param imhtml The GTK IM/HTML. | |
655 * @param size The HTML font size to use. | |
656 */ | |
8061 | 657 void gtk_imhtml_font_set_size(GtkIMHtml *imhtml, gint size); |
9033 | 658 |
659 /** | |
660 * Decreases the font size by 1 at the current location or selection in a GTK | |
661 * IM/HTML. | |
662 * | |
663 * @param imhtml The GTK IM/HTML. | |
664 */ | |
8061 | 665 void gtk_imhtml_font_shrink(GtkIMHtml *imhtml); |
9033 | 666 |
667 /** | |
668 * Increases the font size by 1 at the current location or selection in a GTK | |
669 * IM/HTML. | |
670 * | |
671 * @param imhtml The GTK IM/HTML. | |
672 */ | |
8061 | 673 void gtk_imhtml_font_grow(GtkIMHtml *imhtml); |
9033 | 674 |
675 /** | |
676 * Returns the HTML formatted contents between two iters in a GTK IM/HTML. | |
677 * | |
678 * @param imhtml The GTK IM/HTML. | |
679 * @param start The GtkTextIter indicating the start point in the IM/HTML. | |
680 * @param end The GtkTextIter indicating the end point in the IM/HTML. | |
681 * | |
682 * @return A string containing the HTML formatted text. | |
683 */ | |
8061 | 684 char *gtk_imhtml_get_markup_range(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *end); |
9033 | 685 |
686 /** | |
687 * Returns the entire HTML formatted contents of a GTK IM/HTML. | |
688 * | |
689 * @param imhtml The GTK IM/HTML. | |
690 * | |
691 * @return A string containing the HTML formatted text. | |
692 */ | |
8061 | 693 char *gtk_imhtml_get_markup(GtkIMHtml *imhtml); |
9033 | 694 |
695 /** | |
696 * Returns a null terminated array of pointers to null terminated strings, each | |
697 * string for each line. g_strfreev() should be called to free it when done. | |
698 * | |
699 * @param imhtml The GTK IM/HTML. | |
700 * | |
701 * @return A null terminated array of null terminated HTML formatted strings. | |
702 */ | |
8677 | 703 char **gtk_imhtml_get_markup_lines(GtkIMHtml *imhtml); |
9033 | 704 |
705 /** | |
706 * Returns the entire unformatted (plain text) contents of a GTK IM/HTML | |
707 * between two iters in a GTK IM/HTML. | |
708 * | |
709 * @param imhtml The GTK IM/HTML. | |
710 * @param start The GtkTextIter indicating the start point in the IM/HTML. | |
711 * @param end The GtkTextIter indicating the end point in the IM/HTML. | |
712 * | |
713 * @return A string containing the unformatted text. | |
714 */ | |
8677 | 715 char *gtk_imhtml_get_text(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *stop); |
8061 | 716 |
9033 | 717 /*@}*/ |
718 | |
1428 | 719 #ifdef __cplusplus |
720 } | |
721 #endif | |
722 | |
723 #endif |