From 9198c9958afedc8104858979ec949c72933cbf91 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 23 Feb 2020 17:06:51 +0000 Subject: Desktop: Add page-info API. This will be a core window intended to show information about the page currently shown in the associated browser window. --- desktop/page-info.h | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 desktop/page-info.h (limited to 'desktop') diff --git a/desktop/page-info.h b/desktop/page-info.h new file mode 100644 index 000000000..89b82e0b6 --- /dev/null +++ b/desktop/page-info.h @@ -0,0 +1,141 @@ +/* + * Copyright 2020 Michael Drake + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file + * Pave info viewer window interface + */ + +#ifndef NETSURF_DESKTOP_PAGE_INFO_H +#define NETSURF_DESKTOP_PAGE_INFO_H + +#include +#include + +#include "utils/errors.h" +#include "netsurf/mouse.h" + +struct rect; +struct nsurl; +struct page_info; +struct core_window; +struct browser_window; +struct redraw_context; +struct core_window_callback_table; + +/** + * Initialise the page_info module. + * + * \return NSERROR_OK on success, appropriate error code otherwise. + */ +nserror page_info_init(void); + +/** + * Finalise the page_info module. + * + * \return NSERROR_OK on success, appropriate error code otherwise. + */ +nserror page_info_fini(void); + +/** + * Create a page info corewindow. + * + * The page info window is opened for a particular browser window. + * It can be destroyed before the browser window is destroyed by calling + * \ref page_info_destroy. + * + * \param[in] cw_t Callback table for the containing core_window. + * \param[in] cw_h Handle for the containing core_window. + * \param[in] bw Browser window to show page info for. + * \param[out] pi_out The created page info window handle. + * \return NSERROR_OK on success, appropriate error code otherwise. + */ +nserror page_info_create( + const struct core_window_callback_table *cw_t, + struct core_window *cw_h, + const struct browser_window *bw, + struct page_info **pi_out); + +/** + * Destroy a page info corewindow. + * + * \param[in] pi The page info window handle. + */ +void page_info_destroy( + struct page_info *pi); + +/** + * Redraw the page info window. + * + * Causes the page info window to issue plot operations to redraw + * the specified area of the viewport. + * + * \param[in] pi The page info window handle. + * \param[in] x X coordinate to render page_info at. + * \param[in] y Y coordinate to render page_info at. + * \param[in] clip Current clip rectangle. + * \param[in] ctx Current redraw context. + * \return NSERROR_OK on success, appropriate error code otherwise. + */ +nserror page_info_redraw( + const struct page_info *pi, + int x, + int y, + const struct rect *clip, + const struct redraw_context *ctx); + +/** + * Mouse action handling. + * + * \param[in] pi The page info window handle. + * \param[in] mouse The current mouse state + * \param[in] x The current mouse X coordinate + * \param[in] y The current mouse Y coordinate + * \return NSERROR_OK on success, appropriate error code otherwise. + */ +nserror page_info_mouse_action( + struct page_info *pi, + enum browser_mouse_state mouse, + int x, + int y); + +/** + * Key press handling. + * + * \param[in] pi The page info window handle. + * \param[in] key The ucs4 character codepoint. + * \return true if the keypress is dealt with, false otherwise. + */ +bool page_info_keypress( + struct page_info *pi, + int32_t key); + +/** + * Get size of page info content area. + * + * \param[in] pi The page info window handle. + * \param[out] width On success, return the page info content width. + * \param[out] height On success, return the page info content height. + * \return NSERROR_OK on success, appropriate error code otherwise. + */ +nserror page_info_get_size( + struct page_info *pi, + int *width, + int *height); + +#endif -- cgit v1.2.3