SYNOPSIS

        package PerlPanel::Applet::MyMenu;
        use base 'PerlPanel::MenuBase';
        use strict;

sub create_menu {

my $self = shift;

$self->menu->append($self->menu_item( 'Hello World!', $icon, sub { print "Hello World!\n" } )); return 1; }

1;

DESCRIPTION

\*(C`PerlPanel::MenuBase\*(C' is a base class that does as much as possible to abstract the nuts-and-bolts details of building a PerlPanel menu applet. If you use \*(C`PerlPanel::MenuBase\*(C' to write a menu applet, you don't need to worry about menu hierarchies or icons - all that's done for you. Instead to can concentrate on building your menu backend.

USAGE

\*(C`PerlPanel::MenuBase\*(C' is a base class - that means, you must write a Perl module that inherits from it. The \*(C`use base\*(C' line in the example above is one way you can do this. Then you simply override the \*(C`configure()\*(C' and \*(C`create_menu()\*(C' methods with your own.

STANDARD METHODS

$self->add_control_items;

This method appends the standard set of PerlPanel control options to the menu. The menu will subsequently look like this:

| | | ----------------------------- | | Lock Screen | | Run Program... | | Take Screenshot... | | ----------------------------- | | Shut Down... | | Reboot... | | ----------------------------- | | Configure... | | Close Panel | | Add To Panel > | | ----------------------------- | | About... | +-------------------------------+

my $item = $self->menu_item($label, $icon, $callback);

This returns a ready-prepared Gtk2::ImageMenuItem. This method does a lot of hard work for you - $label is set as the text label for the item, and if defined, $callback is connected to the 'activate' signal.

$icon can be either a file, a \*(C`Gtk::Gdk::Pixbuf\*(C', or a stock \s-1ID\s0. \*(C`menu_item\*(C' will automagically resize the icon to fit in with the rest of the menu.

my $icon = $self->get_icon($string, $is_submenu_parent);

This method is deprecated and is no longer available. Use PerlPanel::lookup_icon() instead.

RELATED TO PerlPanel::MenuBase…

* perlpanel
* perlpanel-applet-howto
* Gtk2