NetSurf
corewindow.h
Go to the documentation of this file.
1/*
2 * Copyright 2017 Vincent Sanders <vince@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 FB_COREWINDOW_H
20#define FB_COREWINDOW_H
21
22#include "netsurf/core_window.h"
23
25
26/**
27 * fb core window state
28 */
30
31 /**
32 * framebuffer toolkit window.
33 */
35 /**
36 * framebuffer toolkit horizontal scrollbar.
37 */
39 /**
40 * framebuffer toolkit vertical scrollbar.
41 */
43 /**
44 * framebuffer toolkit user drawable widget.
45 */
47
48 int scrollx, scrolly; /**< scroll offsets. */
49
50
51 /** drag status set by core */
53
54 /**
55 * callback to draw on drawable area of fb core window
56 *
57 * \param fb_cw The fb core window structure.
58 * \param r The rectangle of the window that needs updating.
59 * \return NSERROR_OK on success otherwise apropriate error code
60 */
61 nserror (*draw)(struct fb_corewindow *fb_cw, struct rect *r);
62
63 /**
64 * callback for keypress on fb core window
65 *
66 * \param fb_cw The fb core window structure.
67 * \param nskey The netsurf key code.
68 * \return NSERROR_OK if key processed,
69 * NSERROR_NOT_IMPLEMENTED if key not processed
70 * otherwise apropriate error code
71 */
72 nserror (*key)(struct fb_corewindow *fb_cw, uint32_t nskey);
73
74 /**
75 * callback for mouse event on fb core window
76 *
77 * \param fb_cw The fb core window structure.
78 * \param mouse_state mouse state
79 * \param x location of event
80 * \param y location of event
81 * \return NSERROR_OK on sucess otherwise apropriate error code.
82 */
83 nserror (*mouse)(struct fb_corewindow *fb_cw, browser_mouse_state mouse_state, int x, int y);
84};
85
86
87/**
88 * initialise elements of fb core window.
89 *
90 * As a pre-requisite the draw, key and mouse callbacks must be defined
91 *
92 * \param fb_cw A fb core window structure to initialise
93 * \return NSERROR_OK on successful initialisation otherwise error code.
94 */
96
97
98/**
99 * finalise elements of fb core window.
100 *
101 * \param fb_cw A fb core window structure to initialise
102 * \return NSERROR_OK on successful finalisation otherwise error code.
103 */
105
106#endif
Interface to core window handling.
core_window_drag_status
drag status passed to drag_status callback
Definition: core_window.h:41
wimp_w parent
Definition: dialog.c:88
nserror
Enumeration of error codes.
Definition: errors.h:29
struct core_window_table * framebuffer_core_window_table
Definition: corewindow.c:204
nserror fb_corewindow_init(fbtk_widget_t *parent, struct fb_corewindow *fb_cw)
initialise elements of fb core window.
Definition: corewindow.c:207
nserror fb_corewindow_fini(struct fb_corewindow *fb_cw)
finalise elements of fb core window.
Definition: corewindow.c:278
browser_mouse_state
Mouse state: 1 is primary mouse button.
Definition: mouse.h:52
Core user interface window function table.
Definition: core_window.h:53
fb core window state
Definition: corewindow.h:29
struct fbtk_widget_s * wnd
framebuffer toolkit window.
Definition: corewindow.h:34
core_window_drag_status drag_status
drag status set by core
Definition: corewindow.h:52
nserror(* key)(struct fb_corewindow *fb_cw, uint32_t nskey)
callback for keypress on fb core window
Definition: corewindow.h:72
struct fbtk_widget_s * drawable
framebuffer toolkit user drawable widget.
Definition: corewindow.h:46
struct fbtk_widget_s * vscroll
framebuffer toolkit vertical scrollbar.
Definition: corewindow.h:42
struct fbtk_widget_s * hscroll
framebuffer toolkit horizontal scrollbar.
Definition: corewindow.h:38
nserror(* draw)(struct fb_corewindow *fb_cw, struct rect *r)
callback to draw on drawable area of fb core window
Definition: corewindow.h:61
int scrolly
scroll offsets.
Definition: corewindow.h:48
nserror(* mouse)(struct fb_corewindow *fb_cw, browser_mouse_state mouse_state, int x, int y)
callback for mouse event on fb core window
Definition: corewindow.h:83
Widget description.
Definition: widget.h:120
Rectangle coordinates.
Definition: types.h:40