Reference |
|
tree_controltree_node<doc/tree/tree.js><doc/tree/tree.css>The following synopsis is written with Java syntax to make type information explicit and to make it obvious to which class a member function belongs.
public class tree_node { /* Constructors */ public tree_node(String text); public tree_node(String text, String url); /* Member Functions */ public tree_node add(tree_node child); public tree_node add(String text); public tree_node add(String text, String url); public tree_node parent(); } public class tree_control { /* Constructor */ public tree_control(String target_frame); /* Static Member Function */ public static void sync(); /* Instance Member Functions */ public tree_node add(tree_node child); public tree_node add(String text); public tree_node add(String text, String url); public void draw(); public void reset(); /* Public Member Data */ public String caption = "Contents"; public boolean numbered = true; public int indent = 15; public boolean dump_html = false; }
tree_controlRepresents a tree control. At most one instance or tree_control may exist in an HTML frame.
tree_control.tree_controlpublic tree_control(String target_frame);
Constructs a tree_control whose hyperlinks open documents in the named HTML frame.
tree_control.syncpublic static void sync();
Attempts to synchronize the tree_control in the current frame with the document displayed in the target frame. If successful, this operation reloads the document in the top-level HTML frame with a url linking to the current position in the documentation. The generated url is suitable for bookmarking or publication.
This function is invoked when the user click the hyperlink [link to this page] which appears under the tree control caption. The need for this feature is discussed in the Tutorial ('Viewing Documentation with a Tree Control') and the Rationale ('Completely Addressable').
[Detailed specification omitted]
tree_control.addpublic tree_node add(tree_node child); public tree_node add(String text); public tree_node add(String text, String url);
Each member adds a tree_node to this tree_control, as the last child of the root, and returns the added tree_node. The first member adds an existing node; the second and third members add newly constructed nodes.[1]
tree_control.drawpublic void draw();
Draws this tree_control inside the HTML document element with id attribute 'tree_control'; e.g., the following HTML can be used to display a tree_control inside an HTML table:
<table border=1>
<tr><td>
<span id='tree_control'>
<!-- Tree control will be drawn here -->
</span>
</td></tr>
</table>
tree_control.resetpublic void reset();
Collapses all nodes except the root.
tree_control.captionpublic String caption;
Heading displayed above this tree_control in old browsers. In such browsers, this tree_control and its caption consume an entire HTML frame.
tree_control.numberedpublic int numbered;
True if tree_nodes should be displayed with hierachical addresses preceding their text labels. E.g., if numbered is true, the first child of the second child of the root will be labeled 2.1.
tree_control.indentpublic int indent;
The number of pixels by which a child node is offset horizontally from its parent.
tree_control.dump_htmlpublic String dump_html;
True if the literal HTML for the tree_control should be displayed in place of the tree_control itself. This is useful for generating the HTML to place within a noscript element for browsers which do not support JavaScript, or for which JavaScript has been disabled.
tree_nodeRepresents a node in a tree control, consisting of a text label together with an optional url and an optional list of children. Each tree control has a root node which is created automatically and is not displayed.
tree_node.tree_nodepublic tree_node(String text); public tree_node(String text, String url);
The first member constructs a tree_node with the given text label and no associated url. The second member constucts a tree_node with the given text label and target url.[1]
tree_node.addpublic tree_node add(tree_node child); public tree_node add(String text); public tree_node add(String text, String url);
Each member adds a child tree_node to this tree_node at the end of its list of children, and returns the added tree_node. The first member adds an existing node; the second and third members add newly constructed nodes.[1]
tree_node.parent public tree_node parent();
Returns this tree_node's parent. Useful for adding multiple tree_nodes with a single statement.
The HTML generated by tree_control.draw() contains hooks for customization using Cascading Style Sheets. In particular:
h1 element with class attribute tree-caption.
p and anchor elements with class attribute tree-sync.
div element with class attribute tree-item.
+ or - is enclosed in anchor and span elements with class attributes tree-icon.
span element with class attribute tree-label.
span element with class attributes 'tree-text'.
anchor element with class attributes 'tree-text'.
[1]In JavaScript these members are implemented as one function.
Revised 22 July, 2004
© Copyright Jonathan D. Turkanis, 2004
Use, modification, and distribution are subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)