Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
26 | .\" Set up some character translations and predefined strings. \*(-- will | |
27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | |
28 | .\" double quote, and \*(R" will give a right double quote. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie n \{\ | |
35 | . ds -- \(*W- | |
36 | . ds PI pi | |
37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch | |
38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch | |
39 | . ds L" "" | |
40 | . ds R" "" | |
41 | . ds C` "" | |
42 | . ds C' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "OVERVIEW 1" | |
132 | .TH OVERVIEW 1 "2000-12-30" "perl v5.8.0" "User Contributed Perl Documentation" | |
133 | .SH "NAME" | |
134 | \&\fBTk\fR \- An overview of an Object Oriented Tk8.0 extension for perl5 | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | use Tk; | |
138 | .PP | |
139 | $main = MainWindow\->\fInew()\fR; | |
140 | .PP | |
141 | $widget = \f(CW$main\fR\->\fIWidget\fR(...); | |
142 | .PP | |
143 | $widget\->pack(...); | |
144 | .PP | |
145 | \&... | |
146 | .PP | |
147 | MainLoop; | |
148 | .SH "DESCRIPTION" | |
149 | .IX Header "DESCRIPTION" | |
150 | In writing the perl Tk extension, the goals were to provide a complete | |
151 | interface to the latest production version of John Ousterhout's Tk, while providing | |
152 | an Object Oriented interface to perl code. | |
153 | .SH "CONTENTS" | |
154 | .IX Header "CONTENTS" | |
155 | The package is composed of three loosely connected parts: | |
156 | .IP "\fIpTk\fR \- Converted Tk source" 4 | |
157 | .IX Item "pTk - Converted Tk source" | |
158 | The \fIpTk\fR sub-directory is a copy of the C code of Tk4.0, modified | |
159 | to allow use by languages other than the original Tcl. | |
160 | (The pTk can be read as 'perl' Tk or 'portable' Tk, depending on | |
161 | your sensibilities.) | |
162 | .IP "\fBTk\fR to Perl 'Glue'" 4 | |
163 | .IX Item "Tk to Perl 'Glue'" | |
164 | The top level directory provides \fITk.xs\fR and \fItkGlue.c\fR | |
165 | which provide the perl-callable interfaces to pTk | |
166 | .IP "Perl code for 'Widget' Classes" 4 | |
167 | .IX Item "Perl code for 'Widget' Classes" | |
168 | The \fITk/Tk\fR sub-directory contains the various perl modules that comprise | |
169 | the \*(L"Classes\*(R" that are visible to Tk applications. | |
170 | .Sp | |
171 | The \*(L"major\*(R" widgets such as \fBTk::Text\fR are actually in separate directories | |
172 | at the top level (e.g. \fIText/*\fR for \fBTk::Text\fR) and are dynamically | |
173 | loaded as needed on platforms which support perl5's \fBDynaLoader\fR. | |
174 | .SH "CLASS HIERARCHY" | |
175 | .IX Header "CLASS HIERARCHY" | |
176 | .IP "\fBpackage Tk;\fR \- the 'base class'" 4 | |
177 | .IX Item "package Tk; - the 'base class'" | |
178 | All the \*(L"command names\*(R" documented in Tcl/Tk are made to look like perl | |
179 | sub's and reside in the Tk package. Their names are all lower case. | |
180 | Typically there are very few commands at this level which are called | |
181 | directly by applications. | |
182 | .IP "\fBpackage Tk::Widget;\fR \- the 'Widget class'" 4 | |
183 | .IX Item "package Tk::Widget; - the 'Widget class'" | |
184 | There are no actual objects of the \fBTk::Widget\fR class; however all | |
185 | the various Tk window \*(L"widgets\*(R" inherit from it, and it in turn | |
186 | inherits all the core Tk functions from Tk. | |
187 | .Sp | |
188 | \&\fBTk::Widget\fR provides various functions and interfaces which are | |
189 | common to all Widgets. | |
190 | .Sp | |
191 | A widget is represented to perl as a blessed reference to a hash. There are some | |
192 | members of the hash which are private to Tk and its tkGlue code. Keys | |
193 | starting with \fB'.'\fR and of the form \fB/_[A\-Z][A\-Za\-z_]+_/\fR | |
194 | (i.e. starting and ending in _ and with first char after _ being upper case) should be | |
195 | considered reserved to \fBTk\fR. | |
196 | .IP "\fBTk::Button\fR, \fBTk::Entry\fR, \fBTk::Text\fR ..." 4 | |
197 | .IX Item "Tk::Button, Tk::Entry, Tk::Text ..." | |
198 | There is one class for each of the \*(L"Tk\*(R" widget item types. | |
199 | Some of them like \fBTk::Frame\fR do very little indeed, and really | |
200 | only exist so that they can be derived from or so that focus or menu | |
201 | traversal can discover the \*(L"kind\*(R" of window being processed. | |
202 | .Sp | |
203 | Other classes, \fBTk::Text\fR for example, provide a lot of methods | |
204 | used with Tk's \*(L"bind\*(R" to provide a rich keyboard/mouse interface | |
205 | to the widgets' data. | |
206 | .Sp | |
207 | These widget classes also include conversions of the Tcl code for | |
208 | event bindings, keyboard focus traversal, menu bars, and menu keyboard | |
209 | traversal. All the Tcl functions have been converted, but the names have | |
210 | changed (systematically) and they have been split up between the various | |
211 | classes in what I hope is an appropriate manner. | |
212 | Name changes are normally: dropping initial tk_ as the Tk-ness is implicit | |
213 | in the \fBTk::\fR prefix, and similarly dropping say Menu from the name if it | |
214 | has been moved the Tk::Menu class. | |
215 | Thus 'proc tkMenuNextEntry' becomes 'sub NextEntry' in the Tk::Menu package. | |
216 | .IP "\fBTk::Image\fR" 4 | |
217 | .IX Item "Tk::Image" | |
218 | This does for Tk4.0's \*(L"images\*(R" what \fBTk::Widget\fR does for widgets. | |
219 | Images are new to Tk4.0 and the class structure is not mature either. | |
220 | .Sp | |
221 | There are three sub-classes \fBTk::Bitmap\fR, \fBTk::Pixmap\fR and \fBTk::Photo\fR. | |
222 | .Sp | |
223 | It is expected that \fBTk::Image\fR hierarchy will evolve during the \*(L"beta\*(R" | |
224 | phase of Tk to allow dynamic or auto-loaded image types or photo formats | |
225 | (e.g. support for \s-1JPEG\s0 format for photos). | |
226 | .IP "Composite Widgets" 4 | |
227 | .IX Item "Composite Widgets" | |
228 | A composite is some kind of 'frame' with subwidgets which give it useful behaviour. | |
229 | \&\fBTk::Dialog\fR is an example of | |
230 | a composite widget classes built from the basic \fBTk\fR ones. | |
231 | It is intended that user code should not need to be aware that a particular | |
232 | class is a composite, and create and configure such widgets in the same manner | |
233 | as any other kind. The \fBconfigure\fR mechanism and the methods of the | |
234 | class manipulate the subwidgets as required. | |
235 | .Sp | |
236 | Composite widgets are implemented via \fBTk::Frame\fR and multiple inheritance. | |
237 | The two 'frame' base classes \fBTk::Frame\fR and | |
238 | \&\fBTk::Toplevel\fR include the additional class \fBTk::Derived\fR | |
239 | in their inheritance. \fBTk::Derived\fR provides methods to allow additional | |
240 | \&\fBconfigure\fR options to be defined for a widget. | |
241 | .Sp | |
242 | A Composite widget is typically defined as derived | |
243 | from \fBTk::Frame\fR or \fBTk::Toplevel\fR | |
244 | (e.g. \fBTk::Dialog\fR). |