Mercurial > pidgin.yaz
annotate src/gtkimhtml.h @ 8664:f95edb58087c
[gaim-migrate @ 9416]
Marc E. (elcomandante) made us a new jabber icon that isn't quite so out
of focus. Thanks Marc!
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Wed, 14 Apr 2004 12:40:49 +0000 |
parents | f8ab826e11ad |
children | cc2ce209cc46 |
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, | |
63 GTK_IMHTML_SMILEY = 1 << 10 | |
64 } GtkIMHtmlButtons; | |
8061 | 65 |
66 typedef struct { | |
67 GtkTextMark *start; | |
68 GtkTextMark *end; | |
69 char *start_tag; | |
70 char *end_tag; | |
71 GtkTextBuffer *buffer; | |
72 GtkTextTag *tag; | |
73 } GtkIMHtmlFormatSpan; | |
7694 | 74 |
1428 | 75 struct _GtkIMHtml { |
3922 | 76 GtkTextView text_view; |
77 GtkTextBuffer *text_buffer; | |
78 GtkTextMark *end; | |
1428 | 79 GdkCursor *hand_cursor; |
80 GdkCursor *arrow_cursor; | |
8061 | 81 GdkCursor *text_cursor; |
4032 | 82 GHashTable *smiley_data; |
83 GtkSmileyTree *default_smilies; | |
8456 | 84 char *protocol_name; |
4254 | 85 |
86 gboolean show_smileys; | |
6124 | 87 gboolean show_comments; |
4735 | 88 |
8456 | 89 gboolean html_shortcuts; |
90 gboolean smiley_shortcuts; | |
91 | |
4735 | 92 GtkWidget *tip_window; |
93 char *tip; | |
94 guint tip_timer; | |
4895 | 95 |
96 GList *scalables; | |
4947 | 97 GdkRectangle old_rect; |
7295 | 98 |
8061 | 99 gchar *search_string; |
7694 | 100 |
8061 | 101 gboolean editable; |
8420 | 102 GtkIMHtmlButtons format_functions; |
103 | |
8061 | 104 struct { |
105 GtkIMHtmlFormatSpan *bold; | |
106 GtkIMHtmlFormatSpan *italic; | |
107 GtkIMHtmlFormatSpan *underline; | |
108 GtkIMHtmlFormatSpan *forecolor; | |
109 GtkIMHtmlFormatSpan *backcolor; | |
110 GtkIMHtmlFormatSpan *fontface; | |
111 GtkIMHtmlFormatSpan *sizespan; | |
112 int fontsize; | |
113 } edit; | |
114 char *clipboard_string; | |
115 GList *format_spans; | |
1428 | 116 }; |
117 | |
118 struct _GtkIMHtmlClass { | |
3922 | 119 GtkTextViewClass parent_class; |
1428 | 120 |
5967 | 121 void (*url_clicked)(GtkIMHtml *, const gchar *); |
8420 | 122 void (*buttons_update)(GtkIMHtml *, GtkIMHtmlButtons); |
123 void (*toggle_format)(GtkIMHtml *, GtkIMHtmlButtons); | |
8427 | 124 void (*clear_format)(GtkIMHtml *); |
8506 | 125 void (*update_format)(GtkIMHtml *); |
5967 | 126 }; |
127 | |
128 struct _GtkIMHtmlFontDetail { | |
129 gushort size; | |
130 gchar *face; | |
131 gchar *fore; | |
132 gchar *back; | |
133 gchar *sml; | |
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 | |
207 GString* gtk_imhtml_append_text_with_images (GtkIMHtml *imhtml, | |
208 const gchar *text, | |
209 GtkIMHtmlOptions options, | |
210 GSList *images); | |
5967 | 211 |
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); | |
8420 | 233 void gtk_imhtml_set_format_functions(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons); |
8516 | 234 void gtk_imhtml_get_current_format(GtkIMHtml *imhtml, gboolean *bold, gboolean *italic, gboolean *underline); |
8061 | 235 gboolean gtk_imhtml_get_editable(GtkIMHtml *imhtml); |
236 gboolean gtk_imhtml_toggle_bold(GtkIMHtml *imhtml); | |
237 gboolean gtk_imhtml_toggle_italic(GtkIMHtml *imhtml); | |
238 gboolean gtk_imhtml_toggle_underline(GtkIMHtml *imhtml); | |
239 gboolean gtk_imhtml_toggle_forecolor(GtkIMHtml *imhtml, const char *color); | |
240 gboolean gtk_imhtml_toggle_backcolor(GtkIMHtml *imhtml, const char *color); | |
241 gboolean gtk_imhtml_toggle_fontface(GtkIMHtml *imhtml, const char *face); | |
242 void gtk_imhtml_insert_link(GtkIMHtml *imhtml, const char *url, const char *text); | |
243 void gtk_imhtml_insert_smiley(GtkIMHtml *imhtml, const char *sml, char *smiley); | |
244 void gtk_imhtml_font_set_size(GtkIMHtml *imhtml, gint size); | |
245 void gtk_imhtml_font_shrink(GtkIMHtml *imhtml); | |
246 void gtk_imhtml_font_grow(GtkIMHtml *imhtml); | |
247 char *gtk_imhtml_get_markup_range(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *end); | |
248 char *gtk_imhtml_get_markup(GtkIMHtml *imhtml); | |
249 char *gtk_imhtml_get_text(GtkIMHtml *imhtml); | |
250 | |
1428 | 251 #ifdef __cplusplus |
252 } | |
253 #endif | |
254 | |
255 #endif |