.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Gtk2::SimpleMenu 3pm" .TH Gtk2::SimpleMenu 3pm "2019-09-16" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Gtk2::SimpleMenu \- A simple interface to Gtk2's ItemFactory for creating application menus .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Gtk2 \*(Aq\-init\*(Aq; \& use Gtk2::SimpleMenu; \& \& my $menu_tree = [ \& _File => { \& item_type => \*(Aq\*(Aq, \& children => [ \& _New => { \& callback => \e&new_cb, \& callback_action => 0, \& accelerator => \*(AqN\*(Aq, \& }, \& _Save => { \& callback_action => 1, \& callback_data => \*(Aqper entry cbdata\*(Aq, \& accelerator => \*(AqS\*(Aq, \& }, \& _Exec => { \& item_type => \*(Aq\*(Aq, \& callback_action => 2, \& extra_data => \*(Aqgtk\-execute\*(Aq, \& }, \& _Quit => { \& callback => sub { Gtk2\->main_quit; }, \& callback_action => 3, \& accelerator => \*(AqQ\*(Aq, \& }, \& ], \& }, \& _Mode => { \& _First => { \& item_type => \*(Aq\*(Aq, \& callback => \e&mode_callback, \& callback_action => 4, \& groupid => 1, \& }, \& _Second => { \& item_type => \*(Aq\*(Aq, \& callback => \e&mode_callback, \& callback_action => 5, \& groupid => 1, \& }, \& _Third => { \& item_type => \*(Aq\*(Aq, \& callback => \e&mode_callback, \& callback_action => 6, \& groupid => 1, \& }, \& } \& _Help => { \& children => [ \& _Tearoff => { \& item_type => \*(Aq\*(Aq, \& }, \& _CheckItem => { \& item_type => \*(Aq\*(Aq, \& callback_action => 7, \& }, \& Separator => { \& item_type => \*(Aq\*(Aq, \& }, \& _Contents => { \& callback_action => 8, \& }, \& _About => { \& callback_action => 9, \& }, \& ] \& } \& ]; \& \& my $menu = Gtk2::SimpleMenu\->new ( \& menu_tree => $menu_tree, \& default_callback => \e&default_callback, \& user_data => \*(Aquser_data\*(Aq, \& ); \& \& # an example of how to get to the menuitems. \& $menu\->get_widget(\*(Aq/File/Save\*(Aq)\->activate; \& \& $container\->add ($menu\->{widget}); .Ve .SH "ABSTRACT" .IX Header "ABSTRACT" SimpleMenu is an interface for creating application menubars in as simple a manner as possible. Its main benefit is that the menu is specified as a tree, which is the natural representation of such a menu. .SH "DESCRIPTION" .IX Header "DESCRIPTION" SimpleMenu aims to simplify the design and management of a complex application menu bar by allowing the structure to be specified as a multi-rooted tree. Much the same functionality is provided by Gtk2::ItemFactory, but the data provided as input is a 1\-D array and the hierarchy of the menu is controlled entirely by the path components. This is not ideal when languages such as Perl provide for simple nested data structures. .PP Another advantage of the SimpleMenu widget is that it simplifies the creation and use of accelerators. .PP SimpleMenu is a child of Gtk2::ItemFactory, so that it may be treated as such. Any method that can be called on a ItemFactory can be called on a SimpleMenu. .SH "OBJECT HIERARCHY" .IX Header "OBJECT HIERARCHY" .Vb 4 \& Glib::Object \& +\-\-\- Gtk2::Object \& +\-\-\- Gtk2::ItemFactory \& +\-\-\- Gtk2::SimpleMenu .Ve .SH "FUNCTIONS" .IX Header "FUNCTIONS" .ie n .IP "$menu = Gtk2::SimpleMenu\->new (menu_tree => $menu_tree, ...)" 4 .el .IP "\f(CW$menu\fR = Gtk2::SimpleMenu\->new (menu_tree => \f(CW$menu_tree\fR, ...)" 4 .IX Item "$menu = Gtk2::SimpleMenu->new (menu_tree => $menu_tree, ...)" Creates a new Gtk2::SimpleMenu object with the specified tree. Optionally key value paris providing a default_callback and user_data can be provided as well. After creating the menu object all of the subsequent widgets will have been created and are ready for use. .SH "MEMBER VARIABLES" .IX Header "MEMBER VARIABLES" .ie n .IP "$menu\->{widget}" 4 .el .IP "\f(CW$menu\fR\->{widget}" 4 .IX Item "$menu->{widget}" The Gtk2::MenuBar root of the SimpleMenu. This is what should be added to the widget which will contain the SimpleMenu. .Sp .Vb 1 \& $container\->add ($menu\->{widget}); .Ve .ie n .IP "$menu\->{accel_group}" 4 .el .IP "\f(CW$menu\fR\->{accel_group}" 4 .IX Item "$menu->{accel_group}" The Gtk2::AccellGroup created by the menu tree. Normally accell_group would be added to the main window of an application, but this is only necessary if accelerators are being used in the menu tree's items. .Sp .Vb 1 \& $win\->add_accel_group ($menu\->{accel_group}); .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBPerl\fR\|(1), \fBGlib\fR\|(3pm), \fBGtk2\fR\|(3pm), examples/simple_menu.pl. .PP Note: Gtk2::SimpleMenu is deprecated in favor of Gtk2::Ex::Simple::Menu, part of the Gtk2\-Perl\-Ex project at . .SH "AUTHORS" .IX Header "AUTHORS" .Vb 1 \& Ross McFarland .Ve .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright 2003 by the Gtk2\-Perl team. .PP This library is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 Library General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. .PP This library is distributed in the hope that it will be useful, but \s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE.\s0 See the \s-1GNU\s0 Library General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, \s-1MA\s0 02110\-1301 \s-1USA.\s0