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 / Item.pod
CommitLineData
86530b38
AT
1
2=head1 NAME
3
4Tk::Menu::Item - Base class for Menu items
5
6=for pm Tk/Menu/Item.pm
7
8=for category Implementation
9
10=head1 SYNOPSIS
11
12 require Tk::Menu::Item;
13
14 my $but = $menu->Button(...);
15 $but->configure(...);
16 my $what = $but->cget();
17
18 package Whatever;
19 require Tk::Menu::Item;
20 @ISA = qw(Tk::Menu::Item);
21
22 sub PreInit
23 {
24 my ($class,$menu,$info) = @_;
25 $info->{'-xxxxx'} = ...
26 my $y = delete $info->{'-yyyy'};
27 }
28
29=head1 DESCRIPTION
30
31Tk::Menu::Item is the base class from which Tk::Menu::Button,
32Tk::Menu::Cascade, Tk::Menu::Radiobutton and Tk::Menu::Checkbutton are derived.
33There is also a Tk::Menu::Separator.
34
35Constructors are declared so that $menu-E<gt>Button(...) etc. do what you would
36expect.
37
38The C<-label> option is pre-processed allowing ~ to be prefixed to the character
39to derive a C<-underline> value. Thus
40
41 $menu->Button(-label => 'Goto ~Home',...)
42
43 is equivalent to
44
45 $menu->Button(-label => 'Goto Home', -underline => 6, ...)
46
47The C<Cascade> menu item creates a sub-menu and accepts
48these options:
49
50=over 4
51
52=item B<-menuitems>
53
54A list of items for the sub-menu.
55Within this list (which is also accepted by Menu and Menubutton) the first
56two elements of each item should be the "constructor" name and the label:
57
58 -menuitems => [
59 [Button => '~Quit', -command => [destroy => $mw]],
60 [Checkbutton => '~Oil', -variable => \$oil],
61 ]
62
63=item B<-postcommand>
64
65A callback to be invoked before posting the menu.
66
67=item B<-tearoff>
68
69Specifies whether sub-menu can be torn-off or not.
70
71=item B<-menuvar>
72
73Scalar reference that will be set to the newly-created sub-menu.
74
75=back
76
77The returned object is currently a blessed reference to an array of two items:
78the containing Menu and the 'label'.
79Methods C<configure> and C<cget> are mapped onto underlying C<entryconfigure>
80and C<entrycget>.
81
82The main purpose of the OO interface is to allow derived item classes to
83be defined which pre-set the options used to create a more basic item.
84
85=head1 BUGS
86
87This OO interface is very new. Using the label as the "key" is a problem
88for separaror items which don't have one. The alternative would be to
89use an index into the menu but that is a problem if items are deleted
90(or inserted other than at the end).
91
92There should probably be a PostInit entry point too, or a more widget like
93defered 'configure'.
94
95=cut
96