Gtk2-Ex-FormFactory
view release on metacpan or search on metacpan
tutorial/music.pl view on Meta::CPAN
content => [
Gtk2::Ex::FormFactory::Window->new (
title => "Music database - Gtk2::Ex::FormFactory example",
properties => {
default_width => 640,
default_height => 640,
},
quit_on_close => 1,
content => [
$self->build_menu,
Gtk2::Ex::FormFactory::Table->new (
expand => 1,
layout => "
+----------------------------------------------------+
| Buttons |
+----------------------------------------------------+
| Sep |
+----------------+>----------------------------------+
^ Artist list | Artist Form |
| +-----------------------------------+
| | Album List |
| +-----------------------------------+
| | Album Form |
| +-----------------------------------+
| ^ Song List |
| +-----------------------------------+
| | Song Form |
+----------------+-----------------------------------+
",
content => [
$self->build_buttons,
Gtk2::Ex::FormFactory::HSeparator->new(),
$self->build_artist_list,
$self->build_artist_form,
$self->build_album_list,
$self->build_album_form,
$self->build_song_list,
$self->build_song_form,
],
),
],
),
],
);
$ff->open;
$ff->update;
$self->set_form_factory($ff);
if ( !$self->get_config->get_db_connection_ok ) {
$self->open_preferences;
}
1;
}
sub build_menu {
my $self = shift;
return Gtk2::Ex::FormFactory::Menu->new (
menu_tree => [
"_File" => {
item_type => '<Branch>',
children => [
"_Exit" => {
item_type => '<StockItem>',
extra_data => 'gtk-quit',
callback => sub {
$self->get_form_factory->close;
Gtk2->main_quit;
},
accelerator => '<ctrl>q',
},
],
},
"_Edit" => {
item_type => '<Branch>',
children => [
"_Preferences" => {
item_type => '<StockItem>',
extra_data => 'gtk-preferences',
callback => sub { $self->open_preferences },
accelerator => '<ctrl>p',
},
"sep1" => {
item_type => '<Separator>',
},
"Add _artist" => {
object => "db",
callback => sub { $self->add_artist },
accelerator => '<ctrl>a',
},
"Ad_d album" => {
object => "artist",
callback => sub { $self->add_album },
accelerator => '<ctrl>d',
},
"Add _song" => {
object => "album",
callback => sub { $self->add_song },
accelerator => '<ctrl>s',
},
"sep2" => {
item_type => '<Separator>',
},
"_Delete selected artist" => {
object => "artist",
callback => sub { $self->delete_artist },
accelerator => '<ctrl><alt>a',
},
"D_elete selected album" => {
object => "album",
callback => sub { $self->delete_album },
accelerator => '<ctrl><alt>d',
},
"De_lete selected song" => {
object => "song",
callback => sub { $self->delete_song },
accelerator => '<ctrl><alt>s',
},
( run in 1.175 second using v1.01-cache-2.11-cpan-524268b4103 )