#lang scribble/manual @(require scribble/racket scribble/example scribble/core (for-label racket/base racket/string racket/class racket/file) ) @defmodule[racket-webview] @title{Object-Oriented Interface: @racket[wv-settings%]} @author[@author+email["Hans Dijkema" "hans@dijkewijk.nl"]] @defclass[wv-settings% object% ()]{ An OO wrapper around a settings backend implementing, e.g. @racket[simple-ini/class]. A @racket[wv-settings%] object represents a view on one settings section. The supplied @racket[wv-context] value is used as the section identifier for context-local settings. The class delegates all actual storage operations to the supplied @racket[ini] object. @defconstructor[([ini object?] [wv-context symbol?])]{ Creates a new settings object. The @racket[ini] argument is the backing settings object. The @racket[wv-context] argument is used as the section identifier for context-local settings. The class assumes that @racket[ini] supports methods compatible with: @itemlist[#:style 'compact @item{@racket[(send ini get section key)]} @item{@racket[(send ini get section key default)]} @item{@racket[(send ini set! section key value)]} ] } @defmethod*[([(get [key symbol?]) any/c] [(get [key symbol?] [default-value any/c]) any/c])]{ Returns the value associated with @racket[key] in the current section. Returns @tt{default-value} (when supplied) if the key is not found. } @defmethod*[([(set! [key symbol?] [value any/c]) this])]{ Stores @racket[value] under @racket[key] in the current section. } @defmethod*[([(get/global [key symbol?]) any/c] [(get/global [key symbol?] [default-value any/c]) any/c])]{ Returns the value associated with @racket[key] in the global section. This method delegates to @tt{(send ini get 'global key default-value)}. } @defmethod*[([(set/global! [key symbol?] [value any/c]) this])]{ Stores @racket[value] under @racket[key] in the global section. Delegates to @tt{(send ini set! 'global key value)}. } @defmethod*[([(clone [context any/c]) (is-a?/c wv-settings%)])]{ Creates a new @racket[wv-settings%] object using the same @racket[ini] backend but with another section identifier. It is intended to support cheap creation of per-section settings views. } @defmethod*[([(context) symbol?])]{ Returns the section identifier associated with this settings object. } }