Orac-alpha
view release on metacpan or search on metacpan
Shell/Menu.pm view on Meta::CPAN
sub menu_edit {
my ($self, $menus_ref) = @_;
$menus_ref->AddItems(
[ "command" => qq/External Editor/, -command => sub {
my $f = $self->edit->external_edit($self->get_all_text_buffer);
$self->replace_buffer($f);
} ],
"-",
[ "command" => qq/Clear All/, -command => sub { $self->clear_all } ],
[ "command" => qq/Clear Entry/, -command => sub { $self->clear_entry } ],
[ "command" => qq/Clear Result/, -command => sub { $self->clear_result } ],
"-",
);
}
sub menu_meta {
my ($self, $menus_ref) = @_;
$menus_ref->AddItems(
[ "command" => "All Tables", -command => sub { $self->meta(q{all_tables}) } ],
"-",
);
}
sub menu_options {
my ($self, $menus_ref) = @_;
# Options menu
my $menu_ref =$self->menus->{options}->menu unless $menus_ref;
# Autoexecute: When autoexec is on, statements ending in [;/] will
# execute when the enter/return is pressed.
$menus_ref->AddItems(
[ "checkbutton" => " Autoexec",
-variable => \$self->options->{autoexec}],
[ "checkbutton" => " Debug",
-variable => \$self->options->{debug} ],
[ "checkbutton" => " Stop on Error",
-variable => \$self->options->{stop_on_error} ],
[ "checkbutton" => " Ignore Comments",
-variable => \$self->options->{ignore_comments} ],
[ "checkbutton" => " Write Error to Results",
-variable => \$self->options->{write_error_rslt} ],
[ "checkbutton" => " Minimize Main Window",
-variable => \$self->options->{mini_main_wd} ],
"-",
);
my $opt_disp = $menus_ref->Menu;
my @formats = $self->load_formats;
my $_f;
foreach (@formats) {
$opt_disp->radiobutton( -label => $_,
-variable => \$self->options->{display_format},
-value => $_,
);
}
$menus_ref->cascade( -label => qq{Display format...});
$menus_ref->entryconfigure(
qq{Display format...}, -menu => $opt_disp,
-state => q{normal});
# Create the entries for rows returned.
my $opt_row = $menus_ref->Menu;
foreach (qw/1 10 25 50 100 all/) {
$opt_row->radiobutton( -label => $_, -variable => \$self->options->{rows},
-value => $_ );
}
$menus_ref->cascade( -label => qq{Rows return...} );
$menus_ref->entryconfigure( qq{Rows return...},
-menu => $opt_row,
-state => q{disabled});
}
sub menu_help {
my ($self, $menus_ref) = @_;
my $menu_ref =$self->menus->{help}->menu unless $menus_ref;
# Help menu
$menus_ref->AddItems(
[ "command" => "Index", -command => sub { $self->tba } ],
"-",
[ "command" => "About", -command => sub { $self->tba } ],
);
}
sub menu_button {
my $self = shift;
# Create a button bar.
#$dbistatus = "Creating menu button bar";
my $bf = $self->dbiwd->Frame( -relief => 'ridge', -borderwidth => 2 );
$bf->pack( -side => 'top', -anchor => 'n', -expand => 0, -fill => 'x' );
# need to invoke the execute in other parts of the application.
$self->buttons({q{exec} =>
$bf->Button( -text=> 'Execute',
-image => $self->icon(q{exec}),
-command=> sub{ $self->doit() }
)->pack(side=>'left')});
$self->buttons(
{q{execall} => $bf->Button( -text=> 'Execute All',
-image => $self->icon(q{execall}),
-command=> sub{ $self->execute_all_buffer() }
)->pack(side=>'left'),
q{clear} => $bf->Button( -text=> q{Clear},
-image => $self->icon(q{clear}),
-command=>sub{ $self->clear_all(); }
)->pack(side=>q{left}),
q{commit} => $bf->Button( -text=> q{Commit},
-image => $self->icon(q{commit}),
-command=> sub{ $self->commit() },
-state => q{disabled}
)->pack(side=> q{left}),
q{rollback} => $bf->Button( -text=> q{Rollback},
-image => $self->icon(q{rollback}),
-command=> sub{ $self->rollback() },
-state => q{disabled}
)->pack(side=> q{left})});
# Put the logo on this bar.
( run in 0.661 second using v1.01-cache-2.11-cpan-0d23b851a93 )