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;
|
618
|
48 int uline;
|
|
49 int strike;
|
|
50 int width, height;
|
1
|
51 int x, y;
|
|
52 char *url;
|
|
53 int was_selected;
|
|
54 int sel_s, sel_e;
|
|
55 int newline;
|
618
|
56 char *text;
|
1
|
57 GdkPixmap *pm;
|
618
|
58 int fit;
|
1
|
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;
|
618
|
75 GdkGC *gc;
|
|
76 GdkGC *bg_gc;
|
1
|
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;
|
618
|
83 gint editable;
|
|
84 gint transparent;
|
1
|
85 gint timer;
|
|
86 gint last_ver_value;
|
618
|
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;
|
1
|
95 };
|
|
96
|
|
97
|
|
98 struct _GtkHtmlClass {
|
|
99 GtkWidgetClass parent_class;
|
|
100
|
|
101 void (*set_scroll_adjustments) (GtkHtml *html,
|
|
102 GtkAdjustment *hadjustment,
|
|
103 GtkAdjustment *vadjustment);
|
|
104
|
|
105 };
|
|
106
|
|
107
|
|
108 #define HTML_BIT_TEXT 0
|
|
109 #define HTML_BIT_PIXMAP 1
|
|
110 #define HTML_BIT_SEP 2
|
|
111
|
|
112 #define HTML_OPTION_NO_COLOURS 0x01
|
|
113 #define HTML_OPTION_NO_FONTS 0x02
|
|
114
|
|
115 #define STYLE_ITALIC 0x01000000
|
|
116 #define STYLE_BOLD 0x020000000
|
|
117
|
|
118 #define FIXED_FONT "-*-courier-medium-r-*-*-*-%d-*-*-*-*-*-*"
|
|
119 #define FIXED_BOLD_FONT "-*-courier-bold-r-*-*-*-%d-*-*-*-*-*-*"
|
|
120 #define FIXED_ITALIC_FONT "-*-courier-medium-o-*-*-*-%d-*-*-*-*-*-*"
|
|
121 #define FIXED_BOLD_ITALIC_FONT "-*-courier-bold-o-*-*-*-%d-*-*-*-*-*-*"
|
|
122 #define PROP_FONT "-*-helvetica-medium-r-*-*-*-%d-*-*-*-*-*-*"
|
|
123 #define PROP_BOLD_FONT "-*-helvetica-bold-r-*-*-*-%d-*-*-*-*-*-*"
|
|
124 #define PROP_ITALIC_FONT "-*-helvetica-medium-o-*-*-*-%d-*-*-*-*-*-*"
|
|
125 #define PROP_BOLD_ITALIC_FONT "-*-helvetica-bold-o-*-*-*-%d-*-*-*-*-*-*"
|
|
126
|
|
127 #define HTML_TOOLTIP_DELAY 500
|
|
128
|
618
|
129 GtkType gtk_html_get_type (void);
|
|
130 GtkWidget* gtk_html_new (GtkAdjustment *hadj,
|
|
131 GtkAdjustment *vadj);
|
|
132 void gtk_html_set_editable (GtkHtml *html,
|
|
133 gboolean is_editable);
|
|
134 void gtk_html_set_transparent (GtkHtml *html,
|
|
135 gboolean is_transparent);
|
|
136 void gtk_html_set_adjustments (GtkHtml *html,
|
|
137 GtkAdjustment *hadj,
|
|
138 GtkAdjustment *vadj);
|
|
139 void gtk_html_append_text (GtkHtml *html,
|
|
140 char *text, gint options);
|
|
141 void gtk_html_freeze (GtkHtml *html);
|
|
142 void gtk_html_thaw (GtkHtml *html);
|
|
143 void gtk_html_add_pixmap (GtkHtml * html, GdkPixmap *pm,
|
|
144 gint fint, gint newline);
|
1
|
145
|
|
146 #ifdef __cplusplus
|
|
147 /*}*/
|
|
148 #endif /* __cplusplus */
|
|
149
|
|
150 #endif /* __GTK_HTML_H__ */
|
|
151
|
|
152
|
|
153
|