Update Chinese (China) translation
[yelp.git] / libyelp / yelp-view.h
blobc28e131d87234a75ffccb3d218ca9fb3149c72b7
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * Copyright (C) 2009 Shaun McCance <shaunm@gnome.org>
4 * Copyright (C) 2014 Igalia S.L.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
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 GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public
17 * License along with this program; if not, see <http://www.gnu.org/licenses/>.
19 * Author: Shaun McCance <shaunm@gnome.org>
22 #ifndef __YELP_VIEW_H__
23 #define __YELP_VIEW_H__
25 #include <gtk/gtk.h>
26 #include <webkit2/webkit2.h>
28 #include "yelp-document.h"
29 #include "yelp-uri.h"
31 G_BEGIN_DECLS
33 #define YELP_TYPE_VIEW (yelp_view_get_type ())
34 #define YELP_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), YELP_TYPE_VIEW, YelpView))
35 #define YELP_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), YELP_TYPE_VIEW, YelpViewClass))
36 #define YELP_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YELP_TYPE_VIEW))
37 #define YELP_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), YELP_TYPE_VIEW))
38 #define YELP_VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), YELP_TYPE_VIEW, YelpViewClass))
40 typedef struct _YelpView YelpView;
41 typedef struct _YelpViewClass YelpViewClass;
42 typedef gboolean (* YelpViewActionValidFunc) (YelpView *view, GtkAction *action, gchar *uri, gpointer data);
44 struct _YelpView
46 WebKitWebView parent;
49 struct _YelpViewClass
51 WebKitWebViewClass parent_class;
53 gboolean (* external_uri) (YelpView *view,
54 YelpUri *uri);
57 typedef enum {
58 YELP_VIEW_STATE_BLANK,
59 YELP_VIEW_STATE_LOADING,
60 YELP_VIEW_STATE_LOADED,
61 YELP_VIEW_STATE_ERROR
62 } YelpViewState;
64 GType yelp_view_get_type (void);
66 GtkWidget * yelp_view_new (void);
67 void yelp_view_load (YelpView *view,
68 const gchar *uri);
69 void yelp_view_load_uri (YelpView *view,
70 YelpUri *uri);
71 void yelp_view_load_document (YelpView *view,
72 YelpUri *uri,
73 YelpDocument *document);
74 YelpDocument * yelp_view_get_document (YelpView *view);
76 void yelp_view_register_actions (YelpView *view,
77 GActionMap *map);
79 void yelp_view_add_link_action (YelpView *view,
80 GtkAction *action,
81 YelpViewActionValidFunc func,
82 gpointer data);
83 YelpUri * yelp_view_get_active_link_uri (YelpView *view);
84 gchar * yelp_view_get_active_link_text (YelpView *view);
86 G_END_DECLS
88 #endif /* __YELP_VIEW_H__ */