Mercurial > pidgin.yaz
annotate src/gtkimhtml.h @ 8984:4623d24347d8
[gaim-migrate @ 9759]
Oops, forgot about this. This keeps us from telling the other side
to connect to us when we can't connect to them when the reason we were
connecting to them in the first place was because they couldn't connect
to us.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Thu, 20 May 2004 02:24:17 +0000 |
parents | 4ff4c34b7500 |
children | b24967757d46 |
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 | |
36 #define GTK_TYPE_IMHTML (gtk_imhtml_get_type ()) | |
37 #define GTK_IMHTML(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_IMHTML, GtkIMHtml)) | |
38 #define GTK_IMHTML_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMHTML, GtkIMHtmlClass)) | |
39 #define GTK_IS_IMHTML(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_IMHTML)) | |
40 #define GTK_IS_IMHTML_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMHTML)) | |
5967 | 41 #define GTK_IMHTML_SCALABLE(obj) ((GtkIMHtmlScalable *)obj) |
1428 | 42 |
5967 | 43 typedef struct _GtkIMHtml GtkIMHtml; |
44 typedef struct _GtkIMHtmlClass GtkIMHtmlClass; | |
45 typedef struct _GtkIMHtmlFontDetail GtkIMHtmlFontDetail; /* The five elements contained in a FONT tag */ | |
46 typedef struct _GtkSmileyTree GtkSmileyTree; | |
47 typedef struct _GtkIMHtmlSmiley GtkIMHtmlSmiley; | |
48 typedef struct _GtkIMHtmlScalable GtkIMHtmlScalable; | |
49 typedef struct _GtkIMHtmlImage GtkIMHtmlImage; | |
50 typedef struct _GtkIMHtmlHr GtkIMHtmlHr; | |
8962 | 51 typedef struct _GtkIMHtmlFuncs GtkIMHtmlFuncs; |
8061 | 52 |
8420 | 53 typedef enum { |
54 GTK_IMHTML_BOLD = 1 << 0, | |
55 GTK_IMHTML_ITALIC = 1 << 1, | |
56 GTK_IMHTML_UNDERLINE = 1 << 2, | |
57 GTK_IMHTML_GROW = 1 << 3, | |
58 GTK_IMHTML_SHRINK = 1 << 4, | |
59 GTK_IMHTML_FACE = 1 << 5, | |
60 GTK_IMHTML_FORECOLOR = 1 << 6, | |
61 GTK_IMHTML_BACKCOLOR = 1 << 7, | |
62 GTK_IMHTML_LINK = 1 << 8, | |
63 GTK_IMHTML_IMAGE = 1 << 9, | |
8677 | 64 GTK_IMHTML_SMILEY = 1 << 10, |
65 GTK_IMHTML_ALL = -1 | |
8420 | 66 } GtkIMHtmlButtons; |
8061 | 67 |
1428 | 68 struct _GtkIMHtml { |
3922 | 69 GtkTextView text_view; |
70 GtkTextBuffer *text_buffer; | |
8677 | 71 GtkTextMark *scrollpoint; |
1428 | 72 GdkCursor *hand_cursor; |
73 GdkCursor *arrow_cursor; | |
8061 | 74 GdkCursor *text_cursor; |
4032 | 75 GHashTable *smiley_data; |
76 GtkSmileyTree *default_smilies; | |
8456 | 77 char *protocol_name; |
4254 | 78 |
6124 | 79 gboolean show_comments; |
4735 | 80 |
8456 | 81 gboolean html_shortcuts; |
82 gboolean smiley_shortcuts; | |
83 | |
4735 | 84 GtkWidget *tip_window; |
85 char *tip; | |
86 guint tip_timer; | |
4895 | 87 |
88 GList *scalables; | |
4947 | 89 GdkRectangle old_rect; |
7295 | 90 |
8061 | 91 gchar *search_string; |
7694 | 92 |
8061 | 93 gboolean editable; |
8420 | 94 GtkIMHtmlButtons format_functions; |
8677 | 95 gboolean wbfo; /* Whole buffer formatting only. */ |
96 | |
97 gint insert_offset; | |
8420 | 98 |
8061 | 99 struct { |
8677 | 100 gboolean bold:1; |
101 gboolean italic:1; | |
102 gboolean underline:1; | |
103 gchar *forecolor; | |
104 gchar *backcolor; | |
105 gchar *fontface; | |
8061 | 106 int fontsize; |
8677 | 107 GtkTextTag *link; |
8061 | 108 } edit; |
8740
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
109 |
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
110 double zoom; |
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
111 int original_fsize; |
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
112 |
8681 | 113 char *clipboard_text_string; |
114 char *clipboard_html_string; | |
8962 | 115 |
116 GSList *im_images; | |
117 GtkIMHtmlFuncs *funcs; | |
1428 | 118 }; |
119 | |
120 struct _GtkIMHtmlClass { | |
3922 | 121 GtkTextViewClass parent_class; |
1428 | 122 |
5967 | 123 void (*url_clicked)(GtkIMHtml *, const gchar *); |
8420 | 124 void (*buttons_update)(GtkIMHtml *, GtkIMHtmlButtons); |
125 void (*toggle_format)(GtkIMHtml *, GtkIMHtmlButtons); | |
8427 | 126 void (*clear_format)(GtkIMHtml *); |
8506 | 127 void (*update_format)(GtkIMHtml *); |
5967 | 128 }; |
129 | |
130 struct _GtkIMHtmlFontDetail { | |
131 gushort size; | |
132 gchar *face; | |
133 gchar *fore; | |
134 gchar *back; | |
135 gchar *sml; | |
8689 | 136 gboolean underline; |
5967 | 137 }; |
138 | |
139 struct _GtkSmileyTree { | |
140 GString *values; | |
141 GtkSmileyTree **children; | |
142 GtkIMHtmlSmiley *image; | |
1428 | 143 }; |
144 | |
4263 | 145 struct _GtkIMHtmlSmiley { |
146 gchar *smile; | |
147 gchar *file; | |
6814
782907a6ae65
[gaim-migrate @ 7354]
Christian Hammond <chipx86@chipx86.com>
parents:
6282
diff
changeset
|
148 GdkPixbufAnimation *icon; |
4263 | 149 gboolean hidden; |
150 }; | |
151 | |
5967 | 152 struct _GtkIMHtmlScalable { |
4895 | 153 void (*scale)(struct _GtkIMHtmlScalable *, int, int); |
154 void (*add_to)(struct _GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
155 void (*free)(struct _GtkIMHtmlScalable *); | |
156 }; | |
157 | |
5967 | 158 struct _GtkIMHtmlImage { |
4895 | 159 GtkIMHtmlScalable scalable; |
5012 | 160 GtkImage *image; |
5046 | 161 GdkPixbuf *pixbuf; |
4895 | 162 GtkTextMark *mark; |
5012 | 163 gchar *filename; |
4895 | 164 int width; |
165 int height; | |
8962 | 166 int id; |
5967 | 167 }; |
4895 | 168 |
5967 | 169 struct _GtkIMHtmlHr { |
4895 | 170 GtkIMHtmlScalable scalable; |
171 GtkWidget *sep; | |
5967 | 172 }; |
173 | |
174 typedef enum { | |
175 GTK_IMHTML_NO_COLOURS = 1 << 0, | |
176 GTK_IMHTML_NO_FONTS = 1 << 1, | |
8105 | 177 GTK_IMHTML_NO_COMMENTS = 1 << 2, /* Remove */ |
5967 | 178 GTK_IMHTML_NO_TITLE = 1 << 3, |
179 GTK_IMHTML_NO_NEWLINE = 1 << 4, | |
180 GTK_IMHTML_NO_SIZES = 1 << 5, | |
181 GTK_IMHTML_NO_SCROLL = 1 << 6, | |
182 GTK_IMHTML_RETURN_LOG = 1 << 7, | |
183 GTK_IMHTML_USE_POINTSIZE = 1 << 8 | |
184 } GtkIMHtmlOptions; | |
185 | |
8962 | 186 typedef gpointer (*GtkIMHtmlGetImageFunc) (int id); |
187 typedef gpointer (*GtkIMHtmlGetImageDataFunc) (gpointer i); | |
188 typedef size_t (*GtkIMHtmlGetImageSizeFunc) (gpointer i); | |
189 typedef const char *(*GtkIMHtmlGetImageFilenameFunc)(gpointer i); | |
190 typedef void (*GtkIMHtmlImageRefFunc) (int id); | |
191 typedef void (*GtkIMHtmlImageUnrefFunc) (int id); | |
192 | |
193 struct _GtkIMHtmlFuncs { | |
194 GtkIMHtmlGetImageFunc image_get; | |
195 GtkIMHtmlGetImageDataFunc image_get_data; | |
196 GtkIMHtmlGetImageSizeFunc image_get_size; | |
197 GtkIMHtmlGetImageFilenameFunc image_get_filename; | |
198 GtkIMHtmlImageRefFunc image_ref; | |
199 GtkIMHtmlImageUnrefFunc image_unref; | |
200 }; | |
201 | |
202 | |
5967 | 203 GtkType gtk_imhtml_get_type (void); |
204 GtkWidget* gtk_imhtml_new (void *, void *); | |
205 | |
206 void gtk_imhtml_set_adjustments (GtkIMHtml *imhtml, | |
207 GtkAdjustment *hadj, | |
208 GtkAdjustment *vadj); | |
209 | |
210 void gtk_imhtml_associate_smiley (GtkIMHtml *imhtml, | |
211 gchar *sml, GtkIMHtmlSmiley *smiley); | |
212 | |
213 void gtk_imhtml_remove_smileys (GtkIMHtml *imhtml); | |
214 | |
8962 | 215 void gtk_imhtml_set_funcs (GtkIMHtml *imhtml, GtkIMHtmlFuncs *f); |
216 | |
5967 | 217 void gtk_imhtml_show_comments (GtkIMHtml *imhtml, gboolean show); |
218 | |
8456 | 219 void gtk_imhtml_html_shortcuts(GtkIMHtml *imhtml, gboolean allow); |
220 | |
221 void gtk_imhtml_smiley_shortcuts (GtkIMHtml *imhtml, gboolean allow); | |
222 | |
223 void gtk_imhtml_set_protocol_name(GtkIMHtml *imhtml, gchar *protocol_name); | |
224 | |
6982 | 225 #define gtk_imhtml_append_text(x, y, z) \ |
226 gtk_imhtml_append_text_with_images(x, y, z, NULL) | |
227 | |
8677 | 228 void gtk_imhtml_append_text_with_images (GtkIMHtml *imhtml, |
6982 | 229 const gchar *text, |
230 GtkIMHtmlOptions options, | |
231 GSList *images); | |
8677 | 232 void gtk_imhtml_insert_html_at_iter(GtkIMHtml *imhtml, |
233 const gchar *text, | |
234 GtkIMHtmlOptions options, | |
235 GtkTextIter *iter); | |
8729 | 236 void gtk_imhtml_scroll_to_end(GtkIMHtml *imhtml); |
5967 | 237 void gtk_imhtml_clear (GtkIMHtml *imhtml); |
238 void gtk_imhtml_page_up (GtkIMHtml *imhtml); | |
239 void gtk_imhtml_page_down (GtkIMHtml *imhtml); | |
4895 | 240 |
8740
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
241 void gtk_imhtml_font_zoom(GtkIMHtml *imhtml, double zoom); |
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
242 |
4895 | 243 GtkIMHtmlScalable *gtk_imhtml_scalable_new(); |
8962 | 244 GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename, int id); |
5967 | 245 void gtk_imhtml_image_free(GtkIMHtmlScalable *); |
246 void gtk_imhtml_image_scale(GtkIMHtmlScalable *, int, int); | |
247 void gtk_imhtml_image_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
4895 | 248 |
5967 | 249 GtkIMHtmlScalable *gtk_imhtml_hr_new(); |
250 void gtk_imhtml_hr_free(GtkIMHtmlScalable *); | |
251 void gtk_imhtml_hr_scale(GtkIMHtmlScalable *, int, int); | |
252 void gtk_imhtml_hr_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
4895 | 253 |
7295 | 254 /* Search functions */ |
255 gboolean gtk_imhtml_search_find(GtkIMHtml *imhtml, const gchar *text); | |
256 void gtk_imhtml_search_clear(GtkIMHtml *imhtml); | |
4895 | 257 |
8061 | 258 /* Editable stuff */ |
259 void gtk_imhtml_set_editable(GtkIMHtml *imhtml, gboolean editable); | |
8677 | 260 void gtk_imhtml_set_whole_buffer_formatting_only(GtkIMHtml *imhtml, gboolean wbfo); |
8420 | 261 void gtk_imhtml_set_format_functions(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons); |
8788 | 262 GtkIMHtmlButtons gtk_imhtml_get_format_functions(GtkIMHtml *imhtml); |
8516 | 263 void gtk_imhtml_get_current_format(GtkIMHtml *imhtml, gboolean *bold, gboolean *italic, gboolean *underline); |
8061 | 264 gboolean gtk_imhtml_get_editable(GtkIMHtml *imhtml); |
265 gboolean gtk_imhtml_toggle_bold(GtkIMHtml *imhtml); | |
266 gboolean gtk_imhtml_toggle_italic(GtkIMHtml *imhtml); | |
267 gboolean gtk_imhtml_toggle_underline(GtkIMHtml *imhtml); | |
268 gboolean gtk_imhtml_toggle_forecolor(GtkIMHtml *imhtml, const char *color); | |
269 gboolean gtk_imhtml_toggle_backcolor(GtkIMHtml *imhtml, const char *color); | |
270 gboolean gtk_imhtml_toggle_fontface(GtkIMHtml *imhtml, const char *face); | |
8677 | 271 void gtk_imhtml_toggle_link(GtkIMHtml *imhtml, const char *url); |
272 void gtk_imhtml_insert_link(GtkIMHtml *imhtml, GtkTextMark *mark, const char *url, const char *text); | |
8061 | 273 void gtk_imhtml_insert_smiley(GtkIMHtml *imhtml, const char *sml, char *smiley); |
8677 | 274 void gtk_imhtml_insert_smiley_at_iter(GtkIMHtml *imhtml, const char *sml, char *smiley, GtkTextIter *iter); |
8962 | 275 void gtk_imhtml_insert_image_at_iter(GtkIMHtml *imhtml, int id, GtkTextIter *iter); |
8061 | 276 void gtk_imhtml_font_set_size(GtkIMHtml *imhtml, gint size); |
277 void gtk_imhtml_font_shrink(GtkIMHtml *imhtml); | |
278 void gtk_imhtml_font_grow(GtkIMHtml *imhtml); | |
279 char *gtk_imhtml_get_markup_range(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *end); | |
280 char *gtk_imhtml_get_markup(GtkIMHtml *imhtml); | |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8729
diff
changeset
|
281 /* returns a null terminated array of pointers to null terminated strings, each string for each line */ |
8677 | 282 /* g_strfreev() should be called on it */ |
283 char **gtk_imhtml_get_markup_lines(GtkIMHtml *imhtml); | |
284 char *gtk_imhtml_get_text(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *stop); | |
8061 | 285 |
1428 | 286 #ifdef __cplusplus |
287 } | |
288 #endif | |
289 | |
290 #endif |