NetSurf
page-info.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 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/**
20 * \file
21 * Pave info viewer window interface
22 */
23
24#ifndef NETSURF_DESKTOP_PAGE_INFO_H
25#define NETSURF_DESKTOP_PAGE_INFO_H
26
27#include <stdint.h>
28#include <stdbool.h>
29
30#include "utils/errors.h"
31#include "netsurf/mouse.h"
32
33struct rect;
34struct nsurl;
35struct page_info;
36struct core_window;
37struct browser_window;
38struct redraw_context;
39
40/**
41 * Initialise the page_info module.
42 *
43 * \return NSERROR_OK on success, appropriate error code otherwise.
44 */
46
47/**
48 * Finalise the page_info module.
49 *
50 * \return NSERROR_OK on success, appropriate error code otherwise.
51 */
53
54/**
55 * Create a page info corewindow.
56 *
57 * The page info window is opened for a particular browser window.
58 * It can be destroyed before the browser window is destroyed by calling
59 * \ref page_info_destroy.
60 *
61 * \param[in] cw_h Handle for the containing core_window.
62 * \param[in] bw Browser window to show page info for.
63 * \param[out] pi_out The created page info window handle.
64 * \return NSERROR_OK on success, appropriate error code otherwise.
65 */
66nserror page_info_create(struct core_window *cw_h,
67 struct browser_window *bw,
68 struct page_info **pi_out);
69
70/**
71 * Destroy a page info corewindow.
72 *
73 * \param[in] pi The page info window handle.
74 */
76
77/**
78 * change the browser window the page information refers to
79 *
80 * \param[in] pgi The page info window context
81 * \param[in] bw The new browser window
82 * \return NSERROR_OK on sucess else error code.
83 */
84nserror page_info_set(struct page_info *pgi, struct browser_window *bw);
85
86/**
87 * Redraw the page info window.
88 *
89 * Causes the page info window to issue plot operations to redraw
90 * the specified area of the viewport.
91 *
92 * \param[in] pi The page info window handle.
93 * \param[in] x X coordinate to render page_info at.
94 * \param[in] y Y coordinate to render page_info at.
95 * \param[in] clip Current clip rectangle.
96 * \param[in] ctx Current redraw context.
97 * \return NSERROR_OK on success, appropriate error code otherwise.
98 */
100 const struct page_info *pi,
101 int x,
102 int y,
103 const struct rect *clip,
104 const struct redraw_context *ctx);
105
106/**
107 * Mouse action handling.
108 *
109 * \param[in] pi The page info window handle.
110 * \param[in] mouse The current mouse state
111 * \param[in] x The current mouse X coordinate
112 * \param[in] y The current mouse Y coordinate
113 * \param[out] did_something Set to true if this resulted in some action
114 * \return NSERROR_OK on success, appropriate error code otherwise.
115 */
117 struct page_info *pi,
118 enum browser_mouse_state mouse,
119 int x,
120 int y,
121 bool *did_something);
122
123/**
124 * Key press handling.
125 *
126 * \param[in] pi The page info window handle.
127 * \param[in] key The ucs4 character codepoint.
128 * \return true if the keypress is dealt with, false otherwise.
129 */
131 struct page_info *pi,
132 int32_t key);
133
134/**
135 * Get size of page info content area.
136 *
137 * \param[in] pi The page info window handle.
138 * \param[out] width On success, return the page info content width.
139 * \param[out] height On success, return the page info content height.
140 * \return NSERROR_OK on success, appropriate error code otherwise.
141 */
143 struct page_info *pi,
144 int *width,
145 int *height);
146
147#endif
Error codes.
nserror
Enumeration of error codes.
Definition: errors.h:29
Core mouse and pointer states.
browser_mouse_state
Mouse state: 1 is primary mouse button.
Definition: mouse.h:52
struct nsurl nsurl
NetSurf URL object.
Definition: nsurl.h:31
nserror page_info_get_size(struct page_info *pi, int *width, int *height)
Get size of page info content area.
Definition: page-info.c:822
nserror page_info_destroy(struct page_info *pi)
Destroy a page info corewindow.
Definition: page-info.c:570
nserror page_info_fini(void)
Finalise the page_info module.
Definition: page-info.c:291
nserror page_info_redraw(const struct page_info *pi, int x, int y, const struct rect *clip, const struct redraw_context *ctx)
Redraw the page info window.
Definition: page-info.c:620
nserror page_info_create(struct core_window *cw_h, struct browser_window *bw, struct page_info **pi_out)
Create a page info corewindow.
Definition: page-info.c:537
nserror page_info_init(void)
Initialise the page_info module.
Definition: page-info.c:258
bool page_info_keypress(struct page_info *pi, int32_t key)
Key press handling.
Definition: page-info.c:814
nserror page_info_set(struct page_info *pgi, struct browser_window *bw)
change the browser window the page information refers to
Definition: page-info.c:580
nserror page_info_mouse_action(struct page_info *pi, enum browser_mouse_state mouse, int x, int y, bool *did_something)
Mouse action handling.
Definition: page-info.c:753
int width
Definition: gui.c:160
int height
Definition: gui.c:161
Browser window data.
The page info window structure.
Definition: page-info.c:238
Rectangle coordinates.
Definition: types.h:40
Redraw context.
Definition: plotters.h:51
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.
Definition: plot.c:357