OO framework
This commit is contained in:
53
private/wv-dialog.rkt
Normal file
53
private/wv-dialog.rkt
Normal file
@@ -0,0 +1,53 @@
|
||||
#lang racket/base
|
||||
|
||||
(require racket/class
|
||||
"wv-window.rkt"
|
||||
)
|
||||
|
||||
(provide wv-dialog%
|
||||
)
|
||||
|
||||
|
||||
(define (default-w) 400)
|
||||
(define (default-h) 400)
|
||||
|
||||
(define wv-dialog%
|
||||
(class wv-window%
|
||||
(inherit-field parent settings wv-context html-path x y width height)
|
||||
|
||||
(super-new)
|
||||
|
||||
(define/override (init-size)
|
||||
(displayln "init-size")
|
||||
(let ((px (get-field x parent))
|
||||
(py (get-field y parent))
|
||||
(pw (get-field width parent))
|
||||
(ph (get-field height parent))
|
||||
)
|
||||
(displayln px)
|
||||
(displayln py)
|
||||
(displayln pw)
|
||||
(displayln ph)
|
||||
(let ((dw (send settings get 'width (if (eq? width #f) (default-w) width)))
|
||||
(dh (send settings get 'height (if (eq? height #f) (default-h) height)))
|
||||
)
|
||||
(displayln dw)
|
||||
(displayln dh)
|
||||
(let ((xx (/ (- pw dw) 2))
|
||||
(yy (/ (- ph dh) 2)))
|
||||
(let ((x (inexact->exact (round (exact->inexact (+ px xx)))))
|
||||
(y (inexact->exact (round (exact->inexact (+ py yy)))))
|
||||
)
|
||||
(displayln "move")
|
||||
(send this move x y)
|
||||
(displayln "resize")
|
||||
(send this resize dw dh)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user