Rev 1 | Rev 218 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#pragma onceusing namespace System;using namespace System::ComponentModel;using namespace System::Collections;using namespace System::Windows::Forms;using namespace System::Data;using namespace System::Drawing;namespace Creator {/// <summary>/// Summary for LoadShip////// 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 LoadShip : public System::Windows::Forms::Form{public:LoadShip(void){InitializeComponent();m_iType = 0;this->Text = "Select Ship Entry";m_lData = new CyStringList;m_iGroup = -1;}void FillData(){for ( int i = 0; i < this->ListShip->SelectedItems->Count; i++ )m_lData->PushBack(CyStringFromSystemString(this->ListShip->SelectedItems[i]->Text), CyStringFromSystemString(this->ListShip->SelectedItems[i]->SubItems[1]->Text));}CyStringList *GetDataList() { return m_lData; }void AddGroup(String ^text){ListViewGroup ^group = gcnew ListViewGroup(text, HorizontalAlignment::Left);this->ListShip->Groups->Add(group);++m_iGroup;}void AddShip(String ^id, String ^text){ListViewItem ^item = gcnew ListViewItem(id);item->SubItems->Add(text);item->ImageIndex = m_iType;if ( m_iGroup > -1 )item->Group = this->ListShip->Groups[m_iGroup];this->ListShip->Items->Add(item);}void Cockpits(){m_iType = 1;this->Text = "Select Cockpit Entries";this->ListShip->MultiSelect = true;this->columnHeader2->Width = 0;this->columnHeader1->Text = "Cockpit ID";}void Animations(){m_iType = 6;this->Text = "Select Animation Entries";this->ListShip->MultiSelect = true;this->columnHeader2->Width = 0;this->columnHeader1->Text = "Animations";this->Width += 200;}void Bodies(){m_iType = 3;this->Text = "Select the Bodies entries";this->ListShip->MultiSelect = true;this->columnHeader2->Width = 0;this->columnHeader1->Text = "Bodies";}void Dummies(){m_iType = 4;this->Text = "Select the Dummy entries";this->ListShip->MultiSelect = true;this->columnHeader2->Width = 0;this->columnHeader1->Text = "Dummies";this->Width += 200;}void Components(){m_iType = 5;this->Text = "Select the Component entries";this->ListShip->MultiSelect = true;this->columnHeader1->Text = "Component";this->columnHeader2->Text = "Data";this->Width += 200;}void CutData(){m_iType = 2;this->Text = "Select CutData Entries";this->ListShip->MultiSelect = true;this->columnHeader1->Text = "Cuts";this->columnHeader2->Text = "Filename";}String ^GetShipName(){return _US(m_lData->FindString(_S(m_sData))->data.ToString());}String ^GetData() { return m_sData; }protected:/// <summary>/// Clean up any resources being used./// </summary>~LoadShip(){if (components){delete components;}delete m_lData;}private: System::Windows::Forms::Panel^ panel1;private: System::Windows::Forms::Button^ button2;private: System::Windows::Forms::Button^ button1;private: System::Windows::Forms::ListView^ ListShip;private: System::Windows::Forms::ColumnHeader^ columnHeader1;private: System::Windows::Forms::ColumnHeader^ columnHeader2;private: System::Windows::Forms::ImageList^ imageList1;private: System::ComponentModel::IContainer^ components;protected:private:/// <summary>/// Required designer variable./// </summary>CyStringList *m_lData;String ^m_sData;int m_iType;int m_iGroup;#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){this->components = (gcnew System::ComponentModel::Container());System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(LoadShip::typeid));this->panel1 = (gcnew System::Windows::Forms::Panel());this->button2 = (gcnew System::Windows::Forms::Button());this->button1 = (gcnew System::Windows::Forms::Button());this->ListShip = (gcnew System::Windows::Forms::ListView());this->columnHeader1 = (gcnew System::Windows::Forms::ColumnHeader());this->columnHeader2 = (gcnew System::Windows::Forms::ColumnHeader());this->imageList1 = (gcnew System::Windows::Forms::ImageList(this->components));this->panel1->SuspendLayout();this->SuspendLayout();//// panel1//this->panel1->Controls->Add(this->button2);this->panel1->Controls->Add(this->button1);this->panel1->Dock = System::Windows::Forms::DockStyle::Bottom;this->panel1->Location = System::Drawing::Point(10, 500);this->panel1->Name = L"panel1";this->panel1->Padding = System::Windows::Forms::Padding(5);this->panel1->Size = System::Drawing::Size(383, 43);this->panel1->TabIndex = 0;//// button2//this->button2->DialogResult = System::Windows::Forms::DialogResult::Cancel;this->button2->Dock = System::Windows::Forms::DockStyle::Right;this->button2->Location = System::Drawing::Point(197, 5);this->button2->Name = L"button2";this->button2->Size = System::Drawing::Size(91, 33);this->button2->TabIndex = 1;this->button2->Text = L"Cancel";this->button2->UseVisualStyleBackColor = true;//// button1//this->button1->DialogResult = System::Windows::Forms::DialogResult::OK;this->button1->Dock = System::Windows::Forms::DockStyle::Right;this->button1->Enabled = false;this->button1->Location = System::Drawing::Point(288, 5);this->button1->Name = L"button1";this->button1->Size = System::Drawing::Size(90, 33);this->button1->TabIndex = 0;this->button1->Text = L"OK";this->button1->UseVisualStyleBackColor = true;this->button1->Click += gcnew System::EventHandler(this, &LoadShip::button1_Click);//// ListShip//this->ListShip->Columns->AddRange(gcnew cli::array< System::Windows::Forms::ColumnHeader^ >(2) {this->columnHeader1, this->columnHeader2});this->ListShip->Dock = System::Windows::Forms::DockStyle::Fill;this->ListShip->FullRowSelect = true;this->ListShip->LargeImageList = this->imageList1;this->ListShip->Location = System::Drawing::Point(10, 10);this->ListShip->Name = L"ListShip";this->ListShip->Size = System::Drawing::Size(383, 490);this->ListShip->SmallImageList = this->imageList1;this->ListShip->TabIndex = 1;this->ListShip->UseCompatibleStateImageBehavior = false;this->ListShip->View = System::Windows::Forms::View::Details;this->ListShip->MouseDoubleClick += gcnew System::Windows::Forms::MouseEventHandler(this, &LoadShip::ListShip_MouseDoubleClick);this->ListShip->SelectedIndexChanged += gcnew System::EventHandler(this, &LoadShip::ListShip_SelectedIndexChanged);//// columnHeader1//this->columnHeader1->Text = L"Ship ID";//// columnHeader2//this->columnHeader2->Text = L"Ship Text";//// imageList1//this->imageList1->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^ >(resources->GetObject(L"imageList1.ImageStream")));this->imageList1->TransparentColor = System::Drawing::Color::Transparent;this->imageList1->Images->SetKeyName(0, L"drak-icon.png");this->imageList1->Images->SetKeyName(1, L"redhat-games.png");this->imageList1->Images->SetKeyName(2, L"gnome-fs-bookmark-missing.png");this->imageList1->Images->SetKeyName(3, L"users.png");this->imageList1->Images->SetKeyName(4, L"nobody.png");this->imageList1->Images->SetKeyName(5, L"redhat-accessories.png");this->imageList1->Images->SetKeyName(6, L"tvtime.png");//// LoadShip//this->AcceptButton = this->button1;this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;this->CancelButton = this->button2;this->ClientSize = System::Drawing::Size(403, 553);this->ControlBox = false;this->Controls->Add(this->ListShip);this->Controls->Add(this->panel1);this->Name = L"LoadShip";this->Padding = System::Windows::Forms::Padding(10);this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;this->Text = L"LoadShip";this->Load += gcnew System::EventHandler(this, &LoadShip::LoadShip_Load);this->panel1->ResumeLayout(false);this->ResumeLayout(false);}#pragma endregionprivate: System::Void LoadShip_Load(System::Object^ sender, System::EventArgs^ e) {this->ListShip->AutoResizeColumns(ColumnHeaderAutoResizeStyle::HeaderSize);if ( m_iType == 1 || m_iType == 3 || m_iType == 4 || m_iType == 6 )this->columnHeader2->Width = 0;this->ListShip->Focus();}private: System::Void ListShip_MouseDoubleClick(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {if ( this->ListShip->SelectedItems->Count ){m_sData = this->ListShip->SelectedItems[0]->Text;this->FillData();this->DialogResult = System::Windows::Forms::DialogResult::OK;this->Close();}}private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {if ( this->ListShip->SelectedItems->Count ){m_sData = this->ListShip->SelectedItems[0]->Text;this->FillData();this->DialogResult = System::Windows::Forms::DialogResult::OK;this->Close();}}private: System::Void ListShip_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {this->button1->Enabled = (this->ListShip->SelectedItems->Count) ? true : false;}};}