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/core_window.h"
41#include "netsurf/search.h"
42#include "netsurf/clipboard.h"
43#include "netsurf/utf8.h"
44#include "netsurf/layout.h"
45#include "netsurf/netsurf.h"
46
47/**
48 * The global interface table.
49 */
50struct netsurf_table *guit = NULL;
51
52
53static void gui_default_window_set_title(struct gui_window *g, const char *title)
54{
55}
56
57static nserror gui_default_window_set_url(struct gui_window *g, struct nsurl *url)
58{
59 return NSERROR_OK;
60}
61
64 const struct rect *rect)
65{
66 return true;
67}
68
70 nsurl *url,
71 const char *title)
72{
73 return NSERROR_OK;
74}
75
77 hlcache_handle *icon)
78{
79}
80
83{
84}
85
87 const char *text)
88{
89}
90
92 int x, int y, int height,
93 const struct rect *clip)
94{
95}
96
98 struct form_control *control)
99{
100}
101
104 struct form_control *gadget)
105{
106}
107
111{
112}
113
115 const char *selection)
116{
117}
118
119
120static void
123 const char *msg,
124 size_t msglen,
126{
127}
128
129
130/** verify window table is valid */
132{
133 /* check table is present */
134 if (gwt == NULL) {
136 }
137
138 /* check the mandantory fields are set */
139 if (gwt->create == NULL) {
141 }
142 if (gwt->destroy == NULL) {
144 }
145 if (gwt->invalidate == NULL) {
147 }
148 if (gwt->get_scroll == NULL) {
150 }
151 if (gwt->set_scroll == NULL) {
153 }
154 if (gwt->get_dimensions == NULL) {
156 }
157 if (gwt->event == NULL) {
159 }
160
161
162 /* fill in the optional entries with defaults */
163 if (gwt->set_title == NULL) {
165 }
166 if (gwt->set_url == NULL) {
168 }
169 if (gwt->set_icon == NULL) {
171 }
172 if (gwt->set_status == NULL) {
174 }
175 if (gwt->set_pointer == NULL) {
177 }
178 if (gwt->place_caret == NULL) {
180 }
181 if (gwt->drag_start == NULL) {
183 }
184 if (gwt->save_link == NULL) {
186 }
187 if (gwt->create_form_select_menu == NULL) {
190 }
191 if (gwt->file_gadget_open == NULL) {
193 }
194 if (gwt->drag_save_object == NULL) {
196 }
197 if (gwt->drag_save_selection == NULL) {
199 }
200 if (gwt->console_log == NULL) {
202 }
203
204 return NSERROR_OK;
205}
206
207
208static nserror gui_default_corewindow_invalidate(struct core_window *cw, const struct rect *rect)
209{
210 return NSERROR_OK;
211}
212
213static nserror gui_default_corewindow_set_extent(struct core_window *cw, int width, int height)
214{
215 return NSERROR_OK;
216}
217
218static nserror gui_default_corewindow_set_scroll(struct core_window *cw, int x, int y)
219{
220 return NSERROR_OK;
221}
222
223static nserror gui_default_corewindow_get_scroll(const struct core_window *cw, int *x, int *y)
224{
225 return NSERROR_OK;
226}
227
228static nserror gui_default_corewindow_get_dimensions(const struct core_window *cw, int *width, int *height)
229{
230 return NSERROR_OK;
231}
232
234{
235 return NSERROR_OK;
236}
237
245};
246
247/** verify corewindow window table is valid */
249{
250 /* check table is present */
251 if (cwt == NULL) {
253 }
254
255 /* all enties are mandantory */
256 if (cwt->invalidate == NULL) {
258 }
259 if (cwt->set_extent == NULL) {
261 }
262 if (cwt->set_scroll == NULL) {
264 }
265 if (cwt->get_scroll == NULL) {
267 }
268 if (cwt->get_dimensions == NULL) {
270 }
271 if (cwt->drag_status == NULL) {
273 }
274
275 return NSERROR_OK;
276}
277
278static struct gui_download_window *
280{
281 return NULL;
282}
283
285 const char *data, unsigned int size)
286{
287 return NSERROR_OK;
288}
289
291 const char *error_msg)
292{
293}
294
296{
297}
298
304};
305
306/** verify download window table is valid */
308{
309 /* check table is present */
310 if (gdt == NULL) {
312 }
313
314 /* all enties are mandantory */
315 if (gdt->create == NULL) {
317 }
318 if (gdt->data == NULL) {
320 }
321 if (gdt->error == NULL) {
323 }
324 if (gdt->done == NULL) {
326 }
327
328 return NSERROR_OK;
329}
330
331static void gui_default_get_clipboard(char **buffer, size_t *length)
332{
333 *buffer = NULL;
334 *length = 0;
335}
336
337static void gui_default_set_clipboard(const char *buffer, size_t length,
338 nsclipboard_styles styles[], int n_styles)
339{
340}
341
345};
346
347/** verify clipboard table is valid */
349{
350 /* check table is present */
351 if (gct == NULL) {
353 }
354
355 /* optional operations */
356 if (gct->get == NULL) {
358 }
359 if (gct->set == NULL) {
361 }
362 return NSERROR_OK;
363}
364
365/**
366 * The default utf8 conversion implementation.
367 *
368 * The default implementation assumes the local encoding is utf8
369 * allowing the conversion to be a simple copy.
370 *
371 * @param [in] string The source string.
372 * @param [in] len The \a string length or 0 to compute it.
373 * @param [out] result A pointer to the converted string.
374 * @result NSERROR_OK or NSERROR_NOMEM if memory could not be allocated.
375 */
376static nserror gui_default_utf8(const char *string, size_t len, char **result)
377{
378 assert(string && result);
379
380 if (len == 0)
381 len = strlen(string);
382
383 *result = strndup(string, len);
384 if (!(*result))
385 return NSERROR_NOMEM;
386
387 return NSERROR_OK;
388}
389
392 .local_to_utf8 = gui_default_utf8,
393};
394
395/** verify clipboard table is valid */
397{
398 /* check table is present */
399 if (gut == NULL) {
401 }
402
403 /* mandantory operations */
404 if (gut->utf8_to_local == NULL) {
406 }
407 if (gut->local_to_utf8 == NULL) {
409 }
410 return NSERROR_OK;
411}
412
413static void gui_default_status(bool found, void *p)
414{
415}
416
417static void gui_default_hourglass(bool active, void *p)
418{
419}
420
421static void gui_default_add_recent(const char *string, void *p)
422{
423}
424
425static void gui_default_forward_state(bool active, void *p)
426{
427}
428
429static void gui_default_back_state(bool active, void *p)
430{
431}
432
435 .hourglass = gui_default_hourglass,
436 .add_recent = gui_default_add_recent,
437 .forward_state = gui_default_forward_state,
438 .back_state = gui_default_back_state,
439};
440
441/** verify search table is valid */
443{
444 /* check table is present */
445 if (gst == NULL) {
447 }
448
449 /* fill in the optional entries with defaults */
450 if (gst->status == NULL) {
452 }
453 if (gst->hourglass == NULL) {
455 }
456 if (gst->add_recent == NULL) {
458 }
459 if (gst->forward_state == NULL) {
461 }
462 if (gst->back_state == NULL) {
464 }
465
466 return NSERROR_OK;
467}
468
469static nserror
470gui_default_provider_update(const char *provider_name,
471 struct bitmap *provider_bitmap)
472{
473 return NSERROR_OK;
474}
475
478};
479
480/** verify search table is valid */
482{
483 /* check table is present */
484 if (gswt == NULL) {
486 }
487
488 /* mandantory operations */
489 if (gswt->provider_update == NULL) {
491 }
492
493 return NSERROR_OK;
494}
495
496/** verify low level cache persistant backing store table is valid */
498{
499 /* check table is present */
500 if (glt == NULL) {
502 }
503
504 /* mandantory operations */
505 if (glt->store == NULL) {
507 }
508 if (glt->fetch == NULL) {
510 }
511 if (glt->invalidate == NULL) {
513 }
514 if (glt->release == NULL) {
516 }
517 if (glt->initialise == NULL) {
519 }
520 if (glt->finalise == NULL) {
522 }
523
524 return NSERROR_OK;
525}
526
528{
529 return NULL;
530}
531
532static nserror gui_default_get_resource_data(const char *path, const uint8_t **data, size_t *data_len)
533{
534 return NSERROR_NOT_FOUND;
535}
536
538{
539 return NSERROR_OK;
540}
541
542static char *gui_default_mimetype(const char *path)
543{
544 return strdup(guit->fetch->filetype(path));
545}
546
547static int gui_default_socket_open(int domain, int type, int protocol)
548{
549 return (int) socket(domain, type, protocol);
550}
551
552static int gui_default_socket_close(int fd)
553{
554 return (int) ns_close_socket(fd);
555}
556
557/** verify fetch table is valid */
559{
560 /* check table is present */
561 if (gft == NULL) {
563 }
564
565 /* check the mandantory fields are set */
566 if (gft->filetype == NULL) {
568 }
569
570 /* fill in the optional entries with defaults */
571 if (gft->get_resource_url == NULL) {
573 }
574 if (gft->get_resource_data == NULL) {
576 }
577 if (gft->release_resource_data == NULL) {
579 }
580 if (gft->mimetype == NULL) {
582 }
583 if (gft->socket_open == NULL) {
585 }
586 if (gft->socket_close == NULL) {
588 }
589
590 return NSERROR_OK;
591}
592
593/** verify file table is valid */
595{
596 /* check table is present */
597 if (gft == NULL) {
599 }
600
601 /* check the mandantory fields are set */
602 if (gft->mkpath == NULL) {
604 }
605 if (gft->basename == NULL) {
607 }
608 if (gft->nsurl_to_path == NULL) {
610 }
611 if (gft->path_to_nsurl == NULL) {
613 }
614 if (gft->mkdir_all == NULL) {
616 }
617
618 return NSERROR_OK;
619}
620
621/**
622 * verify bitmap table is valid
623 *
624 * \param gbt The bitmap table to verify.
625 * \return NSERROR_OK if the table is valid else NSERROR_BAD_PARAMETER.
626 */
628{
629 /* check table is present */
630 if (gbt == NULL) {
632 }
633
634 /* check the mandantory fields are set */
635 if (gbt->create == NULL) {
637 }
638
639 if (gbt->destroy == NULL) {
641 }
642
643 if (gbt->set_opaque == NULL) {
645 }
646
647 if (gbt->get_opaque == NULL) {
649 }
650
651 if (gbt->get_buffer == NULL) {
653 }
654
655 if (gbt->get_rowstride == NULL) {
657 }
658
659 if (gbt->get_width == NULL) {
661 }
662
663 if (gbt->get_height == NULL) {
665 }
666
667 if (gbt->modified == NULL) {
669 }
670
671 if (gbt->render == NULL) {
673 }
674
675 return NSERROR_OK;
676}
677
678/**
679 * verify layout table is valid
680 *
681 * \param glt The layout table to verify.
682 * \return NSERROR_OK if the table is valid else NSERROR_BAD_PARAMETER.
683 */
685{
686 /* check table is present */
687 if (glt == NULL) {
689 }
690
691 /* check the mandantory fields are set */
692 if (glt->width == NULL) {
694 }
695
696 if (glt->position == NULL) {
698 }
699
700 if (glt->split == NULL) {
702 }
703
704 return NSERROR_OK;
705}
706
707static void gui_default_quit(void)
708{
709}
710
711
713{
715}
716
717
719 nsurl *url, const char *realm,
720 const char *username, const char *password,
721 nserror (*cb)(nsurl *url, const char * realm,
722 const char *username,
723 const char *password,
724 void *pw),
725 void *cbpw)
726{
728}
729
730static void
731gui_default_pdf_password(char **owner_pass, char **user_pass, char *path)
732{
733 *owner_pass = NULL;
734 save_pdf(path);
735}
736
737static nserror
738gui_default_present_cookies(const char *search_term)
739{
741}
742
743/** verify misc table is valid */
745{
746 /* check table is present */
747 if (gmt == NULL) {
749 }
750
751 /* check the mandantory fields are set */
752 if (gmt->schedule == NULL) {
754 }
755
756 /* fill in the optional entries with defaults */
757 if (gmt->quit == NULL) {
758 gmt->quit = gui_default_quit;
759 }
760 if (gmt->launch_url == NULL) {
762 }
763 if (gmt->login == NULL) {
765 }
766 if (gmt->pdf_password == NULL) {
768 }
769 if (gmt->present_cookies == NULL) {
771 }
772 return NSERROR_OK;
773}
774
775
776/* exported interface documented in netsurf/netsurf.h */
778{
779 nserror err;
780
781 /* ensure not already initialised */
782 if (guit != NULL) {
783 return NSERROR_INIT_FAILED;
784 }
785
786 /* check table is present */
787 if (gt == NULL) {
789 }
790
791 /* mandantory tables */
792
793 /* miscellaneous table */
794 err = verify_misc_register(gt->misc);
795 if (err != NSERROR_OK) {
796 return err;
797 }
798
799 /* window table */
801 if (err != NSERROR_OK) {
802 return err;
803 }
804
805 /* fetch table */
806 err = verify_fetch_register(gt->fetch);
807 if (err != NSERROR_OK) {
808 return err;
809 }
810
811 /* bitmap table */
813 if (err != NSERROR_OK) {
814 return err;
815 }
816
817 /* layout table */
819 if (err != NSERROR_OK) {
820 return err;
821 }
822
823 /* optional tables */
824
825 /* core window table */
826 if (gt->corewindow == NULL) {
827 /* set default core window table */
829 }
831 if (err != NSERROR_OK) {
832 return err;
833 }
834
835
836 /* file table */
837 if (gt->file == NULL) {
839 }
840 err = verify_file_register(gt->file);
841 if (err != NSERROR_OK) {
842 return err;
843 }
844
845 /* download table */
846 if (gt->download == NULL) {
847 /* set default download table */
849 }
851 if (err != NSERROR_OK) {
852 return err;
853 }
854
855 /* clipboard table */
856 if (gt->clipboard == NULL) {
857 /* set default clipboard table */
859 }
861 if (err != NSERROR_OK) {
862 return err;
863 }
864
865 /* utf8 table */
866 if (gt->utf8 == NULL) {
867 /* set default utf8 table */
869 }
870 err = verify_utf8_register(gt->utf8);
871 if (err != NSERROR_OK) {
872 return err;
873 }
874
875 /* search table */
876 if (gt->search == NULL) {
877 /* set default search table */
879 }
881 if (err != NSERROR_OK) {
882 return err;
883 }
884
885 /* web search table */
886 if (gt->search_web == NULL) {
887 /* set default search table */
889 }
891 if (err != NSERROR_OK) {
892 return err;
893 }
894
895 /* llcache table */
896 if (gt->llcache == NULL) {
897 /* set default backing store table */
899 }
901 if (err != NSERROR_OK) {
902 return err;
903 }
904
905 guit = gt;
906
907 return NSERROR_OK;
908}
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
Interface to core window handling.
core_window_drag_status
drag status passed to drag_status callback
Definition: core_window.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:552
static struct core_window_table default_corewindow_table
Definition: gui_factory.c:238
static void gui_default_status(bool found, void *p)
Definition: gui_factory.c:413
nserror netsurf_register(struct netsurf_table *gt)
Register operation table.
Definition: gui_factory.c:777
static nserror gui_default_window_save_link(struct gui_window *g, nsurl *url, const char *title)
Definition: gui_factory.c:69
static nserror gui_default_launch_url(struct nsurl *url)
Definition: gui_factory.c:712
static void gui_default_add_recent(const char *string, void *p)
Definition: gui_factory.c:421
static nserror verify_layout_register(struct gui_layout_table *glt)
verify layout table is valid
Definition: gui_factory.c:684
static nserror verify_window_register(struct gui_window_table *gwt)
verify window table is valid
Definition: gui_factory.c:131
static void gui_default_download_error(struct gui_download_window *dw, const char *error_msg)
Definition: gui_factory.c:290
static nserror verify_llcache_register(struct gui_llcache_table *glt)
verify low level cache persistant backing store table is valid
Definition: gui_factory.c:497
static nserror gui_default_get_resource_data(const char *path, const uint8_t **data, size_t *data_len)
Definition: gui_factory.c:532
static nserror gui_default_download_data(struct gui_download_window *dw, const char *data, unsigned int size)
Definition: gui_factory.c:284
static void gui_default_window_set_status(struct gui_window *g, const char *text)
Definition: gui_factory.c:86
static nsurl * gui_default_get_resource_url(const char *path)
Definition: gui_factory.c:527
static nserror verify_download_register(struct gui_download_table *gdt)
verify download window table is valid
Definition: gui_factory.c:307
static void gui_default_back_state(bool active, void *p)
Definition: gui_factory.c:429
static int gui_default_socket_open(int domain, int type, int protocol)
Definition: gui_factory.c:547
static nserror gui_default_utf8(const char *string, size_t len, char **result)
The default utf8 conversion implementation.
Definition: gui_factory.c:376
static nserror verify_corewindow_register(struct core_window_table *cwt)
verify corewindow window table is valid
Definition: gui_factory.c:248
static nserror verify_misc_register(struct gui_misc_table *gmt)
verify misc table is valid
Definition: gui_factory.c:744
static void gui_default_window_file_gadget_open(struct gui_window *g, hlcache_handle *hl, struct form_control *gadget)
Definition: gui_factory.c:102
static nserror verify_utf8_register(struct gui_utf8_table *gut)
verify clipboard table is valid
Definition: gui_factory.c:396
static nserror gui_default_release_resource_data(const uint8_t *data)
Definition: gui_factory.c:537
static nserror gui_default_corewindow_get_dimensions(const struct core_window *cw, int *width, int *height)
Definition: gui_factory.c:228
static struct gui_search_table default_search_table
Definition: gui_factory.c:433
static struct gui_clipboard_table default_clipboard_table
Definition: gui_factory.c:342
static struct gui_search_web_table default_search_web_table
Definition: gui_factory.c:476
static void gui_default_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
Definition: gui_factory.c:81
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:91
static char * gui_default_mimetype(const char *path)
Definition: gui_factory.c:542
static void gui_default_window_set_title(struct gui_window *g, const char *title)
Definition: gui_factory.c:53
static struct gui_utf8_table default_utf8_table
Definition: gui_factory.c:390
static void gui_default_quit(void)
Definition: gui_factory.c:707
static void gui_default_window_drag_save_selection(struct gui_window *g, const char *selection)
Definition: gui_factory.c:114
static void gui_default_window_create_form_select_menu(struct gui_window *g, struct form_control *control)
Definition: gui_factory.c:97
static nserror verify_search_web_register(struct gui_search_web_table *gswt)
verify search table is valid
Definition: gui_factory.c:481
static nserror gui_default_provider_update(const char *provider_name, struct bitmap *provider_bitmap)
Definition: gui_factory.c:470
struct netsurf_table * guit
The global interface table.
Definition: gui_factory.c:50
static void gui_default_window_drag_save_object(struct gui_window *g, hlcache_handle *c, gui_save_type type)
Definition: gui_factory.c:108
static void gui_default_set_clipboard(const char *buffer, size_t length, nsclipboard_styles styles[], int n_styles)
Definition: gui_factory.c:337
static void gui_default_pdf_password(char **owner_pass, char **user_pass, char *path)
Definition: gui_factory.c:731
static nserror gui_default_corewindow_get_scroll(const struct core_window *cw, int *x, int *y)
Definition: gui_factory.c:223
static nserror gui_default_corewindow_dragstatus(struct core_window *cw, core_window_drag_status ds)
Definition: gui_factory.c:233
static nserror verify_file_register(struct gui_file_table *gft)
verify file table is valid
Definition: gui_factory.c:594
static nserror verify_search_register(struct gui_search_table *gst)
verify search table is valid
Definition: gui_factory.c:442
static struct gui_download_window * gui_default_download_create(download_context *ctx, struct gui_window *parent)
Definition: gui_factory.c:279
static void gui_default_window_set_icon(struct gui_window *g, hlcache_handle *icon)
Definition: gui_factory.c:76
static nserror gui_default_window_set_url(struct gui_window *g, struct nsurl *url)
Definition: gui_factory.c:57
static bool gui_default_window_drag_start(struct gui_window *g, gui_drag_type type, const struct rect *rect)
Definition: gui_factory.c:62
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:718
static nserror gui_default_present_cookies(const char *search_term)
Definition: gui_factory.c:738
static nserror gui_default_corewindow_set_extent(struct core_window *cw, int width, int height)
Definition: gui_factory.c:213
static nserror gui_default_corewindow_set_scroll(struct core_window *cw, int x, int y)
Definition: gui_factory.c:218
static void gui_default_get_clipboard(char **buffer, size_t *length)
Definition: gui_factory.c:331
static void gui_default_forward_state(bool active, void *p)
Definition: gui_factory.c:425
static struct gui_download_table default_download_table
Definition: gui_factory.c:299
static nserror verify_bitmap_register(struct gui_bitmap_table *gbt)
verify bitmap table is valid
Definition: gui_factory.c:627
static nserror gui_default_corewindow_invalidate(struct core_window *cw, const struct rect *rect)
Definition: gui_factory.c:208
static nserror verify_clipboard_register(struct gui_clipboard_table *gct)
verify clipboard table is valid
Definition: gui_factory.c:348
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:121
static void gui_default_hourglass(bool active, void *p)
Definition: gui_factory.c:417
static void gui_default_download_done(struct gui_download_window *dw)
Definition: gui_factory.c:295
static nserror verify_fetch_register(struct gui_fetch_table *gft)
verify fetch table is valid
Definition: gui_factory.c:558
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:112
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 width
Definition: gui.c:160
int height
Definition: gui.c:161
core web search facilities interface.
Interface to utility string handling.
RISC OS wimp toolkit bitmap.
Definition: bitmap.c:68
Core user interface window function table.
Definition: core_window.h:53
nserror(* set_extent)(struct core_window *cw, int width, int height)
Update the logical extent of the window.
Definition: core_window.h:81
nserror(* get_dimensions)(const struct core_window *cw, int *width, int *height)
Get window viewport dimensions.
Definition: core_window.h:115
nserror(* drag_status)(struct core_window *cw, core_window_drag_status ds)
Inform corewindow owner of drag status.
Definition: core_window.h:125
nserror(* invalidate)(struct core_window *cw, const struct rect *rect)
Invalidate an area of a window.
Definition: core_window.h:71
nserror(* get_scroll)(const struct core_window *cw, int *x, int *y)
Get the current scroll offsets.
Definition: core_window.h:105
nserror(* set_scroll)(struct core_window *cw, int x, int y)
Scroll the window to given scroll offsets.
Definition: core_window.h:95
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:298
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:104
struct gui_search_table * search
Page search table.
Definition: gui_table.h:122
struct gui_clipboard_table * clipboard
Clipboard table.
Definition: gui_table.h:87
struct gui_fetch_table * fetch
Fetcher table.
Definition: gui_table.h:94
struct gui_llcache_table * llcache
Low level cache table.
Definition: gui_table.h:143
struct core_window_table * corewindow
Core window table.
Definition: gui_table.h:75
struct gui_search_web_table * search_web
Web search table.
Definition: gui_table.h:132
struct gui_window_table * window
Window table.
Definition: gui_table.h:66
struct gui_bitmap_table * bitmap
Bitmap table.
Definition: gui_table.h:153
struct gui_download_table * download
Download table.
Definition: gui_table.h:82
struct gui_layout_table * layout
Layout table.
Definition: gui_table.h:163
struct gui_utf8_table * utf8
UTF8 table.
Definition: gui_table.h:115
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