Mercurial > pidgin
annotate src/gtkimhtml.h @ 8941:71fddf3f340d
[gaim-migrate @ 9711]
Eradicate the two tab completion preferences.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 16 May 2004 00:26:08 +0000 |
parents | 1ab2a9c17f4a |
children | 4ff4c34b7500 |
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 |
6124 | 78 gboolean show_comments; |
4735 | 79 |
8456 | 80 gboolean html_shortcuts; |
81 gboolean smiley_shortcuts; | |
82 | |
4735 | 83 GtkWidget *tip_window; |
84 char *tip; | |
85 guint tip_timer; | |
4895 | 86 |
87 GList *scalables; | |
4947 | 88 GdkRectangle old_rect; |
7295 | 89 |
8061 | 90 gchar *search_string; |
7694 | 91 |
8061 | 92 gboolean editable; |
8420 | 93 GtkIMHtmlButtons format_functions; |
8677 | 94 gboolean wbfo; /* Whole buffer formatting only. */ |
95 | |
96 gint insert_offset; | |
8420 | 97 |
8061 | 98 struct { |
8677 | 99 gboolean bold:1; |
100 gboolean italic:1; | |
101 gboolean underline:1; | |
102 gchar *forecolor; | |
103 gchar *backcolor; | |
104 gchar *fontface; | |
8061 | 105 int fontsize; |
8677 | 106 GtkTextTag *link; |
8061 | 107 } edit; |
8740
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
108 |
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
109 double zoom; |
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
110 int original_fsize; |
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
111 |
8681 | 112 char *clipboard_text_string; |
113 char *clipboard_html_string; | |
1428 | 114 }; |
115 | |
116 struct _GtkIMHtmlClass { | |
3922 | 117 GtkTextViewClass parent_class; |
1428 | 118 |
5967 | 119 void (*url_clicked)(GtkIMHtml *, const gchar *); |
8420 | 120 void (*buttons_update)(GtkIMHtml *, GtkIMHtmlButtons); |
121 void (*toggle_format)(GtkIMHtml *, GtkIMHtmlButtons); | |
8427 | 122 void (*clear_format)(GtkIMHtml *); |
8506 | 123 void (*update_format)(GtkIMHtml *); |
5967 | 124 }; |
125 | |
126 struct _GtkIMHtmlFontDetail { | |
127 gushort size; | |
128 gchar *face; | |
129 gchar *fore; | |
130 gchar *back; | |
131 gchar *sml; | |
8689 | 132 gboolean underline; |
5967 | 133 }; |
134 | |
135 struct _GtkSmileyTree { | |
136 GString *values; | |
137 GtkSmileyTree **children; | |
138 GtkIMHtmlSmiley *image; | |
1428 | 139 }; |
140 | |
4263 | 141 struct _GtkIMHtmlSmiley { |
142 gchar *smile; | |
143 gchar *file; | |
6814
782907a6ae65
[gaim-migrate @ 7354]
Christian Hammond <chipx86@chipx86.com>
parents:
6282
diff
changeset
|
144 GdkPixbufAnimation *icon; |
4263 | 145 gboolean hidden; |
146 }; | |
147 | |
5967 | 148 struct _GtkIMHtmlScalable { |
4895 | 149 void (*scale)(struct _GtkIMHtmlScalable *, int, int); |
150 void (*add_to)(struct _GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
151 void (*free)(struct _GtkIMHtmlScalable *); | |
152 }; | |
153 | |
5967 | 154 struct _GtkIMHtmlImage { |
4895 | 155 GtkIMHtmlScalable scalable; |
5012 | 156 GtkImage *image; |
5046 | 157 GdkPixbuf *pixbuf; |
4895 | 158 GtkTextMark *mark; |
5012 | 159 gchar *filename; |
4895 | 160 int width; |
161 int height; | |
5967 | 162 }; |
4895 | 163 |
5967 | 164 struct _GtkIMHtmlHr { |
4895 | 165 GtkIMHtmlScalable scalable; |
166 GtkWidget *sep; | |
5967 | 167 }; |
168 | |
169 typedef enum { | |
170 GTK_IMHTML_NO_COLOURS = 1 << 0, | |
171 GTK_IMHTML_NO_FONTS = 1 << 1, | |
8105 | 172 GTK_IMHTML_NO_COMMENTS = 1 << 2, /* Remove */ |
5967 | 173 GTK_IMHTML_NO_TITLE = 1 << 3, |
174 GTK_IMHTML_NO_NEWLINE = 1 << 4, | |
175 GTK_IMHTML_NO_SIZES = 1 << 5, | |
176 GTK_IMHTML_NO_SCROLL = 1 << 6, | |
177 GTK_IMHTML_RETURN_LOG = 1 << 7, | |
178 GTK_IMHTML_USE_POINTSIZE = 1 << 8 | |
179 } GtkIMHtmlOptions; | |
180 | |
181 GtkType gtk_imhtml_get_type (void); | |
182 GtkWidget* gtk_imhtml_new (void *, void *); | |
183 | |
184 void gtk_imhtml_set_adjustments (GtkIMHtml *imhtml, | |
185 GtkAdjustment *hadj, | |
186 GtkAdjustment *vadj); | |
187 | |
188 void gtk_imhtml_associate_smiley (GtkIMHtml *imhtml, | |
189 gchar *sml, GtkIMHtmlSmiley *smiley); | |
190 | |
191 void gtk_imhtml_remove_smileys (GtkIMHtml *imhtml); | |
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); | |
8729 | 212 void gtk_imhtml_scroll_to_end(GtkIMHtml *imhtml); |
5967 | 213 void gtk_imhtml_clear (GtkIMHtml *imhtml); |
214 void gtk_imhtml_page_up (GtkIMHtml *imhtml); | |
215 void gtk_imhtml_page_down (GtkIMHtml *imhtml); | |
4895 | 216 |
8740
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
217 void gtk_imhtml_font_zoom(GtkIMHtml *imhtml, double zoom); |
61a090413b93
[gaim-migrate @ 9495]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
218 |
4895 | 219 GtkIMHtmlScalable *gtk_imhtml_scalable_new(); |
6982 | 220 GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename); |
5967 | 221 void gtk_imhtml_image_free(GtkIMHtmlScalable *); |
222 void gtk_imhtml_image_scale(GtkIMHtmlScalable *, int, int); | |
223 void gtk_imhtml_image_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
4895 | 224 |
5967 | 225 GtkIMHtmlScalable *gtk_imhtml_hr_new(); |
226 void gtk_imhtml_hr_free(GtkIMHtmlScalable *); | |
227 void gtk_imhtml_hr_scale(GtkIMHtmlScalable *, int, int); | |
228 void gtk_imhtml_hr_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
4895 | 229 |
7295 | 230 /* Search functions */ |
231 gboolean gtk_imhtml_search_find(GtkIMHtml *imhtml, const gchar *text); | |
232 void gtk_imhtml_search_clear(GtkIMHtml *imhtml); | |
4895 | 233 |
8061 | 234 /* Editable stuff */ |
235 void gtk_imhtml_set_editable(GtkIMHtml *imhtml, gboolean editable); | |
8677 | 236 void gtk_imhtml_set_whole_buffer_formatting_only(GtkIMHtml *imhtml, gboolean wbfo); |
8420 | 237 void gtk_imhtml_set_format_functions(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons); |
8788 | 238 GtkIMHtmlButtons gtk_imhtml_get_format_functions(GtkIMHtml *imhtml); |
8516 | 239 void gtk_imhtml_get_current_format(GtkIMHtml *imhtml, gboolean *bold, gboolean *italic, gboolean *underline); |
8061 | 240 gboolean gtk_imhtml_get_editable(GtkIMHtml *imhtml); |
241 gboolean gtk_imhtml_toggle_bold(GtkIMHtml *imhtml); | |
242 gboolean gtk_imhtml_toggle_italic(GtkIMHtml *imhtml); | |
243 gboolean gtk_imhtml_toggle_underline(GtkIMHtml *imhtml); | |
244 gboolean gtk_imhtml_toggle_forecolor(GtkIMHtml *imhtml, const char *color); | |
245 gboolean gtk_imhtml_toggle_backcolor(GtkIMHtml *imhtml, const char *color); | |
246 gboolean gtk_imhtml_toggle_fontface(GtkIMHtml *imhtml, const char *face); | |
8677 | 247 void gtk_imhtml_toggle_link(GtkIMHtml *imhtml, const char *url); |
248 void gtk_imhtml_insert_link(GtkIMHtml *imhtml, GtkTextMark *mark, const char *url, const char *text); | |
8061 | 249 void gtk_imhtml_insert_smiley(GtkIMHtml *imhtml, const char *sml, char *smiley); |
8677 | 250 void gtk_imhtml_insert_smiley_at_iter(GtkIMHtml *imhtml, const char *sml, char *smiley, GtkTextIter *iter); |
8061 | 251 void gtk_imhtml_font_set_size(GtkIMHtml *imhtml, gint size); |
252 void gtk_imhtml_font_shrink(GtkIMHtml *imhtml); | |
253 void gtk_imhtml_font_grow(GtkIMHtml *imhtml); | |
254 char *gtk_imhtml_get_markup_range(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *end); | |
255 char *gtk_imhtml_get_markup(GtkIMHtml *imhtml); | |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8729
diff
changeset
|
256 /* returns a null terminated array of pointers to null terminated strings, each string for each line */ |
8677 | 257 /* g_strfreev() should be called on it */ |
258 char **gtk_imhtml_get_markup_lines(GtkIMHtml *imhtml); | |
259 char *gtk_imhtml_get_text(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *stop); | |
8061 | 260 |
1428 | 261 #ifdef __cplusplus |
262 } | |
263 #endif | |
264 | |
265 #endif |