Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / lib / site_perl / 5.8.0 / sun4-solaris / Tk / Tree.pod
CommitLineData
86530b38
AT
1
2=head1 NAME
3
4Tk::Tree - Create and manipulate Tree widgets
5
6=for pm Tixish/Tree.pm
7
8=for category Tix Extensions
9
10=head1 SYNOPSIS
11
12S< >B<use Tk::Tree;>
13
14S< >I<$tree> = I<$parent>-E<gt>B<Tree>(?I<options>?);
15
16=head1 SUPER-CLASS
17
18The B<Tree> class is derived from the L<HList|Tk::HList> class and inherits all
19the methods, options and subwidgets of its super-class. A B<Tree> widget is
20not scrolled by default.
21
22=head1 STANDARD OPTIONS
23
24B<Tree> supports all the standard options of an HList widget.
25See L<Tk::options> for details on the standard options.
26
27=head1 WIDGET-SPECIFIC OPTIONS
28
29=over 4
30
31=item Name: B<browseCmd>
32
33=item Class: B<BrowseCmd>
34
35=item Switch: B<-browsecmd>
36
37Specifies a L<callback|Tk::callbacks> to call whenever the user browses on an entry
38(usually by single-clicking on the entry). The callback is called with
39one argument, the pathname of the entry.
40
41=item Name: B<closeCmd>
42
43=item Class: B<CloseCmd>
44
45=item Switch: B<-closecmd>
46
47Specifies a L<callback|Tk::callbacks> to call whenever an entry needs to be closed (See
48L<"BINDINGS"> below). This method is called with one argument,
49the pathname of the entry. This method should perform appropriate
50actions to close the specified entry. If the B<-closecmd> option
51is not specified, the default closing action is to hide all child
52entries of the specified entry.
53
54=item Name: B<command>
55
56=item Class: B<Command>
57
58=item Switch: B<-command>
59
60Specifies a L<callback|Tk::callbacks> to call whenever the user activates an entry
61(usually by double-clicking on the entry). The callback
62is called with one argument, the pathname of the entry.
63
64=item Name: B<ignoreInvoke>
65
66=item Class: B<IgnoreInvoke>
67
68=item Switch: B<-ignoreinvoke>
69
70A Boolean value that specifies when a branch should be opened or
71closed. A branch will always be opened or closed when the user presses
72the (+) and (-) indicators. However, when the user invokes a branch
73(by doublc-clicking or pressing E<lt>ReturnE<gt>), the branch will be opened
74or closed only if B<-ignoreinvoke> is set to false (the default
75setting).
76
77=item Name: B<openCmd>
78
79=item Class: B<OpenCmd>
80
81=item Switch: B<-opencmd>
82
83Specifies a L<callback|Tk::callbacks> to call whenever an entry needs to be opened (See
84L<"BINDINGS"> below). This method is called with one argument,
85the pathname of the entry. This method should perform appropriate
86actions to open the specified entry. If the B<-opencmd> option
87is not specified, the default opening action is to show all the child
88entries of the specified entry.
89
90=back
91
92=head1 DESCRIPTION
93
94The B<Tree> method creates a new window and makes it into a Tree widget
95and return a reference to it. Additional options, described above, may
96be specified on the command line or in the option database to configure
97aspects of the Tree widget such as its cursor and relief.
98
99The Tree widget can be used to display hierarchical data in a tree
100form. The user can adjust the view of the tree by opening or closing
101parts of the tree.
102
103To display a static tree structure, you can add the entries into the
104Tree widget and hide any entries as desired. Then you can call
105the B<autosetmode> method. This will set up the Tree widget so that it
106handles all the I<open> and I<close> events automatically.
107the demonstration program F<Tixish/examples/perl-tix-tree>).
108
109The above method is not applicable if you want to maintain a dynamic tree
110structure, i.e, you do not know all the entries in the tree and you need
111to add or delete entries subsequently. To do this, you should first create
112the entries in the Tree widget. Then, use the B<setmode> method to
113indicate the entries that can be opened or closed, and use the B<-opencmd>
114and B<-closecmd> options to handle the opening and closing events. (Please
115see the demonstration program F<Tixish/examples/perl-tix-dyntree>).
116
117Use either
118
119S< >I<$parent>-E<gt>B<Scrolled>(B<'Tree'>, ... );
120
121or
122
123S< >I<$parent>-E<gt>B<ScrlTree>( ... );
124
125to create a scrolled B<Tree>. See L<Tk::Scrolled> for details.
126
127=head1 WIDGET METHODS
128
129The B<Tree> method creates a widget object.
130This object supports the B<configure> and B<cget> methods
131described in L<Tk::options> which can be used to enquire and
132modify the options described above.
133The widget also inherits all the methods provided by the generic
134L<Tk::Widget|Tk::Widget> class.
135
136The following additional methods are available for Tree widgets:
137
138=over 4
139
140=item I<$tree>-E<gt>B<autosetmode>
141
142This method calls the B<setmode> method for all the entries in
143this Tree widget: if an entry has no child entries, its mode is set to
144B<none>. Otherwise, if the entry has any hidden child entries, its
145mode is set to B<open>; otherwise its mode is set to B<close>.
146
147=item I<$tree>-E<gt>B<close>(I<entryPath>)
148
149Close the entry given by I<entryPath> if its I<mode> is B<close>.
150
151=item I<$tree>-E<gt>B<getmode>(I<entryPath>)
152
153Returns the current I<mode> of the entry given by I<entryPath>.
154
155=item I<$tree>-E<gt>B<open>(I<entryPath>)
156
157Open the entry given by I<entryPath> if its I<mode> is B<open>.
158
159=item I<$tree>-E<gt>B<setmode>(I<entryPath, mode>)
160
161This method is used to indicate whether the entry given by
162I<entryPath> has children entries and whether the children are
163visible. I<mode> must be one of B<open>,
164B<close> or B<none>. If I<mode> is set to B<open>, a (+)
165indicator is drawn next the the entry. If I<mode> is set to
166B<close>, a (-) indicator is drawn next the the entry. If
167I<mode> is set to B<none>, no indicators will be drawn for this
168entry. The default I<mode> is none. The B<open> mode indicates
169the entry has hidden children and this entry can be opened by the
170user. The B<close> mode indicates that all the children of the entry
171are now visible and the entry can be closed by the user.
172
173=back
174
175=head1 BINDINGS
176
177The basic mouse and keyboard bindings of the Tree widget are the same
178as the L<bindings of the HList|Tk::HList/"BINDINGS"> widget.
179In addition, the entries can be opened or closed under the following
180conditions:
181
182=over 4
183
184=item [1]
185
186If the I<mode> of the entry is B<open>, it can be opened by clicking
187on its (+) indicator.
188
189=item [2]
190
191If the I<mode> of the entry is B<close>, it can be closed by clicking
192on its (-) indicator.
193
194=back
195
196=head1 SEE ALSO
197
198L<Tk::HList|Tk::HList>
199
200=head1 AUTHOR
201
202Perl/TK version by Chris Dean <ctdean@cogit.com>. Original Tcl/Tix
203version by Ioi Kim Lam.
204
205=head1 ACKNOWLEDGEMENTS
206
207Thanks to Achim Bohnet <ach@mpe.mpg.de> for all his help.
208
209=cut
210