NetSurf
gui_factory.c
Go to the documentation of this file.
1/*
2 * Copyright 2014 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#include <stdlib.h>
20#include <stdint.h>
21#include <stdbool.h>
22#include <string.h>
23#include <unistd.h>
24
25#include "utils/config.h"
26#include "utils/errors.h"
27#include "utils/file.h"
28#include "utils/inet.h"
29#include "netsurf/bitmap.h"
30#include "content/hlcache.h"
32
33#include "desktop/save_pdf.h"
34#include "desktop/download.h"
35#include "desktop/searchweb.h"
36#include "netsurf/download.h"
37#include "netsurf/fetch.h"
38#include "netsurf/misc.h"
39#include "netsurf/window.h"
40#include "netsurf/search.h"
41#include "netsurf/clipboard.h"
42#include "netsurf/utf8.h"
43#include "netsurf/layout.h"
44#include "netsurf/netsurf.h"
45
46/**
47 * The global interface table.
48 */
49struct netsurf_table *guit = NULL;
50
51
52static void gui_default_window_set_title(struct gui_window *g, const char *title)
53{
54}
55
56static nserror gui_default_window_set_url(struct gui_window *g, struct nsurl *url)
57{
58 return NSERROR_OK;
59}
60
63 const struct rect *rect)
64{
65 return true;
66}
67
69 nsurl *url,
70 const char *title)
71{
72 return NSERROR_OK;
73}
74
76 hlcache_handle *icon)
77{
78}
79
82{
83}
84
86 const char *text)
87{
88}
89
91 int x, int y, int height,
92 const struct rect *clip)
93{
94}
95
97 struct form_control *control)
98{
99}
100
103 struct form_control *gadget)
104{
105}
106
110{
111}
112
114 const char *selection)
115{
116}
117
118
119static void
122 const char *msg,
123 size_t msglen,
125{
126}
127
128
129/** verify window table is valid */
131{
132 /* check table is present */
133 if (gwt == NULL) {
135 }
136
137 /* check the mandantory fields are set */
138 if (gwt->create == NULL) {
140 }
141 if (gwt->destroy == NULL) {
143 }
144 if (gwt->invalidate == NULL) {
146 }
147 if (gwt->get_scroll == NULL) {
149 }
150 if (gwt->set_scroll == NULL) {
152 }
153 if (gwt->get_dimensions == NULL) {
155 }
156 if (gwt->event == NULL) {
158 }
159
160
161 /* fill in the optional entries with defaults */
162 if (gwt->set_title == NULL) {
164 }
165 if (gwt->set_url == NULL) {
167 }
168 if (gwt->set_icon == NULL) {
170 }
171 if (gwt->set_status == NULL) {
173 }
174 if (gwt->set_pointer == NULL) {
176 }
177 if (gwt->place_caret == NULL) {
179 }
180 if (gwt->drag_start == NULL) {
182 }
183 if (gwt->save_link == NULL) {
185 }
186 if (gwt->create_form_select_menu == NULL) {
189 }
190 if (gwt->file_gadget_open == NULL) {
192 }
193 if (gwt->drag_save_object == NULL) {
195 }
196 if (gwt->drag_save_selection == NULL) {
198 }
199 if (gwt->console_log == NULL) {
201 }
202
203 return NSERROR_OK;
204}
205
206
207
208static struct gui_download_window *
210{
211 return NULL;
212}
213
215 const char *data, unsigned int size)
216{
217 return NSERROR_OK;
218}
219
221 const char *error_msg)
222{
223}
224
226{
227}
228
234};
235
236/** verify download window table is valid */
238{
239 /* check table is present */
240 if (gdt == NULL) {
242 }
243
244 /* all enties are mandantory */
245 if (gdt->create == NULL) {
247 }
248 if (gdt->data == NULL) {
250 }
251 if (gdt->error == NULL) {
253 }
254 if (gdt->done == NULL) {
256 }
257
258 return NSERROR_OK;
259}
260
261static void gui_default_get_clipboard(char **buffer, size_t *length)
262{
263 *buffer = NULL;
264 *length = 0;
265}
266
267static void gui_default_set_clipboard(const char *buffer, size_t length,
268 nsclipboard_styles styles[], int n_styles)
269{
270}
271
275};
276
277/** verify clipboard table is valid */
279{
280 /* check table is present */
281 if (gct == NULL) {
283 }
284
285 /* optional operations */
286 if (gct->get == NULL) {
288 }
289 if (gct->set == NULL) {
291 }
292 return NSERROR_OK;
293}
294
295/**
296 * The default utf8 conversion implementation.
297 *
298 * The default implementation assumes the local encoding is utf8
299 * allowing the conversion to be a simple copy.
300 *
301 * @param [in] string The source string.
302 * @param [in] len The \a string length or 0 to compute it.
303 * @param [out] result A pointer to the converted string.
304 * @result NSERROR_OK or NSERROR_NOMEM if memory could not be allocated.
305 */
306static nserror gui_default_utf8(const char *string, size_t len, char **result)
307{
308 assert(string && result);
309
310 if (len == 0)
311 len = strlen(string);
312
313 *result = strndup(string, len);
314 if (!(*result))
315 return NSERROR_NOMEM;
316
317 return NSERROR_OK;
318}
319
322 .local_to_utf8 = gui_default_utf8,
323};
324
325/** verify clipboard table is valid */
327{
328 /* check table is present */
329 if (gut == NULL) {
331 }
332
333 /* mandantory operations */
334 if (gut->utf8_to_local == NULL) {
336 }
337 if (gut->local_to_utf8 == NULL) {
339 }
340 return NSERROR_OK;
341}
342
343static void gui_default_status(bool found, void *p)
344{
345}
346
347static void gui_default_hourglass(bool active, void *p)
348{
349}
350
351static void gui_default_add_recent(const char *string, void *p)
352{
353}
354
355static void gui_default_forward_state(bool active, void *p)
356{
357}
358
359static void gui_default_back_state(bool active, void *p)
360{
361}
362
365 .hourglass = gui_default_hourglass,
366 .add_recent = gui_default_add_recent,
367 .forward_state = gui_default_forward_state,
368 .back_state = gui_default_back_state,
369};
370
371/** verify search table is valid */
373{
374 /* check table is present */
375 if (gst == NULL) {
377 }
378
379 /* fill in the optional entries with defaults */
380 if (gst->status == NULL) {
382 }
383 if (gst->hourglass == NULL) {
385 }
386 if (gst->add_recent == NULL) {
388 }
389 if (gst->forward_state == NULL) {
391 }
392 if (gst->back_state == NULL) {
394 }
395
396 return NSERROR_OK;
397}
398
399static nserror
400gui_default_provider_update(const char *provider_name,
401 struct bitmap *provider_bitmap)
402{
403 return NSERROR_OK;
404}
405
408};
409
410/** verify search table is valid */
412{
413 /* check table is present */
414 if (gswt == NULL) {
416 }
417
418 /* mandantory operations */
419 if (gswt->provider_update == NULL) {
421 }
422
423 return NSERROR_OK;
424}
425
426/** verify low level cache persistant backing store table is valid */
428{
429 /* check table is present */
430 if (glt == NULL) {
432 }
433
434 /* mandantory operations */
435 if (glt->store == NULL) {
437 }
438 if (glt->fetch == NULL) {
440 }
441 if (glt->invalidate == NULL) {
443 }
444 if (glt->release == NULL) {
446 }
447 if (glt->initialise == NULL) {
449 }
450 if (glt->finalise == NULL) {
452 }
453
454 return NSERROR_OK;
455}
456
458{
459 return NULL;
460}
461
462static nserror gui_default_get_resource_data(const char *path, const uint8_t **data, size_t *data_len)
463{
464 return NSERROR_NOT_FOUND;
465}
466
468{
469 return NSERROR_OK;
470}
471
472static char *gui_default_mimetype(const char *path)
473{
474 return strdup(guit->fetch->filetype(path));
475}
476
477static int gui_default_socket_open(int domain, int type, int protocol)
478{
479 return (int) socket(domain, type, protocol);
480}
481
482static int gui_default_socket_close(int fd)
483{
484 return (int) ns_close_socket(fd);
485}
486
487/** verify fetch table is valid */
489{
490 /* check table is present */
491 if (gft == NULL) {
493 }
494
495 /* check the mandantory fields are set */
496 if (gft->filetype == NULL) {
498 }
499
500 /* fill in the optional entries with defaults */
501 if (gft->get_resource_url == NULL) {
503 }
504 if (gft->get_resource_data == NULL) {
506 }
507 if (gft->release_resource_data == NULL) {
509 }
510 if (gft->mimetype == NULL) {
512 }
513 if (gft->socket_open == NULL) {
515 }
516 if (gft->socket_close == NULL) {
518 }
519
520 return NSERROR_OK;
521}
522
523/** verify file table is valid */
525{
526 /* check table is present */
527 if (gft == NULL) {
529 }
530
531 /* check the mandantory fields are set */
532 if (gft->mkpath == NULL) {
534 }
535 if (gft->basename == NULL) {
537 }
538 if (gft->nsurl_to_path == NULL) {
540 }
541 if (gft->path_to_nsurl == NULL) {
543 }
544 if (gft->mkdir_all == NULL) {
546 }
547
548 return NSERROR_OK;
549}
550
551/**
552 * verify bitmap table is valid
553 *
554 * \param gbt The bitmap table to verify.
555 * \return NSERROR_OK if the table is valid else NSERROR_BAD_PARAMETER.
556 */
558{
559 /* check table is present */
560 if (gbt == NULL) {
562 }
563
564 /* check the mandantory fields are set */
565 if (gbt->create == NULL) {
567 }
568
569 if (gbt->destroy == NULL) {
571 }
572
573 if (gbt->set_opaque == NULL) {
575 }
576
577 if (gbt->get_opaque == NULL) {
579 }
580
581 if (gbt->get_buffer == NULL) {
583 }
584
585 if (gbt->get_rowstride == NULL) {
587 }
588
589 if (gbt->get_width == NULL) {
591 }
592
593 if (gbt->get_height == NULL) {
595 }
596
597 if (gbt->modified == NULL) {
599 }
600
601 if (gbt->render == NULL) {
603 }
604
605 return NSERROR_OK;
606}
607
608/**
609 * verify layout table is valid
610 *
611 * \param glt The layout table to verify.
612 * \return NSERROR_OK if the table is valid else NSERROR_BAD_PARAMETER.
613 */
615{
616 /* check table is present */
617 if (glt == NULL) {
619 }
620
621 /* check the mandantory fields are set */
622 if (glt->width == NULL) {
624 }
625
626 if (glt->position == NULL) {
628 }
629
630 if (glt->split == NULL) {
632 }
633
634 return NSERROR_OK;
635}
636
637static void gui_default_quit(void)
638{
639}
640
641
643{
645}
646
647
649 nsurl *url, const char *realm,
650 const char *username, const char *password,
651 nserror (*cb)(nsurl *url, const char * realm,
652 const char *username,
653 const char *password,
654 void *pw),
655 void *cbpw)
656{
658}
659
660static void
661gui_default_pdf_password(char **owner_pass, char **user_pass, char *path)
662{
663 *owner_pass = NULL;
664 save_pdf(path);
665}
666
667static nserror
668gui_default_present_cookies(const char *search_term)
669{
671}
672
673/** verify misc table is valid */
675{
676 /* check table is present */
677 if (gmt == NULL) {
679 }
680
681 /* check the mandantory fields are set */
682 if (gmt->schedule == NULL) {
684 }
685
686 /* fill in the optional entries with defaults */
687 if (gmt->quit == NULL) {
688 gmt->quit = gui_default_quit;
689 }
690 if (gmt->launch_url == NULL) {
692 }
693 if (gmt->login == NULL) {
695 }
696 if (gmt->pdf_password == NULL) {
698 }
699 if (gmt->present_cookies == NULL) {
701 }
702 return NSERROR_OK;
703}
704
705
706/* exported interface documented in netsurf/netsurf.h */
708{
709 nserror err;
710
711 /* ensure not already initialised */
712 if (guit != NULL) {
713 return NSERROR_INIT_FAILED;
714 }
715
716 /* check table is present */
717 if (gt == NULL) {
719 }
720
721 /* mandantory tables */
722
723 /* miscellaneous table */
724 err = verify_misc_register(gt->misc);
725 if (err != NSERROR_OK) {
726 return err;
727 }
728
729 /* window table */
731 if (err != NSERROR_OK) {
732 return err;
733 }
734
735 /* fetch table */
736 err = verify_fetch_register(gt->fetch);
737 if (err != NSERROR_OK) {
738 return err;
739 }
740
741 /* bitmap table */
743 if (err != NSERROR_OK) {
744 return err;
745 }
746
747 /* layout table */
749 if (err != NSERROR_OK) {
750 return err;
751 }
752
753 /* optional tables */
754
755 /* file table */
756 if (gt->file == NULL) {
758 }
759 err = verify_file_register(gt->file);
760 if (err != NSERROR_OK) {
761 return err;
762 }
763
764 /* download table */
765 if (gt->download == NULL) {
766 /* set default download table */
768 }
770 if (err != NSERROR_OK) {
771 return err;
772 }
773
774 /* clipboard table */
775 if (gt->clipboard == NULL) {
776 /* set default clipboard table */
778 }
780 if (err != NSERROR_OK) {
781 return err;
782 }
783
784 /* utf8 table */
785 if (gt->utf8 == NULL) {
786 /* set default utf8 table */
788 }
789 err = verify_utf8_register(gt->utf8);
790 if (err != NSERROR_OK) {
791 return err;
792 }
793
794 /* search table */
795 if (gt->search == NULL) {
796 /* set default search table */
798 }
800 if (err != NSERROR_OK) {
801 return err;
802 }
803
804 /* web search table */
805 if (gt->search_web == NULL) {
806 /* set default search table */
808 }
810 if (err != NSERROR_OK) {
811 return err;
812 }
813
814 /* llcache table */
815 if (gt->llcache == NULL) {
816 /* set default backing store table */
818 }
820 if (err != NSERROR_OK) {
821 return err;
822 }
823
824 guit = gt;
825
826 return NSERROR_OK;
827}
STATIC char result[100]
Definition: arexx.c:77
Low-level source data cache backing store interface.
struct gui_llcache_table * null_llcache_table
static osspriteop_area * buffer
The buffer characteristics.
Definition: buffer.c:55
char * strndup(const char *s, size_t n)
Duplicate up to n characters of a string.
Definition: utils.c:332
browser_window_console_source
Sources of messages which end up in the browser window console.
Definition: console.h:30
browser_window_console_flags
Flags for browser window console logging.
Definition: console.h:41
Core download context (interface)
nserror save_pdf(const char *path)
Definition: save_pdf.c:992
PDF Plotting.
wimp_w parent
Definition: dialog.c:88
Error codes.
nserror
Enumeration of error codes.
Definition: errors.h:29
@ NSERROR_NOT_FOUND
Requested item not found.
Definition: errors.h:34
@ NSERROR_INIT_FAILED
Initialisation failed.
Definition: errors.h:38
@ NSERROR_NOT_IMPLEMENTED
Functionality is not implemented.
Definition: errors.h:61
@ NSERROR_BAD_PARAMETER
Bad Parameter.
Definition: errors.h:48
@ NSERROR_NO_FETCH_HANDLER
No fetch handler for URL scheme.
Definition: errors.h:33
@ NSERROR_NOMEM
Memory exhaustion.
Definition: errors.h:32
@ NSERROR_OK
No error.
Definition: errors.h:30
const char * type
Definition: filetype.cpp:44
struct atari_hotlist hl
Definition: hotlist.c:47
static int gui_default_socket_close(int fd)
Definition: gui_factory.c:482
static void gui_default_status(bool found, void *p)
Definition: gui_factory.c:343
nserror netsurf_register(struct netsurf_table *gt)
Register operation table.
Definition: gui_factory.c:707
static nserror gui_default_window_save_link(struct gui_window *g, nsurl *url, const char *title)
Definition: gui_factory.c:68
static nserror gui_default_launch_url(struct nsurl *url)
Definition: gui_factory.c:642
static void gui_default_add_recent(const char *string, void *p)
Definition: gui_factory.c:351
static nserror verify_layout_register(struct gui_layout_table *glt)
verify layout table is valid
Definition: gui_factory.c:614
static nserror verify_window_register(struct gui_window_table *gwt)
verify window table is valid
Definition: gui_factory.c:130
static void gui_default_download_error(struct gui_download_window *dw, const char *error_msg)
Definition: gui_factory.c:220
static nserror verify_llcache_register(struct gui_llcache_table *glt)
verify low level cache persistant backing store table is valid
Definition: gui_factory.c:427
static nserror gui_default_get_resource_data(const char *path, const uint8_t **data, size_t *data_len)
Definition: gui_factory.c:462
static nserror gui_default_download_data(struct gui_download_window *dw, const char *data, unsigned int size)
Definition: gui_factory.c:214
static void gui_default_window_set_status(struct gui_window *g, const char *text)
Definition: gui_factory.c:85
static nsurl * gui_default_get_resource_url(const char *path)
Definition: gui_factory.c:457
static nserror verify_download_register(struct gui_download_table *gdt)
verify download window table is valid
Definition: gui_factory.c:237
static void gui_default_back_state(bool active, void *p)
Definition: gui_factory.c:359
static int gui_default_socket_open(int domain, int type, int protocol)
Definition: gui_factory.c:477
static nserror gui_default_utf8(const char *string, size_t len, char **result)
The default utf8 conversion implementation.
Definition: gui_factory.c:306
static nserror verify_misc_register(struct gui_misc_table *gmt)
verify misc table is valid
Definition: gui_factory.c:674
static void gui_default_window_file_gadget_open(struct gui_window *g, hlcache_handle *hl, struct form_control *gadget)
Definition: gui_factory.c:101
static nserror verify_utf8_register(struct gui_utf8_table *gut)
verify clipboard table is valid
Definition: gui_factory.c:326
static nserror gui_default_release_resource_data(const uint8_t *data)
Definition: gui_factory.c:467
static struct gui_search_table default_search_table
Definition: gui_factory.c:363
static struct gui_clipboard_table default_clipboard_table
Definition: gui_factory.c:272
static struct gui_search_web_table default_search_web_table
Definition: gui_factory.c:406
static void gui_default_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
Definition: gui_factory.c:80
static void gui_default_window_place_caret(struct gui_window *g, int x, int y, int height, const struct rect *clip)
Definition: gui_factory.c:90
static char * gui_default_mimetype(const char *path)
Definition: gui_factory.c:472
static void gui_default_window_set_title(struct gui_window *g, const char *title)
Definition: gui_factory.c:52
static struct gui_utf8_table default_utf8_table
Definition: gui_factory.c:320
static void gui_default_quit(void)
Definition: gui_factory.c:637
static void gui_default_window_drag_save_selection(struct gui_window *g, const char *selection)
Definition: gui_factory.c:113
static void gui_default_window_create_form_select_menu(struct gui_window *g, struct form_control *control)
Definition: gui_factory.c:96
static nserror verify_search_web_register(struct gui_search_web_table *gswt)
verify search table is valid
Definition: gui_factory.c:411
static nserror gui_default_provider_update(const char *provider_name, struct bitmap *provider_bitmap)
Definition: gui_factory.c:400
struct netsurf_table * guit
The global interface table.
Definition: gui_factory.c:49
static void gui_default_window_drag_save_object(struct gui_window *g, hlcache_handle *c, gui_save_type type)
Definition: gui_factory.c:107
static void gui_default_set_clipboard(const char *buffer, size_t length, nsclipboard_styles styles[], int n_styles)
Definition: gui_factory.c:267
static void gui_default_pdf_password(char **owner_pass, char **user_pass, char *path)
Definition: gui_factory.c:661
static nserror verify_file_register(struct gui_file_table *gft)
verify file table is valid
Definition: gui_factory.c:524
static nserror verify_search_register(struct gui_search_table *gst)
verify search table is valid
Definition: gui_factory.c:372
static struct gui_download_window * gui_default_download_create(download_context *ctx, struct gui_window *parent)
Definition: gui_factory.c:209
static void gui_default_window_set_icon(struct gui_window *g, hlcache_handle *icon)
Definition: gui_factory.c:75
static nserror gui_default_window_set_url(struct gui_window *g, struct nsurl *url)
Definition: gui_factory.c:56
static bool gui_default_window_drag_start(struct gui_window *g, gui_drag_type type, const struct rect *rect)
Definition: gui_factory.c:61
static nserror gui_default_401login_open(nsurl *url, const char *realm, const char *username, const char *password, nserror(*cb)(nsurl *url, const char *realm, const char *username, const char *password, void *pw), void *cbpw)
Definition: gui_factory.c:648
static nserror gui_default_present_cookies(const char *search_term)
Definition: gui_factory.c:668
static void gui_default_get_clipboard(char **buffer, size_t *length)
Definition: gui_factory.c:261
static void gui_default_forward_state(bool active, void *p)
Definition: gui_factory.c:355
static struct gui_download_table default_download_table
Definition: gui_factory.c:229
static nserror verify_bitmap_register(struct gui_bitmap_table *gbt)
verify bitmap table is valid
Definition: gui_factory.c:557
static nserror verify_clipboard_register(struct gui_clipboard_table *gct)
verify clipboard table is valid
Definition: gui_factory.c:278
static void gui_default_console_log(struct gui_window *gw, browser_window_console_source src, const char *msg, size_t msglen, browser_window_console_flags flags)
Definition: gui_factory.c:120
static void gui_default_hourglass(bool active, void *p)
Definition: gui_factory.c:347
static void gui_default_download_done(struct gui_download_window *dw)
Definition: gui_factory.c:225
static nserror verify_fetch_register(struct gui_fetch_table *gft)
verify fetch table is valid
Definition: gui_factory.c:488
High-level resource cache interface.
Generic bitmap handling interface.
Interface to platform-specific clipboard operations.
Interface to platform-specific download operations.
Interface to platform-specific fetcher operations.
Interface to platform-specific layout operation table.
Interface to platform-specific miscellaneous browser operation table.
gui_pointer_shape
Definition: mouse.h:89
Interface to platform-specific search operations.
Interface to platform-specific utf8 operations.
Interface to platform-specific graphical user interface window operations.
gui_save_type
Definition: window.h:39
gui_drag_type
Definition: window.h:56
internet structures and defines
#define ns_close_socket
Definition: inet.h:61
NetSurf core interface registration, construction and destruction.
struct nsurl nsurl
NetSurf URL object.
Definition: nsurl.h:31
int height
Definition: gui.c:160
core web search facilities interface.
Interface to utility string handling.
RISC OS wimp toolkit bitmap.
Definition: bitmap.c:68
A context for a download.
Definition: download.c:40
Form control.
Definition: form_internal.h:73
Bitmap operations.
Definition: bitmap.h:125
void(* set_opaque)(void *bitmap, bool opaque)
Set the opacity of a bitmap.
Definition: bitmap.h:151
int(* get_height)(void *bitmap)
Get the bitmap height.
Definition: bitmap.h:193
void(* destroy)(void *bitmap)
Destroy a bitmap.
Definition: bitmap.h:143
void *(* create)(int width, int height, enum gui_bitmap_flags flags)
Create a new bitmap.
Definition: bitmap.h:136
nserror(* render)(struct bitmap *bitmap, struct hlcache_handle *content)
Render content into a bitmap.
Definition: bitmap.h:208
int(* get_width)(void *bitmap)
Get the bitmap width.
Definition: bitmap.h:185
size_t(* get_rowstride)(void *bitmap)
Get the number of bytes per row of the image.
Definition: bitmap.h:177
bool(* get_opaque)(void *bitmap)
Get the opacity of a bitmap.
Definition: bitmap.h:159
void(* modified)(void *bitmap)
Marks a bitmap as modified.
Definition: bitmap.h:200
unsigned char *(* get_buffer)(void *bitmap)
Get the image buffer from a bitmap.
Definition: bitmap.h:169
function table for clipboard operations.
Definition: clipboard.h:42
void(* get)(char **buffer, size_t *length)
Core asks front end for clipboard contents.
Definition: clipboard.h:49
void(* set)(const char *buffer, size_t length, nsclipboard_styles styles[], int n_styles)
Core tells front end to put given text in clipboard.
Definition: clipboard.h:59
function table for download windows.
Definition: download.h:34
nserror(* data)(struct gui_download_window *dw, const char *data, unsigned int size)
Definition: download.h:37
void(* done)(struct gui_download_window *dw)
Definition: download.h:41
void(* error)(struct gui_download_window *dw, const char *error_msg)
Definition: download.h:39
struct gui_download_window *(* create)(struct download_context *ctx, struct gui_window *parent)
Definition: download.h:35
context for each download.
Definition: download.c:91
struct download_context * ctx
Associated context, or 0 if the fetch has completed or aborted.
Definition: download.c:101
function table for fetcher operations.
Definition: fetch.h:33
const char *(* filetype)(const char *unix_path)
Determine the MIME type of a local file.
Definition: fetch.h:45
nserror(* release_resource_data)(const uint8_t *data)
Releases source data.
Definition: fetch.h:89
char *(* mimetype)(const char *ro_path)
Find a MIME type for a local file.
Definition: fetch.h:100
nserror(* get_resource_data)(const char *path, const uint8_t **data, size_t *data_len)
Translate resource to source data.
Definition: fetch.h:77
struct nsurl *(* get_resource_url)(const char *path)
Translate resource to full url.
Definition: fetch.h:62
int(* socket_close)(int socket)
Close a socket.
Definition: fetch.h:118
int(* socket_open)(int domain, int type, int protocol)
Open a socket.
Definition: fetch.h:110
/brief function table for file and filename operations.
Definition: file.h:50
nserror(* basename)(const char *path, char **str, size_t *size)
Get the basename of a file.
Definition: file.h:84
nserror(* mkdir_all)(const char *fname)
Ensure that all directory elements needed to store a filename exist.
Definition: file.h:116
nserror(* nsurl_to_path)(struct nsurl *url, char **path)
Create a path from a nsurl.
Definition: file.h:95
nserror(* mkpath)(char **str, size_t *size, size_t nemb, va_list ap)
Generate a path from one or more component elemnts.
Definition: file.h:68
nserror(* path_to_nsurl)(const char *path, struct nsurl **url)
Create a nsurl from a path.
Definition: file.h:108
nserror(* position)(const struct plot_font_style *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x)
Find the position in a string where an x coordinate falls.
Definition: layout.h:63
nserror(* width)(const struct plot_font_style *fstyle, const char *string, size_t length, int *width)
Measure the width of a string.
Definition: layout.h:49
nserror(* split)(const struct plot_font_style *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x)
Find where to split a string to make it fit a width.
Definition: layout.h:88
low level cache backing store operation table
Definition: backing_store.h:44
nserror(* initialise)(const struct llcache_store_parameters *parameters)
Initialise the backing store.
Definition: backing_store.h:51
nserror(* store)(struct nsurl *url, enum backing_store_flags flags, uint8_t *data, const size_t datalen)
Place an object in the backing store.
Definition: backing_store.h:80
nserror(* finalise)(void)
Finalise the backing store.
Definition: backing_store.h:58
nserror(* invalidate)(struct nsurl *url)
Invalidate a source object from the backing store.
nserror(* release)(struct nsurl *url, enum backing_store_flags flags)
release a previously fetched or stored memory object.
nserror(* fetch)(struct nsurl *url, enum backing_store_flags flags, uint8_t **data, size_t *datalen)
Retrieve an object from the backing store.
Definition: backing_store.h:99
Graphical user interface browser misc function table.
Definition: misc.h:39
nserror(* schedule)(int t, void(*callback)(void *p), void *p)
Schedule a callback.
Definition: misc.h:58
nserror(* launch_url)(struct nsurl *url)
core has no fetcher for url
Definition: misc.h:71
nserror(* login)(struct nsurl *url, const char *realm, const char *username, const char *password, nserror(*cb)(struct nsurl *url, const char *realm, const char *username, const char *password, void *pw), void *cbpw)
Retrieve username/password for a given url+realm if there is one stored in a frontend-specific way (e...
Definition: misc.h:105
void(* quit)(void)
called to allow the gui to cleanup.
Definition: misc.h:66
nserror(* present_cookies)(const char *search_term)
Request that the cookie manager be displayed.
Definition: misc.h:126
void(* pdf_password)(char **owner_pass, char **user_pass, char *path)
Prompt the user for a password for a PDF.
Definition: misc.h:117
function table for page text search.
Definition: search.h:31
void(* back_state)(bool active, void *p)
activate search back button in gui
Definition: search.h:72
void(* add_recent)(const char *string, void *p)
add search string to recent searches list front has full liberty how to implement the bare notificati...
Definition: search.h:56
void(* forward_state)(bool active, void *p)
activate search forwards button in gui
Definition: search.h:64
void(* status)(bool found, void *p)
Change the displayed search status.
Definition: search.h:38
void(* hourglass)(bool active, void *p)
display hourglass while searching.
Definition: search.h:46
Graphical user interface browser web search function table.
Definition: searchweb.h:34
nserror(* provider_update)(const char *provider_name, struct bitmap *ico_bitmap)
called when the search provider details are updated.
Definition: searchweb.h:42
User interface utf8 characterset conversion routines.
Definition: utf8.h:31
nserror(* local_to_utf8)(const char *string, size_t len, char **result)
Convert a string encoded in the system local encoding to UTF-8.
Definition: utf8.h:50
nserror(* utf8_to_local)(const char *string, size_t len, char **result)
Convert a UTF-8 encoded string into the system local encoding.
Definition: utf8.h:40
Graphical user interface window function table.
Definition: window.h:137
nserror(* get_dimensions)(struct gui_window *gw, int *width, int *height)
Find the current dimensions of a browser window's content area.
Definition: window.h:241
void(* set_title)(struct gui_window *gw, const char *title)
Set the title of a window.
Definition: window.h:264
nserror(* set_scroll)(struct gui_window *gw, const struct rect *rect)
Set the scroll position of a browser window.
Definition: window.h:224
bool(* drag_start)(struct gui_window *g, gui_drag_type type, const struct rect *rect)
start a drag operation within a window
Definition: window.h:317
void(* set_pointer)(struct gui_window *g, enum gui_pointer_shape shape)
Change mouse pointer shape.
Definition: window.h:296
nserror(* save_link)(struct gui_window *g, struct nsurl *url, const char *title)
save link operation
Definition: window.h:327
void(* set_icon)(struct gui_window *gw, struct hlcache_handle *icon)
Set a favicon for a gui window.
Definition: window.h:280
nserror(* invalidate)(struct gui_window *gw, const struct rect *rect)
Invalidate an area of a window.
Definition: window.h:194
nserror(* event)(struct gui_window *gw, enum gui_window_event event)
Miscellaneous event occurred for a window.
Definition: window.h:254
void(* destroy)(struct gui_window *gw)
Destroy previously created gui window.
Definition: window.h:174
bool(* get_scroll)(struct gui_window *gw, int *sx, int *sy)
Get the scroll position of a browser window.
Definition: window.h:205
void(* create_form_select_menu)(struct gui_window *gw, struct form_control *control)
create a form select menu
Definition: window.h:335
void(* drag_save_object)(struct gui_window *gw, struct hlcache_handle *c, gui_save_type type)
object dragged to window
Definition: window.h:353
void(* console_log)(struct gui_window *gw, browser_window_console_source src, const char *msg, size_t msglen, browser_window_console_flags flags)
console logging happening.
Definition: window.h:374
struct gui_window *(* create)(struct browser_window *bw, struct gui_window *existing, gui_window_create_flags flags)
Create and open a gui window for a browsing context.
Definition: window.h:164
nserror(* set_url)(struct gui_window *gw, struct nsurl *url)
Set the navigation url.
Definition: window.h:272
void(* set_status)(struct gui_window *g, const char *text)
Set the status bar message of a browser window.
Definition: window.h:288
void(* drag_save_selection)(struct gui_window *gw, const char *selection)
drag selection save
Definition: window.h:361
void(* place_caret)(struct gui_window *g, int x, int y, int height, const struct rect *clip)
Place the caret in a browser window.
Definition: window.h:307
void(* file_gadget_open)(struct gui_window *gw, struct hlcache_handle *hl, struct form_control *gadget)
Called when file chooser gadget is activated.
Definition: window.h:344
first entry in window list
Definition: gui.c:296
High-level cache handle.
Definition: hlcache.c:66
NetSurf operation function table.
Definition: gui_table.h:48
struct gui_misc_table * misc
Browser table.
Definition: gui_table.h:57
struct gui_file_table * file
File table.
Definition: gui_table.h:95
struct gui_search_table * search
Page search table.
Definition: gui_table.h:113
struct gui_clipboard_table * clipboard
Clipboard table.
Definition: gui_table.h:78
struct gui_fetch_table * fetch
Fetcher table.
Definition: gui_table.h:85
struct gui_llcache_table * llcache
Low level cache table.
Definition: gui_table.h:134
struct gui_search_web_table * search_web
Web search table.
Definition: gui_table.h:123
struct gui_window_table * window
Window table.
Definition: gui_table.h:66
struct gui_bitmap_table * bitmap
Bitmap table.
Definition: gui_table.h:144
struct gui_download_table * download
Download table.
Definition: gui_table.h:73
struct gui_layout_table * layout
Layout table.
Definition: gui_table.h:154
struct gui_utf8_table * utf8
UTF8 table.
Definition: gui_table.h:106
Rectangle coordinates.
Definition: types.h:40
struct gui_file_table * default_file_table
Default (posix) file operation table.
Definition: file.c:285
Default operations table for files.
static nserror path(const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6])
Plots a path.
Definition: plot.c:821
static nserror text(const struct redraw_context *ctx, const struct plot_font_style *fstyle, int x, int y, const char *text, size_t length)
Text plotting.
Definition: plot.c:978
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.
Definition: plot.c:357