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 GTK_COREWINDOW_H
20#define GTK_COREWINDOW_H
21
22#include "netsurf/core_window.h"
23
24/**
25 * nsgtk core window mouse state
26 */
28 browser_mouse_state state; /**< last event status */
29 bool pressed;
32 int last_x;
33 int last_y;
34};
35
36/**
37 * nsgtk core window state
38 */
40 /* public variables */
41 /** GTK drawable widget */
42 GtkDrawingArea *drawing_area;
43 /** scrollable area drawing area is within */
44 GtkScrolledWindow *scrolled;
45
46 /* private variables */
47 /** Input method */
48 GtkIMContext *input_method;
49 /** table of callbacks for core window operations */
51 /** mouse state */
53 /** drag status set by core */
55
56 /**
57 * callback to draw on drawable area of nsgtk core window
58 *
59 * \param nsgtk_cw The nsgtk core window structure.
60 * \param r The rectangle of the window that needs updating.
61 * \return NSERROR_OK on success otherwise appropriate error code
62 */
63 nserror (*draw)(struct nsgtk_corewindow *nsgtk_cw, struct rect *r);
64
65 /**
66 * callback for keypress on nsgtk core window
67 *
68 * \param nsgtk_cw The nsgtk core window structure.
69 * \param nskey The netsurf key code.
70 * \return NSERROR_OK if key processed,
71 * NSERROR_NOT_IMPLEMENTED if key not processed
72 * otherwise appropriate error code
73 */
74 nserror (*key)(struct nsgtk_corewindow *nsgtk_cw, uint32_t nskey);
75
76 /**
77 * callback for mouse event on nsgtk core window
78 *
79 * \param nsgtk_cw The nsgtk core window structure.
80 * \param mouse_state mouse state
81 * \param x location of event
82 * \param y location of event
83 * \return NSERROR_OK on success otherwise appropriate error code.
84 */
85 nserror (*mouse)(struct nsgtk_corewindow *nsgtk_cw, browser_mouse_state mouse_state, int x, int y);
86};
87
88/**
89 * initialise elements of gtk core window.
90 *
91 * \param nsgtk_cw A gtk core window structure to initialise
92 * \return NSERROR_OK on successful initialisation otherwise error code.
93 */
95
96/**
97 * finalise elements of gtk core window.
98 *
99 * \param nsgtk_cw A gtk core window structure to initialise
100 * \return NSERROR_OK on successful finalisation otherwise error code.
101 */
103
104#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
nserror nsgtk_corewindow_init(struct nsgtk_corewindow *nsgtk_cw)
initialise elements of gtk core window.
Definition: corewindow.c:732
nserror nsgtk_corewindow_fini(struct nsgtk_corewindow *nsgtk_cw)
finalise elements of gtk core window.
Definition: corewindow.c:786
browser_mouse_state
Mouse state.
Definition: mouse.h:43
Callbacks to achieve various core window functionality.
Definition: core_window.h:51
nsgtk core window mouse state
Definition: corewindow.h:27
browser_mouse_state state
last event status
Definition: corewindow.h:28
nsgtk core window state
Definition: corewindow.h:39
nserror(* key)(struct nsgtk_corewindow *nsgtk_cw, uint32_t nskey)
callback for keypress on nsgtk core window
Definition: corewindow.h:74
nserror(* draw)(struct nsgtk_corewindow *nsgtk_cw, struct rect *r)
callback to draw on drawable area of nsgtk core window
Definition: corewindow.h:63
struct core_window_callback_table * cb_table
table of callbacks for core window operations
Definition: corewindow.h:50
GtkScrolledWindow * scrolled
scrollable area drawing area is within
Definition: corewindow.h:44
nserror(* mouse)(struct nsgtk_corewindow *nsgtk_cw, browser_mouse_state mouse_state, int x, int y)
callback for mouse event on nsgtk core window
Definition: corewindow.h:85
core_window_drag_status drag_status
drag status set by core
Definition: corewindow.h:54
GtkDrawingArea * drawing_area
GTK drawable widget.
Definition: corewindow.h:42
GtkIMContext * input_method
Input method.
Definition: corewindow.h:48
struct nsgtk_corewindow_mouse mouse_state
mouse state
Definition: corewindow.h:52
Rectangle coordinates.
Definition: types.h:40