#lang scribble/manual @(require scribble/racket scribble/example scribble/core (for-label racket/base racket/class racket/path "../private/wv-settings.rkt" "../private/racket-webview.rkt") ) @defmodule[racket-webview] @title{Object-Oriented Interface: @racket[wv-context%]} @author[@author+email["Hans Dijkema" "hans@dijkewijk.nl"]] @defclass[wv-context% object% ()]{ An OO wrapper around a webview context together with its associated settings. A @racket[wv-context%] object creates and owns a webview context by calling @racket[webview-new-context]. It also creates a corresponding @racket[wv-settings%] instance for access to global and per-section settings. This class manages construction of a webview context using a file getter and boilerplate JavaScript, exposure of the created low-level context object via @racket[context], access to the base URL of the created context via @racket[base-url] and access to settings views via @racket[settings]. @defconstructor[([base-path path-string?] [file-getter procedure? (webview-standard-file-getter base-path)] [context-js procedure? (λ () "")] [boilerplate-js procedure? (webview-default-boilerplate-js context-js)] [ini object?])]{ Creates a new @racket[wv-context%] object. The @racket[base-path] argument is used to construct the default @racket[file-getter]. The @racket[file-getter] argument is passed to @racket[webview-new-context] and is responsible for resolving files served by the context. The @racket[context-js] argument must be a procedure producing the JavaScript snippet that should be injected into the context. The @racket[boilerplate-js] argument must be a procedure producing the final boilerplate JavaScript used when constructing the context. By default it is built from @racket[context-js] using @racket[webview-default-boilerplate-js]. The @racket[ini] argument is mandatory and supplies the settings backend used for construction of the internal @racket[wv-settings%] object. If omitted, the constructor raises an error. During initialization the class: @itemlist[#:style 'compact @item{creates a new low-level context with @racket[webview-new-context];} @item{creates a @racket[wv-settings%] object using @racket[ini] and the global context identifier @racket['global].} ] } @defmethod*[([(context) wv-context?])]{ Returns the underlying webview context (struct) created during initialization. } @defmethod*[([(settings [section symbol?]) (is-a?/c wv-settings%)])] { Returns a @tt{wv-settings%} object for @racket[section]. This method delegates to the internally stored @racket[wv-settings%] object by calling @racket[(send settings-obj clone section)]. The resulting object shares the same @racket[ini] backend as the global settings object, but addresses the supplied section. } @defmethod*[([(base-url) any/c])] { Returns the base URL of the underlying webview context. This method delegates to @racket[wv-context-base-url]. } }