Mercurial > pidgin
annotate src/gtkimhtml.h @ 7750:14cc6614af93
[gaim-migrate @ 8395]
And this completes the proper way to handle setting my own clipboard data
such that it won't screw up Windows and be all hacky.
However, this copy stuff will make smileys no longer copy in plaintext. That's
easy to fix, though.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Thu, 04 Dec 2003 20:43:27 +0000 |
parents | ddda7537918e |
children | 3db18c16f573 |
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 * |
5 * Copyright (C) 2000, Eric Warmenhoven <warmenhoven@yahoo.com> | |
6 * | |
7 * This program is free software; you can redistribute it and/or modify | |
8 * under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
20 */ | |
21 | |
22 #ifndef __GTK_IMHTML_H | |
23 #define __GTK_IMHTML_H | |
24 | |
25 #include <gdk/gdk.h> | |
3922 | 26 #include <gtk/gtktextview.h> |
4735 | 27 #include <gtk/gtktooltips.h> |
5012 | 28 #include <gtk/gtkimage.h> |
1428 | 29 |
30 #ifdef __cplusplus | |
31 extern "C" { | |
32 #endif | |
33 | |
34 #define GTK_TYPE_IMHTML (gtk_imhtml_get_type ()) | |
35 #define GTK_IMHTML(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_IMHTML, GtkIMHtml)) | |
36 #define GTK_IMHTML_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMHTML, GtkIMHtmlClass)) | |
37 #define GTK_IS_IMHTML(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_IMHTML)) | |
38 #define GTK_IS_IMHTML_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMHTML)) | |
5967 | 39 #define GTK_IMHTML_SCALABLE(obj) ((GtkIMHtmlScalable *)obj) |
1428 | 40 |
5967 | 41 typedef struct _GtkIMHtml GtkIMHtml; |
42 typedef struct _GtkIMHtmlClass GtkIMHtmlClass; | |
43 typedef struct _GtkIMHtmlFontDetail GtkIMHtmlFontDetail; /* The five elements contained in a FONT tag */ | |
44 typedef struct _GtkSmileyTree GtkSmileyTree; | |
45 typedef struct _GtkIMHtmlSmiley GtkIMHtmlSmiley; | |
46 typedef struct _GtkIMHtmlScalable GtkIMHtmlScalable; | |
47 typedef struct _GtkIMHtmlImage GtkIMHtmlImage; | |
48 typedef struct _GtkIMHtmlHr GtkIMHtmlHr; | |
1428 | 49 |
7694 | 50 |
51 typedef struct { | |
52 GtkTextMark *start; | |
53 GtkTextMark *end; | |
54 char *start_tag; | |
55 char *end_tag; | |
56 GtkTextBuffer *buffer; | |
7714 | 57 GtkTextTag *tag; |
7694 | 58 } GtkIMHtmlFormatSpan; |
59 | |
1428 | 60 struct _GtkIMHtml { |
3922 | 61 GtkTextView text_view; |
62 GtkTextBuffer *text_buffer; | |
63 GtkTextMark *end; | |
64 gboolean comments, smileys; | |
1428 | 65 GdkCursor *hand_cursor; |
66 GdkCursor *arrow_cursor; | |
7694 | 67 GdkCursor *text_cursor; |
4032 | 68 GHashTable *smiley_data; |
69 GtkSmileyTree *default_smilies; | |
4254 | 70 |
71 gboolean show_smileys; | |
6124 | 72 gboolean show_comments; |
4735 | 73 |
74 GtkWidget *tip_window; | |
75 char *tip; | |
76 guint tip_timer; | |
4895 | 77 |
78 GList *scalables; | |
4947 | 79 GdkRectangle old_rect; |
7295 | 80 |
81 gchar *search_string; | |
7694 | 82 |
83 gboolean editable; | |
84 struct { | |
85 GtkIMHtmlFormatSpan *bold; | |
86 GtkIMHtmlFormatSpan *italic; | |
87 GtkIMHtmlFormatSpan *underline; | |
7714 | 88 GtkIMHtmlFormatSpan *forecolor; |
89 GtkIMHtmlFormatSpan *backcolor; | |
7717 | 90 GtkIMHtmlFormatSpan *fontface; |
7740 | 91 GtkIMHtmlFormatSpan *sizespan; |
92 int fontsize; | |
7694 | 93 } edit; |
94 GList *format_spans; | |
1428 | 95 }; |
96 | |
97 struct _GtkIMHtmlClass { | |
3922 | 98 GtkTextViewClass parent_class; |
1428 | 99 |
5967 | 100 void (*url_clicked)(GtkIMHtml *, const gchar *); |
101 }; | |
102 | |
103 struct _GtkIMHtmlFontDetail { | |
104 gushort size; | |
105 gchar *face; | |
106 gchar *fore; | |
107 gchar *back; | |
108 gchar *sml; | |
109 }; | |
110 | |
111 struct _GtkSmileyTree { | |
112 GString *values; | |
113 GtkSmileyTree **children; | |
114 GtkIMHtmlSmiley *image; | |
1428 | 115 }; |
116 | |
4263 | 117 struct _GtkIMHtmlSmiley { |
118 gchar *smile; | |
119 gchar *file; | |
6814
782907a6ae65
[gaim-migrate @ 7354]
Christian Hammond <chipx86@chipx86.com>
parents:
6282
diff
changeset
|
120 GdkPixbufAnimation *icon; |
4263 | 121 gboolean hidden; |
122 }; | |
123 | |
5967 | 124 struct _GtkIMHtmlScalable { |
4895 | 125 void (*scale)(struct _GtkIMHtmlScalable *, int, int); |
126 void (*add_to)(struct _GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
127 void (*free)(struct _GtkIMHtmlScalable *); | |
128 }; | |
129 | |
5967 | 130 struct _GtkIMHtmlImage { |
4895 | 131 GtkIMHtmlScalable scalable; |
5012 | 132 GtkImage *image; |
5046 | 133 GdkPixbuf *pixbuf; |
4895 | 134 GtkTextMark *mark; |
5012 | 135 gchar *filename; |
4895 | 136 int width; |
137 int height; | |
5967 | 138 }; |
4895 | 139 |
5967 | 140 struct _GtkIMHtmlHr { |
4895 | 141 GtkIMHtmlScalable scalable; |
142 GtkWidget *sep; | |
5967 | 143 }; |
144 | |
145 typedef enum { | |
146 GTK_IMHTML_NO_COLOURS = 1 << 0, | |
147 GTK_IMHTML_NO_FONTS = 1 << 1, | |
148 GTK_IMHTML_NO_COMMENTS = 1 << 2, | |
149 GTK_IMHTML_NO_TITLE = 1 << 3, | |
150 GTK_IMHTML_NO_NEWLINE = 1 << 4, | |
151 GTK_IMHTML_NO_SIZES = 1 << 5, | |
152 GTK_IMHTML_NO_SCROLL = 1 << 6, | |
153 GTK_IMHTML_RETURN_LOG = 1 << 7, | |
154 GTK_IMHTML_USE_POINTSIZE = 1 << 8 | |
155 } GtkIMHtmlOptions; | |
156 | |
157 GtkType gtk_imhtml_get_type (void); | |
158 GtkWidget* gtk_imhtml_new (void *, void *); | |
159 | |
160 void gtk_imhtml_set_adjustments (GtkIMHtml *imhtml, | |
161 GtkAdjustment *hadj, | |
162 GtkAdjustment *vadj); | |
163 | |
164 void gtk_imhtml_associate_smiley (GtkIMHtml *imhtml, | |
165 gchar *sml, GtkIMHtmlSmiley *smiley); | |
166 | |
167 void gtk_imhtml_remove_smileys (GtkIMHtml *imhtml); | |
168 | |
169 void gtk_imhtml_show_smileys (GtkIMHtml *imhtml, gboolean show); | |
170 | |
171 void gtk_imhtml_show_comments (GtkIMHtml *imhtml, gboolean show); | |
172 | |
6982 | 173 #define gtk_imhtml_append_text(x, y, z) \ |
174 gtk_imhtml_append_text_with_images(x, y, z, NULL) | |
175 | |
176 GString* gtk_imhtml_append_text_with_images (GtkIMHtml *imhtml, | |
177 const gchar *text, | |
178 GtkIMHtmlOptions options, | |
179 GSList *images); | |
5967 | 180 |
181 void gtk_imhtml_clear (GtkIMHtml *imhtml); | |
182 void gtk_imhtml_page_up (GtkIMHtml *imhtml); | |
183 void gtk_imhtml_page_down (GtkIMHtml *imhtml); | |
4895 | 184 |
185 GtkIMHtmlScalable *gtk_imhtml_scalable_new(); | |
6982 | 186 GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename); |
5967 | 187 void gtk_imhtml_image_free(GtkIMHtmlScalable *); |
188 void gtk_imhtml_image_scale(GtkIMHtmlScalable *, int, int); | |
189 void gtk_imhtml_image_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
4895 | 190 |
5967 | 191 GtkIMHtmlScalable *gtk_imhtml_hr_new(); |
192 void gtk_imhtml_hr_free(GtkIMHtmlScalable *); | |
193 void gtk_imhtml_hr_scale(GtkIMHtmlScalable *, int, int); | |
194 void gtk_imhtml_hr_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
4895 | 195 |
7295 | 196 /* Search functions */ |
197 gboolean gtk_imhtml_search_find(GtkIMHtml *imhtml, const gchar *text); | |
198 void gtk_imhtml_search_clear(GtkIMHtml *imhtml); | |
4895 | 199 |
7694 | 200 /* Editable stuff */ |
201 void gtk_imhtml_set_editable(GtkIMHtml *imhtml, gboolean editable); | |
202 gboolean gtk_imhtml_get_editable(GtkIMHtml *imhtml); | |
203 gboolean gtk_imhtml_toggle_bold(GtkIMHtml *imhtml); | |
7701 | 204 gboolean gtk_imhtml_toggle_italic(GtkIMHtml *imhtml); |
7694 | 205 gboolean gtk_imhtml_toggle_underline(GtkIMHtml *imhtml); |
7714 | 206 gboolean gtk_imhtml_toggle_forecolor(GtkIMHtml *imhtml, const char *color); |
207 gboolean gtk_imhtml_toggle_backcolor(GtkIMHtml *imhtml, const char *color); | |
7717 | 208 gboolean gtk_imhtml_toggle_fontface(GtkIMHtml *imhtml, const char *face); |
7707 | 209 void gtk_imhtml_insert_link(GtkIMHtml *imhtml, const char *url, const char *text); |
7736 | 210 void gtk_imhtml_insert_smiley(GtkIMHtml *imhtml, const char *sml, char *smiley); |
7740 | 211 void gtk_imhtml_font_shrink(GtkIMHtml *imhtml); |
212 void gtk_imhtml_font_grow(GtkIMHtml *imhtml); | |
7749 | 213 char *gtk_imhtml_get_markup_range(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *end); |
7694 | 214 char *gtk_imhtml_get_markup(GtkIMHtml *imhtml); |
215 char *gtk_imhtml_get_text(GtkIMHtml *imhtml); | |
216 | |
1428 | 217 #ifdef __cplusplus |
218 } | |
219 #endif | |
220 | |
221 #endif |