Gtk2::OSXApplication - Perl extension for mac integration code GtkOSXApplication
use Gtk2 '-init'; use Gtk2::OSXApplication; my $osxapp=new Gtk2::OSXApplication(); ... $osxapp->set_menu_bar($bar); $osxapp->ready();
A sample from my CuePlay application:
if ($os eq "darwin") { require Gtk2::OSXApplication; my $app=new Gtk2::OSXApplication(); my $menubar=Gtk2::MenuBar->new(); my $menu=Gtk2::Menu->new(); my $item=Gtk2::MenuItem->new_with_label("Info"); $item->set_submenu($menu); my $about=Gtk2::MenuItem->new_with_label("About"); $menu->append($about); $menubar->append($item); $about->show(); $item->show(); $menu->show(); $menubar->show(); $app->set_menu_bar($menubar); $app->ready(); }
Creates an OSXApplication object. Do this asap after use Gtk2 '-init'. Exports the following functions of GtkOSXApplication:
$self->set_menu_bar($menu_shell) $self->sync_menubar() $self->insert_app_menu_item($menu_item,$index) $self->set_window_menu($menu_item) $self->set_help_menu($menu_item) $self->set_dock_menu($menu_shell) $self->set_dock_icon_pixbuf($pixbuf) $self->set_dock_icon_resource($name,$type,$subdir) $self->activate() Activates this application. Use this before using Gtk::Window->present();
Hans Oesterholt, <oesterhol@cpan.org>
Copyright (C) 2012 by fam. Oesterholt
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.3 or, at your option, any later version of Perl 5 you may have available.
To install Gtk2::OSXApplication, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gtk2::OSXApplication
CPAN shell
perl -MCPAN -e shell install Gtk2::OSXApplication
For more information on module installation, please visit the detailed CPAN module installation guide.