class 'Fl::MenuButton';
isa 'Fl::Menu';
include 'FL/Fl_Menu_Button.H';
widget_type 'Fl_Menu_Button';

=pod

=head1 NAME

Fl::MenuButton - Button that Pops Up a Menu

=head1 Description

This is a button that when pushed pops up a menu (or hierarchy of menus)
defined by an array of Fl::MenuItem objects.

=for html <center><img src="http://www.fltk.org/doc-1.3/menu_button.png" /></center>

Normally any mouse button will pop up a menu and it is lined up below the
button as shown in the picture. However an Fl::MenuButton may also control a
pop-up menu. This is done by setting the type(). If type() is zero a normal
menu button is produced. If it is nonzero then this is a pop-up menu. The bits
in type() indicate what mouse buttons pop up the menu (see
Fl::MenuButton->popup_buttons).

The menu will also pop up in response to shortcuts indicated by putting a '&'
character in the label().

Typing the shortcut() of any of the menu items will cause callbacks exactly
the same as when you pick the item with the mouse. The '&' character in menu
item names are only looked at when the menu is popped up, however.

When the user picks an item off the menu, the item's callback is done with the
menu_button as the Fl::Widget argument. If the item does not have a callback
the menu_button's callback is done instead.

=head1 Methods

Fl::MenuButton inherits from Fl::Menu and Fl::Widget. On top of that, it
exposes the following methods...

=head2 new(...)

    my $ic_a = Fl::MenuButton->new(0, 0, 250, 500, 'Important Stuff');
    my $ic_b = Fl::MenuButton->new(0, 0, 250, 500);

The constructor creates a new widget using the given position, size, and
label.

The default boxtype is FL_UP_BOX.

The destructor removes the widget.

=cut

xs {name        => 'new',
    definitions => [
            {required => [[qw[int x]], [qw[int y]], [qw[int w]], [qw[int h]]],
             optional => [['const char *', 'label', ' 0']],
             returns  => 'Fl_Menu_Button *'
            }
    ]
};
xs {name        => 'DESTROY',
    definitions => [{returns => 'void'}]
};
xs {name        => 'draw',
    definitions => [{returns  => 'void' }
    ]
};
xs {name        => 'handle',
    definitions => [{required => [[qw[int event]]], returns  => 'int'  }
    ]
};

=pod

=head2 popup( )

Act exactly as though the user clicked the button or typed the shortcut key.

The menu appears, it waits for the user to pick an item, and if they pick one
it sets value() and does the callback or sets changed() as described above.
The menu item is returned or NULL if the user dismisses the menu.

=cut

xs {name        => 'popup',
    definitions => [
        {returns => 'const Fl_Menu_Item *'}
    ]
};

=pod

=head1 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.

=head1 AUTHOR

Sanko Robinson E<lt>sanko@cpan.orgE<gt>

=cut
