NAME
LibUI::MenuItem - Menu Item Use in Conjunction with LibUI::Menu
SYNOPSIS
use LibUI ':all';
use LibUI::Window;
use LibUI::Menu;
Init && die;
my $mnuTest = LibUI::Menu->new('Test');
my $mnuCheck = $mnuTest->appendCheckItem('Target');
$mnuTest->appendSeparator;
$mnuTest->appendItem('Enable')->onClicked( sub { $mnuCheck->enable }, undef );
$mnuTest->appendItem('Disable')->onClicked( sub { $mnuCheck->disable }, undef );
$mnuTest->appendItem('Check')->onClicked( sub { $mnuCheck->setChecked(1) }, undef );
$mnuTest->appendItem('Uncheck')->onClicked( sub { $mnuCheck->setChecked(0) }, undef );
my $window = LibUI::Window->new( 'Hi', 320, 100, 1 );
$window->onClosing(
sub {
Quit();
return 1;
},
undef
);
$window->show;
Main();
DESCRIPTION
A LibUI::MenuItem object represents a menu item used in conjunction with LibUI::Menu.
Functions
Not a lot here but... well, it's just a menu item.
checked( )
if( $mnu_i->checked ) {
...;
}
Returns whether or not the menu item's checkbox is checked.
disable( )
$mnu_i->disable;
Disables the menu item.
Menu item is grayed out and user interaction is not possible.
enable( )
$mnu_i->enable;
Enables the menu item.
onClicked( ... )
$chk->onClicked(
sub {
my ($ctrl, $win, $data) = @_;
warn $ctrl->text;
}, undef);
Registers a callback for when the checkbox is toggled by the user.
Expected parameters include:
$callback- CodeRef that should expect the following:$data- user data to be passed to the callback
setChecked( ... )
$chk->setChecked( 1 );
Sets whether or not the menu item's checkbox is checked.
To be used only with items created via appendCheckItem( ... ).
See Also
LICENSE
Copyright (C) Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
Sanko Robinson <sanko@cpan.org>