original commit: 66bb46c743ff22b1bebf40d4567d41411124b0fe
This commit is contained in:
Matthew Flatt 1999-02-28 22:08:55 +00:00
parent 77630149a0
commit f7745379a2
2 changed files with 63 additions and 7 deletions

View File

@ -1482,7 +1482,7 @@
(send c set-editor e)
(send c stretchable-height #f))
(send f show #t)
(try '(no-hscroll no-vscroll))
@ -1490,6 +1490,57 @@
(try '(no-hscroll))
(try '()))
(define (minsize-frame)
(define f (make-object frame% "x"))
(define bp (make-object horizontal-panel% f))
(define tb (make-object button% "Toggle Stretch" bp
(lambda (b e)
(for-each
(lambda (p)
(send p stretchable-width (not (send p stretchable-width)))
(send p stretchable-height (not (send p stretchable-height))))
containers))))
(define ps (make-object button% "Print Sizes" bp
(lambda (b e)
(newline)
(for-each
(lambda (p)
(let ([c (car (send p get-children))])
(let-values ([(w h) (send c get-size)]
[(cw ch) (send c get-client-size)])
(printf "~a: (~a x ~a) client[~a x ~a] diff<~a x ~a> min{~a x ~a}~n"
c w h cw ch
(- w cw) (- h ch)
(send c min-width) (send c min-height)))))
(reverse containers))
(newline))))
(define containers null)
(define (make-container p)
(let ([p (make-object vertical-panel% p '(border))])
(send p stretchable-width #f)
(send p stretchable-height #f)
(set! containers (cons p containers))
p))
(define hp0 (make-object horizontal-panel% f))
(define p (make-object panel% (make-container hp0)))
(define pb (make-object panel% (make-container hp0) '(border)))
(define hp1 (make-object horizontal-panel% f))
(define c (make-object canvas% (make-container hp1)))
(define cb (make-object canvas% (make-container hp1) '(border)))
(define ch (make-object canvas% (make-container hp1) '(hscroll)))
(define cv (make-object canvas% (make-container hp1) '(vscroll)))
(define chv (make-object canvas% (make-container hp1) '(hscroll vscroll)))
(define cbhv (make-object canvas% (make-container hp1) '(border hscroll vscroll)))
(send f show #t))
;----------------------------------------------------------------------
(define selector (make-object frame% "Test Selector"))
@ -1546,6 +1597,8 @@
(make-object button% "Make Panel Frame" pp (lambda (b e) (panel-frame)))
(make-object horizontal-pane% pp)
(make-object button% "Editor Canvas One-liners" pp (lambda (b e) (editor-canvas-oneline-frame)))
(make-object horizontal-pane% pp)
(make-object button% "Minsize Windows" pp (lambda (b e) (minsize-frame)))
(define bp (make-object horizontal-pane% ap))
(send bp stretchable-width #f)
(make-object button% "Make Button Frame" bp (lambda (b e) (button-frame frame% null)))

View File

@ -1908,8 +1908,8 @@
(set! move-children? #f)
(redraw client-width client-height))))]
[init-min (lambda (x) 0)])
[init-min (lambda (x) (if (memq 'border style) 8 0))])
(public
; place-children: determines where each child of panel should be
; placed.
@ -3237,7 +3237,7 @@
;-------------------- Canvas class constructions --------------------
(define canvas-default-size 20) ; an arbitrary default size for canvases to avoid initial size problems
(define canvas-default-size 20) ; a default size for canvases tht fits borders without losing client sizes
(define canvas<%>
(interface (subwindow<%>)
@ -3341,9 +3341,12 @@
[wx #f])
(sequence
(super-init (lambda ()
(let ([ds (if (or (memq 'vscroll style) (memq 'hscroll style))
canvas-default-size
0)])
(let ([ds (+ (if (memq 'border style)
4
0)
(if (or (memq 'vscroll style) (memq 'hscroll style))
canvas-default-size
1))])
(set! wx (make-object wx-canvas% this this
(mred->wx-container parent)
-1 -1 ds ds