App-makebeamerinfo

 view release on metacpan or  search on metacpan

lib/App/makebeamerinfo/GUI.pm  view on Meta::CPAN

package App::makebeamerinfo::GUI;

use strict;
use warnings;

use Tk;
use Tk::LabFrame;
use Tk::LabEntry;
use Tk::NoteBook;

use App::makebeamerinfo;
our @ISA = qw/App::makebeamerinfo/;

sub new {
  my $class = shift;

  my $self = $class->SUPER::new(@_);

  #rebless
  bless $self, $class;

  $self->{gui} = $self->create_window;

  return $self;
}

sub userMessage {
  my $self = shift;
  my ($title, $message) = @_;
  $self->{gui}{'mw'} -> messageBox(-title=> $title, -message=> $message);
}

sub run {
  MainLoop();
}

sub create_window {
  #creates Tk window

  my $self = shift;

  my %gui;

  $gui{'mw'} = MainWindow->new;
  $gui{'mw'} -> title( 'Makebeamerinfo' );

  # Create Tabs
  $gui{'nb'} = $gui{'mw'} -> NoteBook() -> pack;
  $gui{'tabs'}{'setup'} = $gui{'nb'} -> add(
    'setup',
    -label => "Setup"
  );
  $gui{'tabs'}{'transitions'} = $gui{'nb'} -> add(
    'transitions',
    -label => "Transitions",
    -state => "disabled" # start disabled if defaulting to use non-custom trans_set
  );

  # Create frame to hold action buttons
  $gui{'frame'}{'actions'} = $gui{'mw'} -> Frame(
    -relief => "raised",
    -borderwidth => 2
  ) -> pack(-fill => 'x');

  # Create action buttons
  $gui{'button'}{'create'} = $gui{'frame'}{'actions'} -> Button(
    -text => "Create .info",
    -command => sub{ $self->createInfo },
  ) -> grid(-row => 1, -column => 1);
  $gui{'button'}{'about'} = $gui{'frame'}{'actions'} -> Button(
    -text => "About MBI",
    -command => sub{ $self->aboutMBI },
  ) -> grid(-row => 1, -column => 2);
  $gui{'button'}{'quit'} = $gui{'frame'}{'actions'} -> Button(
    -text => "Quit",
    -command => sub{ $self->exitProgramEarly },
  ) -> grid(-row => 1, -column => 3);



( run in 0.868 second using v1.01-cache-2.11-cpan-98e64b0badf )