document set-links-label!
svn: r14381
This commit is contained in:
parent
345e84eb31
commit
33c30e7dd7
|
@ -146,9 +146,10 @@
|
||||||
label)
|
label)
|
||||||
(send parent add-child child)
|
(send parent add-child child)
|
||||||
(send child add-parent parent dark-pen light-pen dark-brush light-brush dark-text light-text dx dy label))
|
(send child add-parent parent dark-pen light-pen dark-brush light-brush dark-text light-text dx dy label))
|
||||||
|
|
||||||
(define (set-links-label! parent child label)
|
(define (set-links-label! parent child label)
|
||||||
(send child set-parent-link-label parent label))
|
(send child set-parent-link-label parent label))
|
||||||
|
|
||||||
(define graph-snip-mixin
|
(define graph-snip-mixin
|
||||||
(mixin ((class->interface snip%)) (graph-snip<%>)
|
(mixin ((class->interface snip%)) (graph-snip<%>)
|
||||||
(field (children null))
|
(field (children null))
|
||||||
|
@ -163,15 +164,6 @@
|
||||||
(field (parent-links null))
|
(field (parent-links null))
|
||||||
(define/public (get-parent-links) parent-links)
|
(define/public (get-parent-links) parent-links)
|
||||||
(define/public (get-parents) (map link-snip parent-links))
|
(define/public (get-parents) (map link-snip parent-links))
|
||||||
(define/public (set-parent-link-label parent label)
|
|
||||||
(let ([parent-link
|
|
||||||
(cond [(memf (lambda (parent-link)
|
|
||||||
(eq? (link-snip parent-link) parent))
|
|
||||||
parent-links)
|
|
||||||
=> car]
|
|
||||||
[else #f])])
|
|
||||||
(when parent-link
|
|
||||||
(set-link-label! parent-link label))))
|
|
||||||
(define/public add-parent
|
(define/public add-parent
|
||||||
(case-lambda
|
(case-lambda
|
||||||
[(parent) (add-parent parent #f #f #f #f)]
|
[(parent) (add-parent parent #f #f #f #f)]
|
||||||
|
@ -202,6 +194,15 @@
|
||||||
parent
|
parent
|
||||||
parent-links
|
parent-links
|
||||||
(lambda (parent parent-link) (eq? (link-snip parent-link) parent))))))
|
(lambda (parent parent-link) (eq? (link-snip parent-link) parent))))))
|
||||||
|
(define/public (set-parent-link-label parent label)
|
||||||
|
(let ([parent-link
|
||||||
|
(cond [(memf (lambda (parent-link)
|
||||||
|
(eq? (link-snip parent-link) parent))
|
||||||
|
parent-links)
|
||||||
|
=> car]
|
||||||
|
[else #f])])
|
||||||
|
(when parent-link
|
||||||
|
(set-link-label! parent-link label))))
|
||||||
|
|
||||||
(define/public (has-self-loop?)
|
(define/public (has-self-loop?)
|
||||||
(memq this (get-children)))
|
(memq this (get-children)))
|
||||||
|
|
|
@ -60,4 +60,16 @@ this snip.
|
||||||
Removes a parent snip from this snip. Be sure to remove this
|
Removes a parent snip from this snip. Be sure to remove this
|
||||||
snip as a child from the argument, too.
|
snip as a child from the argument, too.
|
||||||
|
|
||||||
}}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@defmethod[(set-parent-link-label [parent (is-a?/c graph-snip<%>)]
|
||||||
|
[label (or/c false/c string/)])
|
||||||
|
void?]{
|
||||||
|
|
||||||
|
Changes the label on the edge going to the @scheme[parent] to be
|
||||||
|
@scheme[label]. Ignored if no such egde exists.
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -74,3 +74,12 @@ used.}
|
||||||
|
|
||||||
Like @scheme[add-links], but with extra @scheme[dark-text] and
|
Like @scheme[add-links], but with extra @scheme[dark-text] and
|
||||||
@scheme[light-text] arguments to set the colors of the label.}
|
@scheme[light-text] arguments to set the colors of the label.}
|
||||||
|
|
||||||
|
@defproc[(set-links-label! [parent (is-a?/c graph-snip<%>)]
|
||||||
|
[child (is-a?/c graph-snip<%>)]
|
||||||
|
[label (or/c string? false/c)])
|
||||||
|
void?]{
|
||||||
|
|
||||||
|
Changes the label on the edge going from @scheme[child] to
|
||||||
|
@scheme[parent] to be @scheme[label]. If there is no existing edge
|
||||||
|
between the two nodes, then nothing happens.}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user