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
29struct redraw_context;
30struct nsurl;
31struct rect;
32
33/**
34 * Initialise the global history.
35 *
36 * This iterates through the URL database, generating the global history data,
37 * and creates a treeview.
38 *
39 * This must be called before any other global_history_* function.
40 *
41 * \param cw_t Callback table for core_window containing the treeview.
42 * \param core_window_handle The core_window in which the treeview is shown.
43 * \return NSERROR_OK on success, appropriate error otherwise
44 */
46 void *core_window_handle);
47
48/**
49 * Finalise the global history.
50 *
51 * This destroys the global history treeview and the global history module's
52 * internal data. After calling this if global history is required again,
53 * global_history_init must be called.
54 *
55 * \return NSERROR_OK on success, appropriate error otherwise
56 */
58
59/**
60 * Add an entry to the global history.
61 *
62 * If the URL already exists in the global history, the old node is removed.
63 *
64 * \param url URL for node being added
65 * \return NSERROR_OK on success, appropriate error otherwise
66 */
68
69/**
70 * Save global history to file (html)
71 *
72 * \param path The path to save history to
73 * \param title The title to give the document, or NULL for default
74 * \return NSERROR_OK on success, or appropriate error otherwise
75 */
76nserror global_history_export(const char *path, const char *title);
77
78/**
79 * Redraw the global history.
80 *
81 * \param x X coordinate to render treeview at
82 * \param y Y coordinate to render treeview at
83 * \param clip Current clip rectangle (wrt tree origin)
84 * \param ctx Current redraw context
85 */
86void global_history_redraw(int x, int y, struct rect *clip,
87 const struct redraw_context *ctx);
88
89/**
90 * Handles all kinds of mouse action
91 *
92 * \param mouse The current mouse state
93 * \param x X coordinate
94 * \param y Y coordinate
95 */
96void global_history_mouse_action(enum browser_mouse_state mouse, int x, int y);
97
98/**
99 * Key press handling.
100 *
101 * \param key The ucs4 character codepoint
102 * \return true if the keypress is dealt with, false otherwise.
103 */
104bool global_history_keypress(uint32_t key);
105
106/**
107 * Determine whether there is a selection
108 *
109 * \return true iff there is a selection
110 */
112
113/**
114 * Get the first selected node
115 *
116 * \param url Updated to the selected entry's address, or NULL
117 * \param title Updated to the selected entry's title, or NULL
118 * \return true iff global history has a selection
119 */
120bool global_history_get_selection(struct nsurl **url, const char **title);
121
122/**
123 * Expand the treeview's nodes
124 *
125 * \param only_folders Iff true, only folders are expanded.
126 * \return NSERROR_OK on success, appropriate error otherwise
127 */
128nserror global_history_expand(bool only_folders);
129
130/**
131 * Contract the treeview's nodes
132 *
133 * \param all Iff false, only entries are contracted.
134 * \return NSERROR_OK on success, appropriate error otherwise
135 */
137
138#endif
nserror global_history_expand(bool only_folders)
Expand the treeview's nodes.
nserror global_history_fini(void)
Finalise the global history.
nserror global_history_init(struct core_window_callback_table *cw_t, void *core_window_handle)
Initialise 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
static struct core_window_callback_table cw_t
Declare Core Window Callbacks:
Definition: treeview.c:534
Core mouse and pointer states.
browser_mouse_state
Mouse state.
Definition: mouse.h:43
struct nsurl nsurl
NetSurf URL object.
Definition: nsurl.h:31
Callbacks to achieve various core window functionality.
Definition: core_window.h:51
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