Mercurial > pidgin
annotate src/gtkimhtml.h @ 7854:1e8322fc19b5
[gaim-migrate @ 8508]
Merry X-Mas
(My priest uses the term "X-Mas," to refer to the secular celebration that
coincides with Advent, and Christmas to refer to the actual Christmas season
directly after Advent and "X-Mas.")
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sat, 13 Dec 2003 19:34:40 +0000 |
parents | 3db18c16f573 |
children | d9e831876c28 |
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 * |
5 * Copyright (C) 2000, Eric Warmenhoven <warmenhoven@yahoo.com> | |
6 * | |
7 * This program is free software; you can redistribute it and/or modify | |
8 * under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
20 */ | |
21 | |
22 #ifndef __GTK_IMHTML_H | |
23 #define __GTK_IMHTML_H | |
24 | |
25 #include <gdk/gdk.h> | |
3922 | 26 #include <gtk/gtktextview.h> |
4735 | 27 #include <gtk/gtktooltips.h> |
5012 | 28 #include <gtk/gtkimage.h> |
1428 | 29 |
30 #ifdef __cplusplus | |
31 extern "C" { | |
32 #endif | |
33 | |
34 #define GTK_TYPE_IMHTML (gtk_imhtml_get_type ()) | |
35 #define GTK_IMHTML(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_IMHTML, GtkIMHtml)) | |
36 #define GTK_IMHTML_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMHTML, GtkIMHtmlClass)) | |
37 #define GTK_IS_IMHTML(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_IMHTML)) | |
38 #define GTK_IS_IMHTML_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMHTML)) | |
5967 | 39 #define GTK_IMHTML_SCALABLE(obj) ((GtkIMHtmlScalable *)obj) |
1428 | 40 |
5967 | 41 typedef struct _GtkIMHtml GtkIMHtml; |
42 typedef struct _GtkIMHtmlClass GtkIMHtmlClass; | |
43 typedef struct _GtkIMHtmlFontDetail GtkIMHtmlFontDetail; /* The five elements contained in a FONT tag */ | |
44 typedef struct _GtkSmileyTree GtkSmileyTree; | |
45 typedef struct _GtkIMHtmlSmiley GtkIMHtmlSmiley; | |
46 typedef struct _GtkIMHtmlScalable GtkIMHtmlScalable; | |
47 typedef struct _GtkIMHtmlImage GtkIMHtmlImage; | |
48 typedef struct _GtkIMHtmlHr GtkIMHtmlHr; | |
1428 | 49 |
7694 | 50 |
51 typedef struct { | |
52 GtkTextMark *start; | |
53 GtkTextMark *end; | |
54 char *start_tag; | |
55 char *end_tag; | |
56 GtkTextBuffer *buffer; | |
7714 | 57 GtkTextTag *tag; |
7694 | 58 } GtkIMHtmlFormatSpan; |
59 | |
1428 | 60 struct _GtkIMHtml { |
3922 | 61 GtkTextView text_view; |
62 GtkTextBuffer *text_buffer; | |
63 GtkTextMark *end; | |
64 gboolean comments, smileys; | |
1428 | 65 GdkCursor *hand_cursor; |
66 GdkCursor *arrow_cursor; | |
7694 | 67 GdkCursor *text_cursor; |
4032 | 68 GHashTable *smiley_data; |
69 GtkSmileyTree *default_smilies; | |
4254 | 70 |
71 gboolean show_smileys; | |
6124 | 72 gboolean show_comments; |
4735 | 73 |
74 GtkWidget *tip_window; | |
75 char *tip; | |
76 guint tip_timer; | |
4895 | 77 |
78 GList *scalables; | |
4947 | 79 GdkRectangle old_rect; |
7295 | 80 |
81 gchar *search_string; | |
7694 | 82 |
83 gboolean editable; | |
84 struct { | |
85 GtkIMHtmlFormatSpan *bold; | |
86 GtkIMHtmlFormatSpan *italic; | |
87 GtkIMHtmlFormatSpan *underline; | |
7714 | 88 GtkIMHtmlFormatSpan *forecolor; |
89 GtkIMHtmlFormatSpan *backcolor; | |
7717 | 90 GtkIMHtmlFormatSpan *fontface; |
7740 | 91 GtkIMHtmlFormatSpan *sizespan; |
92 int fontsize; | |
7694 | 93 } edit; |
7854 | 94 char *clipboard_string; |
7694 | 95 GList *format_spans; |
1428 | 96 }; |
97 | |
98 struct _GtkIMHtmlClass { | |
3922 | 99 GtkTextViewClass parent_class; |
1428 | 100 |
5967 | 101 void (*url_clicked)(GtkIMHtml *, const gchar *); |
102 }; | |
103 | |
104 struct _GtkIMHtmlFontDetail { | |
105 gushort size; | |
106 gchar *face; | |
107 gchar *fore; | |
108 gchar *back; | |
109 gchar *sml; | |
110 }; | |
111 | |
112 struct _GtkSmileyTree { | |
113 GString *values; | |
114 GtkSmileyTree **children; | |
115 GtkIMHtmlSmiley *image; | |
1428 | 116 }; |
117 | |
4263 | 118 struct _GtkIMHtmlSmiley { |
119 gchar *smile; | |
120 gchar *file; | |
6814
782907a6ae65
[gaim-migrate @ 7354]
Christian Hammond <chipx86@chipx86.com>
parents:
6282
diff
changeset
|
121 GdkPixbufAnimation *icon; |
4263 | 122 gboolean hidden; |
123 }; | |
124 | |
5967 | 125 struct _GtkIMHtmlScalable { |
4895 | 126 void (*scale)(struct _GtkIMHtmlScalable *, int, int); |
127 void (*add_to)(struct _GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
128 void (*free)(struct _GtkIMHtmlScalable *); | |
129 }; | |
130 | |
5967 | 131 struct _GtkIMHtmlImage { |
4895 | 132 GtkIMHtmlScalable scalable; |
5012 | 133 GtkImage *image; |
5046 | 134 GdkPixbuf *pixbuf; |
4895 | 135 GtkTextMark *mark; |
5012 | 136 gchar *filename; |
4895 | 137 int width; |
138 int height; | |
5967 | 139 }; |
4895 | 140 |
5967 | 141 struct _GtkIMHtmlHr { |
4895 | 142 GtkIMHtmlScalable scalable; |
143 GtkWidget *sep; | |
5967 | 144 }; |
145 | |
146 typedef enum { | |
147 GTK_IMHTML_NO_COLOURS = 1 << 0, | |
148 GTK_IMHTML_NO_FONTS = 1 << 1, | |
149 GTK_IMHTML_NO_COMMENTS = 1 << 2, | |
150 GTK_IMHTML_NO_TITLE = 1 << 3, | |
151 GTK_IMHTML_NO_NEWLINE = 1 << 4, | |
152 GTK_IMHTML_NO_SIZES = 1 << 5, | |
153 GTK_IMHTML_NO_SCROLL = 1 << 6, | |
154 GTK_IMHTML_RETURN_LOG = 1 << 7, | |
155 GTK_IMHTML_USE_POINTSIZE = 1 << 8 | |
156 } GtkIMHtmlOptions; | |
157 | |
158 GtkType gtk_imhtml_get_type (void); | |
159 GtkWidget* gtk_imhtml_new (void *, void *); | |
160 | |
161 void gtk_imhtml_set_adjustments (GtkIMHtml *imhtml, | |
162 GtkAdjustment *hadj, | |
163 GtkAdjustment *vadj); | |
164 | |
165 void gtk_imhtml_associate_smiley (GtkIMHtml *imhtml, | |
166 gchar *sml, GtkIMHtmlSmiley *smiley); | |
167 | |
168 void gtk_imhtml_remove_smileys (GtkIMHtml *imhtml); | |
169 | |
170 void gtk_imhtml_show_smileys (GtkIMHtml *imhtml, gboolean show); | |
171 | |
172 void gtk_imhtml_show_comments (GtkIMHtml *imhtml, gboolean show); | |
173 | |
6982 | 174 #define gtk_imhtml_append_text(x, y, z) \ |
175 gtk_imhtml_append_text_with_images(x, y, z, NULL) | |
176 | |
177 GString* gtk_imhtml_append_text_with_images (GtkIMHtml *imhtml, | |
178 const gchar *text, | |
179 GtkIMHtmlOptions options, | |
180 GSList *images); | |
5967 | 181 |
182 void gtk_imhtml_clear (GtkIMHtml *imhtml); | |
183 void gtk_imhtml_page_up (GtkIMHtml *imhtml); | |
184 void gtk_imhtml_page_down (GtkIMHtml *imhtml); | |
4895 | 185 |
186 GtkIMHtmlScalable *gtk_imhtml_scalable_new(); | |
6982 | 187 GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename); |
5967 | 188 void gtk_imhtml_image_free(GtkIMHtmlScalable *); |
189 void gtk_imhtml_image_scale(GtkIMHtmlScalable *, int, int); | |
190 void gtk_imhtml_image_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
4895 | 191 |
5967 | 192 GtkIMHtmlScalable *gtk_imhtml_hr_new(); |
193 void gtk_imhtml_hr_free(GtkIMHtmlScalable *); | |
194 void gtk_imhtml_hr_scale(GtkIMHtmlScalable *, int, int); | |
195 void gtk_imhtml_hr_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
4895 | 196 |
7295 | 197 /* Search functions */ |
198 gboolean gtk_imhtml_search_find(GtkIMHtml *imhtml, const gchar *text); | |
199 void gtk_imhtml_search_clear(GtkIMHtml *imhtml); | |
4895 | 200 |
7694 | 201 /* Editable stuff */ |
202 void gtk_imhtml_set_editable(GtkIMHtml *imhtml, gboolean editable); | |
203 gboolean gtk_imhtml_get_editable(GtkIMHtml *imhtml); | |
204 gboolean gtk_imhtml_toggle_bold(GtkIMHtml *imhtml); | |
7701 | 205 gboolean gtk_imhtml_toggle_italic(GtkIMHtml *imhtml); |
7694 | 206 gboolean gtk_imhtml_toggle_underline(GtkIMHtml *imhtml); |
7714 | 207 gboolean gtk_imhtml_toggle_forecolor(GtkIMHtml *imhtml, const char *color); |
208 gboolean gtk_imhtml_toggle_backcolor(GtkIMHtml *imhtml, const char *color); | |
7717 | 209 gboolean gtk_imhtml_toggle_fontface(GtkIMHtml *imhtml, const char *face); |
7707 | 210 void gtk_imhtml_insert_link(GtkIMHtml *imhtml, const char *url, const char *text); |
7736 | 211 void gtk_imhtml_insert_smiley(GtkIMHtml *imhtml, const char *sml, char *smiley); |
7778 | 212 void gtk_imhtml_font_set_size(GtkIMHtml *imhtml, gint size); |
7740 | 213 void gtk_imhtml_font_shrink(GtkIMHtml *imhtml); |
214 void gtk_imhtml_font_grow(GtkIMHtml *imhtml); | |
7749 | 215 char *gtk_imhtml_get_markup_range(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *end); |
7694 | 216 char *gtk_imhtml_get_markup(GtkIMHtml *imhtml); |
217 char *gtk_imhtml_get_text(GtkIMHtml *imhtml); | |
218 | |
1428 | 219 #ifdef __cplusplus |
220 } | |
221 #endif | |
222 | |
223 #endif |