The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

hide

Remove the dialog window.

DESCRIPTION

Implementation of a horizontal menu, such as the menu bar at the top of the screen.

new

add_item

Adds the given item to this menu.

highlight_attrs

Default attributes - show highlighted items in bold

normal_attrs

Apply a blue background to the standard menu

new

Instantiates a new menu using vertical style.

add_item

Adds a new item to this menu.

new

Instantiate a new menu item.

Takes the following named parameters:

  • label - what to display as the label, currently text only, may include an accelerator key using the & prefix for example '&File' would be 'File' with Alt-F as the shortcut

  • on_activate - optional code to call when the item is activated

sap

parent_menu

Returns the parent for this menu.

bind_key

Binds the key combination to the given coderef.

Expects two parameters: the key combination, and the coderef to call when that combination is pressed.

Examples of key combinations:

 Alt-F
 Alt-f
 x
 Ctrl-X
 Shift-Y
 Ctrl-Alt-Z
 Alt-Ctrl-Insert

add_item

Adds this item to a parent Tickit::Widget::Menubar::Item.

activate

Calls the activation function if one is defined. See the on_activate parameter to "new" for setting this.

set_parent_menu

Sets the parent for this item. Should be another Tickit::Widget::Menubar::Item or Tickit::Widget::Menubar.

Returns the current submenu.

Returns the floating window used for the menu popup.

show_menu

Shows the menu. Instantiates a new floating window.

DESCRIPTION

Implements the logic to wrap the horizontal and vertical menus comprising a typical Menubar layout.

        $menu->on_highlight_changed(
                sub {
                        my $menu = shift;
                        if($self->popup) {
                                warn "Should change popup to " . $menu->highlighted_item;
                        }
                }
        );
        $menu->bind_key(
                sub {
                        my ($type, $str, $key) = @_;
                        if($type eq 'key') {
                                if($str eq 'Escape') {
                                        warn "Had escape";
                                        return 0 unless $self->popup;
                                        $self->popup->hide;
                                        delete $self->{popup};
                                        $menu->redraw;
                                        return 0;
                                }
                        }
                        return 1;
                }
        );
        $menu;
}