Subversion Repositories spk

Rev

Rev 1 | 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 InputBox
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 InputBox : public System::Windows::Forms::Form
23
	{
24
	public:
25
		InputBox(System::String ^str)
26
		{
27
			InitializeComponent();
28
 
29
			this->ComboInput->Visible = false;
30
			Label->Text = str;
31
			TextInput->Focus();
32
		}
33
		InputBox(System::String ^str, System::String ^text)
34
		{
35
			InitializeComponent();
36
 
37
			this->ComboInput->Visible = false;
38
			Label->Text = str;
39
			TextInput->Text = text;
40
			TextInput->Focus();
41
		}
42
 
43
		void Large()
44
		{
45
			this->Height += 50;
46
		}
47
 
48
		void AddItemDefauilt(String ^item) { this->AddItem(item, true); }
49
		void AddItem(String ^item, bool def)
50
		{
51
			this->AddItem(item);
52
			if ( def )
53
				this->ComboInput->SelectedIndex = this->ComboInput->Items->Count - 1;
54
		}
55
		void AddItem(String ^item)
56
		{
57
			this->TextInput->Visible = false;
58
			this->ComboInput->Visible = true;
59
			this->pictureBox1->Image = this->imageList1->Images[1];
60
			this->ComboInput->Items->Add(item);
61
		}
62
		void SetSelectedOption(int index)
63
		{
343 cycrow 64
			if(index < this->ComboInput->Items->Count)
65
				this->ComboInput->SelectedIndex = index;
1 cycrow 66
		}
67
 
68
		System::String ^GetInput() { if ( !this->ComboInput->Items->Count ) return TextInput->Text; return this->ComboInput->Text; }
69
		int GetInputSelected() { return this->ComboInput->SelectedIndex; }
70
 
71
	protected:
72
		/// <summary>
73
		/// Clean up any resources being used.
74
		/// </summary>
75
		~InputBox()
76
		{
77
			if (components)
78
			{
79
				delete components;
80
			}
81
		}
82
	private: System::Windows::Forms::Panel^  panel1;
83
	private: System::Windows::Forms::Button^  ButOK;
84
	private: System::Windows::Forms::Button^  ButCancel;
85
	private: System::Windows::Forms::Label^  Label;
86
	private: System::Windows::Forms::PictureBox^  pictureBox1;
87
	private: System::Windows::Forms::Panel^  panel2;
88
	private: System::Windows::Forms::Panel^  panel3;
89
	private: System::Windows::Forms::RichTextBox^  TextInput;
90
	private: System::Windows::Forms::RichTextBox^  richTextBox1;
91
	private: System::Windows::Forms::ComboBox^  ComboInput;
92
	private: System::Windows::Forms::ImageList^  imageList1;
93
	private: System::ComponentModel::IContainer^  components;
94
 
95
	private:
96
		/// <summary>
97
		/// Required designer variable.
98
		/// </summary>
99
 
100
 
101
#pragma region Windows Form Designer generated code
102
		/// <summary>
103
		/// Required method for Designer support - do not modify
104
		/// the contents of this method with the code editor.
105
		/// </summary>
106
		void InitializeComponent(void)
107
		{
108
			this->components = (gcnew System::ComponentModel::Container());
109
			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(InputBox::typeid));
110
			this->panel1 = (gcnew System::Windows::Forms::Panel());
111
			this->ButOK = (gcnew System::Windows::Forms::Button());
112
			this->ButCancel = (gcnew System::Windows::Forms::Button());
113
			this->Label = (gcnew System::Windows::Forms::Label());
114
			this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
115
			this->TextInput = (gcnew System::Windows::Forms::RichTextBox());
116
			this->panel2 = (gcnew System::Windows::Forms::Panel());
117
			this->panel3 = (gcnew System::Windows::Forms::Panel());
118
			this->ComboInput = (gcnew System::Windows::Forms::ComboBox());
119
			this->imageList1 = (gcnew System::Windows::Forms::ImageList(this->components));
120
			this->panel1->SuspendLayout();
121
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox1))->BeginInit();
122
			this->panel2->SuspendLayout();
123
			this->panel3->SuspendLayout();
124
			this->SuspendLayout();
125
			// 
126
			// panel1
127
			// 
128
			this->panel1->Controls->Add(this->ButOK);
129
			this->panel1->Controls->Add(this->ButCancel);
130
			this->panel1->Dock = System::Windows::Forms::DockStyle::Bottom;
131
			this->panel1->Location = System::Drawing::Point(0, 106);
132
			this->panel1->Name = L"panel1";
133
			this->panel1->Size = System::Drawing::Size(367, 26);
134
			this->panel1->TabIndex = 0;
135
			// 
136
			// ButOK
137
			// 
138
			this->ButOK->DialogResult = System::Windows::Forms::DialogResult::OK;
139
			this->ButOK->Dock = System::Windows::Forms::DockStyle::Right;
140
			this->ButOK->Location = System::Drawing::Point(217, 0);
141
			this->ButOK->Name = L"ButOK";
142
			this->ButOK->Size = System::Drawing::Size(75, 26);
143
			this->ButOK->TabIndex = 1;
144
			this->ButOK->TabStop = false;
145
			this->ButOK->Text = L"OK";
146
			this->ButOK->UseVisualStyleBackColor = true;
147
			// 
148
			// ButCancel
149
			// 
150
			this->ButCancel->DialogResult = System::Windows::Forms::DialogResult::Cancel;
151
			this->ButCancel->Dock = System::Windows::Forms::DockStyle::Right;
152
			this->ButCancel->Location = System::Drawing::Point(292, 0);
153
			this->ButCancel->Name = L"ButCancel";
154
			this->ButCancel->Size = System::Drawing::Size(75, 26);
155
			this->ButCancel->TabIndex = 0;
156
			this->ButCancel->TabStop = false;
157
			this->ButCancel->Text = L"Cancel";
158
			this->ButCancel->UseVisualStyleBackColor = true;
159
			// 
160
			// Label
161
			// 
162
			this->Label->Dock = System::Windows::Forms::DockStyle::Fill;
163
			this->Label->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
164
				static_cast<System::Byte>(0)));
165
			this->Label->Location = System::Drawing::Point(55, 5);
166
			this->Label->Margin = System::Windows::Forms::Padding(3);
167
			this->Label->Name = L"Label";
168
			this->Label->Size = System::Drawing::Size(307, 54);
169
			this->Label->TabIndex = 1;
170
			this->Label->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
171
			// 
172
			// pictureBox1
173
			// 
174
			this->pictureBox1->Dock = System::Windows::Forms::DockStyle::Left;
175
			this->pictureBox1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"pictureBox1.Image")));
176
			this->pictureBox1->Location = System::Drawing::Point(5, 5);
177
			this->pictureBox1->Name = L"pictureBox1";
178
			this->pictureBox1->Size = System::Drawing::Size(50, 54);
179
			this->pictureBox1->SizeMode = System::Windows::Forms::PictureBoxSizeMode::StretchImage;
180
			this->pictureBox1->TabIndex = 4;
181
			this->pictureBox1->TabStop = false;
182
			// 
183
			// TextInput
184
			// 
185
			this->TextInput->Dock = System::Windows::Forms::DockStyle::Fill;
186
			this->TextInput->Location = System::Drawing::Point(5, 5);
187
			this->TextInput->Name = L"TextInput";
188
			this->TextInput->Size = System::Drawing::Size(357, 32);
189
			this->TextInput->TabIndex = 5;
190
			this->TextInput->Text = L"";
191
			// 
192
			// panel2
193
			// 
194
			this->panel2->Controls->Add(this->Label);
195
			this->panel2->Controls->Add(this->pictureBox1);
196
			this->panel2->Dock = System::Windows::Forms::DockStyle::Top;
197
			this->panel2->Location = System::Drawing::Point(0, 0);
198
			this->panel2->Name = L"panel2";
199
			this->panel2->Padding = System::Windows::Forms::Padding(5);
200
			this->panel2->Size = System::Drawing::Size(367, 64);
201
			this->panel2->TabIndex = 6;
202
			// 
203
			// panel3
204
			// 
205
			this->panel3->Controls->Add(this->ComboInput);
206
			this->panel3->Controls->Add(this->TextInput);
207
			this->panel3->Dock = System::Windows::Forms::DockStyle::Fill;
208
			this->panel3->Location = System::Drawing::Point(0, 64);
209
			this->panel3->Name = L"panel3";
210
			this->panel3->Padding = System::Windows::Forms::Padding(5);
211
			this->panel3->Size = System::Drawing::Size(367, 42);
212
			this->panel3->TabIndex = 5;
213
			// 
214
			// ComboInput
215
			// 
216
			this->ComboInput->Dock = System::Windows::Forms::DockStyle::Fill;
217
			this->ComboInput->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
218
			this->ComboInput->FormattingEnabled = true;
219
			this->ComboInput->Location = System::Drawing::Point(5, 5);
220
			this->ComboInput->Name = L"ComboInput";
221
			this->ComboInput->Size = System::Drawing::Size(357, 21);
222
			this->ComboInput->TabIndex = 6;
223
			// 
224
			// imageList1
225
			// 
226
			this->imageList1->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^  >(resources->GetObject(L"imageList1.ImageStream")));
227
			this->imageList1->TransparentColor = System::Drawing::Color::Transparent;
228
			this->imageList1->Images->SetKeyName(0, L"text");
229
			this->imageList1->Images->SetKeyName(1, L"input");
230
			// 
231
			// InputBox
232
			// 
233
			this->AcceptButton = this->ButOK;
234
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
235
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
236
			this->CancelButton = this->ButCancel;
237
			this->ClientSize = System::Drawing::Size(367, 132);
238
			this->ControlBox = false;
239
			this->Controls->Add(this->panel3);
240
			this->Controls->Add(this->panel2);
241
			this->Controls->Add(this->panel1);
242
			this->Name = L"InputBox";
243
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
244
			this->Text = L"Text Input";
245
			this->TopMost = true;
246
			this->Load += gcnew System::EventHandler(this, &InputBox::InputBox_Load);
247
			this->panel1->ResumeLayout(false);
248
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox1))->EndInit();
249
			this->panel2->ResumeLayout(false);
250
			this->panel3->ResumeLayout(false);
251
			this->ResumeLayout(false);
252
 
253
		}
254
#pragma endregion
255
	private: System::Void InputBox_Load(System::Object^  sender, System::EventArgs^  e) {
256
				 this->TextInput->Focus();
257
				 if ( this->ComboInput->Items->Count && this->ComboInput->SelectedIndex == -1 )
258
					 this->ComboInput->SelectedIndex = 0;
259
			 }
260
};
261
}