Mercurial > pidgin
annotate src/gtkimhtml.h @ 8849:50d0f76639e7
[gaim-migrate @ 9616]
Let there be SILC.
committer: Tailor Script <tailor@pidgin.im>
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Sat, 01 May 2004 19:34:44 +0000 |
parents | 262f81346c0a |
children | 1ab2a9c17f4a |
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; | |
8061 | 51 |
8420 | 52 typedef enum { |
53 GTK_IMHTML_BOLD = 1 << 0, | |
54 GTK_IMHTML_ITALIC = 1 << 1, | |
55 GTK_IMHTML_UNDERLINE = 1 << 2, | |
56 GTK_IMHTML_GROW = 1 << 3, | |
57 GTK_IMHTML_SHRINK = 1 << 4, | |
58 GTK_IMHTML_FACE = 1 << 5, | |
59 GTK_IMHTML_FORECOLOR = 1 << 6, | |
60 GTK_IMHTML_BACKCOLOR = 1 << 7, | |
61 GTK_IMHTML_LINK = 1 << 8, | |
62 GTK_IMHTML_IMAGE = 1 << 9, | |
8677 | 63 GTK_IMHTML_SMILEY = 1 << 10, |
64 GTK_IMHTML_ALL = -1 | |
8420 | 65 } GtkIMHtmlButtons; |
8061 | 66 |
1428 | 67 struct _GtkIMHtml { |
3922 | 68 GtkTextView text_view; |
69 GtkTextBuffer *text_buffer; | |
8677 | 70 GtkTextMark *scrollpoint; |
1428 | 71 GdkCursor *hand_cursor; |
72 GdkCursor *arrow_cursor; | |
8061 | 73 GdkCursor *text_cursor; |
4032 | 74 GHashTable *smiley_data; |
75 GtkSmileyTree *default_smilies; | |
8456 | 76 char *protocol_name; |
4254 | 77 |
78 gboolean show_smileys; | |
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; | |
1428 | 115 }; |
116 | |
117 struct _GtkIMHtmlClass { | |
3922 | 118 GtkTextViewClass parent_class; |
1428 | 119 |
5967 | 120 void (*url_clicked)(GtkIMHtml *, const gchar *); |
8420 | 121 void (*buttons_update)(GtkIMHtml *, GtkIMHtmlButtons); |
122 void (*toggle_format)(GtkIMHtml *, GtkIMHtmlButtons); | |
8427 | 123 void (*clear_format)(GtkIMHtml *); |
8506 | 124 void (*update_format)(GtkIMHtml *); |
5967 | 125 }; |
126 | |
127 struct _GtkIMHtmlFontDetail { | |
128 gushort size; | |
129 gchar *face; | |
130 gchar *fore; | |
131 gchar *back; | |
132 gchar *sml; | |
8689 | 133 gboolean underline; |
5967 | 134 }; |
135 | |
136 struct _GtkSmileyTree { | |
137 GString *values; | |
138 GtkSmileyTree **children; | |
139 GtkIMHtmlSmiley *image; | |
1428 | 140 }; |
141 | |
4263 | 142 struct _GtkIMHtmlSmiley { |
143 gchar *smile; | |
144 gchar *file; | |
6814
782907a6ae65
[gaim-migrate @ 7354]
Christian Hammond <chipx86@chipx86.com>
parents:
6282
diff
changeset
|
145 GdkPixbufAnimation *icon; |
4263 | 146 gboolean hidden; |
147 }; | |
148 | |
5967 | 149 struct _GtkIMHtmlScalable { |
4895 | 150 void (*scale)(struct _GtkIMHtmlScalable *, int, int); |
151 void (*add_to)(struct _GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
152 void (*free)(struct _GtkIMHtmlScalable *); | |
153 }; | |
154 | |
5967 | 155 struct _GtkIMHtmlImage { |
4895 | 156 GtkIMHtmlScalable scalable; |
5012 | 157 GtkImage *image; |
5046 | 158 GdkPixbuf *pixbuf; |
4895 | 159 GtkTextMark *mark; |
5012 | 160 gchar *filename; |
4895 | 161 int width; |
162 int height; | |
5967 | 163 }; |
4895 | 164 |
5967 | 165 struct _GtkIMHtmlHr { |
4895 | 166 GtkIMHtmlScalable scalable; |
167 GtkWidget *sep; | |
5967 | 168 }; |
169 | |
170 typedef enum { | |
171 GTK_IMHTML_NO_COLOURS = 1 << 0, | |
172 GTK_IMHTML_NO_FONTS = 1 << 1, | |
8105 | 173 GTK_IMHTML_NO_COMMENTS = 1 << 2, /* Remove */ |
5967 | 174 GTK_IMHTML_NO_TITLE = 1 << 3, |
175 GTK_IMHTML_NO_NEWLINE = 1 << 4, | |
176 GTK_IMHTML_NO_SIZES = 1 << 5, | |
177 GTK_IMHTML_NO_SCROLL = 1 << 6, | |
178 GTK_IMHTML_RETURN_LOG = 1 << 7, | |
179 GTK_IMHTML_USE_POINTSIZE = 1 << 8 | |
180 } GtkIMHtmlOptions; | |
181 | |
182 GtkType gtk_imhtml_get_type (void); | |
183 GtkWidget* gtk_imhtml_new (void *, void *); | |
184 | |
185 void gtk_imhtml_set_adjustments (GtkIMHtml *imhtml, | |
186 GtkAdjustment *hadj, | |
187 GtkAdjustment *vadj); | |
188 | |
189 void gtk_imhtml_associate_smiley (GtkIMHtml *imhtml, | |
190 gchar *sml, GtkIMHtmlSmiley *smiley); | |
191 | |
192 void gtk_imhtml_remove_smileys (GtkIMHtml *imhtml); | |
193 | |
194 void gtk_imhtml_show_smileys (GtkIMHtml *imhtml, gboolean show); | |
195 | |
196 void gtk_imhtml_show_comments (GtkIMHtml *imhtml, gboolean show); | |
197 | |
8456 | 198 void gtk_imhtml_html_shortcuts(GtkIMHtml *imhtml, gboolean allow); |
199 | |
200 void gtk_imhtml_smiley_shortcuts (GtkIMHtml *imhtml, gboolean allow); | |
201 | |
202 void gtk_imhtml_set_protocol_name(GtkIMHtml *imhtml, gchar *protocol_name); | |
203 | |
6982 | 204 #define gtk_imhtml_append_text(x, y, z) \ |
205 gtk_imhtml_append_text_with_images(x, y, z, NULL) | |
206 | |
8677 | 207 void gtk_imhtml_append_text_with_images (GtkIMHtml *imhtml, |
6982 | 208 const gchar *text, |
209 GtkIMHtmlOptions options, | |
210 GSList *images); | |
8677 | 211 void gtk_imhtml_insert_html_at_iter(GtkIMHtml *imhtml, |
212 const gchar *text, | |
213 GtkIMHtmlOptions options, | |
214 GtkTextIter *iter); | |
8729 | 215 void gtk_imhtml_scroll_to_end(GtkIMHtml *imhtml); |
5967 | 216 void gtk_imhtml_clear (GtkIMHtml *imhtml); |
217 void gtk_imhtml_page_up (GtkIMHtml *imhtml); | |
218 void gtk_imhtml_page_down (GtkIMHtml *imhtml); | |
4895 | 219 |
8740
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
220 void gtk_imhtml_font_zoom(GtkIMHtml *imhtml, double zoom); |
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
221 |
4895 | 222 GtkIMHtmlScalable *gtk_imhtml_scalable_new(); |
6982 | 223 GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename); |
5967 | 224 void gtk_imhtml_image_free(GtkIMHtmlScalable *); |
225 void gtk_imhtml_image_scale(GtkIMHtmlScalable *, int, int); | |
226 void gtk_imhtml_image_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
4895 | 227 |
5967 | 228 GtkIMHtmlScalable *gtk_imhtml_hr_new(); |
229 void gtk_imhtml_hr_free(GtkIMHtmlScalable *); | |
230 void gtk_imhtml_hr_scale(GtkIMHtmlScalable *, int, int); | |
231 void gtk_imhtml_hr_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
4895 | 232 |
7295 | 233 /* Search functions */ |
234 gboolean gtk_imhtml_search_find(GtkIMHtml *imhtml, const gchar *text); | |
235 void gtk_imhtml_search_clear(GtkIMHtml *imhtml); | |
4895 | 236 |
8061 | 237 /* Editable stuff */ |
238 void gtk_imhtml_set_editable(GtkIMHtml *imhtml, gboolean editable); | |
8677 | 239 void gtk_imhtml_set_whole_buffer_formatting_only(GtkIMHtml *imhtml, gboolean wbfo); |
8420 | 240 void gtk_imhtml_set_format_functions(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons); |
8788 | 241 GtkIMHtmlButtons gtk_imhtml_get_format_functions(GtkIMHtml *imhtml); |
8516 | 242 void gtk_imhtml_get_current_format(GtkIMHtml *imhtml, gboolean *bold, gboolean *italic, gboolean *underline); |
8061 | 243 gboolean gtk_imhtml_get_editable(GtkIMHtml *imhtml); |
244 gboolean gtk_imhtml_toggle_bold(GtkIMHtml *imhtml); | |
245 gboolean gtk_imhtml_toggle_italic(GtkIMHtml *imhtml); | |
246 gboolean gtk_imhtml_toggle_underline(GtkIMHtml *imhtml); | |
247 gboolean gtk_imhtml_toggle_forecolor(GtkIMHtml *imhtml, const char *color); | |
248 gboolean gtk_imhtml_toggle_backcolor(GtkIMHtml *imhtml, const char *color); | |
249 gboolean gtk_imhtml_toggle_fontface(GtkIMHtml *imhtml, const char *face); | |
8677 | 250 void gtk_imhtml_toggle_link(GtkIMHtml *imhtml, const char *url); |
251 void gtk_imhtml_insert_link(GtkIMHtml *imhtml, GtkTextMark *mark, const char *url, const char *text); | |
8061 | 252 void gtk_imhtml_insert_smiley(GtkIMHtml *imhtml, const char *sml, char *smiley); |
8677 | 253 void gtk_imhtml_insert_smiley_at_iter(GtkIMHtml *imhtml, const char *sml, char *smiley, GtkTextIter *iter); |
8061 | 254 void gtk_imhtml_font_set_size(GtkIMHtml *imhtml, gint size); |
255 void gtk_imhtml_font_shrink(GtkIMHtml *imhtml); | |
256 void gtk_imhtml_font_grow(GtkIMHtml *imhtml); | |
257 char *gtk_imhtml_get_markup_range(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *end); | |
258 char *gtk_imhtml_get_markup(GtkIMHtml *imhtml); | |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8729
diff
changeset
|
259 /* returns a null terminated array of pointers to null terminated strings, each string for each line */ |
8677 | 260 /* g_strfreev() should be called on it */ |
261 char **gtk_imhtml_get_markup_lines(GtkIMHtml *imhtml); | |
262 char *gtk_imhtml_get_text(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *stop); | |
8061 | 263 |
1428 | 264 #ifdef __cplusplus |
265 } | |
266 #endif | |
267 | |
268 #endif |