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