Module: duim-gadgets-internals Synopsis: DUIM gadgets Author: Scott McKay, Andy Armstrong Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc. All rights reserved. License: Functional Objects Library Public License Version 1.0 Dual-license: GNU Lesser General Public License Warranty: Distributed WITHOUT WARRANTY OF ANY KIND /// Graph controls define constant = one-of(#"horizontal", #"vertical", #"up", #"down", #"left", #"right"); // The nodes in a tree control are layed out in a genuine graph // Note that nodes and edges are not modelled as sheets in the front end! //--- In a perfect world, would be a subclass of define open abstract class () // Various user-settable properties sealed constant slot graph-edge-class :: false-or(subclass()) = #f, init-keyword: edge-class:; sealed constant slot graph-edge-initargs :: = #[], init-keyword: edge-initargs:; sealed constant slot graph-edge-generator :: false-or() = #f, init-keyword: edge-generator:; sealed constant slot graph-orientation :: = #"horizontal", init-keyword: orientation:; sealed constant slot graph-center-nodes? :: = #f, init-keyword: center-nodes?:; sealed constant slot graph-inter-generation-spacing :: = 20, init-keyword: inter-generation-spacing:; sealed constant slot graph-intra-generation-spacing :: = 8, init-keyword: intra-generation-spacing:; end class ; // Nodes within a graph control //--- In a perfect world, would be a subclass of define open abstract class () end class ; define protocol <> (<>) getter node-x (node :: ) => (x :: ); getter node-x-setter (x :: , node :: ) => (x :: ); getter node-y (node :: ) => (y :: ); getter node-y-setter (y :: , node :: ) => (y :: ); end protocol <>; define sealed method make-node (graph :: , object, #rest initargs, #key) => (node :: ) apply(do-make-node, graph, , object: object, initargs) end method make-node; define sealed method find-node (graph :: , object, #key node: parent-node) => (node :: false-or()) do-find-node(graph, object, node: parent-node) end method find-node; // Edges within a graph control define open abstract primary class () sealed constant slot graph-edge-from-node :: , required-init-keyword: from-node:; sealed constant slot graph-edge-to-node :: , required-init-keyword: to-node:; sealed constant slot graph-edge-object :: = #f, init-keyword: object:; end class ; define protocol <> () getter draw-edges (edge :: , medium :: , region :: ) => (); end protocol <>;