Class
rootsThe roots of the graph.
children-functionReturns the children of a node.
layout-functionA function to layout the nodes.
node-pinboard-classThe class of pane to represent nodes.
edge-pinboard-classThe class of pane to represent edges.
node-pane-functionA function to return a pane for each node.
graph-pane-roots
children-function on each of its roots, and then calling it again on each of the children recursively until it runs out of children. Thechildren-function gets called with a node of the graph and should return a list of the children of that node. layout-function tells the graph pane how to lay out its children. It can take two values: :left-rightLay the graph out from the left to the right.
:top-downLay the graph out from the top down.
node-pinboard-class andedge-pinboard-class which default toitem-pinboard-object andline-pinboard-object respectively. These classes must be subclasses ofsimple-pane orpinboard-object, and there are some examples of the use of these keywords below. node-pane-function is called to create a node for each pane, and by default it creates an instance ofnode-pinboard-class. It gets passed the graph pane and the node, and should return an instance ofsimple-pane orpinboard-object.
(defun node-children (node)
(when (< node 16)
(list (* node 2)
(1+ (* node 2)))))
(setq graph (capi:contain
(make-instance 'capi:graph-pane
:roots '(1)
:children-function
'node-children)
:best-width 300
:best-height 400))
(setf (capi:graph-pane-roots graph) '(2 6))
(capi:contain (make-instance 'capi:graph-pane
:roots '(1)
:children-function
'node-children
:layout-function
:top-down)
:best-width 300
:best-height 400)
(capi:contain (make-instance 'capi:graph-pane
:roots '(1)
:children-function
'node-children
:layout-function :top-down
:x-adjust :left)
:best-width 300
:best-height 400)
(capi:contain (make-instance
'capi:graph-pane
:roots '(1)
:children-function 'node-children
:y-adjust :top
:edge-pinboard-class
'capi:right-angle-line-pinboard-object)
:best-width 300
:best-height 400)
:node-pinboard-class to specify that the nodes are drawn as push buttons.
(capi:contain (make-instance
'capi:graph-pane
:roots '(1)
:children-function 'node-children
:node-pinboard-class
'capi:push-button)
:best-width 300
:best-height 400)