/////////////////////////////////////////////////////////////////////////////
// Name:        newwizard.cpp
// Purpose:     wxPackageNewWizard
// Author:      Julian Smart, Francesco Montorsi
// Modified by:
// Created:     05/06/2006 00:14:18
// RCS-ID:      $Id: newwizard.cpp,v 1.2 2007/01/01 20:06:20 frm Exp $
// Copyright:   (c) 2004 Francesco Montorsi
// Licence:     wxWidgets license
/////////////////////////////////////////////////////////////////////////////


// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"

#ifdef __BORLANDC__
#pragma hdrstop
#endif

#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif


#include "guipkg/newwizard.h"


// ----------------------------------------------------------------------------
// wxPackageNewWizard
// ----------------------------------------------------------------------------

IMPLEMENT_DYNAMIC_CLASS( wxPackageNewWizard, wxWizard )
BEGIN_EVENT_TABLE( wxPackageNewWizard, wxWizard )
END_EVENT_TABLE()

wxPackageNewWizard::wxPackageNewWizard( )
{
}

wxPackageNewWizard::wxPackageNewWizard( wxWindow* parent, wxWindowID id, const wxPoint& pos )
{
    Create(parent, id, pos);
}

bool wxPackageNewWizard::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos )
{
////@begin wxPackageNewWizard member initialisation
////@end wxPackageNewWizard member initialisation

////@begin wxPackageNewWizard creation
    SetExtraStyle(GetExtraStyle()|wxDIALOG_EX_CONTEXTHELP|wxWIZARD_EX_HELPBUTTON);
    wxBitmap wizardBitmap(GetBitmapResource(wxT("bin/wizard.png")));
    wxWizard::Create( parent, id, _("Create new package"), wizardBitmap, pos, wxDEFAULT_DIALOG_STYLE|wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX );

    CreateControls();
////@end wxPackageNewWizard creation
    return true;
}

void wxPackageNewWizard::CreateControls()
{
////@begin wxPackageNewWizard content construction
    wxWizard* itemWizard1 = this;

    wxPackageWizardPageIntro* itemWizardPage2 = new wxPackageWizardPageIntro( itemWizard1 );
    itemWizard1->GetPageAreaSizer()->Add(itemWizardPage2);

    wxPackageWizardPageBuildSystem* itemWizardPage11 = new wxPackageWizardPageBuildSystem( itemWizard1 );
    itemWizard1->GetPageAreaSizer()->Add(itemWizardPage11);

    wxPackageWizardPageAutodetect* itemWizardPage28 = new wxPackageWizardPageAutodetect( itemWizard1 );
    itemWizard1->GetPageAreaSizer()->Add(itemWizardPage28);

    wxPackageWizardPageFinish* itemWizardPage36 = new wxPackageWizardPageFinish( itemWizard1 );
    itemWizard1->GetPageAreaSizer()->Add(itemWizardPage36);

    wxWizardPageSimple* lastPage = NULL;
////@end wxPackageNewWizard content construction

    wxUnusedVar(lastPage);
}

bool wxPackageNewWizard::Run()
{
    wxWizardPage* startPage = NULL;
    wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
    while (node)
    {
        wxWizardPage* startPage = wxDynamicCast(node->GetData(), wxWizardPage);
        if (startPage) return RunWizard(startPage);
        node = node->GetNext();
    }

    wxUnusedVar(startPage);
    return false;
}

bool wxPackageNewWizard::ShowToolTips()
{
    return true;
}

wxBitmap wxPackageNewWizard::GetBitmapResource( const wxString& name )
{
    // Bitmap retrieval
////@begin wxPackageNewWizard bitmap retrieval
    wxUnusedVar(name);
    if (name == _T("bin/wizard.png"))
    {
        wxBitmap bitmap(_T("bin/wizard.png"), wxBITMAP_TYPE_PNG);
        return bitmap;
    }
    return wxNullBitmap;
////@end wxPackageNewWizard bitmap retrieval
}




// ----------------------------------------------------------------------------
// wxPackageWizardPageIntro
// ----------------------------------------------------------------------------

IMPLEMENT_DYNAMIC_CLASS( wxPackageWizardPageIntro, wxWizardPage )
BEGIN_EVENT_TABLE( wxPackageWizardPageIntro, wxWizardPage )
END_EVENT_TABLE()

wxPackageWizardPageIntro::wxPackageWizardPageIntro( )
{
}

wxPackageWizardPageIntro::wxPackageWizardPageIntro( wxWizard* parent )
{
    Create( parent );
}

bool wxPackageWizardPageIntro::Create( wxWizard* parent )
{
////@begin wxPackageWizardPageIntro member initialisation
////@end wxPackageWizardPageIntro member initialisation

////@begin wxPackageWizardPageIntro creation
    wxBitmap wizardBitmap(wxNullBitmap);
    wxWizardPage::Create( parent, wizardBitmap );

    CreateControls();
    if (GetSizer())
        GetSizer()->Fit(this);
////@end wxPackageWizardPageIntro creation
    return true;
}

void wxPackageWizardPageIntro::CreateControls()
{
////@begin wxPackageWizardPageIntro content construction
    wxPackageWizardPageIntro* itemWizardPage2 = this;

    wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
    itemWizardPage2->SetSizer(itemBoxSizer3);

    wxStaticText* itemStaticText4 = new wxStaticText( itemWizardPage2, wxID_STATIC, _("This wizard dialog will let you to:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer3->Add(itemStaticText4, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5);

    itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);

    wxRadioButton* itemRadioButton6 = new wxRadioButton( itemWizardPage2, ID_RADIOBUTTON, _("Create an empty package (stub for new component)"), wxDefaultPosition, wxDefaultSize, 0 );
    itemRadioButton6->SetValue(false);
    itemBoxSizer3->Add(itemRadioButton6, 0, wxALIGN_LEFT|wxALL, 5);

    wxStaticText* itemStaticText7 = new wxStaticText( itemWizardPage2, wxID_STATIC, _("A new folder with a template for a new component\nwill be created. The templates will be adapted to\nthe informations entered in the following steps."), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
    itemBoxSizer3->Add(itemStaticText7, 0, wxALIGN_RIGHT|wxALL|wxADJUST_MINSIZE, 5);

    wxRadioButton* itemRadioButton8 = new wxRadioButton( itemWizardPage2, ID_RADIOBUTTON1, _("Package an existing project"), wxDefaultPosition, wxDefaultSize, 0 );
    itemRadioButton8->SetValue(false);
    itemBoxSizer3->Add(itemRadioButton8, 0, wxALIGN_LEFT|wxALL, 5);

    wxStaticText* itemStaticText9 = new wxStaticText( itemWizardPage2, wxID_STATIC, _("The package manager will try to autodetect some\nbasic informations about your package."), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
    itemBoxSizer3->Add(itemStaticText9, 0, wxALIGN_RIGHT|wxALL|wxADJUST_MINSIZE, 5);

    itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);

////@end wxPackageWizardPageIntro content construction
}

bool wxPackageWizardPageIntro::ShowToolTips()
{
    return true;
}




// ----------------------------------------------------------------------------
// wxPackageWizardPageBuildSystem
// ----------------------------------------------------------------------------

IMPLEMENT_DYNAMIC_CLASS( wxPackageWizardPageBuildSystem, wxWizardPage )
BEGIN_EVENT_TABLE( wxPackageWizardPageBuildSystem, wxWizardPage )
END_EVENT_TABLE()


wxPackageWizardPageBuildSystem::wxPackageWizardPageBuildSystem( )
{
}

wxPackageWizardPageBuildSystem::wxPackageWizardPageBuildSystem( wxWizard* parent )
{
    Create( parent );
}

bool wxPackageWizardPageBuildSystem::Create( wxWizard* parent )
{
////@begin wxPackageWizardPageBuildSystem member initialisation
////@end wxPackageWizardPageBuildSystem member initialisation

////@begin wxPackageWizardPageBuildSystem creation
    wxBitmap wizardBitmap(wxNullBitmap);
    wxWizardPage::Create( parent, wizardBitmap );

    CreateControls();
    if (GetSizer())
        GetSizer()->Fit(this);
////@end wxPackageWizardPageBuildSystem creation
    return true;
}

void wxPackageWizardPageBuildSystem::CreateControls()
{
////@begin wxPackageWizardPageBuildSystem content construction
    wxPackageWizardPageBuildSystem* itemWizardPage11 = this;

    wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxVERTICAL);
    itemWizardPage11->SetSizer(itemBoxSizer12);

    wxStaticText* itemStaticText13 = new wxStaticText( itemWizardPage11, wxID_STATIC, _("Choose the build system you would like to use for\nthe new package:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer12->Add(itemStaticText13, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5);

    wxChoicebook* itemChoicebook14 = new wxChoicebook( itemWizardPage11, ID_CHOICEBOOK1, wxDefaultPosition, wxDefaultSize, wxCHB_DEFAULT );

    wxPanel* itemPanel15 = new wxPanel( itemChoicebook14, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
    wxBoxSizer* itemBoxSizer16 = new wxBoxSizer(wxVERTICAL);
    itemPanel15->SetSizer(itemBoxSizer16);

    wxBoxSizer* itemBoxSizer17 = new wxBoxSizer(wxHORIZONTAL);
    itemBoxSizer16->Add(itemBoxSizer17, 0, wxGROW, 5);
    wxStaticText* itemStaticText18 = new wxStaticText( itemPanel15, wxID_STATIC, _("Builds as:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer17->Add(itemStaticText18, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);

    wxString itemChoice19Strings[] = {
        _("Library"),
        _("Executable")
    };
    wxChoice* itemChoice19 = new wxChoice( itemPanel15, ID_CHOICE1, wxDefaultPosition, wxDefaultSize, 2, itemChoice19Strings, 0 );
    itemChoice19->SetStringSelection(_("Library"));
    itemBoxSizer17->Add(itemChoice19, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);

    wxStaticText* itemStaticText20 = new wxStaticText( itemPanel15, wxID_STATIC, _("When using Bakefile for a wxWidgets-based project\nit's strongly suggested to use the wxWidgets presets.\nThey allow you to create a project which can be built\nin several different configurations.\n\nCheck the build modes which you want to support:\n"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer16->Add(itemStaticText20, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);

    wxGridSizer* itemGridSizer21 = new wxGridSizer(2, 2, 0, 0);
    itemBoxSizer16->Add(itemGridSizer21, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
    wxCheckBox* itemCheckBox22 = new wxCheckBox( itemPanel15, ID_CHECKBOX5, _("Debug"), wxDefaultPosition, wxDefaultSize, 0 );
    itemCheckBox22->SetValue(false);
    itemGridSizer21->Add(itemCheckBox22, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);

    wxCheckBox* itemCheckBox23 = new wxCheckBox( itemPanel15, ID_CHECKBOX6, _("Release"), wxDefaultPosition, wxDefaultSize, 0 );
    itemCheckBox23->SetValue(false);
    itemGridSizer21->Add(itemCheckBox23, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);

    wxCheckBox* itemCheckBox24 = new wxCheckBox( itemPanel15, ID_CHECKBOX4, _("ANSI"), wxDefaultPosition, wxDefaultSize, 0 );
    itemCheckBox24->SetValue(false);
    itemGridSizer21->Add(itemCheckBox24, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);

    wxCheckBox* itemCheckBox25 = new wxCheckBox( itemPanel15, ID_CHECKBOX3, _("Unicode"), wxDefaultPosition, wxDefaultSize, 0 );
    itemCheckBox25->SetValue(false);
    itemGridSizer21->Add(itemCheckBox25, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);

    wxCheckBox* itemCheckBox26 = new wxCheckBox( itemPanel15, ID_CHECKBOX7, _("Static library"), wxDefaultPosition, wxDefaultSize, 0 );
    itemCheckBox26->SetValue(false);
    itemGridSizer21->Add(itemCheckBox26, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);

    wxCheckBox* itemCheckBox27 = new wxCheckBox( itemPanel15, ID_CHECKBOX8, _("Shared library"), wxDefaultPosition, wxDefaultSize, 0 );
    itemCheckBox27->SetValue(false);
    itemGridSizer21->Add(itemCheckBox27, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);

    itemChoicebook14->AddPage(itemPanel15, _("Bakefile"));

    itemBoxSizer12->Add(itemChoicebook14, 0, wxGROW|wxALL, 5);

////@end wxPackageWizardPageBuildSystem content construction
}

bool wxPackageWizardPageBuildSystem::ShowToolTips()
{
    return true;
}

wxWizardPage* wxPackageWizardPageIntro::GetPrev() const
{
    // TODO: return the previous page
    return NULL;
}

wxWizardPage* wxPackageWizardPageIntro::GetNext() const
{
    // TODO: return the next page
    return NULL;
}

wxWizardPage* wxPackageWizardPageBuildSystem::GetPrev() const
{
    // TODO: return the previous page
    return NULL;
}

wxWizardPage* wxPackageWizardPageBuildSystem::GetNext() const
{
    // TODO: return the next page
    return NULL;
}



// ----------------------------------------------------------------------------
// wxPackageWizardPageAutodetect
// ----------------------------------------------------------------------------

IMPLEMENT_DYNAMIC_CLASS( wxPackageWizardPageAutodetect, wxWizardPage )
BEGIN_EVENT_TABLE( wxPackageWizardPageAutodetect, wxWizardPage )
END_EVENT_TABLE()


wxPackageWizardPageAutodetect::wxPackageWizardPageAutodetect( )
{
}

wxPackageWizardPageAutodetect::wxPackageWizardPageAutodetect( wxWizard* parent )
{
    Create( parent );
}

bool wxPackageWizardPageAutodetect::Create( wxWizard* parent )
{
////@begin wxPackageWizardPageAutodetect member initialisation
////@end wxPackageWizardPageAutodetect member initialisation

////@begin wxPackageWizardPageAutodetect creation
    wxBitmap wizardBitmap(wxNullBitmap);
    wxWizardPage::Create( parent, wizardBitmap );

    CreateControls();
    if (GetSizer())
        GetSizer()->Fit(this);
////@end wxPackageWizardPageAutodetect creation
    return true;
}

void wxPackageWizardPageAutodetect::CreateControls()
{
////@begin wxPackageWizardPageAutodetect content construction
    wxPackageWizardPageAutodetect* itemWizardPage28 = this;

    wxBoxSizer* itemBoxSizer29 = new wxBoxSizer(wxVERTICAL);
    itemWizardPage28->SetSizer(itemBoxSizer29);

    wxStaticText* itemStaticText30 = new wxStaticText( itemWizardPage28, wxID_STATIC, _("Select the folder containing your component to package:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer29->Add(itemStaticText30, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5);

    wxWindow* itemWindow31 = (wxWindow*) FindWindow(ID_WINDOW);
    wxASSERT( itemWindow31 != NULL );
    itemBoxSizer29->Add(itemWindow31, 0, wxGROW|wxALL, 5);

    wxStaticBox* itemStaticBoxSizer32Static = new wxStaticBox(itemWizardPage28, wxID_ANY, _("Autodetect"));
    wxStaticBoxSizer* itemStaticBoxSizer32 = new wxStaticBoxSizer(itemStaticBoxSizer32Static, wxVERTICAL);
    itemBoxSizer29->Add(itemStaticBoxSizer32, 1, wxGROW|wxALL, 5);

    wxStaticText* itemStaticText33 = new wxStaticText( itemWizardPage28, wxID_STATIC, _("The package manager is able to autodetect some\ncommon configurations for a wxWidgets-based project.\n"), wxDefaultPosition, wxDefaultSize, 0 );
    itemStaticBoxSizer32->Add(itemStaticText33, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5);

    wxWindow* itemWindow34 = (wxWindow*) FindWindow(ID_WINDOW1);
    wxASSERT( itemWindow34 != NULL );
    itemStaticBoxSizer32->Add(itemWindow34, 0, wxGROW|wxALL, 5);

    wxButton* itemButton35 = new wxButton( itemWizardPage28, ID_START, _("Start autodetection"), wxDefaultPosition, wxDefaultSize, 0 );
    itemStaticBoxSizer32->Add(itemButton35, 0, wxALIGN_LEFT|wxALL, 5);

////@end wxPackageWizardPageAutodetect content construction
}

wxWizardPage* wxPackageWizardPageAutodetect::GetPrev() const
{
    // TODO: return the previous page
    return NULL;
}

wxWizardPage* wxPackageWizardPageAutodetect::GetNext() const
{
    // TODO: return the next page
    return NULL;
}

bool wxPackageWizardPageAutodetect::ShowToolTips()
{
    return true;
}



// ----------------------------------------------------------------------------
// wxPackageWizardPageFinish
// ----------------------------------------------------------------------------

IMPLEMENT_DYNAMIC_CLASS( wxPackageWizardPageFinish, wxWizardPage )
BEGIN_EVENT_TABLE( wxPackageWizardPageFinish, wxWizardPage )
END_EVENT_TABLE()

wxPackageWizardPageFinish::wxPackageWizardPageFinish( )
{
}

wxPackageWizardPageFinish::wxPackageWizardPageFinish( wxWizard* parent )
{
    Create( parent );
}

bool wxPackageWizardPageFinish::Create( wxWizard* parent )
{
////@begin wxPackageWizardPageFinish member initialisation
////@end wxPackageWizardPageFinish member initialisation

////@begin wxPackageWizardPageFinish creation
    wxBitmap wizardBitmap(wxNullBitmap);
    wxWizardPage::Create( parent, wizardBitmap );

    CreateControls();
    if (GetSizer())
        GetSizer()->Fit(this);
////@end wxPackageWizardPageFinish creation
    return true;
}

void wxPackageWizardPageFinish::CreateControls()
{
////@begin wxPackageWizardPageFinish content construction
    wxPackageWizardPageFinish* itemWizardPage36 = this;

    wxBoxSizer* itemBoxSizer37 = new wxBoxSizer(wxVERTICAL);
    itemWizardPage36->SetSizer(itemBoxSizer37);

    wxStaticText* itemStaticText38 = new wxStaticText( itemWizardPage36, wxID_STATIC, _("Click 'Finish' to create the following files:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer37->Add(itemStaticText38, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 5);

    wxString* itemListBox39Strings = NULL;
    wxListBox* itemListBox39 = new wxListBox( itemWizardPage36, ID_LISTBOX2, wxDefaultPosition, wxDefaultSize, 0, itemListBox39Strings, wxLB_SINGLE );
    itemListBox39->Enable(false);
    itemBoxSizer37->Add(itemListBox39, 1, wxGROW|wxALL, 5);

////@end wxPackageWizardPageFinish content construction
}

wxWizardPage* wxPackageWizardPageFinish::GetPrev() const
{
    // TODO: return the previous page
    return NULL;
}

wxWizardPage* wxPackageWizardPageFinish::GetNext() const
{
    // TODO: return the next page
    return NULL;
}

bool wxPackageWizardPageFinish::ShowToolTips()
{
    return true;
}
