NetSurf
global_history.h
Go to the documentation of this file.
1/*
2 * Copyright 2012 - 2013 Michael Drake <tlsa@netsurf-browser.org>
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#ifndef _NETSURF_DESKTOP_GLOBAL_HISTORY_H_
20#define _NETSURF_DESKTOP_GLOBAL_HISTORY_H_
21
22#include <stdbool.h>
23#include <stdint.h>
24
25#include "utils/errors.h"
26#include "netsurf/mouse.h"
27
28struct redraw_context;
29struct nsurl;
30struct rect;
31
32/**
33 * Initialise the global history.
34 *
35 * This iterates through the URL database, generating the global history data,
36 * and creates a treeview.
37 *
38 * This must be called before any other global_history_* function.
39 *
40 * \param core_window_handle The core_window in which the global history is shown.
41 * \return NSERROR_OK on success, appropriate error otherwise
42 */
43nserror global_history_init(void *core_window_handle);
44
45/**
46 * Finalise the global history.
47 *
48 * This destroys the global history treeview and the global history module's
49 * internal data. After calling this if global history is required again,
50 * global_history_init must be called.
51 *
52 * \return NSERROR_OK on success, appropriate error otherwise
53 */
55
56/**
57 * Add an entry to the global history.
58 *
59 * If the URL already exists in the global history, the old node is removed.
60 *
61 * \param url URL for node being added
62 * \return NSERROR_OK on success, appropriate error otherwise
63 */
65
66/**
67 * Save global history to file (html)
68 *
69 * \param path The path to save history to
70 * \param title The title to give the document, or NULL for default
71 * \return NSERROR_OK on success, or appropriate error otherwise
72 */
73nserror global_history_export(const char *path, const char *title);
74
75/**
76 * Redraw the global history.
77 *
78 * \param x X coordinate to render treeview at
79 * \param y Y coordinate to render treeview at
80 * \param clip Current clip rectangle (wrt tree origin)
81 * \param ctx Current redraw context
82 */
83void global_history_redraw(int x, int y, struct rect *clip,
84 const struct redraw_context *ctx);
85
86/**
87 * Handles all kinds of mouse action
88 *
89 * \param mouse The current mouse state
90 * \param x X coordinate
91 * \param y Y coordinate
92 */
93void global_history_mouse_action(enum browser_mouse_state mouse, int x, int y);
94
95/**
96 * Key press handling.
97 *
98 * \param key The ucs4 character codepoint
99 * \return true if the keypress is dealt with, false otherwise.
100 */
101bool global_history_keypress(uint32_t key);
102
103/**
104 * Determine whether there is a selection
105 *
106 * \return true iff there is a selection
107 */
109
110/**
111 * Get the first selected node
112 *
113 * \param url Updated to the selected entry's address, or NULL
114 * \param title Updated to the selected entry's title, or NULL
115 * \return true iff global history has a selection
116 */
117bool global_history_get_selection(struct nsurl **url, const char **title);
118
119/**
120 * Expand the treeview's nodes
121 *
122 * \param only_folders Iff true, only folders are expanded.
123 * \return NSERROR_OK on success, appropriate error otherwise
124 */
125nserror global_history_expand(bool only_folders);
126
127/**
128 * Contract the treeview's nodes
129 *
130 * \param all Iff false, only entries are contracted.
131 * \return NSERROR_OK on success, appropriate error otherwise
132 */
134
135#endif
nserror global_history_init(void *core_window_handle)
Initialise the global history.
nserror global_history_expand(bool only_folders)
Expand the treeview's nodes.
nserror global_history_fini(void)
Finalise the global history.
void global_history_redraw(int x, int y, struct rect *clip, const struct redraw_context *ctx)
Redraw the global history.
bool global_history_has_selection(void)
Determine whether there is a selection.
void global_history_mouse_action(enum browser_mouse_state mouse, int x, int y)
Handles all kinds of mouse action.
nserror global_history_add(struct nsurl *url)
Add an entry to the global history.
nserror global_history_export(const char *path, const char *title)
Save global history to file (html)
nserror global_history_contract(bool all)
Contract the treeview's nodes.
bool global_history_keypress(uint32_t key)
Key press handling.
bool global_history_get_selection(struct nsurl **url, const char **title)
Get the first selected node.
Error codes.
nserror
Enumeration of error codes.
Definition: errors.h:29
Core mouse and pointer states.
browser_mouse_state
Mouse state.
Definition: mouse.h:43
struct nsurl nsurl
NetSurf URL object.
Definition: nsurl.h:31
Rectangle coordinates.
Definition: types.h:40
Redraw context.
Definition: plotters.h:51
static nserror path(const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6])
Plots a path.
Definition: plot.c:821
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.
Definition: plot.c:357