App-Guiio

 view release on metacpan or  search on metacpan

lib/App/Guiio/Menues.pm  view on Meta::CPAN

				# $context_menu_handler->[$CONTEXT_MENUE_ARGUMENTS],
				# $popup_x, $popup_y,
				# ) ;
		# }
	# else
		# {
		# push @context_menu_entries, $context_menu_handler->[$CONTEXT_MENUE_SUB]->($self, $popup_x, $popup_y) ;
		# }
	# }
	
# return(\@context_menu_entries) ;
# }

#------------------------------------------------------------------------------------------------------
#Beginning of GUIIO code to handle primary GUIIOMenubar
sub create_GUIIOMenu
{
	my ($self) = @_;
	my $menu_tree = [
        _File => {
                item_type => '<Branch>',
                children => [
                        _New=> {
                                item_type       => '<StockItem>',
                                callback        => \&new_drawing,
                                accelerator     => '<ctrl>N',
                                extra_data      => 'gtk-new',
                        },
                        _Open => {
								item_type 		=> '<StockItem>',
								callback 		=> sub { $self->run_actions_by_name('Open') ;},
								accelerator		=> '<ctrl>O',
								extra_data		=> 'gtk-open',
								},
						_Save => {
                                item_type       => '<StockItem>',
                                callback        => sub { $self->run_actions_by_name('Save') ;},
                                accelerator     => '<ctrl>S',
                                extra_data      => 'gtk-save',
                        },
						Save_As => {
								item_type		=>'<StockItem>',
								callback		=> sub{ $self->run_actions_by_name(['Save',1]);},
								accelerator		=> '<ctrl><alt>S',
								extra_data		=> 'gtk-save',
							},

                        _Quit => {
                                item_type       => '<StockItem>',
                                callback        => sub { exit(0); },
                                accelerator     => '<ctrl>Q',
                                extra_data      => 'gtk-quit',
                        },
                ],
        },
        _Edit => {
                item_type => '<Branch>',
                children => [
                        _Copy => {
                                item_type       => '<StockItem>',
                                callback_action => sub {$self->run_actions_by_name('Copy to clipboard');},
                                accelerator     => '<ctrl>C',
                                extra_data      => 'gtk-copy',
                        },
                        _Paste => {
                                item_type       => '<StockItem>',
                                callback_action => sub {$self->run_actions_by_name('Insert from clipboard');},
                                accelerator     => '<ctrl>V',
                                extra_data      => 'gtk-paste',
                        },
                ],
        },
        _Help => {
                item_type => '<LastBranch>',
                children => [
                        _Help => {
                                item_type       => '<StockItem>',
                                callback_action => 3,
                                accelerator     => '<ctrl>H',
                                extra_data      => 'gtk-help',
                        }
                ],
        },
];

my $menu = Gtk2::SimpleMenu->new (
                menu_tree               => $menu_tree,
                default_callback        => \&default_callback,
        );

return $menu;
}
		sub new_document {
        print "user wants a new document.\n";
}

sub save_document {
        print "user wants to save.\n";
}

sub default_callback {
        my (undef, $callback_action, $menu_item) = @_;
        print "callback action number $callback_action\n";
}

1 ;
	



( run in 0.860 second using v1.01-cache-2.11-cpan-2398b32b56e )