NetSurf
window.h
Go to the documentation of this file.
1/*
2 * Copyright 2011 Vincent Sanders <vince@simtec.co.uk>
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_WINDOW_H_
20#define NETSURF_WINDOWS_WINDOW_H_
21
22/** The window operation function table for win32 */
24
25#include "netsurf/mouse.h"
26
28 struct gui_window *gui;
29
30 double pressed_x;
31 double pressed_y;
32 bool waiting;
34};
35
36struct gui_window {
37 /* The front's private data connected to a browser window */
38 /* currently 1<->1 gui_window<->windows window [non-tabbed] */
39 struct browser_window *bw; /**< the browser_window */
40
41 HWND main; /**< handle to the actual window */
42 HWND toolbar; /**< toolbar handle */
43 HWND urlbar; /**< url bar handle */
44 HWND throbber; /** throbber handle */
45 HWND drawingarea; /**< drawing area handle */
46 HWND statusbar; /**< status bar handle */
47 HWND vscroll; /**< vertical scrollbar handle */
48 HWND hscroll; /**< horizontal scrollbar handle */
49
50 HMENU mainmenu; /**< the main menu */
51 HMENU rclick; /**< the right-click menu */
52 struct nsws_localhistory *localhistory; /**< handle to local history window */
53 int width; /**< width of window */
54 int height; /**< height of drawing area */
55
56 int toolbuttonc; /**< number of toolbar buttons */
57 int toolbuttonsize; /**< width, height of buttons */
58 bool throbbing; /**< whether currently throbbing */
59
60 struct browser_mouse *mouse; /**< mouse state */
61
62 HACCEL acceltable; /**< accelerators */
63
64 HBITMAP hPageInfo[8]; /**< page info handles */
65
66 int scrollx; /**< current scroll location */
67 int scrolly; /**< current scroll location */
68
69 RECT *fullscreen; /**< memorize non-fullscreen area */
70 RECT redraw; /**< Area needing redraw. */
71 int requestscrollx, requestscrolly; /**< scolling requested. */
72 struct gui_window *next, *prev; /**< global linked list */
73};
74
75struct rect;
76
77/**
78 * Obtain gui window structure from window handle.
79 *
80 * \param hwnd The window handle.
81 * \return The gui window associated with the window handle.
82 */
83struct gui_window *nsws_get_gui_window(HWND hwnd);
84
85/**
86 * Cause a browser window to navigate to a url
87 *
88 * \param hwnd The win32 handle to the browser window or one of its decendants.
89 * \param urltxt The URL to navigate to.
90 */
91bool nsws_window_go(HWND hwnd, const char *urltxt);
92
93/**
94 * Set the scroll position of a win32 browser window.
95 *
96 * Scrolls the viewport to ensure the specified rectangle of the
97 * content is shown. The win32 implementation scrolls the contents so
98 * the specified point in the content is at the top of the viewport.
99 *
100 * \param gw The win32 gui window to scroll.
101 * \param rect The rectangle to ensure is shown.
102 * \return NSERROR_OK on success or apropriate error code.
103 */
104nserror win32_window_set_scroll(struct gui_window *gw, const struct rect *rect);
105
106/**
107 * Create the main browser window class.
108 *
109 * \param hinstance The application instance
110 * \return NSERROR_OK on success or NSERROR_INIT_FAILED if the class
111 * creation failed.
112 */
113nserror nsws_create_main_class(HINSTANCE hinstance);
114
115/**
116 * Get the main win32 window handle from a gui window
117 */
118HWND gui_window_main_window(struct gui_window *gw);
119
120/**
121 * Get the localhistory win32 window handle from a gui window
122 */
123struct nsws_localhistory *gui_window_localhistory(struct gui_window *);
124
125
126#endif /* _NETSURF_WINDOWS_WINDOW_H_ */
nserror
Enumeration of error codes.
Definition: errors.h:29
struct gui_window_table * win32_window_table
The window operation function table for win32.
Definition: window.c:1921
nserror nsws_create_main_class(HINSTANCE hinstance)
Create the main browser window class.
Definition: window.c:2083
HWND gui_window_main_window(struct gui_window *gw)
Get the main win32 window handle from a gui window.
Definition: window.c:2112
struct gui_window * nsws_get_gui_window(HWND hwnd)
Obtain gui window structure from window handle.
Definition: window.c:1925
bool nsws_window_go(HWND hwnd, const char *urltxt)
Cause a browser window to navigate to a url.
Definition: window.c:1954
nserror win32_window_set_scroll(struct gui_window *gw, const struct rect *rect)
Set the scroll position of a win32 browser window.
Definition: window.c:1983
struct nsws_localhistory * gui_window_localhistory(struct gui_window *)
Get the localhistory win32 window handle from a gui window.
Core mouse and pointer states.
browser_mouse_state
Mouse state.
Definition: mouse.h:43
double pressed_y
Definition: window.h:31
double pressed_x
Definition: window.h:30
browser_mouse_state state
Definition: window.h:33
struct gui_window * gui
Definition: window.h:28
bool waiting
Definition: window.h:32
Browser window data.
Graphical user interface window function table.
Definition: window.h:137
first entry in window list
Definition: gui.c:297
struct gui_window * prev
Previous in linked list.
Definition: gui.h:159
struct browser_mouse * mouse
mouse state
Definition: window.h:60
HWND main
handle to the actual window
Definition: window.h:41
struct nsws_localhistory * localhistory
handle to local history window
Definition: window.h:52
HMENU mainmenu
the main menu
Definition: window.h:50
HWND throbber
Definition: window.h:44
HACCEL acceltable
accelerators
Definition: window.h:62
int toolbuttonsize
width, height of buttons
Definition: window.h:57
HWND toolbar
toolbar handle
Definition: window.h:42
struct gui_window * next
list for cleanup
Definition: gui.h:159
bool throbbing
whether currently throbbing
Definition: gui.c:311
int toolbuttonc
number of toolbar buttons
Definition: window.h:56
RECT * fullscreen
memorize non-fullscreen area
Definition: window.h:69
int height
height of drawing area
Definition: browser.h:34
int width
width of window
Definition: browser.h:34
HWND vscroll
vertical scrollbar handle
Definition: window.h:47
int requestscrolly
scolling requested.
Definition: window.h:71
int requestscrollx
Definition: window.h:71
int scrollx
current scroll location
Definition: gui.c:306
HMENU rclick
the right-click menu
Definition: window.h:51
RECT redraw
Area needing redraw.
Definition: window.h:70
HWND hscroll
horizontal scrollbar handle
Definition: window.h:48
HWND drawingarea
throbber handle
Definition: window.h:45
HWND urlbar
url bar handle
Definition: window.h:43
HWND statusbar
status bar handle
Definition: window.h:46
HBITMAP hPageInfo[8]
page info handles
Definition: window.h:64
int scrolly
current scroll location
Definition: gui.c:307
struct browser_window * bw
The 'content' window that is rendered in the gui_window.
Definition: gui.c:315
Rectangle coordinates.
Definition: types.h:40