Subversion Repositories spk

Rev

Rev 218 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 cycrow 1
#pragma once
2
 
3
using namespace System;
4
using namespace System::ComponentModel;
5
using namespace System::Collections;
6
using namespace System::Windows::Forms;
7
using namespace System::Data;
8
using namespace System::Drawing;
9
 
10
 
11
namespace Creator {
12
 
13
	/// <summary>
14
	/// Summary for LoadShip
15
	///
16
	/// WARNING: If you change the name of this class, you will need to change the
17
	///          'Resource File Name' property for the managed resource compiler tool
18
	///          associated with all .resx files this class depends on.  Otherwise,
19
	///          the designers will not be able to interact properly with localized
20
	///          resources associated with this form.
21
	/// </summary>
22
	public ref class LoadShip : public System::Windows::Forms::Form
23
	{
24
	public:
25
		LoadShip(void)
26
		{
27
			InitializeComponent();
28
 
29
			m_iType = 0;
30
			this->Text = "Select Ship Entry";
218 cycrow 31
			m_lData = new Utils::WStringList;
1 cycrow 32
			m_iGroup = -1;
33
		}
34
 
35
		void FillData()
36
		{
37
			for ( int i = 0; i < this->ListShip->SelectedItems->Count; i++ )
218 cycrow 38
				m_lData->pushBack(_WS(this->ListShip->SelectedItems[i]->Text), _WS(this->ListShip->SelectedItems[i]->SubItems[1]->Text));
1 cycrow 39
		}
40
 
218 cycrow 41
		Utils::WStringList *GetDataList() { return m_lData; }
1 cycrow 42
 
43
		void AddGroup(String ^text)
44
		{
45
			ListViewGroup ^group = gcnew ListViewGroup(text, HorizontalAlignment::Left);
46
			this->ListShip->Groups->Add(group);
47
			++m_iGroup;
48
		}
49
 
50
		void AddShip(String ^id, String ^text)
51
		{
52
			ListViewItem ^item = gcnew ListViewItem(id);
53
			item->SubItems->Add(text);
54
			item->ImageIndex = m_iType;
55
			if ( m_iGroup > -1 )
56
				item->Group = this->ListShip->Groups[m_iGroup];
57
			this->ListShip->Items->Add(item);
58
		}
59
 
60
		void Cockpits()
61
		{
62
			m_iType = 1;
63
			this->Text = "Select Cockpit Entries";
64
			this->ListShip->MultiSelect = true;
65
			this->columnHeader2->Width = 0;
66
			this->columnHeader1->Text = "Cockpit ID";
67
		}
68
		void Animations()
69
		{
70
			m_iType = 6;
71
			this->Text = "Select Animation Entries";
72
			this->ListShip->MultiSelect = true;
73
			this->columnHeader2->Width = 0;
74
			this->columnHeader1->Text = "Animations";
75
			this->Width += 200;
76
		}
77
		void Bodies()
78
		{
79
			m_iType = 3;
80
			this->Text = "Select the Bodies entries";
81
			this->ListShip->MultiSelect = true;
82
			this->columnHeader2->Width = 0;
83
			this->columnHeader1->Text = "Bodies";
84
		}
85
		void Dummies()
86
		{
87
			m_iType = 4;
88
			this->Text = "Select the Dummy entries";
89
			this->ListShip->MultiSelect = true;
90
			this->columnHeader2->Width = 0;
91
			this->columnHeader1->Text = "Dummies";
92
			this->Width += 200;
93
		}
94
		void Components()
95
		{
96
			m_iType = 5;
97
			this->Text = "Select the Component entries";
98
			this->ListShip->MultiSelect = true;
99
			this->columnHeader1->Text = "Component";
100
			this->columnHeader2->Text = "Data";
101
			this->Width += 200;
102
		}
103
		void CutData()
104
		{
105
			m_iType = 2;
106
			this->Text = "Select CutData Entries";
107
			this->ListShip->MultiSelect = true;
108
			this->columnHeader1->Text = "Cuts";
109
			this->columnHeader2->Text = "Filename";
110
		}
111
 
116 cycrow 112
		String ^GetShipName()
113
		{
224 cycrow 114
			return _US(m_lData->findString(_WS(m_sData)));
116 cycrow 115
		}
116
 
1 cycrow 117
		String ^GetData() { return m_sData; }
118
 
119
	protected:
120
		/// <summary>
121
		/// Clean up any resources being used.
122
		/// </summary>
123
		~LoadShip()
124
		{
125
			if (components)
126
			{
127
				delete components;
128
			}
129
			delete m_lData;
130
		}
131
	private: System::Windows::Forms::Panel^  panel1;
132
	private: System::Windows::Forms::Button^  button2;
133
	private: System::Windows::Forms::Button^  button1;
134
	private: System::Windows::Forms::ListView^  ListShip;
135
	private: System::Windows::Forms::ColumnHeader^  columnHeader1;
136
	private: System::Windows::Forms::ColumnHeader^  columnHeader2;
137
	private: System::Windows::Forms::ImageList^  imageList1;
138
	private: System::ComponentModel::IContainer^  components;
139
	protected: 
140
 
141
	private:
142
		/// <summary>
143
		/// Required designer variable.
144
		/// </summary>
218 cycrow 145
		Utils::WStringList *m_lData;
1 cycrow 146
		String ^m_sData;
147
		int		m_iType;
148
		int		m_iGroup;
149
 
150
 
151
#pragma region Windows Form Designer generated code
152
		/// <summary>
153
		/// Required method for Designer support - do not modify
154
		/// the contents of this method with the code editor.
155
		/// </summary>
156
		void InitializeComponent(void)
157
		{
158
			this->components = (gcnew System::ComponentModel::Container());
159
			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(LoadShip::typeid));
160
			this->panel1 = (gcnew System::Windows::Forms::Panel());
161
			this->button2 = (gcnew System::Windows::Forms::Button());
162
			this->button1 = (gcnew System::Windows::Forms::Button());
163
			this->ListShip = (gcnew System::Windows::Forms::ListView());
164
			this->columnHeader1 = (gcnew System::Windows::Forms::ColumnHeader());
165
			this->columnHeader2 = (gcnew System::Windows::Forms::ColumnHeader());
166
			this->imageList1 = (gcnew System::Windows::Forms::ImageList(this->components));
167
			this->panel1->SuspendLayout();
168
			this->SuspendLayout();
169
			// 
170
			// panel1
171
			// 
172
			this->panel1->Controls->Add(this->button2);
173
			this->panel1->Controls->Add(this->button1);
174
			this->panel1->Dock = System::Windows::Forms::DockStyle::Bottom;
175
			this->panel1->Location = System::Drawing::Point(10, 500);
176
			this->panel1->Name = L"panel1";
177
			this->panel1->Padding = System::Windows::Forms::Padding(5);
178
			this->panel1->Size = System::Drawing::Size(383, 43);
179
			this->panel1->TabIndex = 0;
180
			// 
181
			// button2
182
			// 
183
			this->button2->DialogResult = System::Windows::Forms::DialogResult::Cancel;
184
			this->button2->Dock = System::Windows::Forms::DockStyle::Right;
185
			this->button2->Location = System::Drawing::Point(197, 5);
186
			this->button2->Name = L"button2";
187
			this->button2->Size = System::Drawing::Size(91, 33);
188
			this->button2->TabIndex = 1;
189
			this->button2->Text = L"Cancel";
190
			this->button2->UseVisualStyleBackColor = true;
191
			// 
192
			// button1
193
			// 
194
			this->button1->DialogResult = System::Windows::Forms::DialogResult::OK;
195
			this->button1->Dock = System::Windows::Forms::DockStyle::Right;
196
			this->button1->Enabled = false;
197
			this->button1->Location = System::Drawing::Point(288, 5);
198
			this->button1->Name = L"button1";
199
			this->button1->Size = System::Drawing::Size(90, 33);
200
			this->button1->TabIndex = 0;
201
			this->button1->Text = L"OK";
202
			this->button1->UseVisualStyleBackColor = true;
203
			this->button1->Click += gcnew System::EventHandler(this, &LoadShip::button1_Click);
204
			// 
205
			// ListShip
206
			// 
207
			this->ListShip->Columns->AddRange(gcnew cli::array< System::Windows::Forms::ColumnHeader^  >(2) {this->columnHeader1, this->columnHeader2});
208
			this->ListShip->Dock = System::Windows::Forms::DockStyle::Fill;
209
			this->ListShip->FullRowSelect = true;
210
			this->ListShip->LargeImageList = this->imageList1;
211
			this->ListShip->Location = System::Drawing::Point(10, 10);
212
			this->ListShip->Name = L"ListShip";
213
			this->ListShip->Size = System::Drawing::Size(383, 490);
214
			this->ListShip->SmallImageList = this->imageList1;
215
			this->ListShip->TabIndex = 1;
216
			this->ListShip->UseCompatibleStateImageBehavior = false;
217
			this->ListShip->View = System::Windows::Forms::View::Details;
218
			this->ListShip->MouseDoubleClick += gcnew System::Windows::Forms::MouseEventHandler(this, &LoadShip::ListShip_MouseDoubleClick);
219
			this->ListShip->SelectedIndexChanged += gcnew System::EventHandler(this, &LoadShip::ListShip_SelectedIndexChanged);
220
			// 
221
			// columnHeader1
222
			// 
223
			this->columnHeader1->Text = L"Ship ID";
224
			// 
225
			// columnHeader2
226
			// 
227
			this->columnHeader2->Text = L"Ship Text";
228
			// 
229
			// imageList1
230
			// 
231
			this->imageList1->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^  >(resources->GetObject(L"imageList1.ImageStream")));
232
			this->imageList1->TransparentColor = System::Drawing::Color::Transparent;
233
			this->imageList1->Images->SetKeyName(0, L"drak-icon.png");
234
			this->imageList1->Images->SetKeyName(1, L"redhat-games.png");
235
			this->imageList1->Images->SetKeyName(2, L"gnome-fs-bookmark-missing.png");
236
			this->imageList1->Images->SetKeyName(3, L"users.png");
237
			this->imageList1->Images->SetKeyName(4, L"nobody.png");
238
			this->imageList1->Images->SetKeyName(5, L"redhat-accessories.png");
239
			this->imageList1->Images->SetKeyName(6, L"tvtime.png");
240
			// 
241
			// LoadShip
242
			// 
243
			this->AcceptButton = this->button1;
244
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
245
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
246
			this->CancelButton = this->button2;
247
			this->ClientSize = System::Drawing::Size(403, 553);
248
			this->ControlBox = false;
249
			this->Controls->Add(this->ListShip);
250
			this->Controls->Add(this->panel1);
251
			this->Name = L"LoadShip";
252
			this->Padding = System::Windows::Forms::Padding(10);
253
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
254
			this->Text = L"LoadShip";
255
			this->Load += gcnew System::EventHandler(this, &LoadShip::LoadShip_Load);
256
			this->panel1->ResumeLayout(false);
257
			this->ResumeLayout(false);
258
 
259
		}
260
#pragma endregion
261
	private: System::Void LoadShip_Load(System::Object^  sender, System::EventArgs^  e) {
262
				this->ListShip->AutoResizeColumns(ColumnHeaderAutoResizeStyle::HeaderSize);
263
				if ( m_iType == 1 || m_iType == 3 || m_iType == 4 || m_iType == 6 )
264
					this->columnHeader2->Width = 0;
265
				this->ListShip->Focus();
266
			 }
267
private: System::Void ListShip_MouseDoubleClick(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
268
			if ( this->ListShip->SelectedItems->Count )
269
			{
270
				m_sData = this->ListShip->SelectedItems[0]->Text;
271
				this->FillData();
272
				this->DialogResult = System::Windows::Forms::DialogResult::OK;
273
				this->Close();
274
			}
275
		 }
276
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
277
			if ( this->ListShip->SelectedItems->Count )
278
			{
279
				m_sData = this->ListShip->SelectedItems[0]->Text;
280
				this->FillData();
281
				this->DialogResult = System::Windows::Forms::DialogResult::OK;
282
				this->Close();
283
			}
284
		 }
285
private: System::Void ListShip_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
286
			 this->button1->Enabled = (this->ListShip->SelectedItems->Count) ? true : false;
287
		 }
288
};
289
}