aboutsummaryrefslogtreecommitdiffstats
path: root/embed/ephy-embed.h
blob: 5bd97253c9b623849daa7ad2c5898dcd24d9b02c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
/*
 *  Copyright (C) 2000-2003 Marco Pesenti Gritti
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 *  $Id$
 */

#ifndef EPHY_EMBED_H
#define EPHY_EMBED_H

#include "ephy-embed-event.h"

#include <glib-object.h>
#include <glib.h>
#include <gtk/gtkwidget.h>

G_BEGIN_DECLS

#define EPHY_TYPE_EMBED         (ephy_embed_get_type ())
#define EPHY_EMBED(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_EMBED, EphyEmbed))
#define EPHY_EMBED_IFACE(k)     (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_EMBED, EphyEmbedIface))
#define EPHY_IS_EMBED(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_EMBED))
#define EPHY_IS_EMBED_IFACE(k)      (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_EMBED))
#define EPHY_EMBED_GET_IFACE(inst)  (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EPHY_TYPE_EMBED, EphyEmbedIface))

#define EPHY_TYPE_EMBED_NET_STATE   (ephy_embed_net_state_get_type ())
#define EPHY_TYPE_EMBED_CHROME          (ephy_embed_chrome_get_type ())
#define EPHY_TYPE_EMBED_SECURITY_LEVEL  (ephy_embed_security_level_get_type ())
#define EPHY_TYPE_EMBED_DOCUMENT_TYPE   (ephy_embed_document_type_get_type ())
#define EPHY_TYPE_EMBED_PRINT_PREVIEW_NAV_TYPE  (ephy_embed_ppv_navigation_get_type ())

typedef struct _EphyEmbed   EphyEmbed;
typedef struct _EphyEmbedIface  EphyEmbedIface;

typedef enum
{
    EMBED_STATE_UNKNOWN     = 0,
    EMBED_STATE_START       = 1 << 0,
    EMBED_STATE_REDIRECTING     = 1 << 1,
    EMBED_STATE_TRANSFERRING    = 1 << 2,
    EMBED_STATE_NEGOTIATING     = 1 << 3,
    EMBED_STATE_STOP        = 1 << 4,

    EMBED_STATE_IS_REQUEST      = 1 << 5,
    EMBED_STATE_IS_DOCUMENT     = 1 << 6,
    EMBED_STATE_IS_NETWORK      = 1 << 7,
    EMBED_STATE_IS_WINDOW       = 1 << 8
} EphyEmbedNetState;

typedef enum
{
    EPHY_EMBED_CHROME_MENUBAR   = 1 << 0,
    EPHY_EMBED_CHROME_TOOLBAR   = 1 << 1,
    EPHY_EMBED_CHROME_STATUSBAR = 1 << 2,
    EPHY_EMBED_CHROME_BOOKMARKSBAR  = 1 << 3
} EphyEmbedChrome;

#define EPHY_EMBED_CHROME_ALL (EPHY_EMBED_CHROME_MENUBAR |  \
                   EPHY_EMBED_CHROME_TOOLBAR |  \
                   EPHY_EMBED_CHROME_STATUSBAR |    \
                   EPHY_EMBED_CHROME_BOOKMARKSBAR)

typedef enum
{
    PRINTPREVIEW_GOTO_PAGENUM   = 0,
    PRINTPREVIEW_PREV_PAGE      = 1,
    PRINTPREVIEW_NEXT_PAGE      = 2,
    PRINTPREVIEW_HOME       = 3,
    PRINTPREVIEW_END        = 4
} EphyEmbedPrintPreviewNavType;

typedef enum
{
    STATE_IS_UNKNOWN,
    STATE_IS_INSECURE,
    STATE_IS_BROKEN,
    STATE_IS_SECURE_LOW,
    STATE_IS_SECURE_MED,
    STATE_IS_SECURE_HIGH
} EphyEmbedSecurityLevel;

typedef enum
{
    EMBED_DOCUMENT_HTML,
    EMBED_DOCUMENT_XML,
    EMBED_DOCUMENT_IMAGE,
    EMBED_DOCUMENT_OTHER
} EphyEmbedDocumentType;

struct _EphyEmbedIface
{
    GTypeInterface base_iface;

    /* Signals that we inherit from gtkmozembed
     *
     * void (* net_stop)     (GtkMozEmbed *embed);
     * void (* title)        (EphyEmbed *embed);
     * void (* visibility)   (EphyEmbed *embed,
     *            gboolean visibility);
     * void (* destroy_brsr) (EphyEmbed *embed);
     * void (* size_to)      (EphyEmbed *embed,
     *            int width,
     *            int height);
     * gint (* open_uri)     (EphyEmbed *embed,
     *            const char *url);
     */ 

    int  (* context_menu)   (EphyEmbed *embed,
                     EphyEmbedEvent *event);
    void     (* favicon)        (EphyEmbed *embed,
                     const char *location);
    void     (* location)       (EphyEmbed *embed,
                     const char *location);
    void     (* net_state)      (EphyEmbed *embed,
                     const char *uri,
                     EphyEmbedNetState state);
    gboolean (* dom_mouse_click)    (EphyEmbed *embed,
                     EphyEmbedEvent *event);
    gboolean (* dom_mouse_down) (EphyEmbed *embed,
                     EphyEmbedEvent *event);
    void     (* popup_blocked)  (EphyEmbed *embed,
                     const char *address,
                     const char *features);
    void     (* security_change)    (EphyEmbed *embed,
                     EphyEmbedSecurityLevel level);
    void     (* zoom_change)    (EphyEmbed *embed,
                     float new_zoom);
    void     (* content_change) (EphyEmbed *embed,
                     const char *uri);
    gboolean (* modal_alert)    (EphyEmbed *embed);
    void     (* modal_alert_closed) (EphyEmbed *embed);
    void     (* document_type)  (EphyEmbed *embed,
                     EphyEmbedDocumentType type);
    EphyEmbed * (* new_window)  (EphyEmbed *embed,
                     EphyEmbedChrome chromemask);

    /* Methods  */
    void           (* load_url)         (EphyEmbed *embed,
                             const char *url);
    void           (* stop_load)        (EphyEmbed *embed);
    void           (* reload)           (EphyEmbed *embed,
                             gboolean force);
    gboolean       (* can_go_back)      (EphyEmbed *embed);
    gboolean       (* can_go_forward)       (EphyEmbed *embed);
    gboolean       (* can_go_up)        (EphyEmbed *embed);
    GSList *       (* get_go_up_list)       (EphyEmbed *embed);
    void           (* go_back)          (EphyEmbed *embed);
    void           (* go_forward)       (EphyEmbed *embed);
    void           (* go_up)            (EphyEmbed *embed);

    char *         (* get_title)        (EphyEmbed *embed);
    char *         (* get_location)     (EphyEmbed *embed,
                             gboolean toplevel);
    char *         (* get_link_message)     (EphyEmbed *embed);
    char *         (* get_js_status)        (EphyEmbed *embed);
    int        (* shistory_n_items)     (EphyEmbed *embed);
    void           (* shistory_get_nth)     (EphyEmbed *embed,
                             int nth,
                             gboolean is_relative,
                             char **url,
                             char **title);
    int        (* shistory_get_pos)     (EphyEmbed *embed);
    void           (* shistory_go_nth)      (EphyEmbed *embed,
                             int nth);
    void           (* get_security_level)   (EphyEmbed *embed,
                             EphyEmbedSecurityLevel *level,
                             char **description);
    void           (* show_page_certificate)    (EphyEmbed *embed);
    void           (* set_zoom)         (EphyEmbed *embed,
                             float zoom);
    float          (* get_zoom)         (EphyEmbed *embed);
    void           (* find_set_properties)  (EphyEmbed *embed,
                             const char *search_string,
                             gboolean case_sensitive,
                             gboolean wrap_around);
    gboolean       (* find_next)        (EphyEmbed *embed,
                             gboolean backwards);
    char *         (* get_encoding)     (EphyEmbed *embed);
    gboolean       (* has_automatic_encoding)   (EphyEmbed *embed);
    void           (* set_encoding)     (EphyEmbed *embed,
                             const char *encoding);
    void           (* print)            (EphyEmbed *embed);
    void           (* set_print_preview_mode)   (EphyEmbed *embed,
                             gboolean mode);
    int        (* print_preview_n_pages)    (EphyEmbed *embed);
    void           (* print_preview_navigate)   (EphyEmbed *embed,
                             EphyEmbedPrintPreviewNavType type,
                             int page);
    void           (* activate)         (EphyEmbed *embed);
    gboolean       (* has_modified_forms)   (EphyEmbed *embed);
};

GType         ephy_embed_net_state_get_type     (void);

GType         ephy_embed_chrome_get_type        (void);

GType         ephy_embed_ppv_navigation_get_type    (void);

GType         ephy_embed_security_level_get_type    (void);

GType         ephy_embed_document_type_get_type (void);

GType         ephy_embed_get_type           (void);

/* Base */
void          ephy_embed_load_url           (EphyEmbed *embed,
                             const char *url);

void          ephy_embed_stop_load          (EphyEmbed *embed);

void          ephy_embed_reload         (EphyEmbed *embed,
                             gboolean force);

char         *ephy_embed_get_title          (EphyEmbed *embed);

char         *ephy_embed_get_location       (EphyEmbed *embed,
                             gboolean toplevel);

char         *ephy_embed_get_link_message       (EphyEmbed *embed);

char         *ephy_embed_get_js_status      (EphyEmbed *embed);

/* Navigation */
gboolean      ephy_embed_can_go_back        (EphyEmbed *embed);

gboolean      ephy_embed_can_go_forward     (EphyEmbed *embed);

gboolean      ephy_embed_can_go_up          (EphyEmbed *embed);

GSList       *ephy_embed_get_go_up_list     (EphyEmbed *embed);

void          ephy_embed_go_back            (EphyEmbed *embed);

void          ephy_embed_go_forward         (EphyEmbed *embed);

void          ephy_embed_go_up          (EphyEmbed *embed);

int       ephy_embed_shistory_n_items       (EphyEmbed *embed);

void          ephy_embed_shistory_get_nth       (EphyEmbed *embed,
                             int nth,
                             gboolean is_relative,
                             char **url,
                             char **title);

int       ephy_embed_shistory_get_pos       (EphyEmbed *embed);

void          ephy_embed_shistory_go_nth        (EphyEmbed *embed,
                             int nth);

void          ephy_embed_get_security_level     (EphyEmbed *embed,
                             EphyEmbedSecurityLevel *level,
                             char **description);

void          ephy_embed_show_page_certificate  (EphyEmbed *embed);

/* Zoom */
void          ephy_embed_set_zoom           (EphyEmbed *embed,
                             float zoom);

float         ephy_embed_get_zoom           (EphyEmbed *embed);

/* Find */
void          ephy_embed_find_set_properties    (EphyEmbed *embed,
                             const char *search_string,
                             gboolean case_sensitive,
                             gboolean wrap_around);

gboolean      ephy_embed_find_next          (EphyEmbed *embed,
                             gboolean backwards);

/* Encoding */
char         *ephy_embed_get_encoding       (EphyEmbed *embed);

gboolean      ephy_embed_has_automatic_encoding (EphyEmbed *embed);

void          ephy_embed_set_encoding       (EphyEmbed *embed,
                             const char *encoding);

/* Print */
void          ephy_embed_print          (EphyEmbed *embed);

void          ephy_embed_set_print_preview_mode (EphyEmbed *embed,
                             gboolean preview_mode);

int       ephy_embed_print_preview_n_pages  (EphyEmbed *embed);

void          ephy_embed_print_preview_navigate (EphyEmbed *embed,
                             EphyEmbedPrintPreviewNavType type,
                             int page);

/* Misc. utility */
void          ephy_embed_activate           (EphyEmbed *embed);

gboolean      ephy_embed_has_modified_forms     (EphyEmbed *embed);

G_END_DECLS

#endif