Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | |
2 | =head1 NAME | |
3 | ||
4 | Tk::DirTree - Create and manipulate DirTree widgets | |
5 | ||
6 | =for pm Tixish/DirTree.pm | |
7 | ||
8 | =for category Tix Extensions | |
9 | ||
10 | =head1 SYNOPSIS | |
11 | ||
12 | S< >B<use Tk::DirTree;> | |
13 | ||
14 | S< >I<$dirtree> = I<$parent>-E<gt>B<DirTree>(?I<options>?); | |
15 | ||
16 | =head1 SUPER-CLASS | |
17 | ||
18 | The B<DirTree> class is derived from the L<Tree|Tk::Tree> class and inherits | |
19 | all the methods, options and subwidgets of its super-class. | |
20 | ||
21 | =head1 STANDARD OPTIONS | |
22 | ||
23 | B<Tree> supports all the standard options of a Tree widget. See | |
24 | L<Tk::options> for details on the standard options. | |
25 | ||
26 | =head1 WIDGET-SPECIFIC OPTIONS | |
27 | ||
28 | =over 4 | |
29 | ||
30 | =item Name: B<browseCmd> | |
31 | ||
32 | =item Class: B<BrowseCmd> | |
33 | ||
34 | =item Switch: B<-browsecmd> | |
35 | ||
36 | Specifies a L<callback|Tk::callbacks> to call whenever the user browses on a directory | |
37 | (usually by single-clicking on the name of the directory). The callback | |
38 | is called with one argument, the complete pathname of the directory. | |
39 | ||
40 | =item Name: B<command> | |
41 | ||
42 | =item Class: B<Command> | |
43 | ||
44 | =item Switch: B<-command> | |
45 | ||
46 | Specifies the L<callback|Tk::callbacks> to be called when the user activates on a directory | |
47 | (usually by double-clicking on the name of the directory). The callback | |
48 | is called with one argument, the complete pathname of the directory. | |
49 | ||
50 | =item Name: B<dircmd> | |
51 | ||
52 | =item Class: B<DirCmd> | |
53 | ||
54 | =item Switch: B<-dircmd> | |
55 | ||
56 | Specifies the L<callback|Tk::callbacks> to be called when a directory listing is needed | |
57 | for a particular directory. If this option is not specified, by | |
58 | default the DirTree widget will attempt to read the directory as a | |
59 | Unix directory. On special occasions, the application programmer may | |
60 | want to supply a special method for reading directories: for example, | |
61 | when he needs to list remote directories. In this case, the B<-dircmd> | |
62 | option can be used. The specified callback accepts two arguments: the | |
63 | first is the name of the directory to be listed; the second is a | |
64 | Boolean value indicating whether hidden sub-directories should be | |
65 | listed. This callback returns a list of names of the sub-directories of | |
66 | this directory. For example: | |
67 | ||
68 | sub read_dir { | |
69 | my( $dir, $showhidden ) = @_; | |
70 | return( qw/DOS NORTON WINDOWS/ ) if $dir eq "C:\\"; | |
71 | return(); | |
72 | } | |
73 | ||
74 | =item Name: B<showHidden> | |
75 | ||
76 | =item Class: B<ShowHidden> | |
77 | ||
78 | =item Switch: B<-showhidden> | |
79 | ||
80 | Specifies whether hidden directories should be shown. By default, a | |
81 | directory name starting with a period "." is considered as a hidden | |
82 | directory. This rule can be overridden by supplying an alternative | |
83 | B<-dircmd> option. | |
84 | ||
85 | =item Name: B<directory> | |
86 | ||
87 | =item Class: B<Directory> | |
88 | ||
89 | =item Switch: B<-directory> | |
90 | ||
91 | =item Alias: B<-value> | |
92 | ||
93 | Specifies the name of the current directory to be displayed in the | |
94 | DirTree widget. | |
95 | ||
96 | =back | |
97 | ||
98 | =head1 DESCRIPTION | |
99 | ||
100 | The B<DirTree> constructor method creates a new window (given by the $dirtree | |
101 | argument) and makes it into a DirTree widget. Additional options, | |
102 | described above, may be specified on the command line or in the | |
103 | option database to configure aspects of the DirTree such as its | |
104 | cursor and relief. The DirTree widget displays a list view of a | |
105 | directory, its previous directories and its sub-directories. The | |
106 | user can choose one of the directories displayed in the list or | |
107 | change to another directory. | |
108 | ||
109 | =head1 WIDGET METHODS | |
110 | ||
111 | The B<DirTree> method creates a widget object. | |
112 | This object supports the B<configure> and B<cget> methods | |
113 | described in L<Tk::options> which can be used to enquire and | |
114 | modify the options described above. | |
115 | The widget also inherits all the methods provided by the generic | |
116 | L<Tk::Widget|Tk::Widget> class. | |
117 | ||
118 | The following additional methods are available for DirTree widgets: | |
119 | ||
120 | =over 4 | |
121 | ||
122 | =item I<$dirtree>-E<gt>B<chdir>(I<dir>) | |
123 | ||
124 | Change the current directory to I<dir>. | |
125 | ||
126 | =back | |
127 | ||
128 | =head1 BINDINGS | |
129 | ||
130 | The mouse and keyboard bindings of the DirTree widget are the same as | |
131 | the bindings of the L<Tree|Tk::Tree> widget. | |
132 | ||
133 | =head1 KEYWORDS | |
134 | ||
135 | directory, tree, tix | |
136 | ||
137 | =head1 SEE ALSO | |
138 | ||
139 | L<Tk::Tree|Tk::Tree> | |
140 | L<Tk::HList|Tk::HList> | |
141 | ||
142 | =head1 AUTHOR | |
143 | ||
144 | Perl/TK version by Chris Dean <ctdean@cogit.com>. Original Tcl/Tix | |
145 | version by Ioi Kim Lam. | |
146 | ||
147 | =cut | |
148 |