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;
namespace Creator {
/// <summary>
/// Summary for InputBox
///
/// 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 InputBox : public System::Windows::Forms::Form
{
public:
InputBox(System::String ^str)
{
InitializeComponent();
this->ComboInput->Visible = false;
Label->Text = str;
TextInput->Focus();
}
InputBox(System::String ^str, System::String ^text)
{
InitializeComponent();
this->ComboInput->Visible = false;
Label->Text = str;
TextInput->Text = text;
TextInput->Focus();
}
void Large()
{
this->Height += 50;
}
void AddItemDefauilt(String ^item) { this->AddItem(item, true); }
void AddItem(String ^item, bool def)
{
this->AddItem(item);
if ( def )
this->ComboInput->SelectedIndex = this->ComboInput->Items->Count - 1;
}
void AddItem(String ^item)
{
this->TextInput->Visible = false;
this->ComboInput->Visible = true;
this->pictureBox1->Image = this->imageList1->Images[1];
this->ComboInput->Items->Add(item);
}
void SetSelectedOption(int index)
{
this->ComboInput->SelectedIndex = index;
}
System::String ^GetInput() { if ( !this->ComboInput->Items->Count ) return TextInput->Text; return this->ComboInput->Text; }
int GetInputSelected() { return this->ComboInput->SelectedIndex; }
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~InputBox()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Panel^ panel1;
private: System::Windows::Forms::Button^ ButOK;
private: System::Windows::Forms::Button^ ButCancel;
private: System::Windows::Forms::Label^ Label;
private: System::Windows::Forms::PictureBox^ pictureBox1;
private: System::Windows::Forms::Panel^ panel2;
private: System::Windows::Forms::Panel^ panel3;
private: System::Windows::Forms::RichTextBox^ TextInput;
private: System::Windows::Forms::RichTextBox^ richTextBox1;
private: System::Windows::Forms::ComboBox^ ComboInput;
private: System::Windows::Forms::ImageList^ imageList1;
private: System::ComponentModel::IContainer^ components;
private:
/// <summary>
/// Required designer variable.
/// </summary>
#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(InputBox::typeid));
this->panel1 = (gcnew System::Windows::Forms::Panel());
this->ButOK = (gcnew System::Windows::Forms::Button());
this->ButCancel = (gcnew System::Windows::Forms::Button());
this->Label = (gcnew System::Windows::Forms::Label());
this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
this->TextInput = (gcnew System::Windows::Forms::RichTextBox());
this->panel2 = (gcnew System::Windows::Forms::Panel());
this->panel3 = (gcnew System::Windows::Forms::Panel());
this->ComboInput = (gcnew System::Windows::Forms::ComboBox());
this->imageList1 = (gcnew System::Windows::Forms::ImageList(this->components));
this->panel1->SuspendLayout();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->BeginInit();
this->panel2->SuspendLayout();
this->panel3->SuspendLayout();
this->SuspendLayout();
//
// panel1
//
this->panel1->Controls->Add(this->ButOK);
this->panel1->Controls->Add(this->ButCancel);
this->panel1->Dock = System::Windows::Forms::DockStyle::Bottom;
this->panel1->Location = System::Drawing::Point(0, 106);
this->panel1->Name = L"panel1";
this->panel1->Size = System::Drawing::Size(367, 26);
this->panel1->TabIndex = 0;
//
// ButOK
//
this->ButOK->DialogResult = System::Windows::Forms::DialogResult::OK;
this->ButOK->Dock = System::Windows::Forms::DockStyle::Right;
this->ButOK->Location = System::Drawing::Point(217, 0);
this->ButOK->Name = L"ButOK";
this->ButOK->Size = System::Drawing::Size(75, 26);
this->ButOK->TabIndex = 1;
this->ButOK->TabStop = false;
this->ButOK->Text = L"OK";
this->ButOK->UseVisualStyleBackColor = true;
//
// ButCancel
//
this->ButCancel->DialogResult = System::Windows::Forms::DialogResult::Cancel;
this->ButCancel->Dock = System::Windows::Forms::DockStyle::Right;
this->ButCancel->Location = System::Drawing::Point(292, 0);
this->ButCancel->Name = L"ButCancel";
this->ButCancel->Size = System::Drawing::Size(75, 26);
this->ButCancel->TabIndex = 0;
this->ButCancel->TabStop = false;
this->ButCancel->Text = L"Cancel";
this->ButCancel->UseVisualStyleBackColor = true;
//
// Label
//
this->Label->Dock = System::Windows::Forms::DockStyle::Fill;
this->Label->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->Label->Location = System::Drawing::Point(55, 5);
this->Label->Margin = System::Windows::Forms::Padding(3);
this->Label->Name = L"Label";
this->Label->Size = System::Drawing::Size(307, 54);
this->Label->TabIndex = 1;
this->Label->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
//
// pictureBox1
//
this->pictureBox1->Dock = System::Windows::Forms::DockStyle::Left;
this->pictureBox1->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"pictureBox1.Image")));
this->pictureBox1->Location = System::Drawing::Point(5, 5);
this->pictureBox1->Name = L"pictureBox1";
this->pictureBox1->Size = System::Drawing::Size(50, 54);
this->pictureBox1->SizeMode = System::Windows::Forms::PictureBoxSizeMode::StretchImage;
this->pictureBox1->TabIndex = 4;
this->pictureBox1->TabStop = false;
//
// TextInput
//
this->TextInput->Dock = System::Windows::Forms::DockStyle::Fill;
this->TextInput->Location = System::Drawing::Point(5, 5);
this->TextInput->Name = L"TextInput";
this->TextInput->Size = System::Drawing::Size(357, 32);
this->TextInput->TabIndex = 5;
this->TextInput->Text = L"";
//
// panel2
//
this->panel2->Controls->Add(this->Label);
this->panel2->Controls->Add(this->pictureBox1);
this->panel2->Dock = System::Windows::Forms::DockStyle::Top;
this->panel2->Location = System::Drawing::Point(0, 0);
this->panel2->Name = L"panel2";
this->panel2->Padding = System::Windows::Forms::Padding(5);
this->panel2->Size = System::Drawing::Size(367, 64);
this->panel2->TabIndex = 6;
//
// panel3
//
this->panel3->Controls->Add(this->ComboInput);
this->panel3->Controls->Add(this->TextInput);
this->panel3->Dock = System::Windows::Forms::DockStyle::Fill;
this->panel3->Location = System::Drawing::Point(0, 64);
this->panel3->Name = L"panel3";
this->panel3->Padding = System::Windows::Forms::Padding(5);
this->panel3->Size = System::Drawing::Size(367, 42);
this->panel3->TabIndex = 5;
//
// ComboInput
//
this->ComboInput->Dock = System::Windows::Forms::DockStyle::Fill;
this->ComboInput->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
this->ComboInput->FormattingEnabled = true;
this->ComboInput->Location = System::Drawing::Point(5, 5);
this->ComboInput->Name = L"ComboInput";
this->ComboInput->Size = System::Drawing::Size(357, 21);
this->ComboInput->TabIndex = 6;
//
// 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"text");
this->imageList1->Images->SetKeyName(1, L"input");
//
// InputBox
//
this->AcceptButton = this->ButOK;
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->CancelButton = this->ButCancel;
this->ClientSize = System::Drawing::Size(367, 132);
this->ControlBox = false;
this->Controls->Add(this->panel3);
this->Controls->Add(this->panel2);
this->Controls->Add(this->panel1);
this->Name = L"InputBox";
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
this->Text = L"Text Input";
this->TopMost = true;
this->Load += gcnew System::EventHandler(this, &InputBox::InputBox_Load);
this->panel1->ResumeLayout(false);
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->EndInit();
this->panel2->ResumeLayout(false);
this->panel3->ResumeLayout(false);
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void InputBox_Load(System::Object^ sender, System::EventArgs^ e) {
this->TextInput->Focus();
if ( this->ComboInput->Items->Count && this->ComboInput->SelectedIndex == -1 )
this->ComboInput->SelectedIndex = 0;
}
};
}