package Padre::Plugin::Mojolicious::FBP::NewApp;

## no critic

# This module was generated by Padre::Plugin::FormBuilder::Perl.
# To change this module edit the original .fbp file and regenerate.
# DO NOT MODIFY THIS FILE BY HAND!

use 5.008005;
use utf8;
use strict;
use warnings;
use Padre::Wx             ();
use Padre::Wx::Role::Main ();

our $VERSION = '0.06';
our @ISA     = qw{
	Padre::Wx::Role::Main
	Wx::Dialog
};

sub new {
	my $class  = shift;
	my $parent = shift;

	my $self = $class->SUPER::new(
		$parent,
		-1,
		Wx::gettext("New Mojolicious Application"),
		Wx::DefaultPosition,
		[ 322, 146 ],
		Wx::DEFAULT_DIALOG_STYLE,
	);

	my $app_name_label = Wx::StaticText->new(
		$self,
		-1,
		Wx::gettext("Application Name:"),
	);

	$self->{app_name} = Wx::TextCtrl->new(
		$self,
		-1,
		"",
		Wx::DefaultPosition,
		Wx::DefaultSize,
	);

	$self->{directory_label} = Wx::StaticText->new(
		$self,
		-1,
		Wx::gettext("Parent Directory:"),
	);

	$self->{directory} = Wx::DirPickerCtrl->new(
		$self,
		-1,
		"",
		Wx::gettext("Select a folder"),
		Wx::DefaultPosition,
		Wx::DefaultSize,
		Wx::DIRP_DEFAULT_STYLE,
	);

	$self->{ok_button} = Wx::Button->new(
		$self,
		-1,
		Wx::gettext("OK"),
		Wx::DefaultPosition,
		Wx::DefaultSize,
	);

	Wx::Event::EVT_BUTTON(
		$self,
		$self->{ok_button},
		sub {
			shift->on_ok_clicked(@_);
		},
	);

	$self->{cancel_button} = Wx::Button->new(
		$self,
		-1,
		Wx::gettext("Cancel"),
		Wx::DefaultPosition,
		Wx::DefaultSize,
	);

	Wx::Event::EVT_BUTTON(
		$self,
		$self->{cancel_button},
		sub {
			shift->on_cancel_clicked(@_);
		},
	);

	my $content_sizer = Wx::FlexGridSizer->new( 2, 2, 0, 0 );
	$content_sizer->SetFlexibleDirection(Wx::BOTH);
	$content_sizer->SetNonFlexibleGrowMode(Wx::FLEX_GROWMODE_SPECIFIED);
	$content_sizer->Add( $app_name_label,          0, Wx::ALIGN_CENTER_VERTICAL | Wx::LEFT | Wx::RIGHT | Wx::TOP, 5 );
	$content_sizer->Add( $self->{app_name},        0, Wx::ALIGN_CENTER_VERTICAL | Wx::ALL,                        5 );
	$content_sizer->Add( $self->{directory_label}, 0, Wx::ALIGN_CENTER_VERTICAL | Wx::ALL,                        5 );
	$content_sizer->Add( $self->{directory},       0, Wx::ALIGN_CENTER_VERTICAL | Wx::ALL | Wx::EXPAND,           5 );

	my $buttons_sizer = Wx::BoxSizer->new(Wx::HORIZONTAL);
	$buttons_sizer->Add( 20, 0, 1, Wx::EXPAND, 5 );
	$buttons_sizer->Add( $self->{ok_button},     0, Wx::ALL, 2 );
	$buttons_sizer->Add( $self->{cancel_button}, 0, Wx::ALL, 2 );

	my $vsizer = Wx::BoxSizer->new(Wx::VERTICAL);
	$vsizer->Add( $content_sizer, 1, Wx::EXPAND, 5 );
	$vsizer->Add( $buttons_sizer, 0, Wx::EXPAND, 5 );

	my $hsizer = Wx::BoxSizer->new(Wx::HORIZONTAL);
	$hsizer->Add( $vsizer, 1, Wx::ALL | Wx::EXPAND, 5 );

	$self->SetSizer($hsizer);
	$self->Layout;

	return $self;
}

sub ok_button {
	$_[0]->{ok_button};
}

sub on_ok_clicked {
	$_[0]->main->error('Handler method on_ok_clicked for event ok_button.OnButtonClick not implemented');
}

sub on_cancel_clicked {
	$_[0]->main->error('Handler method on_cancel_clicked for event cancel_button.OnButtonClick not implemented');
}

1;

# Copyright 2008-2011 The Padre development team as listed in Padre.pm.
# LICENSE
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl 5 itself.

