comparison pidgin/gtkwebview.h @ 32522:ac42a0dfda48

Apparently I missed these in my previous commit. Also changed the gtkwebview.h to be javadoc'ed.
author tdrhq@soc.pidgin.im
date Fri, 07 Aug 2009 18:27:41 +0000
parents
children b89351c7580b
comparison
equal deleted inserted replaced
32521:67143ecbddb1 32522:ac42a0dfda48
1 /**
2 * @file gtkwebview.h Wrapper over the Gtk WebKitWebView component
3 * @ingroup pidgin
4 */
5
6 /* Pidgin is the legal property of its developers, whose names are too numerous
7 * to list here. Please refer to the COPYRIGHT file distributed with this
8 * source distribution.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
23 */
24
25 #ifndef _PIDGIN_WEBVIEW_H_
26 #define _PIDGIN_WEBVIEW_H_
27
28 #include <glib.h>
29 #include <gtk/gtk.h>
30 #include <webkit/webkit.h>
31
32 #include "notify.h"
33
34 #define GTK_TYPE_WEBVIEW (gtk_webview_get_type())
35 #define GTK_WEBVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_WEBVIEW, GtkWebView))
36 #define GTK_WEBVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_WEBVIEW, GtkWebViewClass))
37 #define GTK_IS_WEBVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_WEBVIEW))
38 #define GTK_IS_IMHTML_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_WEBVIEW))
39
40
41 struct _GtkWebView
42 {
43 WebKitWebView webkit_web_view;
44
45 /*< private >*/
46 GHashTable *images; /**< a map from id to temporary file for the image */
47 gboolean empty; /**< whether anything has been appended **/
48 char *script_return; /**< the last value returned from a script **/
49 };
50
51 typedef struct _GtkWebView GtkWebView;
52
53 struct _GtkWebViewClass
54 {
55 WebKitWebViewClass parent;
56 };
57
58 typedef struct _GtkWebViewClass GtkWebViewClass;
59
60
61 /**
62 * Returns the GType for a GtkWebView widget
63 *
64 * @return the GType for GtkWebView widget
65 */
66 GType gtk_webview_get_type ();
67
68 /**
69 * Create a new GtkWebView object
70 *
71 * @return a GtkWidget corresponding to the GtkWebView object
72 */
73 GtkWidget* gtk_webview_new ();
74
75 /**
76 * A very basic routine to append html, which can be considered
77 * equivalent to a "document.write" using JavaScript.
78 *
79 * @param webview The GtkWebView object
80 * @param markup The html markup to append
81 */
82 void gtk_webview_append_html (GtkWebView *webview, const char* markup);
83
84 /**
85 * Rather than use webkit_webview_load_string, this routine
86 * parses and displays the <img id=?> tags that make use of the
87 * Pidgin imgstore.
88 *
89 * @param webview The GtkWebView object
90 * @param html The HTML content to load
91 */
92 void gtk_webview_load_html_string_with_imgstore (GtkWebView* webview, const char* html);
93
94 /**
95 * (To be changed, right now it just tests whether an append has been
96 * called since the last clear or since the Widget was created. So it
97 * does not test for load_string's called in between.
98 *
99 * @param webview The GtkWebView object
100 *
101 * @return gboolean indicating whether the webview is empty.
102 */
103 gboolean gtk_webview_is_empty (GtkWebView *webview);
104
105 /**
106 * Executes javascript and returns the answer of the script
107 * formatted as string. The return value needs to be freed using
108 * g_free. If the return values is not required you may instead
109 * use webkit_web_view_execute_script.
110 *
111 * @param webview The GtkWebView object
112 * @param script The JavaScript to execute
113 *
114 * @return the return value of the script.
115 */
116 char* gtk_webview_execute_script (GtkWebView *webview, const char *script);
117
118 /**
119 * Get the current contents of the GtkWebView object.
120 *
121 * @param webview The GtkWebView object
122 *
123 * @return a string with the contents. Needs to be g_free'd after use.
124 */
125 char* gtk_webview_get_markup (GtkWebView *webview);
126
127 /**
128 * Returns the contents of the GtkWebView object, stripped of markups
129 *
130 * @param webview The GtkWebView object
131 *
132 * @return a string with the contents. Needs to be g_free'd after use.
133 */
134 char* gtk_webview_get_text (GtkWebView *view);
135
136 /**
137 * A convenience routine to quote a string for use as a JavaScript
138 * string. For instance, "hello 'world'" becomes "'hello \\'world\\''"
139 *
140 * @param str The string to escape and quote
141 *
142 * @return the quoted string.
143 */
144 char* gtk_webview_quote_js_string (const char* str);
145
146 #endif /* _PIDGIN_WEBVIEW_H_ */