GnuCash c935c2f+
Loading...
Searching...
No Matches
gnc-html.h
1/********************************************************************
2 * gnc-html.h -- display html with gnc special tags *
3 * Copyright (C) 2000 Bill Gribble <grib@billgribble.com> *
4 * *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License as *
7 * published by the Free Software Foundation; either version 2 of *
8 * the License, or (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License*
16 * along with this program; if not, contact: *
17 * *
18 * Free Software Foundation Voice: +1-617-542-5942 *
19 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
20 * Boston, MA 02110-1301, USA gnu@gnu.org *
21\********************************************************************/
22
23#ifndef GNC_HTML_H
24#define GNC_HTML_H
25
32#include <glib-object.h>
33
34G_BEGIN_DECLS
35
36#define GNC_TYPE_HTML (gnc_html_get_type())
37#define GNC_HTML(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_HTML, GncHtml))
38#define GNC_HTML_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_HTML, GncHtmlClass))
39#define GNC_IS_HTML(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GNC_TYPE_HTML))
40#define GNC_IS_HTML_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((o), GNC_TYPE_HTML))
41#define GNC_HTML_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GNC_TYPE_HTML, GncHtmlClass))
42
43typedef struct _GncHtml GncHtml;
44typedef struct _GncHtmlClass GncHtmlClass;
45typedef struct _GncHtmlPrivate GncHtmlPrivate;
46
47#ifdef __cplusplus
48extern "C"
49{
50#endif
51
52GType gnc_html_get_type(void);
53
54#ifdef __cplusplus
55}
56#endif
57
58
59#include "gnc-html-extras.h"
60
61/* The result structure of url handlers. Strings should be g_malloc'd
62 * by the handler and will be freed by gnc_html. */
63typedef struct
64{
65 /* The following members are used if the handler succeeds (returns TRUE). */
66
67 gboolean load_to_stream; /* If TRUE, the url should be loaded from
68 * a stream using the rest of the data in
69 * the struct into the original gnc_html
70 * object. If FALSE, the handler will
71 * perform all needed actions itself. */
72
73 URLType url_type; /* Defaults to original */
74 gchar* location; /* If nullptr, use original (nullptr is default) */
75 gchar* label; /* If nullptr, use original (nullptr is default) */
76
77 URLType base_type;
78 gchar* base_location;
79
80 /* The window that triggered this URL request */
81 GtkWindow *parent;
82
83 /* The following members are used if the handler fails (returns FALSE). */
84 gchar* error_message;
86
87typedef gboolean (* GncHTMLObjectCB)(GncHtml* html, gpointer eb,
88 gpointer data);
89typedef gboolean (* GncHTMLStreamCB)(const gchar* location, gchar** data, int* datalen);
90typedef gboolean (* GncHTMLUrlCB)(const gchar* location, const gchar* label,
91 gboolean new_window, GNCURLResult* result);
92
93#ifdef __cplusplus
94#define NOEXCEPT noexcept
95extern "C"
96{
97#else
98#define NOEXCEPT
99#endif
100
109gboolean gnc_html_register_urltype( URLType type, const gchar* protocol ) NOEXCEPT;
110
114void gnc_html_initialize( void ) NOEXCEPT;
115
116#ifdef __cplusplus
117}
118#endif
119
120#include "gnc-html-history.h"
121
123{
124 GtkBinClass parent_class;
125
126 /* Methods */
127 void (*show_url)( GncHtml* html,
128 URLType type,
129 const gchar* location,
130 const gchar* label,
131 gboolean new_window_hint );
132 void (*show_data)( GncHtml* html, const gchar* data, int datalen );
133 void (*reload)( GncHtml* html, gboolean force_rebuild );
134 void (*copy_to_clipboard)( GncHtml* html );
135 gboolean (*export_to_file)( GncHtml* html, const gchar* file );
136#ifdef WEBKIT1
137 void (*print) (GncHtml* html, const gchar* jobname, gboolean export_pdf);
138#else
139 void (*print) (GncHtml* html, const gchar* jobname);
140#endif
141 void (*cancel)( GncHtml* html );
142 URLType (*parse_url)( GncHtml* html, const gchar* url,
143 gchar** url_location, gchar** url_label );
144 void (*set_parent)( GncHtml* html, GtkWindow* parent );
145};
146
148{
149 GtkBin parent_instance;
150
151 /*< private >*/
152 GncHtmlPrivate* priv;
153};
154
155typedef int (* GncHTMLUrltypeCB)(URLType ut);
156typedef void (* GncHTMLFlyoverCB)(GncHtml* html, const gchar* url,
157 gpointer data);
158typedef void (* GncHTMLLoadCB)(GncHtml* html, URLType type,
159 const gchar* location, const gchar* label,
160 gpointer data);
161typedef int (* GncHTMLButtonCB)(GncHtml* html, GdkEventButton* event,
162 gpointer data);
163
164#ifdef __cplusplus
165extern "C"
166{
167#endif
168
174void gnc_html_destroy( GncHtml* html ) NOEXCEPT;
175
181void gnc_html_show_url( GncHtml* html, URLType type, const gchar* location,
182 const gchar* label, gboolean new_window_hint ) NOEXCEPT;
183
189void gnc_html_show_data( GncHtml* html, const gchar* data, int datalen ) NOEXCEPT;
190
197void gnc_html_reload( GncHtml* html, gboolean view ) NOEXCEPT;
198
204void gnc_html_copy_to_clipboard( GncHtml* html ) NOEXCEPT;
205
213gboolean gnc_html_export_to_file( GncHtml* html, const gchar* filename ) NOEXCEPT;
214
215#ifdef WEBKIT1
225void gnc_html_print (GncHtml* html, const char* jobname, gboolean export_pdf) NOEXCEPT;
226#else
232void gnc_html_print (GncHtml* html, const char* jobname) NOEXCEPT;
233#endif
239void gnc_html_cancel( GncHtml* html ) NOEXCEPT;
240
249URLType gnc_html_parse_url( GncHtml* html, const gchar* url,
250 gchar** url_location, gchar** url_label ) NOEXCEPT;
251
258gnc_html_history* gnc_html_get_history( GncHtml* html ) NOEXCEPT;
259
266GtkWidget* gnc_html_get_widget( GncHtml* html ) NOEXCEPT;
267
274GtkWidget* gnc_html_get_webview( GncHtml* html ) NOEXCEPT;
275
276
283void gnc_html_set_parent( GncHtml* html, GtkWindow* parent ) NOEXCEPT;
284
285/* setting callbacks */
286void gnc_html_set_urltype_cb( GncHtml* html, GncHTMLUrltypeCB urltype_cb ) NOEXCEPT;
287void gnc_html_set_load_cb( GncHtml* html, GncHTMLLoadCB load_cb, gpointer data ) NOEXCEPT;
288void gnc_html_set_flyover_cb( GncHtml* html, GncHTMLFlyoverCB newwin_cb, gpointer data ) NOEXCEPT;
289void gnc_html_set_button_cb( GncHtml* html, GncHTMLButtonCB button_cb, gpointer data ) NOEXCEPT;
290
291/* object handlers deal with <object classid="foo"> objects in HTML.
292 * the handlers are looked up at object load time. */
293void gnc_html_register_object_handler( const gchar* classid, GncHTMLObjectCB hand ) NOEXCEPT;
294void gnc_html_unregister_object_handler( const gchar* classid ) NOEXCEPT;
295
296/* stream handlers load data for particular URLTypes. */
297void gnc_html_register_stream_handler( URLType url_type, GncHTMLStreamCB hand ) NOEXCEPT;
298void gnc_html_unregister_stream_handler( URLType url_type ) NOEXCEPT;
299
300/* handlers for particular URLTypes. */
301void gnc_html_register_url_handler( URLType url_type, GncHTMLUrlCB hand ) NOEXCEPT;
302void gnc_html_unregister_url_handler( URLType url_type ) NOEXCEPT;
303
304const gchar* gnc_html_get_embedded_param( gpointer eb, const gchar* param_name ) NOEXCEPT;
305
306#ifdef __cplusplus
307}
308#endif
309
310G_END_DECLS
311#endif