Mercurial > pidgin
annotate src/gtkimhtml.h @ 8700:ddd2bf87fe8d
[gaim-migrate @ 9453]
I'm adding some of the oscar tooltip info to the oscar
get info dialog. I don't think I'm finished yet, but
I want to try something that might not work,
and it's easier to "cvs -z3 diff -u | patch -p0 -R"
than it is to un-do it.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 18 Apr 2004 17:10:14 +0000 |
parents | b3eae94bd560 |
children | 7024b9145357 |
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; |
8681 | 109 |
110 char *clipboard_text_string; | |
111 char *clipboard_html_string; | |
1428 | 112 }; |
113 | |
114 struct _GtkIMHtmlClass { | |
3922 | 115 GtkTextViewClass parent_class; |
1428 | 116 |
5967 | 117 void (*url_clicked)(GtkIMHtml *, const gchar *); |
8420 | 118 void (*buttons_update)(GtkIMHtml *, GtkIMHtmlButtons); |
119 void (*toggle_format)(GtkIMHtml *, GtkIMHtmlButtons); | |
8427 | 120 void (*clear_format)(GtkIMHtml *); |
8506 | 121 void (*update_format)(GtkIMHtml *); |
5967 | 122 }; |
123 | |
124 struct _GtkIMHtmlFontDetail { | |
125 gushort size; | |
126 gchar *face; | |
127 gchar *fore; | |
128 gchar *back; | |
129 gchar *sml; | |
8689 | 130 gboolean underline; |
5967 | 131 }; |
132 | |
133 struct _GtkSmileyTree { | |
134 GString *values; | |
135 GtkSmileyTree **children; | |
136 GtkIMHtmlSmiley *image; | |
1428 | 137 }; |
138 | |
4263 | 139 struct _GtkIMHtmlSmiley { |
140 gchar *smile; | |
141 gchar *file; | |
6814
782907a6ae65
[gaim-migrate @ 7354]
Christian Hammond <chipx86@chipx86.com>
parents:
6282
diff
changeset
|
142 GdkPixbufAnimation *icon; |
4263 | 143 gboolean hidden; |
144 }; | |
145 | |
5967 | 146 struct _GtkIMHtmlScalable { |
4895 | 147 void (*scale)(struct _GtkIMHtmlScalable *, int, int); |
148 void (*add_to)(struct _GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
149 void (*free)(struct _GtkIMHtmlScalable *); | |
150 }; | |
151 | |
5967 | 152 struct _GtkIMHtmlImage { |
4895 | 153 GtkIMHtmlScalable scalable; |
5012 | 154 GtkImage *image; |
5046 | 155 GdkPixbuf *pixbuf; |
4895 | 156 GtkTextMark *mark; |
5012 | 157 gchar *filename; |
4895 | 158 int width; |
159 int height; | |
5967 | 160 }; |
4895 | 161 |
5967 | 162 struct _GtkIMHtmlHr { |
4895 | 163 GtkIMHtmlScalable scalable; |
164 GtkWidget *sep; | |
5967 | 165 }; |
166 | |
167 typedef enum { | |
168 GTK_IMHTML_NO_COLOURS = 1 << 0, | |
169 GTK_IMHTML_NO_FONTS = 1 << 1, | |
8105 | 170 GTK_IMHTML_NO_COMMENTS = 1 << 2, /* Remove */ |
5967 | 171 GTK_IMHTML_NO_TITLE = 1 << 3, |
172 GTK_IMHTML_NO_NEWLINE = 1 << 4, | |
173 GTK_IMHTML_NO_SIZES = 1 << 5, | |
174 GTK_IMHTML_NO_SCROLL = 1 << 6, | |
175 GTK_IMHTML_RETURN_LOG = 1 << 7, | |
176 GTK_IMHTML_USE_POINTSIZE = 1 << 8 | |
177 } GtkIMHtmlOptions; | |
178 | |
179 GtkType gtk_imhtml_get_type (void); | |
180 GtkWidget* gtk_imhtml_new (void *, void *); | |
181 | |
182 void gtk_imhtml_set_adjustments (GtkIMHtml *imhtml, | |
183 GtkAdjustment *hadj, | |
184 GtkAdjustment *vadj); | |
185 | |
186 void gtk_imhtml_associate_smiley (GtkIMHtml *imhtml, | |
187 gchar *sml, GtkIMHtmlSmiley *smiley); | |
188 | |
189 void gtk_imhtml_remove_smileys (GtkIMHtml *imhtml); | |
190 | |
191 void gtk_imhtml_show_smileys (GtkIMHtml *imhtml, gboolean show); | |
192 | |
193 void gtk_imhtml_show_comments (GtkIMHtml *imhtml, gboolean show); | |
194 | |
8456 | 195 void gtk_imhtml_html_shortcuts(GtkIMHtml *imhtml, gboolean allow); |
196 | |
197 void gtk_imhtml_smiley_shortcuts (GtkIMHtml *imhtml, gboolean allow); | |
198 | |
199 void gtk_imhtml_set_protocol_name(GtkIMHtml *imhtml, gchar *protocol_name); | |
200 | |
6982 | 201 #define gtk_imhtml_append_text(x, y, z) \ |
202 gtk_imhtml_append_text_with_images(x, y, z, NULL) | |
203 | |
8677 | 204 void gtk_imhtml_append_text_with_images (GtkIMHtml *imhtml, |
6982 | 205 const gchar *text, |
206 GtkIMHtmlOptions options, | |
207 GSList *images); | |
8677 | 208 void gtk_imhtml_insert_html_at_iter(GtkIMHtml *imhtml, |
209 const gchar *text, | |
210 GtkIMHtmlOptions options, | |
211 GtkTextIter *iter); | |
5967 | 212 void gtk_imhtml_clear (GtkIMHtml *imhtml); |
213 void gtk_imhtml_page_up (GtkIMHtml *imhtml); | |
214 void gtk_imhtml_page_down (GtkIMHtml *imhtml); | |
4895 | 215 |
216 GtkIMHtmlScalable *gtk_imhtml_scalable_new(); | |
6982 | 217 GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename); |
5967 | 218 void gtk_imhtml_image_free(GtkIMHtmlScalable *); |
219 void gtk_imhtml_image_scale(GtkIMHtmlScalable *, int, int); | |
220 void gtk_imhtml_image_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
4895 | 221 |
5967 | 222 GtkIMHtmlScalable *gtk_imhtml_hr_new(); |
223 void gtk_imhtml_hr_free(GtkIMHtmlScalable *); | |
224 void gtk_imhtml_hr_scale(GtkIMHtmlScalable *, int, int); | |
225 void gtk_imhtml_hr_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
4895 | 226 |
7295 | 227 /* Search functions */ |
228 gboolean gtk_imhtml_search_find(GtkIMHtml *imhtml, const gchar *text); | |
229 void gtk_imhtml_search_clear(GtkIMHtml *imhtml); | |
4895 | 230 |
8061 | 231 /* Editable stuff */ |
232 void gtk_imhtml_set_editable(GtkIMHtml *imhtml, gboolean editable); | |
8677 | 233 void gtk_imhtml_set_whole_buffer_formatting_only(GtkIMHtml *imhtml, gboolean wbfo); |
8420 | 234 void gtk_imhtml_set_format_functions(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons); |
8516 | 235 void gtk_imhtml_get_current_format(GtkIMHtml *imhtml, gboolean *bold, gboolean *italic, gboolean *underline); |
8061 | 236 gboolean gtk_imhtml_get_editable(GtkIMHtml *imhtml); |
237 gboolean gtk_imhtml_toggle_bold(GtkIMHtml *imhtml); | |
238 gboolean gtk_imhtml_toggle_italic(GtkIMHtml *imhtml); | |
239 gboolean gtk_imhtml_toggle_underline(GtkIMHtml *imhtml); | |
240 gboolean gtk_imhtml_toggle_forecolor(GtkIMHtml *imhtml, const char *color); | |
241 gboolean gtk_imhtml_toggle_backcolor(GtkIMHtml *imhtml, const char *color); | |
242 gboolean gtk_imhtml_toggle_fontface(GtkIMHtml *imhtml, const char *face); | |
8677 | 243 void gtk_imhtml_toggle_link(GtkIMHtml *imhtml, const char *url); |
244 void gtk_imhtml_insert_link(GtkIMHtml *imhtml, GtkTextMark *mark, const char *url, const char *text); | |
8061 | 245 void gtk_imhtml_insert_smiley(GtkIMHtml *imhtml, const char *sml, char *smiley); |
8677 | 246 void gtk_imhtml_insert_smiley_at_iter(GtkIMHtml *imhtml, const char *sml, char *smiley, GtkTextIter *iter); |
8061 | 247 void gtk_imhtml_font_set_size(GtkIMHtml *imhtml, gint size); |
248 void gtk_imhtml_font_shrink(GtkIMHtml *imhtml); | |
249 void gtk_imhtml_font_grow(GtkIMHtml *imhtml); | |
250 char *gtk_imhtml_get_markup_range(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *end); | |
251 char *gtk_imhtml_get_markup(GtkIMHtml *imhtml); | |
8677 | 252 /* returns a null terminated array of pointers to null ternimated strings, each string for each line */ |
253 /* g_strfreev() should be called on it */ | |
254 char **gtk_imhtml_get_markup_lines(GtkIMHtml *imhtml); | |
255 char *gtk_imhtml_get_text(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *stop); | |
8061 | 256 |
1428 | 257 #ifdef __cplusplus |
258 } | |
259 #endif | |
260 | |
261 #endif |