summaryrefslogtreecommitdiff
path: root/frontends/gtk/scaffolding.h
blob: 666bc502f2b8374f48353ea19ec884fc4e9b46e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
/*
 * Copyright 2005 James Bursa <bursa@users.sourceforge.net>
 *
 * This file is part of NetSurf, http://www.netsurf-browser.org/
 *
 * NetSurf is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * NetSurf is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef NETSURF_GTK_SCAFFOLDING_H
#define NETSURF_GTK_SCAFFOLDING_H 1

#include <stdbool.h>
#include "utils/errors.h"

struct bitmap;
struct hlcache_handle;
struct gui_window;
struct gui_search_web_table;
struct nsurl;

extern struct gui_search_web_table *nsgtk_search_web_table;


struct gtk_history_window {
	struct nsgtk_scaffolding 	*g;
	GtkWindow		*window;
	GtkScrolledWindow	*scrolled;
	GtkDrawingArea		*drawing_area;
};

struct gtk_search {
	GtkToolbar			*bar;
	GtkEntry			*entry;
	GtkToolButton			*buttons[3]; /* back, forward, */
	GtkCheckButton			*checkAll;	/* close */
	GtkCheckButton			*caseSens;
};


/**
 * create a new scaffolding for a window.
 *
 * \param gw The gui window to create the new scaffold around.
 * \return The newly constructed scaffold or NULL on error.
 */
struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *gw);

/**
 * causes all scaffolding windows to be destroyed.
 *
 * \return NSERROR_OK and all scaffolding windows destroyed else
 *         NSERROR_INVALID if download in progress and user continued.
 */
nserror nsgtk_scaffolding_destroy_all(void);

/**
 * Update scaffolding window when throbber state changes
 */
nserror nsgtk_scaffolding_throbber(struct gui_window* gw, bool active);

/**
 * Obtain the most recently used scaffolding element.
 *
 * This allows tabs to be opened in the most recently used window
 */
struct nsgtk_scaffolding *nsgtk_current_scaffolding(void);

/* acessors for gtk elements within a scaffold */

/**
 * Get the gtk window for a scaffolding.
 */
GtkWindow *nsgtk_scaffolding_window(struct nsgtk_scaffolding *g);

/**
 * Get the gtk notebook from a scaffold.
 */
GtkNotebook *nsgtk_scaffolding_notebook(struct nsgtk_scaffolding *g);

/**
 * Get the gtk url bar from a scaffold.
 */
GtkWidget *nsgtk_scaffolding_urlbar(struct nsgtk_scaffolding *g);

/**
 * Get the gtk web search entry from a scaffold.
 */
GtkWidget *nsgtk_scaffolding_websearch(struct nsgtk_scaffolding *g);

/**
 * Get the gtk toolbar from a scaffold.
 */
GtkToolbar *nsgtk_scaffolding_toolbar(struct nsgtk_scaffolding *g);


struct gtk_search *nsgtk_scaffolding_search(struct nsgtk_scaffolding *g);

GtkMenuBar *nsgtk_scaffolding_menu_bar(struct nsgtk_scaffolding *g);

struct gtk_history_window *nsgtk_scaffolding_history_window(struct nsgtk_scaffolding *g);

struct gui_window *nsgtk_scaffolding_top_level(struct nsgtk_scaffolding *g);

/**
 * reset the scaffold offset value to 0.
 *
 * \todo The value is only ever altered in
 * nsgtk_scaffolding_toolbar_size_allocate and is something to do with
 * the history button either clarify or remove!
 */
void nsgtk_scaffolding_reset_offset(struct nsgtk_scaffolding *g);

/**
 * Iterate through available scaffolding.
 */
struct nsgtk_scaffolding *nsgtk_scaffolding_iterate(struct nsgtk_scaffolding *g);


void nsgtk_scaffolding_update_websearch_ref(struct nsgtk_scaffolding *g);

void nsgtk_scaffolding_toggle_search_bar_visibility(struct nsgtk_scaffolding *g);

/**
 * Set the current active top level gui window.
 */
void nsgtk_scaffolding_set_top_level(struct gui_window *g);

/**
 * update the sensitivity of context sensitive UI elements
 *
 * widgets altered in arrays:
 *   main
 *   right click menu
 *   location
 *   popup
 * current arrays are:
 *   stop
 *   reload
 *   cut
 *   copy
 *   paste
 *   back
 *   forward
 *   nexttab
 *   prevtab
 *   closetab
 */
void nsgtk_scaffolding_set_sensitivity(struct nsgtk_scaffolding *g);

/**
 * Open a context sensitive menu.
 *
 * \param g the scaffolding containing the browser window.
 * \param x The x co-ordinate.
 * \param y The y co-ordinate.
 */
void nsgtk_scaffolding_context_menu(struct nsgtk_scaffolding *g, gdouble x, gdouble y);

gboolean nsgtk_window_url_changed(GtkWidget *, GdkEventKey *, gpointer);

/* core acessors */
/**
 * set the title in the window
 *
 * \param gw The gui window to set title on
 * \param title The title to set which may be NULL
 */
void nsgtk_window_set_title(struct gui_window *gw, const char *title);

/**
 * toolbar style changed
 */
void nsgtk_scaffolding_toolbars(struct nsgtk_scaffolding *g);

#endif /* NETSURF_GTK_SCAFFOLDING_H */