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
35
36/**
37 * ro core window state
38 */
40 /** window handle */
41 wimp_w wh;
42
43 /** toolbar */
45
46 /** content plot origin y relative to window */
48
49 /** content width */
51
52 /** content height */
54
55 /** drag status set by core */
57
58 /**
59 * callback to draw on drawable area of ro core window
60 *
61 * \param ro_cw The riscos core window structure.
62 * \param originx The risc os plotter x origin.
63 * \param originy The risc os plotter y origin.
64 * \param r The rectangle of the window that needs updating.
65 * \return NSERROR_OK on success otherwise apropriate error code
66 */
67 nserror (*draw)(struct ro_corewindow *ro_cw, int originx, int originy, struct rect *r);
68
69 /**
70 * callback for keypress on ro core window
71 *
72 * \param ro_cw The ro core window structure.
73 * \param nskey The netsurf key code.
74 * \return NSERROR_OK if key processed,
75 * NSERROR_NOT_IMPLEMENTED if key not processed
76 * otherwise apropriate error code
77 */
78 nserror (*key)(struct ro_corewindow *ro_cw, uint32_t nskey);
79
80 /**
81 * callback for mouse event on ro core window
82 *
83 * \param ro_cw The ro core window structure.
84 * \param mouse_state mouse state
85 * \param x location of event
86 * \param y location of event
87 * \return NSERROR_OK on sucess otherwise apropriate error code.
88 */
89 nserror (*mouse)(struct ro_corewindow *ro_cw, browser_mouse_state mouse_state, int x, int y);
90
91 /**
92 * callback for clicks in ro core window toolbar.
93 *
94 * \param ro_cw The ro core window structure.
95 * \param action The button bar action.
96 * \return NSERROR_OK if config saved, otherwise apropriate error code
97 */
99
100 /**
101 * callback for updating state of buttons in ro core window toolbar.
102 *
103 * \param ro_cw The ro core window structure.
104 * \return NSERROR_OK if config saved, otherwise apropriate error code
105 */
107
108 /**
109 * callback for saving ro core window toolbar state.
110 *
111 * \param ro_cw The ro core window structure.
112 * \param config The new toolbar configuration.
113 * \return NSERROR_OK if config saved, otherwise apropriate error code
114 */
115 nserror (*toolbar_save)(struct ro_corewindow *ro_cw, char *config);
116
117};
118
119/**
120 * initialise elements of riscos core window.
121 *
122 * As a pre-requisite the draw, key and mouse callbacks must be defined
123 *
124 * \param ro_cw A riscos core window structure to initialise
125 * \param tb_buttons toolbar button bar context
126 * \param tb_order The order of toolbar buttons
127 * \param tb_style The style of toolbar buttons
128 * \param tb_help Thh toolbar help text
129 * \return NSERROR_OK on successful initialisation otherwise error code.
130 */
131nserror 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);
132
133/**
134 * finalise elements of ro core window.
135 *
136 * \param ro_cw A riscos core window structure to initialise
137 * \return NSERROR_OK on successful finalisation otherwise error code.
138 */
140
141
142#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:1078
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:1003
struct core_window_table * riscos_core_window_table
Definition: corewindow.c:974
Core user interface window function table.
Definition: core_window.h:53
Rectangle coordinates.
Definition: types.h:40
ro core window state
Definition: corewindow.h:39
int origin_y
content plot origin y relative to window
Definition: corewindow.h:47
nserror(* toolbar_click)(struct ro_corewindow *ro_cw, button_bar_action action)
callback for clicks in ro core window toolbar.
Definition: corewindow.h:98
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:89
nserror(* toolbar_save)(struct ro_corewindow *ro_cw, char *config)
callback for saving ro core window toolbar state.
Definition: corewindow.h:115
wimp_w wh
window handle
Definition: corewindow.h:41
nserror(* key)(struct ro_corewindow *ro_cw, uint32_t nskey)
callback for keypress on ro core window
Definition: corewindow.h:78
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:67
int content_width
content width
Definition: corewindow.h:50
nserror(* toolbar_update)(struct ro_corewindow *ro_cw)
callback for updating state of buttons in ro core window toolbar.
Definition: corewindow.h:106
int content_height
content height
Definition: corewindow.h:53
struct toolbar * toolbar
toolbar
Definition: corewindow.h:44
core_window_drag_status drag_status
drag status set by core
Definition: corewindow.h:56