use Wx;
use strict;

use Wx qw( wxDefaultSize wxDefaultPosition wxNullAnimation wxNullFont wxBLACK );
use Wx qw( wxID_OK wxID_APPLY wxID_SAVE wxID_SAVEAS wxID_CANCEL wxID_YES wxID_NO wxID_EXIT wxID_ABOUT wxID_HELP );
use Wx qw( wxVERTICAL wxHORIZONTAL wxALL wxLEFT wxRIGHT wxTOP wxBOTTOM wxCENTRE wxGROW );
use Wx qw( wxALIGN_RIGHT wxALIGN_BOTTOM wxALIGN_CENTER wxALIGN_CENTER_VERTICAL wxALIGN_CENTER_HORIZONTAL );
use Wx qw( wxTE_PASSWORD );
use Wx::Locale;

# Bitmap functions

use Wx qw( wxNullBitmap wxBITMAP_TYPE_PNG );

# Window functions

use vars qw($ID_TEXT); $ID_TEXT = 10000;
use vars qw($ID_PWG_URL); $ID_PWG_URL = 10001;
use vars qw($ID_PWG_USERNAME); $ID_PWG_USERNAME = 10002;
use vars qw($ID_PWG_PASSWORD); $ID_PWG_PASSWORD = 10003;
use vars qw($ID_PWG_OK); $ID_PWG_OK = 10004;
use vars qw($ID_PWG_OFFLINE); $ID_PWG_OFFLINE = 10005;
use vars qw($ID_PWG_CANCEL); $ID_PWG_CANCEL = 10006;

sub Login {
    my( $parent ) = $_[0];
    my( $item0 ) = Wx::BoxSizer->new( wxVERTICAL );
    
    $item0->AddSpace( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );

    my( $item2 ) = Wx::StaticBox->new( $parent, -1, "" );
    my( $item1 ) = Wx::StaticBoxSizer->new( $item2, wxVERTICAL );
    
    my( $item3 ) = Wx::FlexGridSizer->new( 0, 2, 0, 0 );
    
    my( $item4 ) = Wx::StaticText->new( $parent, $main::ID_TEXT, gettext("Piwigo url"), wxDefaultPosition, wxDefaultSize, 0 );
    $item3->AddWindow( $item4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    my( $item5 ) = Wx::TextCtrl->new( $parent, $main::ID_PWG_URL, "", wxDefaultPosition, [400,-1], 0 );
    $item3->AddWindow( $item5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    my( $item6 ) = Wx::StaticText->new( $parent, $main::ID_TEXT, gettext("Admin. username :"), wxDefaultPosition, wxDefaultSize, 0 );
    $item3->AddWindow( $item6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    my( $item7 ) = Wx::TextCtrl->new( $parent, $main::ID_PWG_USERNAME, "", wxDefaultPosition, [200,-1], 0 );
    $item3->AddWindow( $item7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    my( $item8 ) = Wx::StaticText->new( $parent, $main::ID_TEXT, gettext("Admin. password :"), wxDefaultPosition, wxDefaultSize, 0 );
    $item3->AddWindow( $item8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    my( $item9 ) = Wx::TextCtrl->new( $parent, $main::ID_PWG_PASSWORD, "", wxDefaultPosition, [200,-1], wxTE_PASSWORD );
    $item3->AddWindow( $item9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    $item1->Add( $item3, 0, wxALIGN_CENTER|wxALL, 5 );

    $item0->Add( $item1, 0, wxALIGN_CENTER|wxALL, 5 );

    $item0->AddSpace( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );

    my( $item10 ) = Wx::BoxSizer->new( wxHORIZONTAL );
    
    my( $item11 ) = Wx::Button->new( $parent, $main::ID_PWG_OK, gettext("Connect"), wxDefaultPosition, wxDefaultSize, 0 );
    $item11->SetDefault();
    $item10->AddWindow( $item11, 0, wxALIGN_CENTER|wxALL, 5 );

    my( $item12 ) = Wx::Button->new( $parent, $main::ID_PWG_OFFLINE, gettext("Work Offline"), wxDefaultPosition, wxDefaultSize, 0 );
    $item10->AddWindow( $item12, 0, wxALIGN_CENTER|wxALL, 5 );

    my( $item13 ) = Wx::Button->new( $parent, $main::ID_PWG_CANCEL, gettext("Exit"), wxDefaultPosition, wxDefaultSize, 0 );
    $item10->AddWindow( $item13, 0, wxALIGN_CENTER|wxALL, 5 );

    $item0->Add( $item10, 0, wxALIGN_CENTER|wxALL, 5 );

    $_[0]->SetSizer( $item0 );
         
    $item0->SetSizeHints( $_[0] );
    
    $item0;
}

use Wx qw( wxITEM_NORMAL wxITEM_RADIO wxITEM_CHECK );

