Fri, 08 Nov 2002 06:10:35 +0000
[gaim-migrate @ 4094]
This is gtkimhtml2--it's a subclass of gtktextview. It's not done yet. It doesn't
do smileys or images, and what it does do so far, it doesn't do perfectly. But it's
perfectly 100% usable, and like 80,000 times faster than gtkimhtml + Pango.
| 1428 | 1 | /* |
| 2 | * GtkIMHtml | |
| 3 | * | |
| 4 | * Copyright (C) 2000, Eric Warmenhoven <warmenhoven@yahoo.com> | |
| 5 | * | |
| 6 | * This program is free software; you can redistribute it and/or modify | |
| 7 | * under the terms of the GNU General Public License as published by | |
| 8 | * the Free Software Foundation; either version 2 of the License, or | |
| 9 | * (at your option) any later version. | |
| 10 | * | |
| 11 | * This program is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | * GNU General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * along with this program; if not, write to the Free Software | |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 19 | * | |
| 20 | */ | |
| 21 | ||
| 22 | #ifndef __GTK_IMHTML_H | |
| 23 | #define __GTK_IMHTML_H | |
| 24 | ||
| 25 | #include <gdk/gdk.h> | |
| 3922 | 26 | #include <gtk/gtktextview.h> |
| 1428 | 27 | |
| 28 | #ifdef __cplusplus | |
| 29 | extern "C" { | |
| 30 | #endif | |
| 31 | ||
| 32 | #define GTK_TYPE_IMHTML (gtk_imhtml_get_type ()) | |
| 33 | #define GTK_IMHTML(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_IMHTML, GtkIMHtml)) | |
| 34 | #define GTK_IMHTML_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMHTML, GtkIMHtmlClass)) | |
| 35 | #define GTK_IS_IMHTML(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_IMHTML)) | |
| 36 | #define GTK_IS_IMHTML_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMHTML)) | |
| 37 | ||
| 38 | typedef gchar** (*GtkIMHtmlImage) (gchar *url); | |
| 39 | ||
|
2349
9832b57ded64
[gaim-migrate @ 2362]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1780
diff
changeset
|
40 | typedef struct _GtkSmileyTree GtkSmileyTree; |
|
9832b57ded64
[gaim-migrate @ 2362]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1780
diff
changeset
|
41 | |
| 1428 | 42 | typedef struct _GtkIMHtml GtkIMHtml; |
| 43 | typedef struct _GtkIMHtmlClass GtkIMHtmlClass; | |
| 44 | ||
| 45 | struct _GtkIMHtml { | |
| 3922 | 46 | GtkTextView text_view; |
| 47 | GtkTextBuffer *text_buffer; | |
| 48 | GtkTextMark *end; | |
| 49 | gboolean comments, smileys; | |
| 1428 | 50 | GdkCursor *hand_cursor; |
| 51 | GdkCursor *arrow_cursor; | |
| 52 | }; | |
| 53 | ||
| 54 | struct _GtkIMHtmlClass { | |
| 3922 | 55 | GtkTextViewClass parent_class; |
| 1428 | 56 | |
| 57 | void (*url_clicked) (GtkIMHtml *, const gchar *); | |
| 58 | }; | |
| 59 | ||
| 60 | typedef enum | |
| 61 | { | |
| 62 | GTK_IMHTML_NO_COLOURS = 1 << 0, | |
| 63 | GTK_IMHTML_NO_FONTS = 1 << 1, | |
| 64 | GTK_IMHTML_NO_COMMENTS = 1 << 2, | |
| 65 | GTK_IMHTML_NO_TITLE = 1 << 3, | |
| 66 | GTK_IMHTML_NO_NEWLINE = 1 << 4, | |
| 67 | GTK_IMHTML_NO_SIZES = 1 << 5, | |
| 68 | GTK_IMHTML_NO_SCROLL = 1 << 6, | |
| 69 | GTK_IMHTML_RETURN_LOG = 1 << 7 | |
| 70 | } GtkIMHtmlOptions; | |
| 71 | ||
| 72 | GtkType gtk_imhtml_get_type (void); | |
| 3922 | 73 | GtkWidget* gtk_imhtml_new (void *, void *); |
| 1428 | 74 | |
| 75 | void gtk_imhtml_set_adjustments (GtkIMHtml *imhtml, | |
| 76 | GtkAdjustment *hadj, | |
| 77 | GtkAdjustment *vadj); | |
| 78 | ||
| 3466 | 79 | void gtk_imhtml_set_defaults (GtkIMHtml *imhtml, |
|
3608
118d0fce78e4
[gaim-migrate @ 3721]
Christian Hammond <chipx86@chipx86.com>
parents:
3466
diff
changeset
|
80 | PangoFontDescription *font, |
| 3466 | 81 | GdkColor *fg_color, |
| 82 | GdkColor *bg_color); | |
| 1428 | 83 | |
| 84 | void gtk_imhtml_set_img_handler (GtkIMHtml *imhtml, | |
| 85 | GtkIMHtmlImage handler); | |
| 86 | ||
| 87 | void gtk_imhtml_associate_smiley (GtkIMHtml *imhtml, | |
| 88 | gchar *text, | |
| 89 | gchar **xpm); | |
| 90 | ||
| 3159 | 91 | void gtk_imhtml_init_smileys (GtkIMHtml *imhtml); |
| 3050 | 92 | |
|
2728
7c6a594a70a0
[gaim-migrate @ 2741]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2363
diff
changeset
|
93 | void gtk_imhtml_remove_smileys (GtkIMHtml *imhtml); |
|
7c6a594a70a0
[gaim-migrate @ 2741]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2363
diff
changeset
|
94 | |
| 3050 | 95 | void gtk_imhtml_reset_smileys (GtkIMHtml *imhtml); |
| 96 | ||
| 1428 | 97 | void gtk_imhtml_show_smileys (GtkIMHtml *imhtml, |
| 98 | gboolean show); | |
| 99 | ||
| 100 | void gtk_imhtml_show_comments (GtkIMHtml *imhtml, | |
| 101 | gboolean show); | |
| 102 | ||
| 103 | GString* gtk_imhtml_append_text (GtkIMHtml *imhtml, | |
| 104 | const gchar *text, | |
|
2856
046ed5e89321
[gaim-migrate @ 2869]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2728
diff
changeset
|
105 | gint len, |
| 1428 | 106 | GtkIMHtmlOptions options); |
| 107 | ||
|
1780
431333222954
[gaim-migrate @ 1790]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1574
diff
changeset
|
108 | void gtk_imhtml_clear (GtkIMHtml *imhtml); |
|
431333222954
[gaim-migrate @ 1790]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1574
diff
changeset
|
109 | |
|
2363
0767c14d7879
[gaim-migrate @ 2376]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2349
diff
changeset
|
110 | void gtk_imhtml_page_up (GtkIMHtml *imhtml); |
|
0767c14d7879
[gaim-migrate @ 2376]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2349
diff
changeset
|
111 | |
|
0767c14d7879
[gaim-migrate @ 2376]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2349
diff
changeset
|
112 | void gtk_imhtml_page_down (GtkIMHtml *imhtml); |
| 3867 | 113 | void gtk_imhtml_to_bottom (GtkIMHtml *imhtml); |
|
2363
0767c14d7879
[gaim-migrate @ 2376]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2349
diff
changeset
|
114 | |
| 1428 | 115 | #ifdef __cplusplus |
| 116 | } | |
| 117 | #endif | |
| 118 | ||
| 119 | #endif |