Mercurial > pidgin
annotate src/gtkimhtml.h @ 7707:17756d5dcfdf
[gaim-migrate @ 8352]
WYSIWYGed links. They'll have tooltips, but they won't be clickable. That
sounds like the right thing to do to me.
committer: Tailor Script <tailor@pidgin.im>
| author | Sean Egan <seanegan@gmail.com> |
|---|---|
| date | Wed, 03 Dec 2003 01:12:41 +0000 |
| parents | 734736bad76c |
| children | 3d9d3d21e600 |
| 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; | |
| 59 } GtkIMHtmlFormatSpan; | |
| 60 | |
| 1428 | 61 struct _GtkIMHtml { |
| 3922 | 62 GtkTextView text_view; |
| 63 GtkTextBuffer *text_buffer; | |
| 64 GtkTextMark *end; | |
| 65 gboolean comments, smileys; | |
| 1428 | 66 GdkCursor *hand_cursor; |
| 67 GdkCursor *arrow_cursor; | |
| 7694 | 68 GdkCursor *text_cursor; |
| 4032 | 69 GHashTable *smiley_data; |
| 70 GtkSmileyTree *default_smilies; | |
| 4254 | 71 |
| 72 gboolean show_smileys; | |
| 6124 | 73 gboolean show_comments; |
| 4735 | 74 |
| 75 GtkWidget *tip_window; | |
| 76 char *tip; | |
| 77 guint tip_timer; | |
| 4895 | 78 |
| 79 GList *scalables; | |
| 4947 | 80 GdkRectangle old_rect; |
| 7295 | 81 |
| 7346 | 82 GSList *copyables; |
| 83 | |
| 7295 | 84 gchar *search_string; |
| 7694 | 85 |
| 86 gboolean editable; | |
| 87 struct { | |
| 88 GtkIMHtmlFormatSpan *bold; | |
| 89 GtkIMHtmlFormatSpan *italic; | |
| 90 GtkIMHtmlFormatSpan *underline; | |
| 91 } edit; | |
| 92 GList *format_spans; | |
| 1428 | 93 }; |
| 94 | |
| 95 struct _GtkIMHtmlClass { | |
| 3922 | 96 GtkTextViewClass parent_class; |
| 1428 | 97 |
| 5967 | 98 void (*url_clicked)(GtkIMHtml *, const gchar *); |
| 99 }; | |
| 100 | |
| 101 struct _GtkIMHtmlFontDetail { | |
| 102 gushort size; | |
| 103 gchar *face; | |
| 104 gchar *fore; | |
| 105 gchar *back; | |
| 106 gchar *sml; | |
| 107 }; | |
| 108 | |
| 109 struct _GtkSmileyTree { | |
| 110 GString *values; | |
| 111 GtkSmileyTree **children; | |
| 112 GtkIMHtmlSmiley *image; | |
| 1428 | 113 }; |
| 114 | |
| 4263 | 115 struct _GtkIMHtmlSmiley { |
| 116 gchar *smile; | |
| 117 gchar *file; | |
|
6814
782907a6ae65
[gaim-migrate @ 7354]
Christian Hammond <chipx86@chipx86.com>
parents:
6282
diff
changeset
|
118 GdkPixbufAnimation *icon; |
| 4263 | 119 gboolean hidden; |
| 120 }; | |
| 121 | |
| 5967 | 122 struct _GtkIMHtmlScalable { |
| 4895 | 123 void (*scale)(struct _GtkIMHtmlScalable *, int, int); |
| 124 void (*add_to)(struct _GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
| 125 void (*free)(struct _GtkIMHtmlScalable *); | |
| 126 }; | |
| 127 | |
| 7346 | 128 struct _GtkIMHtmlCopyable { |
| 129 GtkTextMark *mark; | |
| 130 char *text; | |
| 131 }; | |
| 132 | |
| 5967 | 133 struct _GtkIMHtmlImage { |
| 4895 | 134 GtkIMHtmlScalable scalable; |
| 5012 | 135 GtkImage *image; |
| 5046 | 136 GdkPixbuf *pixbuf; |
| 4895 | 137 GtkTextMark *mark; |
| 5012 | 138 gchar *filename; |
| 4895 | 139 int width; |
| 140 int height; | |
| 5967 | 141 }; |
| 4895 | 142 |
| 5967 | 143 struct _GtkIMHtmlHr { |
| 4895 | 144 GtkIMHtmlScalable scalable; |
| 145 GtkWidget *sep; | |
| 5967 | 146 }; |
| 147 | |
| 148 typedef enum { | |
| 149 GTK_IMHTML_NO_COLOURS = 1 << 0, | |
| 150 GTK_IMHTML_NO_FONTS = 1 << 1, | |
| 151 GTK_IMHTML_NO_COMMENTS = 1 << 2, | |
| 152 GTK_IMHTML_NO_TITLE = 1 << 3, | |
| 153 GTK_IMHTML_NO_NEWLINE = 1 << 4, | |
| 154 GTK_IMHTML_NO_SIZES = 1 << 5, | |
| 155 GTK_IMHTML_NO_SCROLL = 1 << 6, | |
| 156 GTK_IMHTML_RETURN_LOG = 1 << 7, | |
| 157 GTK_IMHTML_USE_POINTSIZE = 1 << 8 | |
| 158 } GtkIMHtmlOptions; | |
| 159 | |
| 160 GtkType gtk_imhtml_get_type (void); | |
| 161 GtkWidget* gtk_imhtml_new (void *, void *); | |
| 162 | |
| 163 void gtk_imhtml_set_adjustments (GtkIMHtml *imhtml, | |
| 164 GtkAdjustment *hadj, | |
| 165 GtkAdjustment *vadj); | |
| 166 | |
| 167 void gtk_imhtml_associate_smiley (GtkIMHtml *imhtml, | |
| 168 gchar *sml, GtkIMHtmlSmiley *smiley); | |
| 169 | |
| 170 void gtk_imhtml_remove_smileys (GtkIMHtml *imhtml); | |
| 171 | |
| 172 void gtk_imhtml_show_smileys (GtkIMHtml *imhtml, gboolean show); | |
| 173 | |
| 174 void gtk_imhtml_show_comments (GtkIMHtml *imhtml, gboolean show); | |
| 175 | |
| 6982 | 176 #define gtk_imhtml_append_text(x, y, z) \ |
| 177 gtk_imhtml_append_text_with_images(x, y, z, NULL) | |
| 178 | |
| 179 GString* gtk_imhtml_append_text_with_images (GtkIMHtml *imhtml, | |
| 180 const gchar *text, | |
| 181 GtkIMHtmlOptions options, | |
| 182 GSList *images); | |
| 5967 | 183 |
| 184 void gtk_imhtml_clear (GtkIMHtml *imhtml); | |
| 185 void gtk_imhtml_page_up (GtkIMHtml *imhtml); | |
| 186 void gtk_imhtml_page_down (GtkIMHtml *imhtml); | |
| 4895 | 187 |
| 188 GtkIMHtmlScalable *gtk_imhtml_scalable_new(); | |
| 6982 | 189 GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename); |
| 5967 | 190 void gtk_imhtml_image_free(GtkIMHtmlScalable *); |
| 191 void gtk_imhtml_image_scale(GtkIMHtmlScalable *, int, int); | |
| 192 void gtk_imhtml_image_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
| 4895 | 193 |
| 5967 | 194 GtkIMHtmlScalable *gtk_imhtml_hr_new(); |
| 195 void gtk_imhtml_hr_free(GtkIMHtmlScalable *); | |
| 196 void gtk_imhtml_hr_scale(GtkIMHtmlScalable *, int, int); | |
| 197 void gtk_imhtml_hr_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
| 4895 | 198 |
| 7295 | 199 /* Search functions */ |
| 200 gboolean gtk_imhtml_search_find(GtkIMHtml *imhtml, const gchar *text); | |
| 201 void gtk_imhtml_search_clear(GtkIMHtml *imhtml); | |
| 4895 | 202 |
| 7694 | 203 /* Editable stuff */ |
| 204 void gtk_imhtml_set_editable(GtkIMHtml *imhtml, gboolean editable); | |
| 205 gboolean gtk_imhtml_get_editable(GtkIMHtml *imhtml); | |
| 206 gboolean gtk_imhtml_toggle_bold(GtkIMHtml *imhtml); | |
| 7701 | 207 gboolean gtk_imhtml_toggle_italic(GtkIMHtml *imhtml); |
| 7694 | 208 gboolean gtk_imhtml_toggle_underline(GtkIMHtml *imhtml); |
| 7707 | 209 void gtk_imhtml_insert_link(GtkIMHtml *imhtml, const char *url, const char *text); |
| 210 | |
| 7694 | 211 char *gtk_imhtml_get_markup(GtkIMHtml *imhtml); |
| 212 char *gtk_imhtml_get_text(GtkIMHtml *imhtml); | |
| 213 | |
| 1428 | 214 #ifdef __cplusplus |
| 215 } | |
| 216 #endif | |
| 217 | |
| 218 #endif |
