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 / overview.pod
CommitLineData
86530b38
AT
1
2=head1 NAME
3
4B<Tk> - An overview of an Object Oriented Tk8.0 extension for perl5
5
6=for category Introduction
7
8=head1 SYNOPSIS
9
10use Tk;
11
12$main = MainWindow-E<gt>new();
13
14$widget = $main-E<gt>I<Widget>(...);
15
16$widget-E<gt>pack(...);
17
18...
19
20MainLoop;
21
22=head1 DESCRIPTION
23
24In writing the perl Tk extension, the goals were to provide a complete
25interface to the latest production version of John Ousterhout's Tk, while providing
26an Object Oriented interface to perl code.
27
28=head1 CONTENTS
29
30The package is composed of three loosely connected parts:
31
32=over 4
33
34=item I<pTk> - Converted Tk source
35
36The I<pTk> sub-directory is a copy of the C code of Tk4.0, modified
37to allow use by languages other than the original Tcl.
38(The pTk can be read as 'perl' Tk or 'portable' Tk, depending on
39your sensibilities.)
40
41=item B<Tk> to Perl 'Glue'
42
43The top level directory provides I<Tk.xs> and I<tkGlue.c>
44which provide the perl-callable interfaces to pTk
45
46=item Perl code for 'Widget' Classes
47
48The I<Tk/Tk> sub-directory contains the various perl modules that comprise
49the "Classes" that are visible to Tk applications.
50
51The "major" widgets such as B<Tk::Text> are actually in separate directories
52at the top level (e.g. I<Text/*> for B<Tk::Text>) and are dynamically
53loaded as needed on platforms which support perl5's B<DynaLoader>.
54
55=back
56
57=head1 CLASS HIERARCHY
58
59=over 4
60
61=item B<package Tk;> - the 'base class'
62
63All the "command names" documented in Tcl/Tk are made to look like perl
64sub's and reside in the Tk package. Their names are all lower case.
65Typically there are very few commands at this level which are called
66directly by applications.
67
68=item B<package Tk::Widget;> - the 'Widget class'
69
70There are no actual objects of the B<Tk::Widget> class; however all
71the various Tk window "widgets" inherit from it, and it in turn
72inherits all the core Tk functions from Tk.
73
74B<Tk::Widget> provides various functions and interfaces which are
75common to all Widgets.
76
77A widget is represented to perl as a blessed reference to a hash. There are some
78members of the hash which are private to Tk and its tkGlue code. Keys
79starting with B<'.'> and of the form B</_[A-Z][A-Za-z_]+_/>
80(i.e. starting and ending in _ and with first char after _ being upper case) should be
81considered reserved to B<Tk>.
82
83=item B<Tk::Button>, B<Tk::Entry>, B<Tk::Text> ...
84
85There is one class for each of the "Tk" widget item types.
86Some of them like B<Tk::Frame> do very little indeed, and really
87only exist so that they can be derived from or so that focus or menu
88traversal can discover the "kind" of window being processed.
89
90Other classes, B<Tk::Text> for example, provide a lot of methods
91used with Tk's "bind" to provide a rich keyboard/mouse interface
92to the widgets' data.
93
94These widget classes also include conversions of the Tcl code for
95event bindings, keyboard focus traversal, menu bars, and menu keyboard
96traversal. All the Tcl functions have been converted, but the names have
97changed (systematically) and they have been split up between the various
98classes in what I hope is an appropriate manner.
99Name changes are normally: dropping initial tk_ as the Tk-ness is implicit
100in the B<Tk::> prefix, and similarly dropping say Menu from the name if it
101has been moved the Tk::Menu class.
102Thus 'proc tkMenuNextEntry' becomes 'sub NextEntry' in the Tk::Menu package.
103
104=item B<Tk::Image>
105
106This does for Tk4.0's "images" what B<Tk::Widget> does for widgets.
107Images are new to Tk4.0 and the class structure is not mature either.
108
109There are three sub-classes B<Tk::Bitmap>, B<Tk::Pixmap> and B<Tk::Photo>.
110
111It is expected that B<Tk::Image> hierarchy will evolve during the "beta"
112phase of Tk to allow dynamic or auto-loaded image types or photo formats
113(e.g. support for JPEG format for photos).
114
115=item Composite Widgets
116
117A composite is some kind of 'frame' with subwidgets which give it useful behaviour.
118B<Tk::Dialog> is an example of
119a composite widget classes built from the basic B<Tk> ones.
120It is intended that user code should not need to be aware that a particular
121class is a composite, and create and configure such widgets in the same manner
122as any other kind. The B<configure> mechanism and the methods of the
123class manipulate the subwidgets as required.
124
125Composite widgets are implemented via B<Tk::Frame> and multiple inheritance.
126The two 'frame' base classes B<Tk::Frame> and
127B<Tk::Toplevel> include the additional class B<Tk::Derived>
128in their inheritance. B<Tk::Derived> provides methods to allow additional
129B<configure> options to be defined for a widget.
130
131A Composite widget is typically defined as derived
132from B<Tk::Frame> or B<Tk::Toplevel>
133(e.g. B<Tk::Dialog>).
134
135=back
136
137=cut
138