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;
40
41/**
42 * Initialise the page_info module.
43 *
44 * \return NSERROR_OK on success, appropriate error code otherwise.
45 */
47
48/**
49 * Finalise the page_info module.
50 *
51 * \return NSERROR_OK on success, appropriate error code otherwise.
52 */
54
55/**
56 * Create a page info corewindow.
57 *
58 * The page info window is opened for a particular browser window.
59 * It can be destroyed before the browser window is destroyed by calling
60 * \ref page_info_destroy.
61 *
62 * \param[in] cw_t Callback table for the containing core_window.
63 * \param[in] cw_h Handle for the containing core_window.
64 * \param[in] bw Browser window to show page info for.
65 * \param[out] pi_out The created page info window handle.
66 * \return NSERROR_OK on success, appropriate error code otherwise.
67 */
69 const struct core_window_callback_table *cw_t,
70 struct core_window *cw_h,
71 struct browser_window *bw,
72 struct page_info **pi_out);
73
74/**
75 * Destroy a page info corewindow.
76 *
77 * \param[in] pi The page info window handle.
78 */
80
81/**
82 * change the browser window the page information refers to
83 *
84 * \param[in] pgi The page info window context
85 * \param[in] bw The new browser window
86 * \return NSERROR_OK on sucess else error code.
87 */
88nserror page_info_set(struct page_info *pgi, struct browser_window *bw);
89
90/**
91 * Redraw the page info window.
92 *
93 * Causes the page info window to issue plot operations to redraw
94 * the specified area of the viewport.
95 *
96 * \param[in] pi The page info window handle.
97 * \param[in] x X coordinate to render page_info at.
98 * \param[in] y Y coordinate to render page_info at.
99 * \param[in] clip Current clip rectangle.
100 * \param[in] ctx Current redraw context.
101 * \return NSERROR_OK on success, appropriate error code otherwise.
102 */
104 const struct page_info *pi,
105 int x,
106 int y,
107 const struct rect *clip,
108 const struct redraw_context *ctx);
109
110/**
111 * Mouse action handling.
112 *
113 * \param[in] pi The page info window handle.
114 * \param[in] mouse The current mouse state
115 * \param[in] x The current mouse X coordinate
116 * \param[in] y The current mouse Y coordinate
117 * \param[out] did_something Set to true if this resulted in some action
118 * \return NSERROR_OK on success, appropriate error code otherwise.
119 */
121 struct page_info *pi,
122 enum browser_mouse_state mouse,
123 int x,
124 int y,
125 bool *did_something);
126
127/**
128 * Key press handling.
129 *
130 * \param[in] pi The page info window handle.
131 * \param[in] key The ucs4 character codepoint.
132 * \return true if the keypress is dealt with, false otherwise.
133 */
135 struct page_info *pi,
136 int32_t key);
137
138/**
139 * Get size of page info content area.
140 *
141 * \param[in] pi The page info window handle.
142 * \param[out] width On success, return the page info content width.
143 * \param[out] height On success, return the page info content height.
144 * \return NSERROR_OK on success, appropriate error code otherwise.
145 */
147 struct page_info *pi,
148 int *width,
149 int *height);
150
151#endif
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
nserror page_info_get_size(struct page_info *pi, int *width, int *height)
Get size of page info content area.
Definition: page-info.c:827
nserror page_info_destroy(struct page_info *pi)
Destroy a page info corewindow.
Definition: page-info.c:574
nserror page_info_fini(void)
Finalise the page_info module.
Definition: page-info.c:292
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:624
nserror page_info_init(void)
Initialise the page_info module.
Definition: page-info.c:259
bool page_info_keypress(struct page_info *pi, int32_t key)
Key press handling.
Definition: page-info.c:819
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:584
nserror page_info_create(const struct core_window_callback_table *cw_t, struct core_window *cw_h, struct browser_window *bw, struct page_info **pi_out)
Create a page info corewindow.
Definition: page-info.c:538
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:757
int width
Definition: gui.c:159
int height
Definition: gui.c:160
Browser window data.
Callbacks to achieve various core window functionality.
Definition: core_window.h:51
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