1
|
1 /*
|
|
2 * gaim
|
|
3 *
|
|
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
|
|
5 *
|
|
6 * This program is free software; you can redistribute it and/or modify
|
|
7 * it 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_HTML_H__
|
|
23 #define __GTK_HTML_H__
|
|
24
|
|
25 #include <gdk/gdk.h>
|
|
26 #include <gtk/gtkwidget.h>
|
|
27
|
|
28 #ifdef __cplusplus
|
|
29 /*extern "C" {*/
|
|
30 #endif /* __cplusplus */
|
|
31
|
|
32 #define GTK_TYPE_HTML (gtk_html_get_type())
|
|
33 #define GTK_HTML(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_HTML, GtkHtml))
|
|
34 #define GTK_HTML_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_HTML, GtkHtmlClass))
|
|
35 #define GTK_IS_HTML(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_HTML))
|
|
36 #define GTK_IS_HTML_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HTML)
|
|
37
|
|
38 typedef struct _GtkHtml GtkHtml;
|
|
39 typedef struct _GtkHtmlClass GtkHtmlClass;
|
|
40 typedef struct _GtkHtmlBit GtkHtmlBit;
|
|
41
|
|
42
|
|
43 struct _GtkHtmlBit {
|
|
44 int type;
|
|
45 GdkColor *fore;
|
|
46 GdkColor *back;
|
|
47 GdkFont *font;
|
|
48 int uline;
|
|
49 int strike;
|
|
50 int width, height;
|
|
51 int x, y;
|
|
52 char *url;
|
|
53 int was_selected;
|
|
54 int sel_s, sel_e;
|
|
55 int newline;
|
|
56 char *text;
|
|
57 GdkPixmap *pm;
|
|
58 int fit;
|
|
59 };
|
|
60
|
|
61
|
|
62 struct _GtkHtml {
|
|
63 GtkWidget widget;
|
|
64
|
|
65 GdkWindow *html_area;
|
|
66
|
|
67 GtkAdjustment *hadj;
|
|
68 GtkAdjustment *vadj;
|
|
69
|
|
70 gint xoffset;
|
|
71 gint yoffset;
|
|
72
|
|
73 int current_x;
|
|
74 int current_y;
|
|
75 GdkGC *gc;
|
|
76 GdkGC *bg_gc;
|
|
77 GList *html_bits;
|
|
78 GList *urls;
|
|
79 int start_sel_x, start_sel_y;
|
|
80 GtkHtmlBit *start_sel, *end_sel;
|
|
81 int num_start, num_end;
|
|
82 char *selected_text;
|
|
83 gint editable;
|
|
84 gint transparent;
|
|
85 gint timer;
|
|
86 gint last_ver_value;
|
|
87 char *title;
|
|
88 gint frozen;
|
|
89 GtkHtmlBit *cursor_hb;
|
|
90 GtkWidget *tooltip_window;
|
|
91 GtkHtmlBit *tooltip_hb;
|
|
92 int tooltip_timer;
|
|
93 int cursor_pos;
|
|
94 GdkPixmap *pm;
|
|
95
|
|
96 };
|
|
97
|
|
98
|
|
99 struct _GtkHtmlClass {
|
|
100 GtkWidgetClass parent_class;
|
|
101
|
|
102 void (*set_scroll_adjustments) (GtkHtml *html,
|
|
103 GtkAdjustment *hadjustment,
|
|
104 GtkAdjustment *vadjustment);
|
|
105
|
|
106 };
|
|
107
|
|
108
|
|
109 #define HTML_BIT_TEXT 0
|
|
110 #define HTML_BIT_PIXMAP 1
|
|
111 #define HTML_BIT_SEP 2
|
|
112
|
|
113
|
|
114 #define HTML_OPTION_NO_COLOURS 0x01
|
|
115 #define HTML_OPTION_NO_FONTS 0x02
|
|
116
|
|
117 #define STYLE_ITALIC 0x01000000
|
|
118 #define STYLE_BOLD 0x020000000
|
|
119
|
|
120 #define FIXED_FONT "-*-courier-medium-r-*-*-*-%d-*-*-*-*-*-*"
|
|
121 #define FIXED_BOLD_FONT "-*-courier-bold-r-*-*-*-%d-*-*-*-*-*-*"
|
|
122 #define FIXED_ITALIC_FONT "-*-courier-medium-o-*-*-*-%d-*-*-*-*-*-*"
|
|
123 #define FIXED_BOLD_ITALIC_FONT "-*-courier-bold-o-*-*-*-%d-*-*-*-*-*-*"
|
|
124 #define PROP_FONT "-*-helvetica-medium-r-*-*-*-%d-*-*-*-*-*-*"
|
|
125 #define PROP_BOLD_FONT "-*-helvetica-bold-r-*-*-*-%d-*-*-*-*-*-*"
|
|
126 #define PROP_ITALIC_FONT "-*-helvetica-medium-o-*-*-*-%d-*-*-*-*-*-*"
|
|
127 #define PROP_BOLD_ITALIC_FONT "-*-helvetica-bold-o-*-*-*-%d-*-*-*-*-*-*"
|
|
128
|
|
129
|
|
130
|
|
131 #define HTML_TOOLTIP_DELAY 500
|
|
132
|
|
133
|
|
134
|
|
135 GtkType gtk_html_get_type (void);
|
|
136 GtkWidget* gtk_html_new (GtkAdjustment *hadj,
|
|
137 GtkAdjustment *vadj);
|
|
138 void gtk_html_set_editable (GtkHtml *html,
|
|
139 gboolean is_editable);
|
|
140 void gtk_html_set_transparent (GtkHtml *html,
|
|
141 gboolean is_transparent);
|
|
142 void gtk_html_set_adjustments (GtkHtml *html,
|
|
143 GtkAdjustment *hadj,
|
|
144 GtkAdjustment *vadj);
|
|
145 void gtk_html_append_text (GtkHtml *html,
|
|
146 char *text,
|
|
147 gint options);
|
|
148 void gtk_html_freeze (GtkHtml *html);
|
|
149 void gtk_html_thaw (GtkHtml *html);
|
|
150
|
|
151
|
|
152
|
|
153
|
|
154 #ifdef __cplusplus
|
|
155 /*}*/
|
|
156 #endif /* __cplusplus */
|
|
157
|
|
158 #endif /* __GTK_HTML_H__ */
|
|
159
|
|
160
|
|
161
|