4
Tk::Menu::Item - Base class for Menu items
6
=for pm Tk/Menu/Item.pm
8
=for category Implementation
12
require Tk::Menu::Item;
14
my $but = $menu->Button(...);
16
my $what = $but->cget();
19
require Tk::Menu::Item;
20
@ISA = qw(Tk::Menu::Item);
24
my ($class,$menu,$info) = @_;
25
$info->{'-xxxxx'} = ...
26
my $y = delete $info->{'-yyyy'};
31
Tk::Menu::Item is the base class from which Tk::Menu::Button,
32
Tk::Menu::Cascade, Tk::Menu::Radiobutton and Tk::Menu::Checkbutton are derived.
33
There is also a Tk::Menu::Separator.
35
Constructors are declared so that $menu-E<gt>Button(...) etc. do what you would
38
The C<-label> option is pre-processed allowing ~ to be prefixed to the character
39
to derive a C<-underline> value. Thus
41
$menu->Button(-label => 'Goto ~Home',...)
45
$menu->Button(-label => 'Goto Home', -underline => 6, ...)
47
The C<Cascade> menu item creates a sub-menu and accepts
54
A list of items for the sub-menu.
55
Within this list (which is also accepted by Menu and Menubutton) the first
56
two elements of each item should be the "constructor" name and the label:
59
[Button => '~Quit', -command => [destroy => $mw]],
60
[Checkbutton => '~Oil', -variable => \$oil],
65
A callback to be invoked before posting the menu.
69
Specifies whether sub-menu can be torn-off or not.
73
Scalar reference that will be set to the newly-created sub-menu.
77
The returned object is currently a blessed reference to an array of two items:
78
the containing Menu and the 'label'.
79
Methods C<configure> and C<cget> are mapped onto underlying C<entryconfigure>
82
The main purpose of the OO interface is to allow derived item classes to
83
be defined which pre-set the options used to create a more basic item.
87
This OO interface is very new. Using the label as the "key" is a problem
88
for separaror items which don't have one. The alternative would be to
89
use an index into the menu but that is a problem if items are deleted
90
(or inserted other than at the end).
92
There should probably be a PostInit entry point too, or a more widget like