NetSurf
corewindow.h
Go to the documentation of this file.
1/*
2 * Copyright 2016 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/**
20 * \file
21 * RISC OS core window interface
22 *
23 * This module is an object that must be encapsulated. Client users
24 * should embed a struct ro_corewindow at the beginning of their
25 * context for this display surface, fill in relevant data and then
26 * call ro_corewindow_init()
27 */
28
29#ifndef NETSURF_RISCOS_COREWINDOW_H
30#define NETSURF_RISCOS_COREWINDOW_H
31
32#include "netsurf/core_window.h"
33
34/**
35 * ro core window state
36 */
38 /** window handle */
39 wimp_w wh;
40
41 /** toolbar */
43
44 /** content plot origin y relative to window */
46
47 /** content width */
49
50 /** content height */
52
53 /** drag status set by core */
55
56 /** table of callbacks for core window operations */
58
59 /**
60 * callback to draw on drawable area of ro core window
61 *
62 * \param ro_cw The riscos core window structure.
63 * \param originx The risc os plotter x origin.
64 * \param originy The risc os plotter y origin.
65 * \param r The rectangle of the window that needs updating.
66 * \return NSERROR_OK on success otherwise apropriate error code
67 */
68 nserror (*draw)(struct ro_corewindow *ro_cw, int originx, int originy, struct rect *r);
69
70 /**
71 * callback for keypress on ro core window
72 *
73 * \param ro_cw The ro core window structure.
74 * \param nskey The netsurf key code.
75 * \return NSERROR_OK if key processed,
76 * NSERROR_NOT_IMPLEMENTED if key not processed
77 * otherwise apropriate error code
78 */
79 nserror (*key)(struct ro_corewindow *ro_cw, uint32_t nskey);
80
81 /**
82 * callback for mouse event on ro core window
83 *
84 * \param ro_cw The ro core window structure.
85 * \param mouse_state mouse state
86 * \param x location of event
87 * \param y location of event
88 * \return NSERROR_OK on sucess otherwise apropriate error code.
89 */
90 nserror (*mouse)(struct ro_corewindow *ro_cw, browser_mouse_state mouse_state, int x, int y);
91
92 /**
93 * callback for clicks in ro core window toolbar.
94 *
95 * \param ro_cw The ro core window structure.
96 * \param action The button bar action.
97 * \return NSERROR_OK if config saved, otherwise apropriate error code
98 */
100
101 /**
102 * callback for updating state of buttons in ro core window toolbar.
103 *
104 * \param ro_cw The ro core window structure.
105 * \return NSERROR_OK if config saved, otherwise apropriate error code
106 */
108
109 /**
110 * callback for saving ro core window toolbar state.
111 *
112 * \param ro_cw The ro core window structure.
113 * \param config The new toolbar configuration.
114 * \return NSERROR_OK if config saved, otherwise apropriate error code
115 */
116 nserror (*toolbar_save)(struct ro_corewindow *ro_cw, char *config);
117
118};
119
120/**
121 * initialise elements of riscos core window.
122 *
123 * As a pre-requisite the draw, key and mouse callbacks must be defined
124 *
125 * \param ro_cw A riscos core window structure to initialise
126 * \param tb_buttons toolbar button bar context
127 * \param tb_order The order of toolbar buttons
128 * \param tb_style The style of toolbar buttons
129 * \param tb_help Thh toolbar help text
130 * \return NSERROR_OK on successful initialisation otherwise error code.
131 */
132nserror ro_corewindow_init(struct ro_corewindow *ro_cw, const struct button_bar_buttons *tb_buttons, char *tb_order, theme_style tb_style, const char *tb_help);
133
134/**
135 * finalise elements of ro core window.
136 *
137 * \param ro_cw A riscos core window structure to initialise
138 * \return NSERROR_OK on successful finalisation otherwise error code.
139 */
141
142
143#endif
static struct s_tb_button tb_buttons[]
Definition: toolbar.c:107
button_bar_action
Definition: button_bar.h:32
Interface to core window handling.
core_window_drag_status
drag status passed to drag_status callback
Definition: core_window.h:41
nserror
Enumeration of error codes.
Definition: errors.h:29
theme_style
Theme styles, collecting groups of attributes for different locations.
Definition: theme.h:31
browser_mouse_state
Mouse state.
Definition: mouse.h:43
nserror ro_corewindow_fini(struct ro_corewindow *ro_cw)
finalise elements of ro core window.
Definition: corewindow.c:1079
nserror ro_corewindow_init(struct ro_corewindow *ro_cw, const struct button_bar_buttons *tb_buttons, char *tb_order, theme_style tb_style, const char *tb_help)
initialise elements of riscos core window.
Definition: corewindow.c:1001
Callbacks to achieve various core window functionality.
Definition: core_window.h:51
Rectangle coordinates.
Definition: types.h:40
ro core window state
Definition: corewindow.h:37
int origin_y
content plot origin y relative to window
Definition: corewindow.h:45
nserror(* toolbar_click)(struct ro_corewindow *ro_cw, button_bar_action action)
callback for clicks in ro core window toolbar.
Definition: corewindow.h:99
struct core_window_callback_table * cb_table
table of callbacks for core window operations
Definition: corewindow.h:57
nserror(* mouse)(struct ro_corewindow *ro_cw, browser_mouse_state mouse_state, int x, int y)
callback for mouse event on ro core window
Definition: corewindow.h:90
nserror(* toolbar_save)(struct ro_corewindow *ro_cw, char *config)
callback for saving ro core window toolbar state.
Definition: corewindow.h:116
wimp_w wh
window handle
Definition: corewindow.h:39
nserror(* key)(struct ro_corewindow *ro_cw, uint32_t nskey)
callback for keypress on ro core window
Definition: corewindow.h:79
nserror(* draw)(struct ro_corewindow *ro_cw, int originx, int originy, struct rect *r)
callback to draw on drawable area of ro core window
Definition: corewindow.h:68
int content_width
content width
Definition: corewindow.h:48
nserror(* toolbar_update)(struct ro_corewindow *ro_cw)
callback for updating state of buttons in ro core window toolbar.
Definition: corewindow.h:107
int content_height
content height
Definition: corewindow.h:51
struct toolbar * toolbar
toolbar
Definition: corewindow.h:42
core_window_drag_status drag_status
drag status set by core
Definition: corewindow.h:54