41 lines
926 B
Racket
41 lines
926 B
Racket
#lang racket/base
|
|
|
|
(require racket/class
|
|
simple-ini/class
|
|
)
|
|
|
|
(provide wv-settings%)
|
|
|
|
(define wv-settings%
|
|
(class object%
|
|
(init-field ini
|
|
wv-context
|
|
)
|
|
|
|
(define/public (get key . default-value)
|
|
(if (null? default-value)
|
|
(send ini get wv-context key)
|
|
(send ini get wv-context key (car default-value))))
|
|
|
|
(define/public (set! key value)
|
|
(send ini set! wv-context key value))
|
|
|
|
(define/public (get/global key . default-value)
|
|
(if (null? default-value)
|
|
(send ini get 'global key)
|
|
(send ini get 'global key (car default-value))))
|
|
|
|
(define/public (set/global! key value)
|
|
(send ini set! 'global key value))
|
|
|
|
(define/public (clone context)
|
|
(new wv-settings% [ini ini] [wv-context context]))
|
|
|
|
(define/public (context)
|
|
wv-context)
|
|
|
|
(super-new)
|
|
)
|
|
)
|
|
|
|
|