add documentation for the splitter mixin
original commit: 7f3f861899403f3a271b35c473878a35ed472e41
This commit is contained in:
parent
923787b89c
commit
dc520a9a47
|
@ -529,6 +529,7 @@
|
|||
(not (send this get-vertical?)))
|
||||
|
||||
;; insert an item into a list after some element
|
||||
;; FIXME: this is probably a library function somewhere
|
||||
(define/private (insert-after list before item)
|
||||
(let loop ([so-far '()]
|
||||
[list list])
|
||||
|
@ -539,6 +540,7 @@
|
|||
[else (loop (cons (car list) so-far) (cdr list))])))
|
||||
|
||||
;; replace an element with a list of stuff
|
||||
;; FIXME: this is probably a library function somewhere
|
||||
(define/private (replace list at stuff)
|
||||
(let loop ([so-far '()]
|
||||
[list list])
|
||||
|
@ -547,6 +549,8 @@
|
|||
[(eq? (car list) at) (append (reverse so-far) stuff (cdr list))]
|
||||
[else (loop (cons (car list) so-far) (cdr list))])))
|
||||
|
||||
;; remove a canvas and merge split panels if necessary
|
||||
;; TODO: restore percentages
|
||||
(define/public (collapse canvas)
|
||||
(begin-container-sequence)
|
||||
(for ([child (get-children)])
|
||||
|
@ -571,7 +575,7 @@
|
|||
(end-container-sequence))
|
||||
|
||||
;; split a canvas by creating a new editor and either
|
||||
;; 1) adding it to the canvas if the canvas is already using the same
|
||||
;; 1) adding it to the panel if the panel is already using the same
|
||||
;; orientation as the split that is about to occur
|
||||
;; 2) create a new panel with the orientation of the split about to
|
||||
;; occur and add a new editor
|
||||
|
|
|
@ -174,4 +174,38 @@
|
|||
@defclass[panel:vertical-dragable% (panel:vertical-dragable-mixin (panel:dragable-mixin vertical-panel%)) ()]{}
|
||||
@defclass[panel:horizontal-dragable% (panel:horizontal-dragable-mixin (panel:dragable-mixin horizontal-panel%)) ()]{}
|
||||
|
||||
@definterface[panel:splitter<%> ()]{
|
||||
A panel that implements @scheme[panel:splitter<%>]. Children can be split
|
||||
horizonally or vertically.
|
||||
}
|
||||
|
||||
@defmixin[panel:splitter-mixin (area-container<%> panel:dragable<%>) (splitter<%>)]{
|
||||
This mixin allows panels to split their children either horizontally or
|
||||
vertically. Children that are split can be further split independant of any
|
||||
other splitting.
|
||||
|
||||
@defmethod[(split-vertical (canvas (instance-of (is-a?/c canvas<%>)))
|
||||
(maker (-> (instance-of (is-a?/c splitter<%>))
|
||||
(instance-of (is-a?/c canvas<%>)))))
|
||||
(instance-of (is-a?/c canvas<%>))]{
|
||||
Splits the @scheme[canvas] vertically by creating a new instance using
|
||||
@scheme[maker]. This splitter object is passed as the argument to
|
||||
@scheme[maker] and should be used as the @scheme[parent] field of the newly
|
||||
created canvas.
|
||||
}
|
||||
|
||||
@defmethod[(split-horizontal (canvas (instance-of (is-a?/c canvas<%>)))
|
||||
(maker (-> (instance-of (is-a?/c splitter<%>))
|
||||
(instance-of (is-a?/c canvas<%>)))))
|
||||
(instance-of (is-a?/c canvas<%>))]{
|
||||
Similar to @scheme[split-vertical] but splits horizontally.
|
||||
}
|
||||
|
||||
@defmethod[(collapse (canvas (instance-of (is-a?/c canvas<%>)))) void]{
|
||||
Removes the given @scheme[canvas] from the splitter hierarchy and collapses
|
||||
any split panes as necessary.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@(include-previously-extracted "main-extracts.ss" #rx"^panel:")
|
||||
|
|
Loading…
Reference in New Issue
Block a user