Mercurial > pidgin
annotate src/gtkimhtml.h @ 7735:edebf99a5ec4
[gaim-migrate @ 8380]
WYSIWYGation of the smileys. These will only WYSIWYG when you use the select
smiley dialog, although with the smiley tree being so perfect for something
like lookup smiley while you search, we could easily auto-replace smileys.
But then we would have to worry about stuff like :) and :)) being different.
I'm going to leave it this way for now.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Thu, 04 Dec 2003 05:06:59 +0000 |
parents | db3bdae1761e |
children | 662a33ce4343 |
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) |
7346 | 40 #define GTK_IMHTML_COPYABLE(obj) ((GtkIMHtmlCopyable *)obj) |
1428 | 41 |
5967 | 42 typedef struct _GtkIMHtml GtkIMHtml; |
43 typedef struct _GtkIMHtmlClass GtkIMHtmlClass; | |
44 typedef struct _GtkIMHtmlFontDetail GtkIMHtmlFontDetail; /* The five elements contained in a FONT tag */ | |
45 typedef struct _GtkSmileyTree GtkSmileyTree; | |
46 typedef struct _GtkIMHtmlSmiley GtkIMHtmlSmiley; | |
47 typedef struct _GtkIMHtmlScalable GtkIMHtmlScalable; | |
48 typedef struct _GtkIMHtmlImage GtkIMHtmlImage; | |
49 typedef struct _GtkIMHtmlHr GtkIMHtmlHr; | |
7346 | 50 typedef struct _GtkIMHtmlCopyable GtkIMHtmlCopyable; |
1428 | 51 |
7694 | 52 |
53 typedef struct { | |
54 GtkTextMark *start; | |
55 GtkTextMark *end; | |
56 char *start_tag; | |
57 char *end_tag; | |
58 GtkTextBuffer *buffer; | |
7714 | 59 GtkTextTag *tag; |
7694 | 60 } GtkIMHtmlFormatSpan; |
61 | |
1428 | 62 struct _GtkIMHtml { |
3922 | 63 GtkTextView text_view; |
64 GtkTextBuffer *text_buffer; | |
65 GtkTextMark *end; | |
66 gboolean comments, smileys; | |
1428 | 67 GdkCursor *hand_cursor; |
68 GdkCursor *arrow_cursor; | |
7694 | 69 GdkCursor *text_cursor; |
4032 | 70 GHashTable *smiley_data; |
71 GtkSmileyTree *default_smilies; | |
4254 | 72 |
73 gboolean show_smileys; | |
6124 | 74 gboolean show_comments; |
4735 | 75 |
76 GtkWidget *tip_window; | |
77 char *tip; | |
78 guint tip_timer; | |
4895 | 79 |
80 GList *scalables; | |
4947 | 81 GdkRectangle old_rect; |
7295 | 82 |
7346 | 83 GSList *copyables; |
84 | |
7295 | 85 gchar *search_string; |
7694 | 86 |
87 gboolean editable; | |
88 struct { | |
89 GtkIMHtmlFormatSpan *bold; | |
90 GtkIMHtmlFormatSpan *italic; | |
91 GtkIMHtmlFormatSpan *underline; | |
7714 | 92 GtkIMHtmlFormatSpan *forecolor; |
93 GtkIMHtmlFormatSpan *backcolor; | |
7717 | 94 GtkIMHtmlFormatSpan *fontface; |
7694 | 95 } edit; |
96 GList *format_spans; | |
1428 | 97 }; |
98 | |
99 struct _GtkIMHtmlClass { | |
3922 | 100 GtkTextViewClass parent_class; |
1428 | 101 |
5967 | 102 void (*url_clicked)(GtkIMHtml *, const gchar *); |
103 }; | |
104 | |
105 struct _GtkIMHtmlFontDetail { | |
106 gushort size; | |
107 gchar *face; | |
108 gchar *fore; | |
109 gchar *back; | |
110 gchar *sml; | |
111 }; | |
112 | |
113 struct _GtkSmileyTree { | |
114 GString *values; | |
115 GtkSmileyTree **children; | |
116 GtkIMHtmlSmiley *image; | |
1428 | 117 }; |
118 | |
4263 | 119 struct _GtkIMHtmlSmiley { |
120 gchar *smile; | |
121 gchar *file; | |
6814
782907a6ae65
[gaim-migrate @ 7354]
Christian Hammond <chipx86@chipx86.com>
parents:
6282
diff
changeset
|
122 GdkPixbufAnimation *icon; |
4263 | 123 gboolean hidden; |
124 }; | |
125 | |
5967 | 126 struct _GtkIMHtmlScalable { |
4895 | 127 void (*scale)(struct _GtkIMHtmlScalable *, int, int); |
128 void (*add_to)(struct _GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
129 void (*free)(struct _GtkIMHtmlScalable *); | |
130 }; | |
131 | |
7346 | 132 struct _GtkIMHtmlCopyable { |
133 GtkTextMark *mark; | |
134 char *text; | |
135 }; | |
136 | |
5967 | 137 struct _GtkIMHtmlImage { |
4895 | 138 GtkIMHtmlScalable scalable; |
5012 | 139 GtkImage *image; |
5046 | 140 GdkPixbuf *pixbuf; |
4895 | 141 GtkTextMark *mark; |
5012 | 142 gchar *filename; |
4895 | 143 int width; |
144 int height; | |
5967 | 145 }; |
4895 | 146 |
5967 | 147 struct _GtkIMHtmlHr { |
4895 | 148 GtkIMHtmlScalable scalable; |
149 GtkWidget *sep; | |
5967 | 150 }; |
151 | |
152 typedef enum { | |
153 GTK_IMHTML_NO_COLOURS = 1 << 0, | |
154 GTK_IMHTML_NO_FONTS = 1 << 1, | |
155 GTK_IMHTML_NO_COMMENTS = 1 << 2, | |
156 GTK_IMHTML_NO_TITLE = 1 << 3, | |
157 GTK_IMHTML_NO_NEWLINE = 1 << 4, | |
158 GTK_IMHTML_NO_SIZES = 1 << 5, | |
159 GTK_IMHTML_NO_SCROLL = 1 << 6, | |
160 GTK_IMHTML_RETURN_LOG = 1 << 7, | |
161 GTK_IMHTML_USE_POINTSIZE = 1 << 8 | |
162 } GtkIMHtmlOptions; | |
163 | |
164 GtkType gtk_imhtml_get_type (void); | |
165 GtkWidget* gtk_imhtml_new (void *, void *); | |
166 | |
167 void gtk_imhtml_set_adjustments (GtkIMHtml *imhtml, | |
168 GtkAdjustment *hadj, | |
169 GtkAdjustment *vadj); | |
170 | |
171 void gtk_imhtml_associate_smiley (GtkIMHtml *imhtml, | |
172 gchar *sml, GtkIMHtmlSmiley *smiley); | |
173 | |
174 void gtk_imhtml_remove_smileys (GtkIMHtml *imhtml); | |
175 | |
176 void gtk_imhtml_show_smileys (GtkIMHtml *imhtml, gboolean show); | |
177 | |
178 void gtk_imhtml_show_comments (GtkIMHtml *imhtml, gboolean show); | |
179 | |
6982 | 180 #define gtk_imhtml_append_text(x, y, z) \ |
181 gtk_imhtml_append_text_with_images(x, y, z, NULL) | |
182 | |
183 GString* gtk_imhtml_append_text_with_images (GtkIMHtml *imhtml, | |
184 const gchar *text, | |
185 GtkIMHtmlOptions options, | |
186 GSList *images); | |
5967 | 187 |
188 void gtk_imhtml_clear (GtkIMHtml *imhtml); | |
189 void gtk_imhtml_page_up (GtkIMHtml *imhtml); | |
190 void gtk_imhtml_page_down (GtkIMHtml *imhtml); | |
4895 | 191 |
192 GtkIMHtmlScalable *gtk_imhtml_scalable_new(); | |
6982 | 193 GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename); |
5967 | 194 void gtk_imhtml_image_free(GtkIMHtmlScalable *); |
195 void gtk_imhtml_image_scale(GtkIMHtmlScalable *, int, int); | |
196 void gtk_imhtml_image_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
4895 | 197 |
5967 | 198 GtkIMHtmlScalable *gtk_imhtml_hr_new(); |
199 void gtk_imhtml_hr_free(GtkIMHtmlScalable *); | |
200 void gtk_imhtml_hr_scale(GtkIMHtmlScalable *, int, int); | |
201 void gtk_imhtml_hr_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
4895 | 202 |
7295 | 203 /* Search functions */ |
204 gboolean gtk_imhtml_search_find(GtkIMHtml *imhtml, const gchar *text); | |
205 void gtk_imhtml_search_clear(GtkIMHtml *imhtml); | |
4895 | 206 |
7694 | 207 /* Editable stuff */ |
208 void gtk_imhtml_set_editable(GtkIMHtml *imhtml, gboolean editable); | |
209 gboolean gtk_imhtml_get_editable(GtkIMHtml *imhtml); | |
210 gboolean gtk_imhtml_toggle_bold(GtkIMHtml *imhtml); | |
7701 | 211 gboolean gtk_imhtml_toggle_italic(GtkIMHtml *imhtml); |
7694 | 212 gboolean gtk_imhtml_toggle_underline(GtkIMHtml *imhtml); |
7714 | 213 gboolean gtk_imhtml_toggle_forecolor(GtkIMHtml *imhtml, const char *color); |
214 gboolean gtk_imhtml_toggle_backcolor(GtkIMHtml *imhtml, const char *color); | |
7717 | 215 gboolean gtk_imhtml_toggle_fontface(GtkIMHtml *imhtml, const char *face); |
7707 | 216 void gtk_imhtml_insert_link(GtkIMHtml *imhtml, const char *url, const char *text); |
217 | |
7694 | 218 char *gtk_imhtml_get_markup(GtkIMHtml *imhtml); |
219 char *gtk_imhtml_get_text(GtkIMHtml *imhtml); | |
220 | |
1428 | 221 #ifdef __cplusplus |
222 } | |
223 #endif | |
224 | |
225 #endif |