NetSurf
browser_history.h
Go to the documentation of this file.
1/*
2 * Copyright 2006 James Bursa <bursa@users.sourceforge.net>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf 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, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 * \file
21 * Interface to browser history operations
22 *
23 * The are operations on a browsing contexts history. These interfaces
24 * allow navigation forward and backwards in the history as well as
25 * enumerating the entries.
26 *
27 * The local history viewing is distinct via corewindow defined in
28 * desktop/local_history.h
29 */
30
31#ifndef NETSURF_DESKTOP_BROWSER_HISTORY_H
32#define NETSURF_DESKTOP_BROWSER_HISTORY_H
33
34#include <stdbool.h>
35
36#include "utils/errors.h"
37
38struct browser_window;
39struct history_entry;
40struct bitmap;
41
42/**
43 * Go back in the history.
44 *
45 * \param bw A browser window to navigate the history in.
46 * \param new_window whether to open in new window.
47 * \return NSERROR_OK or error code on faliure.
48 */
49nserror browser_window_history_back(struct browser_window *bw, bool new_window);
50
51
52/**
53 * Go forward in the history.
54 *
55 * \param bw A browser window to navigate the history in.
56 * \param new_window whether to open in new window.
57 * \return NSERROR_OK or error code on faliure.
58 */
59nserror browser_window_history_forward(struct browser_window *bw, bool new_window);
60
61
62/**
63 * Check whether it is pssible to go back in the history.
64 *
65 * \param bw A browser window to check the history navigation in.
66 * \return true if the history can go back, false otherwise
67 */
69
70
71/**
72 * Check whether it is pssible to go forwards in the history.
73 *
74 * \param bw A browser window to check the history navigation in.
75 * \return true if the history can go forwards, false otherwise
76 */
78
79/**
80 * Get the thumbnail bitmap for the current history entry
81 *
82 * \param bw The browser window
83 * \param bitmap The bitmat for the current history entry.
84 * \return NSERROR_OK or error code on faliure.
85 */
87
88/**
89 * Callback function type for history enumeration
90 *
91 * \param bw The browser window with history being enumerated
92 * \param x0, y0, x1, y1 Coordinates of entry in history tree view
93 * \param entry Current history entry
94 * \return true to continue enumeration, false to cancel enumeration
95 */
97 const struct browser_window *bw,
98 int x0, int y0, int x1, int y1,
99 const struct history_entry *entry, void *user_data);
100
101
102/**
103 * Enumerate all entries in the history.
104 * Do not change the history while it is being enumerated.
105 *
106 * \param bw The browser window to enumerate history of
107 * \param cb callback function
108 * \param user_data context pointer passed to cb
109 */
111 browser_window_history_enumerate_cb cb, void *user_data);
112
113
114/**
115 * Enumerate all entries that will be reached by the 'forward' button
116 *
117 * \param bw The browser window to enumerate history of
118 * \param cb The callback function
119 * \param user_data Data passed to the callback
120 */
122 browser_window_history_enumerate_cb cb, void *user_data);
123
124
125/**
126 * Enumerate all entries that will be reached by the 'back' button
127 *
128 * \param bw The browser window to enumerate history of
129 * \param cb The callback function
130 * \param user_data Data passed to the callback
131 */
133 browser_window_history_enumerate_cb cb, void *user_data);
134
135
136/**
137 * Returns the URL to a history entry
138 *
139 * \param entry the history entry to retrieve the URL from
140 * \return A referenced nsurl URL
141 */
142struct nsurl *browser_window_history_entry_get_url(const struct history_entry *entry);
143
144
145/**
146 * Returns the URL to a history entry
147 *
148 * \param entry the history entry to retrieve the fragment id from
149 * \return the fragment id
150 */
151const char *browser_window_history_entry_get_fragment_id(const struct history_entry *entry);
152
153
154/**
155 * Returns the title of a history entry
156 *
157 * \param entry The history entry to retrieve the title from
158 * \return the title
159 */
160const char *browser_window_history_entry_get_title(const struct history_entry *entry);
161
162
163/**
164 * Navigate to specified history entry, optionally in new window
165 *
166 * \param bw browser window
167 * \param entry entry to open
168 * \param new_window open entry in new window
169 * \return NSERROR_OK or error code on faliure.
170 */
171nserror browser_window_history_go(struct browser_window *bw, struct history_entry *entry, bool new_window);
172
173#endif
void browser_window_history_enumerate_back(const struct browser_window *bw, browser_window_history_enumerate_cb cb, void *user_data)
Enumerate all entries that will be reached by the 'back' button.
nserror browser_window_history_get_thumbnail(struct browser_window *bw, struct bitmap **bitmap_out)
Get the thumbnail bitmap for the current history entry.
nserror browser_window_history_forward(struct browser_window *bw, bool new_window)
Go forward in the history.
nserror browser_window_history_go(struct browser_window *bw, struct history_entry *entry, bool new_window)
Navigate to specified history entry, optionally in new window.
void browser_window_history_enumerate_forward(const struct browser_window *bw, browser_window_history_enumerate_cb cb, void *user_data)
Enumerate all entries that will be reached by the 'forward' button.
const char * browser_window_history_entry_get_title(const struct history_entry *entry)
Returns the title of a history entry.
void browser_window_history_enumerate(const struct browser_window *bw, browser_window_history_enumerate_cb cb, void *user_data)
Enumerate all entries in the history.
bool browser_window_history_forward_available(struct browser_window *bw)
Check whether it is pssible to go forwards in the history.
const char * browser_window_history_entry_get_fragment_id(const struct history_entry *entry)
Returns the URL to a history entry.
bool(* browser_window_history_enumerate_cb)(const struct browser_window *bw, int x0, int y0, int x1, int y1, const struct history_entry *entry, void *user_data)
Callback function type for history enumeration.
struct nsurl * browser_window_history_entry_get_url(const struct history_entry *entry)
Returns the URL to a history entry.
bool browser_window_history_back_available(struct browser_window *bw)
Check whether it is pssible to go back in the history.
nserror browser_window_history_back(struct browser_window *bw, bool new_window)
Go back in the history.
Error codes.
nserror
Enumeration of error codes.
Definition: errors.h:29
struct nsurl nsurl
NetSurf URL object.
Definition: nsurl.h:31
RISC OS wimp toolkit bitmap.
Definition: bitmap.c:68
Browser window data.
struct browser_window * bw
A node in the history tree.