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#ifndef NETSURF_WINDOWS_COREWINDOW_H
20#define NETSURF_WINDOWS_COREWINDOW_H
21
22#include "netsurf/core_window.h"
23
24/**
25 * nsw32 core window state
26 */
28 /** window handle */
29 HWND hWnd;
30
31 /** content width */
33
34 /** content height */
36
37 /** window title */
38 const char *title;
39
40 /** drag status set by core */
42
43 /** table of callbacks for core window operations */
45
46 /**
47 * callback to draw on drawable area of nsw32 core window
48 *
49 * \param nsw32_cw The nsw32 core window structure.
50 * \param r The rectangle of the window that needs updating.
51 * \return NSERROR_OK on success otherwise apropriate error code
52 */
53 nserror (*draw)(struct nsw32_corewindow *nsw32_cw, int scrollx, int scrolly, struct rect *r);
54
55 /**
56 * callback for keypress on nsw32 core window
57 *
58 * \param nsw32_cw The nsw32 core window structure.
59 * \param nskey The netsurf key code.
60 * \return NSERROR_OK if key processed,
61 * NSERROR_NOT_IMPLEMENTED if key not processed
62 * otherwise apropriate error code
63 */
64 nserror (*key)(struct nsw32_corewindow *nsw32_cw, uint32_t nskey);
65
66 /**
67 * callback for mouse event on nsw32 core window
68 *
69 * \param nsw32_cw The nsw32 core window structure.
70 * \param mouse_state mouse state
71 * \param x location of event
72 * \param y location of event
73 * \return NSERROR_OK on sucess otherwise apropriate error code.
74 */
75 nserror (*mouse)(struct nsw32_corewindow *nsw32_cw, browser_mouse_state mouse_state, int x, int y);
76
77 /**
78 * callback for window close event
79 *
80 * \param nsw32_cw The nsw32 core window structure.
81 * \return NSERROR_OK on sucess otherwise apropriate error code.
82 */
83 nserror (*close)(struct nsw32_corewindow *nsw32_cw);
84};
85
86/**
87 * initialise elements of nsw32 core window.
88 *
89 * As a pre-requisite the draw, key and mouse callbacks must be defined
90 *
91 * \param hInstance The instance to create the core window in
92 * \param hWndParent parent window handle may be NULL for top level window.
93 * \param nsw32_cw A nsw32 core window structure to initialise
94 * \return NSERROR_OK on successful initialisation otherwise error code.
95 */
96nserror nsw32_corewindow_init(HINSTANCE hInstance,
97 HWND hWndParent,
98 struct nsw32_corewindow *nsw32_cw);
99
100/**
101 * finalise elements of nsw32 core window.
102 *
103 * \param nsw32_cw A nsw32 core window structure to initialise
104 * \return NSERROR_OK on successful finalisation otherwise error code.
105 */
107
108nserror nsw32_create_corewindow_class(HINSTANCE hInstance);
109
110#endif
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
browser_mouse_state
Mouse state.
Definition: mouse.h:43
Callbacks to achieve various core window functionality.
Definition: core_window.h:51
nsw32 core window state
Definition: corewindow.h:27
nserror(* close)(struct nsw32_corewindow *nsw32_cw)
callback for window close event
Definition: corewindow.h:83
const char * title
window title
Definition: corewindow.h:38
struct core_window_callback_table * cb_table
table of callbacks for core window operations
Definition: corewindow.h:44
nserror(* key)(struct nsw32_corewindow *nsw32_cw, uint32_t nskey)
callback for keypress on nsw32 core window
Definition: corewindow.h:64
core_window_drag_status drag_status
drag status set by core
Definition: corewindow.h:41
nserror(* mouse)(struct nsw32_corewindow *nsw32_cw, browser_mouse_state mouse_state, int x, int y)
callback for mouse event on nsw32 core window
Definition: corewindow.h:75
int content_width
content width
Definition: corewindow.h:32
HWND hWnd
window handle
Definition: corewindow.h:29
int content_height
content height
Definition: corewindow.h:35
nserror(* draw)(struct nsw32_corewindow *nsw32_cw, int scrollx, int scrolly, struct rect *r)
callback to draw on drawable area of nsw32 core window
Definition: corewindow.h:53
Rectangle coordinates.
Definition: types.h:40
nserror nsw32_corewindow_init(HINSTANCE hInstance, HWND hWndParent, struct nsw32_corewindow *nsw32_cw)
initialise elements of nsw32 core window.
Definition: corewindow.c:517
nserror nsw32_create_corewindow_class(HINSTANCE hInstance)
Definition: corewindow.c:583
nserror nsw32_corewindow_fini(struct nsw32_corewindow *nsw32_cw)
finalise elements of nsw32 core window.
Definition: corewindow.c:576