comparison src/gtkimhtml.h @ 5967:156953fe3e14

[gaim-migrate @ 6414] I gave gtkimhtml some TLC. It no longer contains the word "Gaim," and it doesn't complain about needing to include a header. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 28 Jun 2003 00:49:56 +0000
parents 3becf79500d2
children 19cb60247a6c
comparison
equal deleted inserted replaced
5966:5fb6bd688a5b 5967:156953fe3e14
1 /** 1 /**
2 * @file gtkimhtml.h GTK+ Gaim IM rendering component 2 * @file gtkimhtml.h GTK+ IM/HTML rendering component
3 * @ingroup gtkui 3 * @ingroup gtkui
4 * 4 *
5 * Copyright (C) 2000, Eric Warmenhoven <warmenhoven@yahoo.com> 5 * Copyright (C) 2000, Eric Warmenhoven <warmenhoven@yahoo.com>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
34 #define GTK_TYPE_IMHTML (gtk_imhtml_get_type ()) 34 #define GTK_TYPE_IMHTML (gtk_imhtml_get_type ())
35 #define GTK_IMHTML(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_IMHTML, GtkIMHtml)) 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)) 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)) 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)) 38 #define GTK_IS_IMHTML_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMHTML))
39 #define GTK_IMHTML_SCALABLE(obj) ((GtkIMHtmlScalable *)obj)
39 40
40 typedef gchar** (*GtkIMHtmlImage) (gchar *url); 41 typedef struct _GtkIMHtml GtkIMHtml;
41 42 typedef struct _GtkIMHtmlClass GtkIMHtmlClass;
42 typedef struct _GtkSmileyTree GtkSmileyTree; 43 typedef struct _GtkIMHtmlFontDetail GtkIMHtmlFontDetail; /* The five elements contained in a FONT tag */
43 typedef struct _GtkIMHtmlSmiley GtkIMHtmlSmiley; 44 typedef struct _GtkSmileyTree GtkSmileyTree;
44 45 typedef struct _GtkIMHtmlSmiley GtkIMHtmlSmiley;
45 typedef struct _GtkIMHtml GtkIMHtml; 46 typedef struct _GtkIMHtmlScalable GtkIMHtmlScalable;
46 typedef struct _GtkIMHtmlClass GtkIMHtmlClass; 47 typedef struct _GtkIMHtmlImage GtkIMHtmlImage;
48 typedef struct _GtkIMHtmlHr GtkIMHtmlHr;
47 49
48 struct _GtkIMHtml { 50 struct _GtkIMHtml {
49 GtkTextView text_view; 51 GtkTextView text_view;
50 GtkTextBuffer *text_buffer; 52 GtkTextBuffer *text_buffer;
51 GtkTextMark *end; 53 GtkTextMark *end;
67 }; 69 };
68 70
69 struct _GtkIMHtmlClass { 71 struct _GtkIMHtmlClass {
70 GtkTextViewClass parent_class; 72 GtkTextViewClass parent_class;
71 73
72 void (*url_clicked) (GtkIMHtml *, const gchar *); 74 void (*url_clicked)(GtkIMHtml *, const gchar *);
75 };
76
77 struct _GtkIMHtmlFontDetail {
78 gushort size;
79 gchar *face;
80 gchar *fore;
81 gchar *back;
82 gchar *sml;
83 };
84
85 struct _GtkSmileyTree {
86 GString *values;
87 GtkSmileyTree **children;
88 GtkIMHtmlSmiley *image;
73 }; 89 };
74 90
75 struct _GtkIMHtmlSmiley { 91 struct _GtkIMHtmlSmiley {
76 gchar *smile; 92 gchar *smile;
77 gchar *file; 93 gchar *file;
78 GdkPixbuf *icon; 94 GdkPixbuf *icon;
79 gboolean hidden; 95 gboolean hidden;
80 }; 96 };
81 97
82 typedef enum 98 struct _GtkIMHtmlScalable {
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 GTK_IMHTML_USE_POINTSIZE = 1 << 8
93 } GtkIMHtmlOptions;
94
95 GtkType gtk_imhtml_get_type (void);
96 GtkWidget* gtk_imhtml_new (void *, void *);
97
98 void gtk_imhtml_set_adjustments (GtkIMHtml *imhtml,
99 GtkAdjustment *hadj,
100 GtkAdjustment *vadj);
101
102 void gtk_imhtml_associate_smiley (GtkIMHtml *imhtml,
103 gchar *sml,
104 GtkIMHtmlSmiley *smiley);
105
106 void gtk_imhtml_remove_smileys (GtkIMHtml *imhtml);
107
108 void gtk_imhtml_show_smileys (GtkIMHtml *imhtml,
109 gboolean show);
110
111 void gtk_imhtml_show_comments (GtkIMHtml *imhtml,
112 gboolean show);
113
114 GString* gtk_imhtml_append_text (GtkIMHtml *imhtml,
115 const gchar *text,
116 gint len,
117 GtkIMHtmlOptions options);
118
119 void gtk_imhtml_clear (GtkIMHtml *imhtml);
120
121 void gtk_imhtml_page_up (GtkIMHtml *imhtml);
122
123 void gtk_imhtml_page_down (GtkIMHtml *imhtml);
124 void gtk_imhtml_to_bottom (GtkIMHtml *imhtml);
125
126 /* GtkIMHtmlScalable, gaim_im_image, and gaim_hr */
127
128 typedef struct _GtkIMHtmlScalable GtkIMHtmlScalable;
129 #define GTK_IMHTML_SCALABLE(x) ((GtkIMHtmlScalable *)x)
130
131 struct _GtkIMHtmlScalable{
132 void (*scale)(struct _GtkIMHtmlScalable *, int, int); 99 void (*scale)(struct _GtkIMHtmlScalable *, int, int);
133 void (*add_to)(struct _GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *); 100 void (*add_to)(struct _GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *);
134 void (*free)(struct _GtkIMHtmlScalable *); 101 void (*free)(struct _GtkIMHtmlScalable *);
135 }; 102 };
136 103
137 typedef struct { 104 struct _GtkIMHtmlImage {
138 GtkIMHtmlScalable scalable; 105 GtkIMHtmlScalable scalable;
139 GtkImage *image; 106 GtkImage *image;
140 GdkPixbuf *pixbuf; 107 GdkPixbuf *pixbuf;
141 GtkTextMark *mark; 108 GtkTextMark *mark;
142 gchar *filename; 109 gchar *filename;
143 int width; 110 int width;
144 int height; 111 int height;
145 } gaim_im_image; 112 };
146 113
147 typedef struct { 114 struct _GtkIMHtmlHr {
148 GtkIMHtmlScalable scalable; 115 GtkIMHtmlScalable scalable;
149 GtkWidget *sep; 116 GtkWidget *sep;
150 } gaim_hr; 117 };
118
119 typedef enum {
120 GTK_IMHTML_NO_COLOURS = 1 << 0,
121 GTK_IMHTML_NO_FONTS = 1 << 1,
122 GTK_IMHTML_NO_COMMENTS = 1 << 2,
123 GTK_IMHTML_NO_TITLE = 1 << 3,
124 GTK_IMHTML_NO_NEWLINE = 1 << 4,
125 GTK_IMHTML_NO_SIZES = 1 << 5,
126 GTK_IMHTML_NO_SCROLL = 1 << 6,
127 GTK_IMHTML_RETURN_LOG = 1 << 7,
128 GTK_IMHTML_USE_POINTSIZE = 1 << 8
129 } GtkIMHtmlOptions;
130
131 GtkType gtk_imhtml_get_type (void);
132 GtkWidget* gtk_imhtml_new (void *, void *);
133
134 void gtk_imhtml_set_adjustments (GtkIMHtml *imhtml,
135 GtkAdjustment *hadj,
136 GtkAdjustment *vadj);
137
138 void gtk_imhtml_associate_smiley (GtkIMHtml *imhtml,
139 gchar *sml, GtkIMHtmlSmiley *smiley);
140
141 void gtk_imhtml_remove_smileys (GtkIMHtml *imhtml);
142
143 void gtk_imhtml_show_smileys (GtkIMHtml *imhtml, gboolean show);
144
145 void gtk_imhtml_show_comments (GtkIMHtml *imhtml, gboolean show);
146
147 GString* gtk_imhtml_append_text (GtkIMHtml *imhtml,
148 const gchar *text, gint len, GtkIMHtmlOptions options);
149
150 void gtk_imhtml_clear (GtkIMHtml *imhtml);
151 void gtk_imhtml_page_up (GtkIMHtml *imhtml);
152 void gtk_imhtml_page_down (GtkIMHtml *imhtml);
153 void gtk_imhtml_to_bottom (GtkIMHtml *imhtml);
151 154
152 GtkIMHtmlScalable *gtk_imhtml_scalable_new(); 155 GtkIMHtmlScalable *gtk_imhtml_scalable_new();
156 GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, gchar *filename);
157 void gtk_imhtml_image_free(GtkIMHtmlScalable *);
158 void gtk_imhtml_image_scale(GtkIMHtmlScalable *, int, int);
159 void gtk_imhtml_image_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *);
153 160
154 GtkIMHtmlScalable *gaim_im_image_new(GdkPixbuf *img, gchar *filename); 161 GtkIMHtmlScalable *gtk_imhtml_hr_new();
155 162 void gtk_imhtml_hr_free(GtkIMHtmlScalable *);
156 void gaim_im_image_free(GtkIMHtmlScalable *); 163 void gtk_imhtml_hr_scale(GtkIMHtmlScalable *, int, int);
157 164 void gtk_imhtml_hr_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *);
158 void gaim_im_image_scale(GtkIMHtmlScalable *, int, int);
159
160 void gaim_im_image_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *);
161
162 GtkIMHtmlScalable *gaim_hr_new();
163
164 void gaim_hr_free(GtkIMHtmlScalable *);
165
166 void gaim_hr_scale(GtkIMHtmlScalable *, int, int);
167
168 void gaim_hr_add_to(GtkIMHtmlScalable *, GtkIMHtml *, GtkTextIter *);
169 165
170 166
171 #ifdef __cplusplus 167 #ifdef __cplusplus
172 } 168 }
173 #endif 169 #endif