use Wx;
use strict;

use Wx qw( wxDefaultSize wxDefaultPosition wxID_OK wxID_SAVE wxID_SAVEAS wxID_CANCEL wxID_YES wxID_EXIT wxID_ABOUT wxID_HELP );
use Wx qw( wxVERTICAL wxHORIZONTAL wxALL wxLEFT wxRIGHT wxTOP wxBOTTOM wxCENTRE wxGROW wxADJUST_MINSIZE );
use Wx qw( wxALIGN_RIGHT wxALIGN_BOTTOM wxALIGN_CENTER wxALIGN_CENTER_VERTICAL wxALIGN_CENTER_HORIZONTAL );
use Wx qw( wxLI_HORIZONTAL );

# Bitmap functions

use Wx qw( wxNullBitmap wxBITMAP_TYPE_PNG );

# Window functions

use vars qw($ID_PROGRESS_TXT); $ID_PROGRESS_TXT = 10000;
use vars qw($ID_STATICBITMAP); $ID_STATICBITMAP = 10001;
use vars qw($ID_PROGRESS_GAUGE); $ID_PROGRESS_GAUGE = 10002;
use vars qw($ID_LINE); $ID_LINE = 10003;
use vars qw($ID_PROGRESS_OK); $ID_PROGRESS_OK = 10004;
use vars qw($ID_PROGRESS_TXT2); $ID_PROGRESS_TXT2 = 10005;

sub ProcessingProgress {
    my( $item0 ) = Wx::BoxSizer->new( wxVERTICAL );
    
    my( $item1 ) = Wx::BoxSizer->new( wxVERTICAL );
    
    my( $item2 ) = Wx::StaticText->new( $_[0], $main::ID_PROGRESS_TXT, "", wxDefaultPosition, wxDefaultSize, 0 );
    $item1->AddWindow( $item2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );

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

    my( $item3 ) = Wx::StaticBitmap->new( $_[0], $main::ID_STATICBITMAP, wxNullBitmap, wxDefaultPosition, [100,100] );
    $item1->AddWindow( $item3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 10 );

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

    my( $item30 ) = Wx::StaticText->new( $_[0], $main::ID_PROGRESS_TXT2, "", wxDefaultPosition, wxDefaultSize, 0 );
    $item1->AddWindow( $item30, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    my( $item4 ) = Wx::Gauge->new( $_[0], $main::ID_PROGRESS_GAUGE, 100, wxDefaultPosition, [400,12], 0 );
    $item1->AddWindow( $item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 10 );

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

    my( $item5 ) = Wx::StaticLine->new( $_[0], $main::ID_LINE, wxDefaultPosition, [20,-1], wxLI_HORIZONTAL );
    $item0->AddWindow( $item5, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    my( $item6 ) = Wx::BoxSizer->new( wxHORIZONTAL );
    
    my( $item7 ) = Wx::Button->new( $_[0], $main::ID_PROGRESS_OK, "OK", wxDefaultPosition, wxDefaultSize, 0 );
    $item6->AddWindow( $item7, 0, wxALIGN_CENTER|wxALL, 5 );

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

    my( $set_size ) = @_ >= 3 ? $_[2] : 1;
    my( $call_fit ) = @_ >= 2 ? $_[1] : 1;
    if( $set_size == 1 ) {
         $_[0]->SetSizer( $item0 );
         
         if( $call_fit == 1 ) {
             $item0->SetSizeHints( $_[0] );
         }
    }
    
    $item0;
}

