summaryrefslogtreecommitdiff
path: root/gtk/gtk_scaffolding.h
blob: 1db576ac1722abc46c0998e2bceb73efcb0df983 (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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
/*
 * 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 <gtk/gtk.h>
#include <glade/glade.h>
#include <glib.h>
#include "desktop/gui.h"
#include "desktop/plotters.h"
#include "gtk/gtk_menu.h"
#include "gtk/sexy_icon_entry.h"

typedef struct gtk_scaffolding nsgtk_scaffolding;

typedef enum {
	BACK_BUTTON = 0,
	HISTORY_BUTTON,
	FORWARD_BUTTON,
	STOP_BUTTON,
	RELOAD_BUTTON,
	HOME_BUTTON,
	URL_BAR_ITEM,
	WEBSEARCH_ITEM,
	THROBBER_ITEM,
	NEWWINDOW_BUTTON,
	NEWTAB_BUTTON,
	OPENFILE_BUTTON,
	CLOSETAB_BUTTON,
	CLOSEWINDOW_BUTTON,
	SAVEPAGE_BUTTON,
	PDF_BUTTON,
	PLAINTEXT_BUTTON,
	DRAWFILE_BUTTON,
	POSTSCRIPT_BUTTON,
	PRINTPREVIEW_BUTTON,
	PRINT_BUTTON,
	QUIT_BUTTON,
	CUT_BUTTON,
	COPY_BUTTON,
	PASTE_BUTTON,
	DELETE_BUTTON,
	SELECTALL_BUTTON,
	FIND_BUTTON,
	PREFERENCES_BUTTON,
	ZOOMPLUS_BUTTON,
	ZOOMMINUS_BUTTON,
	ZOOMNORMAL_BUTTON,
	FULLSCREEN_BUTTON,
	VIEWSOURCE_BUTTON,
	DOWNLOADS_BUTTON,
	SAVEWINDOWSIZE_BUTTON,
	TOGGLEDEBUGGING_BUTTON,
	SAVEBOXTREE_BUTTON,
	SAVEDOMTREE_BUTTON,
	LOCALHISTORY_BUTTON,
	GLOBALHISTORY_BUTTON,
	ADDBOOKMARKS_BUTTON,
	SHOWBOOKMARKS_BUTTON,
 	SHOWCOOKIES_BUTTON,
	OPENLOCATION_BUTTON,
	NEXTTAB_BUTTON,
	PREVTAB_BUTTON,
	CONTENTS_BUTTON,
	GUIDE_BUTTON,
	INFO_BUTTON,
	ABOUT_BUTTON,
	PLACEHOLDER_BUTTON /* size indicator; array maximum indices */
} nsgtk_toolbar_button;    /* PLACEHOLDER_BUTTON - 1 */

struct gtk_history_window {
	struct gtk_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;
};

struct nsgtk_button_connect {
	GtkToolItem			*button;
	int				location; /* in toolbar */
	bool				sensitivity;
	GtkImageMenuItem		*main;
	GtkImageMenuItem		*rclick;
	GtkImageMenuItem		*popup;
	void				*mhandler; /* menu item clicked */
	void				*bhandler; /* button clicked */
	void				*dataplus; /* customization -> toolbar */
	void				*dataminus; /* customization -> store */
};

extern nsgtk_scaffolding *scaf_list;

nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel);

bool nsgtk_scaffolding_is_busy(nsgtk_scaffolding *g);

GtkWindow *nsgtk_scaffolding_window(nsgtk_scaffolding *g);
GtkNotebook *nsgtk_scaffolding_notebook(nsgtk_scaffolding *g);
GtkWidget *nsgtk_scaffolding_urlbar(nsgtk_scaffolding *g);
GtkWidget *nsgtk_scaffolding_websearch(nsgtk_scaffolding *g);
GtkToolbar *nsgtk_scaffolding_toolbar(nsgtk_scaffolding *g);
struct nsgtk_button_connect *nsgtk_scaffolding_button(nsgtk_scaffolding *g,
		int i);
struct gtk_search *nsgtk_scaffolding_search(nsgtk_scaffolding *g);
GtkMenuBar *nsgtk_scaffolding_menu_bar(nsgtk_scaffolding *g);
struct gtk_history_window *nsgtk_scaffolding_history_window(nsgtk_scaffolding
		*g);
struct gui_window *nsgtk_scaffolding_top_level(nsgtk_scaffolding *g);
void nsgtk_scaffolding_reset_offset(nsgtk_scaffolding *g);
nsgtk_scaffolding *nsgtk_scaffolding_iterate(nsgtk_scaffolding *g);
void nsgtk_scaffolding_toolbar_init(struct gtk_scaffolding *g);
void nsgtk_scaffolding_update_url_bar_ref(nsgtk_scaffolding *g);
void nsgtk_scaffolding_update_throbber_ref(nsgtk_scaffolding *g);
void nsgtk_scaffolding_update_websearch_ref(nsgtk_scaffolding *g);
void nsgtk_scaffolding_set_websearch(nsgtk_scaffolding *g, const char
		*content);
void nsgtk_scaffolding_toggle_search_bar_visibility(nsgtk_scaffolding *g);
void nsgtk_scaffolding_set_top_level(struct gui_window *g);

void nsgtk_scaffolding_destroy(nsgtk_scaffolding *g);

void nsgtk_scaffolding_set_sensitivity(struct gtk_scaffolding *g);
void nsgtk_scaffolding_initial_sensitivity(struct gtk_scaffolding *g);
void nsgtk_scaffolding_popup_menu(struct gtk_scaffolding *g, gdouble x,
    gdouble y);
void nsgtk_scaffolding_toolbar_size_allocate(GtkWidget *widget,
		GtkAllocation *alloc, gpointer data);

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

#define MULTIPROTO(q)\
gboolean nsgtk_on_##q##_activate(struct gtk_scaffolding *);\
gboolean nsgtk_on_##q##_activate_menu(GtkMenuItem *, gpointer);\
gboolean nsgtk_on_##q##_activate_button(GtkButton *, gpointer)
#define MENUPROTO(q)\
gboolean nsgtk_on_##q##_activate(GtkMenuItem *, gpointer)
#define BUTTONPROTO(q)\
gboolean nsgtk_on_##q##_activate(GtkButton *, gpointer)
/* prototypes for handlers */
/* file menu */
MULTIPROTO(newwindow);
MULTIPROTO(newtab);
MULTIPROTO(open_location);
MULTIPROTO(openfile);
MULTIPROTO(savepage);
MULTIPROTO(pdf);
MULTIPROTO(plaintext);
MULTIPROTO(drawfile);
MULTIPROTO(postscript);
MULTIPROTO(printpreview);
MULTIPROTO(print);
MULTIPROTO(closewindow);
MULTIPROTO(quit);

/* edit menu */
MULTIPROTO(cut);
MULTIPROTO(copy);
MULTIPROTO(paste);
MULTIPROTO(delete);
MULTIPROTO(selectall);
MULTIPROTO(find);
MULTIPROTO(preferences);

/* view menu */
MULTIPROTO(stop);
MULTIPROTO(reload);
MULTIPROTO(zoomplus);
MULTIPROTO(zoomnormal);
MULTIPROTO(zoomminus);
MULTIPROTO(fullscreen);
MULTIPROTO(viewsource);
MENUPROTO(menubar);
MENUPROTO(toolbar);
MULTIPROTO(downloads);
MULTIPROTO(savewindowsize);
MULTIPROTO(toggledebugging);
MULTIPROTO(saveboxtree);
MULTIPROTO(savedomtree);

/* navigate menu */
MULTIPROTO(back);
MULTIPROTO(forward);
MULTIPROTO(home);
MULTIPROTO(localhistory);
MULTIPROTO(globalhistory);
MULTIPROTO(addbookmarks);
MULTIPROTO(showbookmarks);
MULTIPROTO(showcookies);
MULTIPROTO(openlocation);

/* tabs menu */
MULTIPROTO(nexttab);
MULTIPROTO(prevtab);
MULTIPROTO(closetab);

/* help menu */
MULTIPROTO(contents);
MULTIPROTO(guide);
MULTIPROTO(info);
MULTIPROTO(about);

/* popup menu */
MENUPROTO(customize);
MENUPROTO(savelink);
MENUPROTO(linkfocused);
MENUPROTO(linkbackground);

/* non-menu */
BUTTONPROTO(history);

#undef MULTIPROTO
#undef MENUPROTO
#undef BUTTONPROTO

#endif /* NETSURF_GTK_SCAFFOLDING_H */