Sat, 05 Apr 2003 01:45:13 +0000
[gaim-migrate @ 5348]
javabsp let us save IM images, and I plugged a few memory leaks
committer: Nathan Walp <nwalp@pidgin.im>
| 1428 | 1 | /* |
| 2 | * GtkIMHtml | |
| 3 | * | |
| 4 | * Copyright (C) 2000, Eric Warmenhoven <warmenhoven@yahoo.com> | |
| 5 | * | |
| 6 | * This program is free software; you can redistribute it and/or modify | |
| 7 | * under the terms of the GNU General Public License as published by | |
| 8 | * the Free Software Foundation; either version 2 of the License, or | |
| 9 | * (at your option) any later version. | |
| 10 | * | |
| 11 | * This program is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | * GNU General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * along with this program; if not, write to the Free Software | |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 19 | * | |
| 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)) | |
| 39 | ||
| 40 | typedef gchar** (*GtkIMHtmlImage) (gchar *url); | |
| 41 | ||
|
2349
9832b57ded64
[gaim-migrate @ 2362]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1780
diff
changeset
|
42 | typedef struct _GtkSmileyTree GtkSmileyTree; |
| 4263 | 43 | typedef struct _GtkIMHtmlSmiley GtkIMHtmlSmiley; |
|
2349
9832b57ded64
[gaim-migrate @ 2362]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1780
diff
changeset
|
44 | |
| 1428 | 45 | typedef struct _GtkIMHtml GtkIMHtml; |
| 46 | typedef struct _GtkIMHtmlClass GtkIMHtmlClass; | |
| 47 | ||
| 48 | struct _GtkIMHtml { | |
| 3922 | 49 | GtkTextView text_view; |
| 50 | GtkTextBuffer *text_buffer; | |
| 51 | GtkTextMark *end; | |
| 52 | gboolean comments, smileys; | |
| 1428 | 53 | GdkCursor *hand_cursor; |
| 54 | GdkCursor *arrow_cursor; | |
| 4032 | 55 | GHashTable *smiley_data; |
| 56 | GtkSmileyTree *default_smilies; | |
| 4254 | 57 | |
| 58 | gboolean show_smileys; | |
| 59 | gboolean show_comments; | |
| 4735 | 60 | |
| 61 | GtkWidget *tip_window; | |
| 62 | char *tip; | |
| 63 | guint tip_timer; | |
| 4895 | 64 | |
| 65 | GList *scalables; | |
| 4947 | 66 | GdkRectangle old_rect; |
| 1428 | 67 | }; |
| 68 | ||
| 69 | struct _GtkIMHtmlClass { | |
| 3922 | 70 | GtkTextViewClass parent_class; |
| 1428 | 71 | |
| 72 | void (*url_clicked) (GtkIMHtml *, const gchar *); | |
| 73 | }; | |
| 74 | ||
| 4263 | 75 | struct _GtkIMHtmlSmiley { |
| 76 | gchar *smile; | |
| 77 | gchar *file; | |
| 78 | GdkPixbuf *icon; | |
| 79 | gboolean hidden; | |
| 80 | }; | |
| 81 | ||
| 1428 | 82 | typedef enum |
| 83 | { | |
| 84 | GTK_IMHTML_NO_COLOURS = 1 << 0, | |
| 85 | GTK_IMHTML_NO_FONTS = 1 << 1, | |
| 86 | GTK_IMHTML_NO_COMMENTS = 1 << 2, | |
| 87 | GTK_IMHTML_NO_TITLE = 1 << 3, | |
| 88 | GTK_IMHTML_NO_NEWLINE = 1 << 4, | |
| 89 | GTK_IMHTML_NO_SIZES = 1 << 5, | |
| 90 | GTK_IMHTML_NO_SCROLL = 1 << 6, | |
| 91 | GTK_IMHTML_RETURN_LOG = 1 << 7 | |
| 92 | } GtkIMHtmlOptions; | |
| 93 | ||
| 94 | GtkType gtk_imhtml_get_type (void); | |
| 3922 | 95 | GtkWidget* gtk_imhtml_new (void *, void *); |
| 1428 | 96 | |
| 97 | void gtk_imhtml_set_adjustments (GtkIMHtml *imhtml, | |
| 98 | GtkAdjustment *hadj, | |
| 99 | GtkAdjustment *vadj); | |
| 100 | ||
| 101 | void gtk_imhtml_associate_smiley (GtkIMHtml *imhtml, | |
| 4032 | 102 | gchar *sml, |
| 4263 | 103 | GtkIMHtmlSmiley *smiley); |
| 1428 | 104 | |
|
2728
7c6a594a70a0
[gaim-migrate @ 2741]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2363
diff
changeset
|
105 | void gtk_imhtml_remove_smileys (GtkIMHtml *imhtml); |
|
7c6a594a70a0
[gaim-migrate @ 2741]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2363
diff
changeset
|
106 | |
| 1428 | 107 | void gtk_imhtml_show_smileys (GtkIMHtml *imhtml, |
| 108 | gboolean show); | |
| 109 | ||
| 110 | void gtk_imhtml_show_comments (GtkIMHtml *imhtml, | |
| 111 | gboolean show); | |
| 112 | ||
| 113 | GString* gtk_imhtml_append_text (GtkIMHtml *imhtml, | |
| 114 | const gchar *text, | |
|
2856
046ed5e89321
[gaim-migrate @ 2869]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2728
diff
changeset
|
115 | gint len, |
| 1428 | 116 | GtkIMHtmlOptions options); |
| 117 | ||
|
1780
431333222954
[gaim-migrate @ 1790]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1574
diff
changeset
|
118 | void gtk_imhtml_clear (GtkIMHtml *imhtml); |
|
431333222954
[gaim-migrate @ 1790]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1574
diff
changeset
|
119 | |
|
2363
0767c14d7879
[gaim-migrate @ 2376]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2349
diff
changeset
|
120 | void gtk_imhtml_page_up (GtkIMHtml *imhtml); |
|
0767c14d7879
[gaim-migrate @ 2376]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2349
diff
changeset
|
121 | |
|
0767c14d7879
[gaim-migrate @ 2376]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2349
diff
changeset
|
122 | void gtk_imhtml_page_down (GtkIMHtml *imhtml); |
| 3867 | 123 | void gtk_imhtml_to_bottom (GtkIMHtml *imhtml); |
|
2363
0767c14d7879
[gaim-migrate @ 2376]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2349
diff
changeset
|
124 | |
| 4895 | 125 | /* GtkIMHtmlScalable, gaim_im_image, and gaim_hr */ |
| 126 | ||
| 127 | typedef struct _GtkIMHtmlScalable GtkIMHtmlScalable; | |
| 128 | #define GTK_IMHTML_SCALABLE(x) ((GtkIMHtmlScalable *)x) | |
| 129 | ||
| 130 | struct _GtkIMHtmlScalable{ | |
| 131 | void (*scale)(struct _GtkIMHtmlScalable *, int, int); | |
| 132 | void (*add_to)(struct _GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
| 133 | void (*free)(struct _GtkIMHtmlScalable *); | |
| 134 | }; | |
| 135 | ||
| 136 | typedef struct { | |
| 137 | GtkIMHtmlScalable scalable; | |
| 5012 | 138 | GtkImage *image; |
| 4895 | 139 | GtkTextMark *mark; |
| 5012 | 140 | gchar *filename; |
| 4895 | 141 | int width; |
| 142 | int height; | |
| 143 | } gaim_im_image; | |
| 144 | ||
| 145 | typedef struct { | |
| 146 | GtkIMHtmlScalable scalable; | |
| 147 | GtkWidget *sep; | |
| 148 | } gaim_hr; | |
| 149 | ||
| 150 | GtkIMHtmlScalable *gtk_imhtml_scalable_new(); | |
| 151 | ||
| 5012 | 152 | GtkIMHtmlScalable *gaim_im_image_new(GdkPixbuf *img, gchar *filename); |
| 4895 | 153 | |
| 154 | void gaim_im_image_free(GtkIMHtmlScalable *); | |
| 155 | ||
| 156 | void gaim_im_image_scale(GtkIMHtmlScalable *, int, int); | |
| 157 | ||
| 158 | void gaim_im_image_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
| 159 | ||
| 160 | GtkIMHtmlScalable *gaim_hr_new(); | |
| 161 | ||
| 162 | void gaim_hr_free(GtkIMHtmlScalable *); | |
| 163 | ||
| 164 | void gaim_hr_scale(GtkIMHtmlScalable *, int, int); | |
| 165 | ||
| 166 | void gaim_hr_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); | |
| 167 | ||
| 168 | ||
| 169 | ||
| 1428 | 170 | #ifdef __cplusplus |
| 171 | } | |
| 172 | #endif | |
| 173 | ||
| 174 | #endif |