Subversion Repositories spk

Rev

Blame | Last modification | View Log | RSS feed

#pragma once

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

#include "WizardStartup.h"
#include "WizardCore1.h"

namespace Creator {

        /// <summary>
        /// Summary for CreationWizard
        ///
        /// WARNING: If you change the name of this class, you will need to change the
        ///          'Resource File Name' property for the managed resource compiler tool
        ///          associated with all .resx files this class depends on.  Otherwise,
        ///          the designers will not be able to interact properly with localized
        ///          resources associated with this form.
        /// </summary>
        public ref class CreationWizard : public System::Windows::Forms::Form
        {
        public:
                CreationWizard(void)
                {
                        InitializeComponent();

                        PreviousControls = gcnew Collections::Generic::List<UserControl ^>();

                        m_pPackage = NULL;
                        m_pControl = nullptr;
                }

                void EnableBack(bool e) { this->ButBack->Enabled = e; }
                void EnableNext(bool e) { this->ButNext->Enabled = e; }
                void CreatePackageType(int type)
                {
                        if ( m_pPackage ) delete m_pPackage;

                        switch ( type )
                        {
                                case TYPE_SPK:
                                        m_pPackage = new CSpkFile;
                                        break;
                                case TYPE_XSP:
                                        m_pPackage = new CXspFile;
                                        break;
                                default:
                                        m_pPackage = new CBaseFile;
                        }
                }

        protected:
                /// <summary>
                /// Clean up any resources being used.
                /// </summary>
                ~CreationWizard()
                {
                        if (components)
                        {
                                delete components;
                        }
                }
        private: System::Windows::Forms::PictureBox^  pictureBox1;
        protected: 
        private: System::Windows::Forms::GroupBox^  groupBox1;
        private: System::Windows::Forms::Button^  ButBack;

        private: System::Windows::Forms::Button^  ButNext;

        private: System::Windows::Forms::Button^  ButDone;

        private: System::Windows::Forms::Button^  button1;
        private: System::Windows::Forms::Panel^  PanelWizard;


        private:
                System::Windows::Forms::UserControl ^m_pControl;
                CBaseFile *m_pPackage;
                /// <summary>
                /// Required designer variable.
                /// </summary>
                System::ComponentModel::Container ^components;
                System::Collections::Generic::List<UserControl ^> ^PreviousControls;

#pragma region Windows Form Designer generated code
                /// <summary>
                /// Required method for Designer support - do not modify
                /// the contents of this method with the code editor.
                /// </summary>
                void InitializeComponent(void)
                {
                        System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(CreationWizard::typeid));
                        this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
                        this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
                        this->ButBack = (gcnew System::Windows::Forms::Button());
                        this->ButNext = (gcnew System::Windows::Forms::Button());
                        this->ButDone = (gcnew System::Windows::Forms::Button());
                        this->button1 = (gcnew System::Windows::Forms::Button());
                        this->PanelWizard = (gcnew System::Windows::Forms::Panel());
                        (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox1))->BeginInit();
                        this->groupBox1->SuspendLayout();
                        this->SuspendLayout();
                        // 
                        // pictureBox1
                        // 
                        this->pictureBox1->Dock = System::Windows::Forms::DockStyle::Top;
                        this->pictureBox1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"pictureBox1.Image")));
                        this->pictureBox1->Location = System::Drawing::Point(0, 0);
                        this->pictureBox1->Name = L"pictureBox1";
                        this->pictureBox1->Size = System::Drawing::Size(755, 110);
                        this->pictureBox1->SizeMode = System::Windows::Forms::PictureBoxSizeMode::StretchImage;
                        this->pictureBox1->TabIndex = 0;
                        this->pictureBox1->TabStop = false;
                        // 
                        // groupBox1
                        // 
                        this->groupBox1->Controls->Add(this->ButBack);
                        this->groupBox1->Controls->Add(this->ButNext);
                        this->groupBox1->Controls->Add(this->ButDone);
                        this->groupBox1->Controls->Add(this->button1);
                        this->groupBox1->Dock = System::Windows::Forms::DockStyle::Bottom;
                        this->groupBox1->Location = System::Drawing::Point(0, 643);
                        this->groupBox1->Name = L"groupBox1";
                        this->groupBox1->Padding = System::Windows::Forms::Padding(10);
                        this->groupBox1->Size = System::Drawing::Size(755, 66);
                        this->groupBox1->TabIndex = 2;
                        this->groupBox1->TabStop = false;
                        // 
                        // ButBack
                        // 
                        this->ButBack->Dock = System::Windows::Forms::DockStyle::Right;
                        this->ButBack->Location = System::Drawing::Point(409, 23);
                        this->ButBack->Name = L"ButBack";
                        this->ButBack->Size = System::Drawing::Size(107, 33);
                        this->ButBack->TabIndex = 3;
                        this->ButBack->Text = L"< Back";
                        this->ButBack->UseVisualStyleBackColor = true;
                        this->ButBack->Click += gcnew System::EventHandler(this, &CreationWizard::ButBack_Click);
                        // 
                        // ButNext
                        // 
                        this->ButNext->Dock = System::Windows::Forms::DockStyle::Right;
                        this->ButNext->Location = System::Drawing::Point(516, 23);
                        this->ButNext->Name = L"ButNext";
                        this->ButNext->Size = System::Drawing::Size(118, 33);
                        this->ButNext->TabIndex = 2;
                        this->ButNext->Text = L"Next >";
                        this->ButNext->UseVisualStyleBackColor = true;
                        this->ButNext->Click += gcnew System::EventHandler(this, &CreationWizard::ButNext_Click);
                        // 
                        // ButDone
                        // 
                        this->ButDone->DialogResult = System::Windows::Forms::DialogResult::OK;
                        this->ButDone->Dock = System::Windows::Forms::DockStyle::Right;
                        this->ButDone->Location = System::Drawing::Point(634, 23);
                        this->ButDone->Name = L"ButDone";
                        this->ButDone->Size = System::Drawing::Size(111, 33);
                        this->ButDone->TabIndex = 1;
                        this->ButDone->Text = L"Done";
                        this->ButDone->UseVisualStyleBackColor = true;
                        // 
                        // button1
                        // 
                        this->button1->DialogResult = System::Windows::Forms::DialogResult::Cancel;
                        this->button1->Dock = System::Windows::Forms::DockStyle::Left;
                        this->button1->Location = System::Drawing::Point(10, 23);
                        this->button1->Name = L"button1";
                        this->button1->Size = System::Drawing::Size(95, 33);
                        this->button1->TabIndex = 0;
                        this->button1->Text = L"Cancel";
                        this->button1->UseVisualStyleBackColor = true;
                        // 
                        // PanelWizard
                        // 
                        this->PanelWizard->Dock = System::Windows::Forms::DockStyle::Fill;
                        this->PanelWizard->Location = System::Drawing::Point(0, 110);
                        this->PanelWizard->Name = L"PanelWizard";
                        this->PanelWizard->Padding = System::Windows::Forms::Padding(10);
                        this->PanelWizard->Size = System::Drawing::Size(755, 533);
                        this->PanelWizard->TabIndex = 3;
                        // 
                        // CreationWizard
                        // 
                        this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
                        this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
                        this->ClientSize = System::Drawing::Size(755, 709);
                        this->Controls->Add(this->PanelWizard);
                        this->Controls->Add(this->groupBox1);
                        this->Controls->Add(this->pictureBox1);
                        this->Icon = (cli::safe_cast<System::Drawing::Icon^  >(resources->GetObject(L"$this.Icon")));
                        this->Name = L"CreationWizard";
                        this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
                        this->Text = L"Package Creation Wizard";
                        this->Load += gcnew System::EventHandler(this, &CreationWizard::CreationWizard_Load);
                        (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox1))->EndInit();
                        this->groupBox1->ResumeLayout(false);
                        this->ResumeLayout(false);

                }
#pragma endregion
        private: System::Void CreationWizard_Load(System::Object^  sender, System::EventArgs^  e) {
                                 m_pControl = gcnew WizardStartup(this);
                                 this->PanelWizard->Controls->Add(m_pControl);
                                 m_pControl->Dock = Windows::Forms::DockStyle::Fill;
                                 this->ButDone->Enabled = false;
                                 this->ButBack->Enabled = false;
                                 this->ButNext->Enabled = false;
                         }
private: System::Void ButNext_Click(System::Object^  sender, System::EventArgs^  e) {
                         Windows::Forms::UserControl ^c = cli::safe_cast<WizardCore1 ^>(m_pControl)->GetNext(m_pPackage);
                         if ( c ) {
                                 PreviousControls->Add(m_pControl);
                                 this->PanelWizard->Controls->Clear();
                                 m_pControl = c;
                                 this->PanelWizard->Controls->Add(m_pControl);
                                 m_pControl->Dock = Windows::Forms::DockStyle::Fill;
                                 this->ButBack->Enabled = true;
                         }
                         this->ButNext->Enabled = false;
                 }
private: System::Void ButBack_Click(System::Object^  sender, System::EventArgs^  e) {
                         this->PanelWizard->Controls->Clear();
                         delete m_pControl;
                         m_pControl = PreviousControls[PreviousControls->Count - 1];
                         PreviousControls->Remove(m_pControl);
                         this->PanelWizard->Controls->Add(m_pControl);
                         m_pControl->Dock = Windows::Forms::DockStyle::Fill;
                         this->ButNext->Enabled = false;

                         if ( !PreviousControls->Count )
                                 this->ButBack->Enabled = false;
                 }
};
}