1 /*
2  * e-web-view-preview.h
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
11  * for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program; if not, see <http://www.gnu.org/licenses/>.
15  *
16  *
17  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
18  *
19  */
20 
21 /* This is intended to serve as a common widget for previews before import.
22  * It contains a GtkTreeView at the top and an EWebView at the bottom.
23  * The tree view is not shown initially, it should be forced with
24  * e_web_view_preview_show_tree_view().
25  *
26  * The internal default EWebView can be accessed by e_web_view_preview_get_preview()
27  * and it should be updated for each change of the selected item in the tree
28  * view, when it's shown.
29  *
30  * Updating an EWebView content through helper functions of an EWebViewPreview
31  * begins with call of e_web_view_preview_begin_update(), which starts an empty
32  * page construction, which is finished by e_web_view_preview_end_update(),
33  * and the content of the EWebView is updated.
34  */
35 
36 #if !defined (__E_UTIL_H_INSIDE__) && !defined (LIBEUTIL_COMPILATION)
37 #error "Only <e-util/e-util.h> should be included directly."
38 #endif
39 
40 #ifndef E_WEB_VIEW_PREVIEW_H
41 #define E_WEB_VIEW_PREVIEW_H
42 
43 #include <e-util/e-web-view.h>
44 
45 /* Standard GObject macros */
46 #define E_TYPE_WEB_VIEW_PREVIEW \
47 	(e_web_view_preview_get_type ())
48 #define E_WEB_VIEW_PREVIEW(obj) \
49 	(G_TYPE_CHECK_INSTANCE_CAST \
50 	((obj), E_TYPE_WEB_VIEW_PREVIEW, EWebViewPreview))
51 #define E_WEB_VIEW_PREVIEW_CLASS(cls) \
52 	(G_TYPE_CHECK_CLASS_CAST \
53 	((cls), E_TYPE_WEB_VIEW_PREVIEW, EWebViewPreviewClass))
54 #define E_IS_WEB_VIEW_PREVIEW(obj) \
55 	(G_TYPE_CHECK_INSTANCE_TYPE \
56 	((obj), E_TYPE_WEB_VIEW_PREVIEW))
57 #define E_IS_WEB_VIEW_PREVIEW_CLASS(cls) \
58 	(G_TYPE_CHECK_CLASS_TYPE \
59 	((cls), E_TYPE_WEB_VIEW_PREVIEW))
60 #define E_WEB_VIEW_PREVIEW_GET_CLASS(obj) \
61 	(G_TYPE_INSTANCE_GET_CLASS \
62 	((obj), E_TYPE_WEB_VIEW_PREVIEW, EWebViewPreviewClass))
63 
64 G_BEGIN_DECLS
65 
66 typedef struct _EWebViewPreview EWebViewPreview;
67 typedef struct _EWebViewPreviewClass EWebViewPreviewClass;
68 typedef struct _EWebViewPreviewPrivate EWebViewPreviewPrivate;
69 
70 struct _EWebViewPreview {
71 	GtkVPaned parent;
72 	EWebViewPreviewPrivate *priv;
73 };
74 
75 struct _EWebViewPreviewClass {
76 	GtkVPanedClass parent_class;
77 };
78 
79 GType		e_web_view_preview_get_type	(void) G_GNUC_CONST;
80 GtkWidget *	e_web_view_preview_new		(void);
81 GtkTreeView *	e_web_view_preview_get_tree_view
82 						(EWebViewPreview *preview);
83 GtkWidget *	e_web_view_preview_get_preview	(EWebViewPreview *preview);
84 void		e_web_view_preview_set_preview	(EWebViewPreview *preview,
85 						 GtkWidget *preview_widget);
86 void		e_web_view_preview_show_tree_view
87 						(EWebViewPreview *preview);
88 void		e_web_view_preview_hide_tree_view
89 						(EWebViewPreview *preview);
90 gboolean	e_web_view_preview_get_escape_values
91 						(EWebViewPreview *preview);
92 void		e_web_view_preview_set_escape_values
93 						(EWebViewPreview *preview,
94 						 gboolean escape);
95 void		e_web_view_preview_begin_update	(EWebViewPreview *preview);
96 void		e_web_view_preview_end_update	(EWebViewPreview *preview);
97 void		e_web_view_preview_add_header	(EWebViewPreview *preview,
98 						 gint index,
99 						 const gchar *header);
100 void		e_web_view_preview_add_text	(EWebViewPreview *preview,
101 						 const gchar *text);
102 void		e_web_view_preview_add_raw_html	(EWebViewPreview *preview,
103 						 const gchar *raw_html);
104 void		e_web_view_preview_add_separator
105 						(EWebViewPreview *preview);
106 void		e_web_view_preview_add_empty_line
107 						(EWebViewPreview *preview);
108 void		e_web_view_preview_add_section	(EWebViewPreview *preview,
109 						 const gchar *section,
110 						 const gchar *value);
111 void		e_web_view_preview_add_section_html
112 						(EWebViewPreview *preview,
113 						 const gchar *section,
114 						 const gchar *html);
115 
116 G_END_DECLS
117 
118 #endif /* E_WEB_VIEW_PREVIEW_H */
119