home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / Vk / VkGraph.z / VkGraph
Encoding:
Text File  |  2002-10-03  |  31.3 KB  |  925 lines

  1.  
  2.  
  3.  
  4. VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))                                                        VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      VkGraph - A component that displays directed graphs
  10.  
  11. IIIINNNNHHHHEEEERRRRIIIITTTTSSSS FFFFRRRROOOOMMMM
  12.      VkComponent : VkCallbackObject
  13.  
  14. HHHHEEEEAAAADDDDEEEERRRR FFFFIIIILLLLEEEE
  15.      #include <Vk/VkGraph.h>
  16.  
  17. PPPPUUUUBBBBLLLLIIIICCCC PPPPRRRROOOOTTTTOOOOCCCCOOOOLLLL SSSSUUUUMMMMMMMMAAAARRRRYYYY
  18.    CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrr////DDDDeeeessssttttrrrruuuuccccttttoooorrrr
  19.            VkGraph(char* name, Widget parent);
  20.            virtual void ~VkGraph(void);
  21.  
  22.  
  23.    SSSSaaaavvvviiiinnnngggg ggggrrrraaaapppphhhhssss
  24.            void saveToFile(void);
  25.  
  26.  
  27.    AAAAcccccccceeeessssssss FFFFuuuunnnnccccttttiiiioooonnnnssss
  28.            Widget twinsButton(void);
  29.            Widget relayButton(void);
  30.            Widget reorientButton(void);
  31.            Widget workArea(void);
  32.            int numNodes(void);
  33.            Widget graphWidget(void);
  34.  
  35.  
  36.    CCCCoooonnnnttttrrrroooolllllllliiiinnnngggg ppppoooossssiiiittttiiiioooonnnn
  37.            void makeNodeVisible(VkNode* node);
  38.  
  39.  
  40.    DDDDeeeessssttttrrrrooooyyyyiiiinnnngggg aaaa ggggrrrraaaapppphhhh
  41.            virtual void tearDownGraph(void);
  42.  
  43.  
  44.    OOOOvvvveeeerrrrvvvviiiieeeewwww ccccoooonnnnttttrrrroooollll
  45.            void showOverview(void);
  46.            void hideOverview(void);
  47.            VkWindow* overviewWindow(void);
  48.  
  49.  
  50.    NNNNooooddddeeee ccccoooonnnnttttrrrroooollll
  51.            virtual void hideNode(VkNode *node);
  52.            virtual void hideParents(VkNode *node);
  53.            virtual void expandNode(VkNode *node);
  54.            virtual void expandSubgraph(VkNode *node);
  55.            void clearAll(void);
  56.            virtual void displayAll(void);
  57.            void sortAll(void);
  58.            virtual void display(VkNode* child);
  59.            virtual VkNode* display(char* name);
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))                                                        VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))
  71.  
  72.  
  73.  
  74.            virtual void hideParentsAndChildren(VkNode* node);
  75.            virtual void displayParentsAndChildren(VkNode* node);
  76.            virtual VkNode* displayParentsAndChildren(char* name);
  77.            virtual void hideParents(VkNode* node);
  78.            virtual void displayWithParents(VkNode* node);
  79.            virtual VkNode* displayWithParents(char* name);
  80.            virtual void displayWithAllParents(VkNode* node);
  81.            virtual VkNode* displayWithAllParents(char* name);
  82.            virtual void displayWithChildren(VkNode* node);
  83.            virtual VkNode* displayWithChildren(char* name);
  84.            virtual void displayWithAllChildren(VkNode* node);
  85.            virtual VkNode* displayWithAllChildren(char* name);
  86.            virtual void displayButterfly(VkNode* node);
  87.            virtual void displayIf(VkGraphFilterProc filterFunction);
  88.            void hideAllChildren(VkNode* node);
  89.            void hideWithAllChildren(VkNode* node);
  90.  
  91.  
  92.    AAAAddddddddiiiinnnngggg aaaannnndddd rrrreeeemmmmoooovvvviiiinnnngggg nnnnooooddddeeeessss
  93.            virtual void add(VkNode* parent, int parentIndex,
  94.                             VkNode* child, int childIndex, char* attribute);
  95.            virtual int add(VkNode* node, int givenIndex);
  96.            virtual void add(VkNode* parent,
  97.                             VkNode* child,
  98.                             char* attribute);
  99.            virtual void remove(VkNode *node,
  100.                                Boolean deleteNode = FALSE);
  101.            virtual void undisplay(VkNode* node);
  102.  
  103.  
  104.    OOOOppppeeeerrrraaaattttiiiinnnngggg oooonnnn NNNNooooddddeeeessss
  105.            virtual void forAllNodesDo(VkGraphNodeProc filterFunction);
  106.  
  107.  
  108.    LLLLaaaayyyyoooouuuutttt SSSSttttyyyylllleeeessss
  109.            virtual VkNode* displayButterfly(char* name);
  110.            virtual void setLayoutStyle(char type);
  111.  
  112.  
  113.    FFFFiiiinnnnddddiiiinnnngggg NNNNooooddddeeeessss
  114.            VkNode* find(char* name);
  115.  
  116.  
  117.    GGGGrrrraaaapppphhhh LLLLaaaayyyyoooouuuutttt
  118.            void doLayout(void);
  119.            void doSubtreeLayout(VkNode* node);
  120.            void doSparseLayout(void);
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))                                                        VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))
  137.  
  138.  
  139.  
  140. PROTECTED PROTOCOL SUMMARY
  141.    NNNNooootttt ffffoooorrrr eeeexxxxtttteeeerrrrnnnnaaaallll uuuusssseeee
  142.           These functions are not intended for external use.  They are only
  143.           used by the VkGraph constructor.  This means that, although they are
  144.           virtual functions, by virtue of historical accident, they cannot be
  145.           overridden. They are listed here only to avoid confusion to those
  146.           who look at the headers.
  147.  
  148.            virtual void arcCreatedHook(VkNode*, Widget, VkNode*);
  149.            virtual void arcDestroyedHook(Widget);
  150.            virtual void popupMenu(VkNode*,XEvent*);
  151.            virtual void setZoomOption(int);
  152.            virtual void twinsVisibleHook(Boolean);
  153.  
  154.  
  155.    PPPPrrrrooootttteeeecccctttteeeedddd DDDDaaaattttaaaa MMMMeeeemmmmbbbbeeeerrrrssss
  156.            VkNode** _nodeList;
  157.  
  158.  
  159.            int _numNodes;
  160.  
  161.  
  162.            int _maxNodes;
  163.  
  164.  
  165.            VkNode* _butterflyNode;
  166.  
  167.  
  168.                 VkPopupMenu* _desktopMenu;
  169.  
  170.  
  171.                 VkMenuItem* _expandSelected;
  172.  
  173.  
  174.                 VkMenuItem* _collapseSelected;
  175.  
  176.  
  177.                 VkMenuItem* _hideSelected;
  178.  
  179.  
  180.                 VkPopupMenu* _popupMenu;
  181.  
  182.  
  183.                 VkMenuItem* _expand;
  184.  
  185.  
  186.                 VkMenuItem* _hide;
  187.  
  188.  
  189.                 VkMenuItem* _expandParents;
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))                                                        VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))
  203.  
  204.  
  205.  
  206.                 VkMenuItem* _hideParents;
  207.  
  208.  
  209.                 VkMenuItem* _collapse;
  210.  
  211.  
  212.                 VkMenuItem* _bigExpand;
  213.  
  214.  
  215.                 VkNode* _selectedNode;
  216.  
  217.  
  218.                 VkMenuItem* _popupTitleObj;
  219.  
  220.  
  221. CCCCLLLLAAAASSSSSSSS DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  222.           The VkGraph class is a component that provides a high-level
  223.           interface to the XmGraph widget. Graphs are constructed by
  224.           specifying parent/child parents of objects, represented by the
  225.           VkNode class. The VkGraph class constructs an abstract graph from
  226.           these objects and allows applications or users to specify which
  227.           portions of the graph to display at any one time. In this way, the
  228.           VkGraph component supports graphs that can be larger than it is
  229.           practical to display at one time.
  230.  
  231.           All nodes displayed by a VkGraph component must belong to the VkNode
  232.           class or a derived class. The VkNode class maintains information
  233.           about parent/child relationships and is able to create a widget on
  234.           demand to be displayed in the VkGraph component. VkGraph manages
  235.           which of the available nodes have visible widgets at any given time.
  236.  
  237. FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNNSSSS
  238.    hhhhiiiiddddeeeeNNNNooooddddeeee(((())))
  239.            virtual void hideNode(VkNode *node);
  240.  
  241.  
  242.           Hide (remove from the visible graph) the given node.
  243.  
  244.    hhhhiiiiddddeeeePPPPaaaarrrreeeennnnttttssss(((())))
  245.            virtual void hideParents(VkNode *node);
  246.  
  247.  
  248.           Hide all visible parents of the given node.
  249.  
  250.    eeeexxxxppppaaaannnnddddNNNNooooddddeeee(((())))
  251.            virtual void expandNode(VkNode *node);
  252.  
  253.  
  254.           Show the specified node, as well as all immediate children.
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))                                                        VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))
  269.  
  270.  
  271.  
  272.    eeeexxxxppppaaaannnnddddSSSSuuuubbbbggggrrrraaaapppphhhh(((())))
  273.            virtual void expandSubgraph(VkNode *node);
  274.  
  275.  
  276.           Show the specified node, as well as all nodes below this node in the
  277.           hierarchy.
  278.  
  279.    hhhhiiiiddddeeeeAAAAllllllllCCCChhhhiiiillllddddrrrreeeennnn(((())))
  280.            void hideAllChildren(VkNode* node);
  281.  
  282.  
  283.           Hide all nodes below this node in the hierarchy.
  284.  
  285.    hhhhiiiiddddeeeeWWWWiiiitttthhhhAAAAllllllllCCCChhhhiiiillllddddrrrreeeennnn(((())))
  286.            void hideWithAllChildren(VkNode* node);
  287.  
  288.  
  289.           Hide this node and also all nodes below this node in the hierarchy.
  290.  
  291.    VVVVkkkkGGGGrrrraaaapppphhhh(((())))
  292.            VkGraph(char *name, Widget parent);
  293.  
  294.  
  295.           Initialize a VkGraph object. Creates the user interface widget used
  296.           by this component.
  297.  
  298.    ~~~~VVVVkkkkGGGGrrrraaaapppphhhh(((())))
  299.            virtual void ~VkGraph(void);
  300.  
  301.  
  302.           Cleanup before destroying a VkGraph object. The destructor does not
  303.           destroy any VkNode objects added to the graph.
  304.  
  305.    ssssaaaavvvveeeeTTTTooooFFFFiiiilllleeee(((())))
  306.            void saveToFile(void);
  307.  
  308.  
  309.           Save a postscript representation of the graph to a file. The user is
  310.           prompted for a filename using a file browser dialog.
  311.  
  312.    ttttwwwwiiiinnnnssssBBBBuuuuttttttttoooonnnn(((())))
  313.            Widget twinsButton(void);
  314.  
  315.  
  316.           This access function retrieves the button widget used to control
  317.           whether sibling arcs are shown.
  318.  
  319.    rrrreeeellllaaaayyyyBBBBuuuuttttttttoooonnnn(((())))
  320.            Widget relayButton(void);
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))                                                        VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))
  335.  
  336.  
  337.  
  338.           This access function retrieves the button widget used to relay the
  339.           graph.
  340.  
  341.    rrrreeeeoooorrrriiiieeeennnnttttBBBBuuuuttttttttoooonnnn(((())))
  342.            Widget reorientButton(void);
  343.  
  344.  
  345.           This access function retrieves the button widget used to reorient
  346.           the graph.
  347.  
  348.    wwwwoooorrrrkkkkAAAArrrreeeeaaaa(((())))
  349.            Widget workArea(void);
  350.  
  351.  
  352.           This access function retrieves an XmForm widget that is located in
  353.           the bottom left corner of the VkGraph component. Applications can
  354.           use this area to add additional controls.
  355.  
  356.    mmmmaaaakkkkeeeeNNNNooooddddeeeeVVVViiiissssiiiibbbblllleeee(((())))
  357.            void makeNodeVisible(VkNode *node);
  358.  
  359.  
  360.           Scroll the graph if necessary to ensure that the given node is in
  361.           the visible portion of the screen.
  362.  
  363.    tttteeeeaaaarrrrDDDDoooowwwwnnnnGGGGrrrraaaapppphhhh(((())))
  364.            virtual void tearDownGraph(void);
  365.  
  366.  
  367.           Destroys an abstract graph and resets a VkGraph object to it's
  368.           initial state. All VkNode objects added to the graph are deleted and
  369.           removed from the graph.
  370.  
  371.    sssshhhhoooowwwwOOOOvvvveeeerrrrvvvviiiieeeewwww(((())))
  372.            void showOverview(void);
  373.  
  374.  
  375.           Display a second window that shows an overview of all nodes in the
  376.           graph.
  377.  
  378.    hhhhiiiiddddeeeeOOOOvvvveeeerrrrvvvviiiieeeewwww(((())))
  379.            void hideOverview(void);
  380.  
  381.  
  382.           Remove the overview window from the screen.
  383.  
  384.    oooovvvveeeerrrrvvvviiiieeeewwwwWWWWiiiinnnnddddoooowwww(((())))
  385.            VkWindow* overviewWindow(void);
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))                                                        VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))
  401.  
  402.  
  403.  
  404.           Return a handle on the VkWindow object that contains the overview of
  405.           the graph.
  406.  
  407.    ttttwwwwiiiinnnnssssVVVViiiissssiiiibbbblllleeeeHHHHooooooookkkk(((())))
  408.            virtual void twinsVisibleHook(Boolean vis);
  409.  
  410.  
  411.           This virtual function can be used by derived classes that wish to
  412.           perform some additional operations when the graph changes its
  413.           display mode from showing all arcs between nodes, to showing only a
  414.           single arc for all connections, and vice-versa.
  415.  
  416.    sssseeeettttZZZZoooooooommmmOOOOppppttttiiiioooonnnn
  417.            void setZoomOption(int index);
  418.  
  419.                Programmatically change the scaling factor of the graph. The argument
  420.                is an index of the supported scale factors, as shown on the zoom option
  421.                menu.
  422.  
  423.    cccclllleeeeaaaarrrrAAAAllllllll(((())))
  424.            void clearAll();
  425.  
  426.  
  427.           Remove all nodes from the visible graph. The abstract graph is left
  428.           undisturbed.
  429.  
  430.    ddddiiiissssppppllllaaaayyyyAAAAllllllll(((())))
  431.            virtual void displayAll(void);
  432.  
  433.  
  434.           Display every node in the abstract graph.  Beware of huge graphs.
  435.  
  436.    ssssoooorrrrttttAAAAllllllll(((())))
  437.            void sortAll(void);
  438.  
  439.  
  440.           Sort the nodes of the graph. See the VkNode::sortFunction member
  441.           function.
  442.  
  443.    aaaadddddddd(((())))
  444.            int add(VkNode *node);
  445.            virtual void add( VkNode *parent,
  446.                              VkNode *child,
  447.                              char *attribute = NULL);
  448.  
  449.  
  450.           Add a node or a pair of nodes with a parent/child relationship to
  451.           the abstract graph. If a node has no relationships, it is simply
  452.           entered into an internal table maintained by the graph. If two nodes
  453.           are given, a parent/child relationship between the two nodes is
  454.           established. A parent/child relationship may also be given an
  455.           attribute, which may be an arbitrary string. This attribute can be
  456.  
  457.  
  458.  
  459.                                                                         PPPPaaaaggggeeee 7777
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))                                                        VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))
  467.  
  468.  
  469.  
  470.           used to control the visual appearance of the arcs that connect the
  471.           two nodes. See "Setting Attributes".
  472.  
  473.    uuuunnnnddddiiiissssppppllllaaaayyyy(((())))
  474.            virtual void undisplay(VkNode *node);
  475.  
  476.  
  477.           Remove the given node from the visible graph.
  478.  
  479.    sssseeeettttSSSSiiiizzzzeeee(((())))
  480.            void setSize(int size);
  481.  
  482.  
  483.           Some applications know in advance how many nodes will be placed in
  484.           an abstract graph. In this case, using _s_e_t_S_i_z_e() to specify this
  485.           size in advance can save time by allowing the VkGraph object to
  486.           allocate sufficient memory at one time. The graph well expand the
  487.           tables if necessary.
  488.  
  489.    rrrreeeesssseeeettttSSSSiiiizzzzeeee(((())))
  490.            void resetSize(int newSize);
  491.  
  492.  
  493.           Changes the size of the internal storage for nodes in the abstract
  494.           graph. Normally, this function is for internal use.
  495.  
  496.    ddddiiiissssppppllllaaaayyyy(((())))
  497.            virtual void display(VkNode *node);
  498.            virtual VkNode* display(char *name);
  499.  
  500.  
  501.           Makes a node visible. The node must have been previously added to
  502.           the abstract graph. If the node is specified by name, the first
  503.           occurrence of that name is displayed.
  504.  
  505.    hhhhiiiiddddeeeePPPPaaaarrrreeeennnnttttssssAAAAnnnnddddCCCChhhhiiiillllddddrrrreeeennnn(((())))
  506.            virtual void hideParentsAndChildren(VkNode *node);
  507.  
  508.  
  509.           Remove all parents and children of the specified node from the
  510.           visible display.
  511.  
  512.    ddddiiiissssppppllllaaaayyyyPPPPaaaarrrreeeennnnttttssssAAAAnnnnddddCCCChhhhiiiillllddddrrrreeeennnn(((())))
  513.            virtual void displayParentsAndChildren(VkNode *node);
  514.            virtual VkNode* displayParentsAndChildren(char *name);
  515.  
  516.  
  517.           Display all parents and children of the specified node.
  518.  
  519.    ddddiiiissssppppllllaaaayyyyPPPPaaaarrrreeeennnnttttssssAAAAnnnnddddCCCChhhhiiiillllddddrrrreeeennnn(((())))
  520.  
  521.  
  522.  
  523.  
  524.  
  525.                                                                         PPPPaaaaggggeeee 8888
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532. VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))                                                        VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))
  533.  
  534.  
  535.  
  536.    hhhhiiiiddddeeeePPPPaaaarrrreeeennnnttttssss(((())))
  537.            virtual void hideParents(VkNode *node);
  538.  
  539.  
  540.           Remove the immediate parents of the specified node.
  541.  
  542.    ddddiiiissssppppllllaaaayyyyWWWWiiiitttthhhhPPPPaaaarrrreeeennnnttttssss(((())))
  543.            virtual void displayWithParents(VkNode *node);
  544.            virtual VkNode* displayWithParents(char *name);
  545.  
  546.  
  547.           Show the specified node along with its immediate parents.
  548.  
  549.    ddddiiiissssppppllllaaaayyyyWWWWiiiitttthhhhAAAAllllllllPPPPaaaarrrreeeennnnttttssss(((())))
  550.            virtual void displayWithAllParents(VkNode  *node);
  551.            virtual VkNode* displayWithAllParents(char *name);
  552.  
  553.  
  554.           Show the specified node along with all nodes above it in the
  555.           hierarchy.
  556.  
  557.    ddddiiiissssppppllllaaaayyyyWWWWiiiitttthhhhCCCChhhhiiiillllddddrrrreeeennnn(((())))
  558.            virtual void displayWithChildren(VkNode *node);
  559.            virtual VkNode* displayWithChildren(char *name);
  560.  
  561.  
  562.           Show the specified node along with its immediate children.
  563.  
  564.    ddddiiiissssppppllllaaaayyyyWWWWiiiitttthhhhAAAAllllllllCCCChhhhiiiillllddddrrrreeeennnn(((())))
  565.            virtual void displayWithAllChildren(VkNode *node);
  566.            virtual VkNode* displayWithAllChildren(char *name);
  567.  
  568.  
  569.           Show the specified node along with all nodes below that point in the
  570.           hierarchy.
  571.  
  572.    ddddiiiissssppppllllaaaayyyyBBBBuuuutttttttteeeerrrrffffllllyyyy(((())))
  573.            virtual void displayButterfly(VkNode *node);
  574.            virtual VkNode* displayButterfly(char *name);
  575.  
  576.  
  577.           Change the graph display mode to display the given node as a
  578.           "butterfly", a graph that has a node in the center, immediate
  579.           parents to the left, and immediate children to the right.
  580.  
  581.    ddddiiiissssppppllllaaaayyyyIIIIffff(((())))
  582.            virtual void displayIf(VkGraphFilterProc filterFunction);
  583.  
  584.  
  585.           Loop through all nodes in the graph displaying any node that passes
  586.           through the given filter function. The form of the filter function
  587.           must be:
  588.  
  589.  
  590.  
  591.                                                                         PPPPaaaaggggeeee 9999
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598. VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))                                                        VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))
  599.  
  600.  
  601.  
  602.            Boolean filterFunction(VkNode *node);
  603.  
  604.  
  605.           The function should return TRUE if the node should be displayed, or
  606.           FALSE if it should not be displayed.
  607.  
  608.    ffffoooorrrrAAAAllllllllNNNNooooddddeeeessssDDDDoooo(((())))
  609.            virtual void forAllNodesDo(VkGraphNodeProc function);
  610.  
  611.  
  612.           Perform some operation on all nodes registered with the VkGraph
  613.           component. The form of the specified function must be:
  614.  
  615.            void function (VkNode *node);
  616.  
  617.  
  618.    sssseeeettttLLLLaaaayyyyoooouuuuttttSSSSttttyyyylllleeee(((())))
  619.            virtual void setLayoutStyle(char type);
  620.  
  621.  
  622.           Set the layout style of the graph. Currently the supported styles
  623.           are XmGRAPH and XmBUTTERFLY. XmGRAPH is the normal, hierarchical
  624.           display mode. XmBUTTERFLY displays a given node as the center of a
  625.           "butterfly" graph. See the _d_i_s_p_l_a_y_B_u_t_t_e_r_f_l_y() member function.
  626.  
  627.    ffffiiiinnnndddd(((())))
  628.            VkNode* find(char *name);
  629.  
  630.  
  631.           Returns the first VkNode object registered with the VkGraph object
  632.           that has the given name.
  633.  
  634.    ddddooooLLLLaaaayyyyoooouuuutttt(((())))
  635.            void doLayout(void);
  636.  
  637.  
  638.           Force a layout of the current graph. Normally, a program adds nodes
  639.           to a graph, displays a subset of these nodes, and then calls
  640.           _d_o_L_a_y_o_u_t() to arrange the nodes on the screen.
  641.  
  642.    ddddooooSSSSuuuubbbbttttrrrreeeeeeeeLLLLaaaayyyyoooouuuutttt(((())))
  643.            void doSubtreeLayout(VkNode *node);
  644.  
  645.  
  646.           Invoke the graph's layout routines on a subtree starting at the
  647.           specified node. No other nodes are moved or considered.
  648.  
  649.    nnnnuuuummmmNNNNooooddddeeeessss(((())))
  650.            int numNodes(void);
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.                                                                        PPPPaaaaggggeeee 11110000
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664. VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))                                                        VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))
  665.  
  666.  
  667.  
  668.           Return the number of nodes in the abstract graph.
  669.  
  670.    ggggrrrraaaapppphhhhWWWWiiiiddddggggeeeetttt(((())))
  671.            Widget graphWidget(void);
  672.  
  673.  
  674.           Returns the XmGraph widget instantiated by the VkGraph component.
  675.           Not all the functionality of the XmGraph widget is encapsulated in
  676.           the VkGraph class, and it is sometimes useful to set various
  677.           resources directly on the graph widget.
  678.  
  679. UUUUSSSSIIIINNNNGGGG AAAATTTTTTTTRRRRIIIIBBBBUUUUTTTTEEEESSSS
  680.      When specifying a parent/child connection in the VkGraph component's
  681.      abstract graph, it is possible to specify an _a_t_t_r_i_b_u_t_e for that
  682.      connection. An attribute is an arbitrary name that can be used to control
  683.      the appearance of the arc widget that connects the two nodes.  For
  684.      example, assume two nodes are added to a graph as follows:
  685.  
  686.  
  687.             graph->add(parent, child, "primary");
  688.             graph->add(parent, child, "secondary");
  689.  
  690.  
  691.      The resulting graph will display two connecting arcs between the two
  692.      nodes. One can now specify X resources to control various aspects of the
  693.      arc. For example:
  694.  
  695.  
  696.            *primary*foreground: red
  697.            *secondary*foreground: blue
  698.            *primary*arcDirection: bidirected
  699.            *secondary*arcDirection: undirected
  700.  
  701.  
  702.      Most resource supported by the Arc widget are supported through this
  703.      interface. The supported resources are:
  704.  
  705.  
  706.            foreground
  707.            toSide
  708.            fromSide
  709.            fromPosition
  710.            toPosition
  711.            arcDirection
  712.            fontList
  713.            arcWidth
  714.            style
  715.            dashes
  716.  
  717.  
  718.      See the SgArc man page for details on these resources.
  719.  
  720.  
  721.  
  722.  
  723.                                                                        PPPPaaaaggggeeee 11111111
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730. VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))                                                        VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))
  731.  
  732.  
  733.  
  734. XXXX RRRREEEESSSSOOOOUUUURRRRCCCCEEEESSSS
  735.      The VkGraph component sets the following default resources to control
  736.      menu labels.
  737.  
  738.  
  739.            "*graph*popupMenu*hideNode*labelString:         Hide Node",
  740.            "*graph*popupMenu*collapseSubgraph*labelString: Collapse Subgraph",
  741.            "*graph*popupMenu*expandOneLevel*labelString:   Show Immediate Children",
  742.            "*graph*popupMenu*expandSubgraph*labelString:   Expand Subgraph",
  743.            "*graph*popupMenu*hideParents.labelString:      Hide Parents",
  744.            "*graph*popupMenu*expandParents.labelString:    Show Parents",
  745.            "*graph*popupMenu*selectedNodes.labelString:    Selected Nodes",
  746.            "*graph*popupMenu*hideSelectedNodes.labelString:     Hide",
  747.            "*graph*popupMenu*collapseSelectedNodes.labelString: Collapse",
  748.            "*graph*popupMenu*expandSelectedNodes.labelString:   Expand",
  749.  
  750.  
  751.  
  752. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  753.      The following code segment creates a graph that displays a simple tree of
  754.      three nodes.
  755.  
  756.  
  757.            #include <Vk/VkNode.h>
  758.            #include <Vk/VkGraph.h>
  759.  
  760.            void buildgraph(Widget parent)
  761.            {
  762.               VkGraph *graph = new VkGraph("graph", parent);
  763.  
  764.               VkNode *node1 = new VkNode("node1");
  765.               VkNode *node2 = new VkNode("node2");
  766.               VkNode *node3 = new VkNode("node3");
  767.               VkNode *node4 = new VkNode("node4");
  768.  
  769.               graph->add(node1, node2);
  770.               graph->add(node1, node3);
  771.               graph->add(node2, node4);
  772.  
  773.               graph->displayAll();
  774.               graph->doLayout();
  775.  
  776.               graph->show();
  777.            }
  778.  
  779.  
  780.      The following code segment reads data from standard input in the form:
  781.  
  782.  
  783.           parent child parentLabel childLabel
  784.  
  785.  
  786.  
  787.  
  788.  
  789.                                                                        PPPPaaaaggggeeee 11112222
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796. VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))                                                        VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))
  797.  
  798.  
  799.  
  800.      and creates a graph. Note the use of _V_k_G_r_a_p_h::_f_i_n_d() to find an existing
  801.      node for a given unique name.
  802.  
  803.  
  804.            #include <Vk/VkNode.h>
  805.            #include <Vk/VkGraph.h>
  806.  
  807.            void buildgraph(Widget parent)
  808.            {
  809.               char    parentName[1000];
  810.               char    childName[1000];
  811.               char    childLabel[1000];
  812.               char    parentLabel[1000];
  813.  
  814.               VkGraph *graph = new VkGraph("graph", parent);
  815.  
  816.               while((nitems = scanf("%s %s %s %s",
  817.                                    parentName, childName,
  818.                                    parentLabel, childLabel)) != EOF &&
  819.                     nitems == 4)
  820.               {
  821.                   VkNode *parent, *child;
  822.  
  823.                   parent = child = NULL;
  824.  
  825.                   if(parentName &&
  826.                      (parent = graph->find(parentName)) == NULL)
  827.                          parent = new VkNode(parentName, parentLabel);
  828.  
  829.                   if(childName &&
  830.                      (child = graph->find(childName)) == NULL)
  831.                          child = new VkNode(childName, childLabel);
  832.  
  833.                   graph->add(parent, child);
  834.               }
  835.  
  836.               graph->displayAll();
  837.               graph->doLayout();
  838.  
  839.               graph->show();
  840.            }
  841.  
  842.  
  843.  
  844. IIIINNNNHHHHEEEERRRRIIIITTTTEEEEDDDD MMMMEEEEMMMMBBBBEEEERRRR FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNNSSSS
  845.    IIIInnnnhhhheeeerrrriiiitttteeeedddd ffffrrrroooommmm VVVVkkkkCCCCoooommmmppppoooonnnneeeennnntttt
  846.           installDestroyHandler(), removeDestroyHandler(), widgetDestroyed(),
  847.           setDefaultResources(), getResources(), VkComponent(), manage(),
  848.           unmanage(), baseWidget(), okToQuit(), _name, _baseWidget, _w,
  849.           deleteCallback
  850.  
  851.  
  852.  
  853.  
  854.  
  855.                                                                        PPPPaaaaggggeeee 11113333
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862. VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))                                                        VVVVkkkkGGGGrrrraaaapppphhhh((((3333xxxx))))
  863.  
  864.  
  865.  
  866.    IIIInnnnhhhheeeerrrriiiitttteeeedddd ffffrrrroooommmm VVVVkkkkCCCCaaaallllllllbbbbaaaacccckkkkOOOObbbbjjjjeeeecccctttt
  867.           callCallbacks(), addCallback(), removeCallback(),
  868.           removeAllCallbacks()
  869.  
  870.  
  871. CCCCLLLLAAAASSSSSSSSEEEESSSS UUUUSSSSEEEEDDDD BBBBYYYY TTTTHHHHIIIISSSS CCCCLLLLAAAASSSSSSSS
  872.      VkApp, VkMenu, VkMenuItem, VkNode, VkPopupMenu
  873.  
  874. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  875.      VkComponent, VkApp, VkMenu, VkMenuItem, VkNode, VkPopupMenu
  876.      _V_i_e_w_K_i_t _P_r_o_g_r_a_m_m_e_r'_s _G_u_i_d_e
  877.      _T_h_e _X _W_i_n_d_o_w _S_y_s_t_e_m, DEC Press, Bob Sheifler and Jim Gettys
  878.      _T_h_e _X _W_i_n_d_o_w _S_y_s_t_e_m _T_o_o_l_k_i_t, DEC Press, Paul Asente and Ralph Swick
  879.      _T_h_e _O_S_F/_M_o_t_i_f _P_r_o_g_r_a_m_m_e_r_s _R_e_f_e_r_e_n_c_e, Prentice Hall, OSF
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.                                                                        PPPPaaaaggggeeee 11114444
  922.  
  923.  
  924.  
  925.