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