Subversion Repositories spk

Rev

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